Questions tagged [draw2d]

Draw2d is a layout and rendering toolkit for displaying graphics on an SWT canvas

Draw2d is a lightweight toolkit for displaying graphical components on an SWT canvas. Lightweight means that all graphical components, which are called figures in Draw2d, are simply Java objects, with no corresponding resource in the operating system.

A LightweightSystem associates a figure composition with an SWT canvas. It hooks listeners for most SWT events, and forwards most of them to an EventDispatcher, which translates them into events on the appropriate figure. Paint events are forwarded from the figures to an UpdateManager, which coordinates painting and layouting on the canvas.

Figures can be composed via a parent-child relationship. Every figure has a rectangular bounds inside which it, and its children, paint. A layout manager can be used to place children based on their index and/or constraint. Figures can be updated in ways which affect their appearance or size, and the update manager ensures that only one layout occurs, followed by a repaint of only the region which was updated.

Any type of diagram, document, or drawing can be easily constructed and efficiently updated by combining the provided figure and layout implementations along with the use of custom figures or layouts when needed.

(Excerpt from the Eclipse Draw2d site.)

147 questions
0
votes
1 answer

Is there a way to have an iframe element on a Draw2D powered canvas?

I am building custom objects with Draw2D and would like to take advantage of the CSS based material design icons from Microsoft (https://cdn.materialdesignicons.com/3.6.95/). The only way I think I can achieve this is an internal frame to load the…
A. Davis
  • 35
  • 6
0
votes
1 answer

GEF/draw2d line routing algorithms

I'm using GEF and Draw2d to create a graph. I have have a 3 level structure I want to show, which means: RootEditPart / Level1EditPart / Level2EditPart / Level3EditPart Where Level2 has multiple children. I want to draw connections between the…
katsharp
  • 2,551
  • 24
  • 27
0
votes
1 answer

How to detect triple-click on Draw2D figure in SWT UI?

I want to detect a triple-click on a Draw2D figure. This will allow the first click to select the Draw2D figure, the second to expand the selection, and the third to expand it further. SWT provides the click count in its MouseEvent. However, Draw2D…
Andy Thomas
  • 84,978
  • 11
  • 107
  • 151
0
votes
1 answer

Triangle in draw2d library

I can't understand org.eclipse.draw2d.Triangle's api. There are some fields for manipulation: protected int direction The direction this triangle will face. Possible values are PositionConstants.NORTH, PositionConstants.SOUTH,…
Stan Kurilin
  • 15,614
  • 21
  • 81
  • 132
0
votes
1 answer

Im working on an application using eclipse RCP. I have a graphical editor and I would like to draw a figure on it programmatically?

I do not want to use an editPart or have any connection with the model. An other solution that would work for me is to draw a figure that is out of bounds of its parent
Fergal Fitz
  • 226
  • 1
  • 4
  • 12
0
votes
2 answers

Handle key presses using draw2d and swt

Every org.eclipse.draw2d.Figure class has addKeyListener() method. But when key presses not every Figure handle it. What kind of figure handles key-events? Thanks.
Stan Kurilin
  • 15,614
  • 21
  • 81
  • 132
0
votes
1 answer

Draw2d text types not correctly displayed in a ui-bootstrap accordion angularjs app

I am trying to use draw2d javascript library inside an ui-bootstrap-tpls accordion inside an angularjs application. A simple example: (I would build a plunker, but I am unable to include the required libraries. In this example, draw2d-canvas is…
alindber
  • 188
  • 15
0
votes
1 answer

Draw2d: Containing RectangleFigure will sometimes cuts off text when zoomed. (Pictures included)

In my program I have a bunch of RectangleFigures where each figure holds text. The text is held in a TextFlow which is held by FlowPage to allow word wrapping. RectangleFigure then uses getPrefferedSize() to make itself just big enough to hold…
Chrus
  • 31
  • 9
0
votes
1 answer

Draw2d: How to get a tooltip to stay longer

I have a program that creates tooltips using Figure.setToolTip(). Everything works great except that the tooltip disappears after a few seconds. The tooltip can contain a lot of information and I would like the tooltip to stay longer (or even…
Chrus
  • 31
  • 9
0
votes
1 answer

GEF/draw2d: DirectedGraph nodes out of order

I have a program where I have a tree. I place the nodes and their edges in NodeList and EdgeList. Then put the lists in a DirectedGraph which I then run through DirectedGraphLayout.visit(). I now place the nodes and edges on the screen. The…
Chrus
  • 31
  • 9
0
votes
1 answer

Gef/draw2d: How to get the height of word wrapped text

So I'm making a draw2d program. I have some inputted text which I word wrap by doing: TextFlow textWrapper = new TextFlow(_title); FlowPage flowPage = new FlowPage(); flowPage.add(textWrapper); Now I need to find the height of the text…
Chrus
  • 31
  • 9
0
votes
1 answer

How to add a force line-break in a draw2d TextFlow

How do I add a forced line-break within a draw2d TextFlow figure. I build a IFigure by adding several different objects. Amongst other things I add a FlowPage containing a TextFlow. But I could not find an option to force line-breaks at specific…
Daniel
  • 3,541
  • 3
  • 33
  • 46
0
votes
1 answer

Eclipse/SWT: Rectangle taking up entire canvas

I am writing an Eclipse RCP-based application and am trying to draw a rectangle on top of a ViewPart. However, the rectangle seems to take up the whole screen even when specifiying the bounds. The following is my code. public void…
Ohanes Dadian
  • 625
  • 1
  • 9
  • 17
0
votes
1 answer

Mouse location on a FreeformViewPort Eclipse GEF on vertical scrolling

I am using GEF and Eclipse draw2d.There is a FreeformViewPort on which the figures are rendered. I have connection anchors in the figure to connect the figures. When I scroll down the viewport and click on a connection anchor of a figure,the mouse…
0
votes
1 answer

nested this pointer in javascript

I'm using draw2d js library. I have the following code that creates a rectangle on the canvas. var rect = new draw2d.shape.basic.Rectangle({x:20,y:30}); rect.on("click", function(){ //var that = this; alert("test"); // I'm trying to…
user2516083
  • 13
  • 1
  • 1