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
1
vote
0 answers

Draw2d JS How to get the figure that the port is connected to from the connection properties?

I create in one part of code figures an connection between figures, like this: var input = figure.createPort("input"); var output= figure.createPort("output"); but i also need get information about connection in other part of code. I have…
1
vote
1 answer

Adding label to PolylineConnection in Draw2D

I'm trying to add a label to a PolylineConnection in Draw2d. I'm using the example in java2s as a basis. The problem is that even if I can create the text by using graphics.drawText() on the paintFigure method from the PathFigure object (that…
Yampeku
  • 583
  • 1
  • 4
  • 21
1
vote
1 answer

Performance of Eclipse GEF/Draw2D for graphs with many nodes

How does drawing large (10.000 nodes) graphs perform when using Eclipse GEF or Draw2D? The nodes can be drawn very simplistic (a circle); no labels and stuff. Is using GEF/Draw2D feasible for this task?
ziggystar
  • 28,410
  • 9
  • 72
  • 124
1
vote
2 answers

Create a figure using Rectangle class

I am trying to create a line segment which has trough and crust as shown below : EDIT : Now I'm getting the line segment figure in outline window but not in the diagram editor However I'm not getting exactly what i wanted . I have to create this…
Vivek_Neel
  • 1,343
  • 1
  • 14
  • 25
1
vote
1 answer

How to build a custom draw2d layoutmanager?

I would like to have a layout manager that can arrange two elements as follows: one main element ABCDEF centered one "postscript" element XYZ, positioned on the top right corner of the encapsulating figure For example: ***********XYZ* * ABCDEF …
Sha
  • 21
  • 3
1
vote
2 answers

How to center Label vertical and horizontal in draw2d Figure?

I have the following situation: Label label = new Label(); label.setText("bla"); RoundedRectangle fig = new RoundedRectangle(); fig.add(label); FlowLayout layout = new…
aphex
  • 3,372
  • 2
  • 28
  • 56
1
vote
1 answer

Dragging Figures within Canvas SWT Draw2D

I've written code that allows drag and drop onto a canvas and supports dragging of the dropped Figure within the canvas itself. The problem is that the code that implements dragging within the canvas occasionally throws a NullPointerException. I…
Asher
  • 811
  • 3
  • 10
  • 19
1
vote
1 answer

Implementing Polyline Connections between Ellipses

I'm trying to create a connection between two ellipses on a canvas, AFTER having created the ellipses and storing their positions on the canvas. These stored positions need to be used to create the connection. The code I've written works for…
Asher
  • 811
  • 3
  • 10
  • 19
1
vote
1 answer

I want to change fontsize in textflow or label

I'm implementing multiline Label Figure. I have a question. How can i change font size of textflow ? I tried with the method [textflow.setFont] before I had changed height value of fontdata. use this code,Font tFont =…
Heizel
  • 13
  • 3
1
vote
1 answer

GEF - child EditParts being drawn beneath Parent's other Figures?

I'm trying to illustrate (and edit) an xml model with a GEF powered graphical editor in eclipse. My xml model can have up to five levels in its parent-child hierarchy. Each element in the heirarchy is its own EditPart (which looks like a box). Child…
icyitscold
  • 1,151
  • 1
  • 9
  • 19
1
vote
1 answer

ScrollPane mouse wheel listener

Is there way to implement mouse wheel listener for ScrollPane? I looked at couple of options: Viewport does not seem to have mouse wheel listener Played with gef's MouseWheelHelper but the y value only changes when I click within the ScrollPane,…
positron
  • 3,643
  • 3
  • 22
  • 26
1
vote
2 answers

java.lang.NoClassDefFoundError: org/eclipse/draw2d/LightweightSystem although it is added

I am trying use draw2d for my plugin development. For now, all I have in my code is: import org.eclipse.draw2d.LightweightSystem; import org.eclipse.swt.SWT; import org.eclipse.swt.widgets.Canvas; import org.eclipse.swt.widgets.Composite; import…
user2033666
  • 109
  • 1
  • 11
1
vote
1 answer

Style TreeViewer's scrollbar

I have an editor that has both draw2d tree and Nebula's GridTreeViewer (basically a JFace TreeViewer). What I need is working, except scrollbars. In draw2d I get scrollbars provided by org.eclipse.draw2d.ScrollPane and in GridTreeViewer I get…
positron
  • 3,643
  • 3
  • 22
  • 26
1
vote
1 answer

How to draw some figures on a editor with draw2d in a eclipse RCP?

I mean drawing somg simple shape like circle,rectangleFigure,and polylineConnectistrong.It seems that a LightweightSystem has to been constructed on a Canvas such as a Shell.And in a RCP application when I add an extension of an editor,the editor…
Sam Su
  • 6,532
  • 8
  • 39
  • 80
1
vote
1 answer

java.lang.NoClassDefFoundError: org/eclipse/draw2d/LightweightSystem

I am building a Eclipse plug-in project with The Eclipse Graphical Editing Framework (GEF). It's ok that I write a single class for testing with example code I find on the internet, the code is following: public class Test { public static void…
Sam Su
  • 6,532
  • 8
  • 39
  • 80
1 2
3
9 10