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
19
votes
3 answers

Javascript Diagram Library

I'm looking for a good JavaScript Diagram library for a project, can be commercial. Mandatory Requirements: Highlight connected lines and components when clicking a component (or hovering) Ability to switch the image of a component (to represent…
sangress
  • 599
  • 5
  • 11
7
votes
2 answers

Handle key presses using swt

I'm want do someStuff() when CTRL-C pressed. I had wrote some code, but it "not enough good". What can I do with it?) //org.eclipse.draw2d.Shape getShape(){....} getShape().addKeyListener(new KeyListener(){ @Override …
Stan Kurilin
  • 15,614
  • 21
  • 81
  • 132
5
votes
3 answers

Sending Ajax Request Using JavaScript to JSF

Currently, I am working on a web application that uses draw2d library to draw shapes and charts. On the server side I am using Java(JSF). I can say that 95% of this application is just pure JavaScript. I like to be able to send Ajax requests from…
Reza
  • 834
  • 1
  • 7
  • 18
4
votes
1 answer

draw2d on drag start event

I want to call my custom callback function every time, when user starts dragging figures. I tried to do it like so: figure.onDragStart = function (x, y, shiftKey, ctrlKey) { myfunc(); }; But the problem is, every time when my function is…
Jacobian
  • 10,122
  • 29
  • 128
  • 221
2
votes
1 answer

Eclipse GEF/Draw2d: Bounds vs. Constraints

Can someone explain the difference/relationship between bounds and constraints in Draw2d? I'm trying to set up a GEF editor where instances of the same EditPart class are nested inside each other (I can post a simplified version of the code if…
user1155252
  • 97
  • 1
  • 10
2
votes
1 answer

Draw2D GridLayoutAlgorithm with constant node width?

We're integrating Draw2D/GEF into an application, and are encountering an issue with the standard layouts provided. We have a collection (say 100) of elements that need to be displayed in a grid-like fashion. We implemented our view using a…
Craig Otis
  • 31,257
  • 32
  • 136
  • 234
2
votes
2 answers

SWT draw2d alpha blending

I'm looking for some method to draw half transparent figures within the draw2d framework. Currently I'm using setAlpha() of org.eclipse.draw2d.Graphics. The problem is that it slows down the whole UI, if I draw more than one half transparent…
atx
  • 266
  • 3
  • 15
2
votes
0 answers

How to add Combo Feature in a ContainerShape Graphiti

I want to add a drop down combo box filter inside a container in the Graphiti Editor. It appears if I override this method: public IDirectEditingFeature getDirectEditingFeature(IDirectEditingContext context) ...as shown in the figure…
Alok
  • 929
  • 10
  • 26
2
votes
1 answer

Eclipse Indigo with Subclipse and draw2d

I've just installed Eclipse Indigo and Subclipse 1.6.17 on RHEL 5.4. I had to deselect the without the Subversion Revision Graph because it requires the draw2d plugin. I am working on a standalone system, so I have downloaded and transfered the…
DanS
  • 1,677
  • 20
  • 30
2
votes
1 answer

Custom Layout Manager in Draw2d

All, Can we define a custom Layout Manager in draw2d ? If yes, can anyone please explain the steps for the same? I need to come up with a TableLayout where I can dynamically add rows and columns?
name_masked
  • 9,544
  • 41
  • 118
  • 172
2
votes
2 answers

Creating a PDF from a Draw2D Canvas

I'm looking for a way to build a PDF from a Draw2D canvas. I believe I've seen a way to do this from Java2D, but not Draw2D. There are many graphical elements involved (as well as text) so I don't think I can go the XSLT route. Does anyone have…
thehiatus
  • 1,575
  • 13
  • 23
2
votes
2 answers

Java SWT Drawing Shapes on canvas with mouse events

I want to make an application in order to draw forms (rectangle, line, square, arrow) like in paint using Java SWT Canvas. I'm using mouse events (Up, Down and move) to get the canvas Y and X position. And i have a button for each form types that…
vinistig
  • 21
  • 3
2
votes
1 answer

How to implement custom FlowLayout in a GEF editor?

I'm implementing a GEF editor and am facing the following problem. There are two types of EditPart: 1) GraphEditPart, 2) NodeEditPart. My editor extends GraphicalEditor, as I'm not needing a palette at all. I use SimpleRootEditPart for the…
QueNuevo
  • 105
  • 12
2
votes
1 answer

Ordering of nested figures in GEF by getChildren()

I have a figure with a ToolBar Layout. I have added a Label in it(Draw 2D). I have to add another figure in it dynamically. But when I do add it, the Label moves down and the newly added figure comes at the top. I have tried adding the label by…
nullpointer
  • 490
  • 2
  • 4
  • 20
2
votes
0 answers

How to be notified about a painting completion?

Does anyone know how to get notified when void org.eclipse.draw2d.UpdateManager.paint(GC gc) { performUpdate(new Rectangle(gc.getClipping())); } is executed? org.eclipse.draw2d.DeferredUpdateManager.performUpdate(new…
ka3ak
  • 2,435
  • 2
  • 30
  • 57
1
2 3
9 10