Skip to content
Patrick Ziegler edited this page Oct 29, 2024 · 5 revisions

Draw2d is a layout and rendering toolkit building on top of SWT. It may be used standalone (outside of Eclipse) or in combination with the GEF or Zest component.

Class_Diagram_Example

Overview

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.

Features

  • Efficient layout and rendering support
  • Various figure and layout implementations
  • Borders
  • Cursors and Tooltip support
  • Connection anchoring, routing, and decorating
  • Multiple, transparent layers
  • Flexible coordinate systems
  • Overview window (thumbnail with scrolling)
  • Printing
Clone this wiki locally