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

Eclipse GEF FanRouter

I am using GEF to create a tool that visualises dependencies between files. I successfully managed to do the connections between nodes and I can also switch the functionality to use the ManhattenConnectionRouter. However I find trouble using the…
stklik
  • 834
  • 1
  • 8
  • 19
0
votes
1 answer

Restricting the bounds of Text Flow to a Figure Draw2D SWT

I'm trying to place text in the centre of a RectangleFigure. I need the words to wrap around according to the bounds of the figure so I'm using a text flow. The problem is that despite setting the bounds of the RectangleFigure, it occupies the…
Asher
  • 811
  • 3
  • 10
  • 19
0
votes
0 answers

Customizing Layout Zest Draw2d

I'm using Zest's tree layout to display a graph. However at present, the lines connecting the nodes are like this. A / \ B C /\ /\ D E F G How do I instead make it appear like this? A __I__ B C _|_ _I_ D E F G
Asher
  • 811
  • 3
  • 10
  • 19
0
votes
1 answer

SWT Invalid Thread Access- Mixing up Displays Draw2D

I've got a class that displays a graph using Zest that can be run on its own since it has a main method. However, I'd like to that main method to be run when I select a button in another shell. The problem is that I get an Invalid Thread Access…
Asher
  • 811
  • 3
  • 10
  • 19
0
votes
1 answer

Enabling Text overflow onto next line Zest Draw2d SWT

I'm displaying a model using the Tree Layout within Zest. However, the text that I have assigned to be displayed in each node is too long. I want the text to move to the next line within the node so all of it can be displayed instead of having most…
Asher
  • 811
  • 3
  • 10
  • 19
0
votes
2 answers

Displaying Hierarchical Tree Structure on Canvas Java SWT Draw2d

I have a tree data structure which stores information. How do I figure out the correct placement of each node i.e. x,y locations of the tree on the canvas, so that nothing overlaps and all sibling nodes are on the same level? My attempts achieve…
Asher
  • 811
  • 3
  • 10
  • 19
0
votes
1 answer

Enabling scrolling for canvas SWT Draw2d

I'm trying to display more on the canvas than is allowed by the window's/canvas's size limits. I know that there are a couple of ways to this. I could use the FigureCanvas but I'm unsure how the viewport ties into it. I opted to create a…
Asher
  • 811
  • 3
  • 10
  • 19
0
votes
1 answer

Cylinder Figures on Canvas SWT Draw2D

I understand that Draw2D doesn't provide support for more complex figures like cylinders and that we have to "construct them ourselves". I couldn't find much support for that route online. Is there any way I can construct a custom Figure…
Asher
  • 811
  • 3
  • 10
  • 19
0
votes
1 answer

Recreation of previously created elements on creation of new elements SWT Draw2d

I've written code that allows drag and drop onto a canvas. On 'dropping', a RectangleFigure is drawn on the canvas at that point. The problem is that when I drop onto the canvas for the second time, another copy of the first dropped element is made…
Asher
  • 811
  • 3
  • 10
  • 19
0
votes
2 answers

Placing figure in top-right corner of another

I want child figure (org.eclipse.draw2d.Figure) to be relative to the top-right corner of the parent (I want place some small icon, which will be ImageFigure, to be 12 pixels from top and right borders). Is there an existing layout manager that can…
Ivan Dubrov
  • 4,778
  • 2
  • 29
  • 41
0
votes
1 answer

can i draw a gradient background for a figureCanvas in Java

I'd like to draw a gradient background for a FigureCanvas. Unfortunately the code which works for Composites or similars does not work for my FigureCanvas. Where it makes a perfect gradient background on my Composite it simply puts one color as…
0
votes
1 answer

Draw2d C# MVC Post JSON to Controller

I am working with the Draw2D library which allows for exporting of the JSON but when I try to do it I cannot get it to export to MVC. This is not an issue with Draw2D but rather lack of knowledge by me as to how to get it to work. I generate the…
scripter78
  • 1,117
  • 3
  • 22
  • 50
0
votes
2 answers

Gallery of GEF/Draw2D figures

I am new to GEF/Draw2D, I've seen some tutorials on the topic, but I am wondering if any of you have seen a gallery of all figures which are shipped together with GEF? So that one can quickly see what do they look like and what's their purpose?
Grzegorz Oledzki
  • 23,614
  • 16
  • 68
  • 106
0
votes
1 answer

Re-aligning text in Eclipse Draw2D Label

I am building an RCP-based application with Draw2D Labels (Figures with text). When my graphical editor re-sizes the label, the text stays in it's initial position. Is there anyway to have the text reposition based on the new constraints of the…
Ohanes Dadian
  • 625
  • 1
  • 9
  • 17
0
votes
1 answer

Showing nested figures in GEF on mouse hover

There's no problem in showing nested figures in GEF on mouse hover. On mouseHover(MouseEvent me), I add(IFigure), and on mouseExited(MouseEvent me) I remove the figure. But as soon as I add a Button(Draw2d), or I add a figure which has a…
nullpointer
  • 490
  • 2
  • 4
  • 20