Eclipse Draw2d 3.3

## org.eclipse.draw2d
Class LightweightSystem

    java.lang.Object
      org.eclipse.draw2d.LightweightSystem

    public class LightweightSystem

extends java.lang.Object

The LightweightSystem is the link between SWT and Draw2d. It is the component that provides the ability for `Figures` to be hosted on an SWT Canvas.

Normal procedure for using a LightweightSystem:

1. Create an SWT Canvas.
2. Create a LightweightSystem passing it that Canvas.
3. Create a Draw2d Figure and call setContents(IFigure). This Figure will be the top-level Figure of the Draw2d application.

Nested Class Summary
`protected class` `LightweightSystem.EventHandler` Listener used to get all necessary events from the Canvas and pass them on to the `EventDispatcher`.
`protected class` `LightweightSystem.RootFigure` The figure at the root of the LightweightSystem.

Constructor Summary
`LightweightSystem()` Constructs a LightweightSystem without a Canvas.
`LightweightSystem(Canvas c)` Constructs a LightweightSystem on Canvas c.

Method Summary
`protected void` `addListeners()` Adds SWT listeners to the LightWeightSystem's Canvas.
`protected void` `controlResized()` Resizes and revalidates the root figure when the control is resized.
`protected LightweightSystem.EventHandler` `createEventHandler()` Returns a new instance of this LightweightSystem's EventHandler.
`protected LightweightSystem.RootFigure` `createRootFigure()` Creates and returns the root figure.
`protected EventDispatcher` `getEventDispatcher()` Returns this LightwightSystem's EventDispatcher.
`IFigure` `getRootFigure()` Returns this LightweightSystem's root figure.
`UpdateManager` `getUpdateManager()` Returns this LightweightSystem's UpdateManager.
`protected void` `init()` Initializes this LightweightSystem by setting the root figure.
`void` `paint(GC gc)` Invokes this LightweightSystem's `UpdateManager` to paint this LightweightSystem's Canvas and contents.
`void` `setContents(IFigure figure)` Sets the contents of the LightweightSystem to the passed figure.
`void` `setControl(Canvas c)` Sets the LightweightSystem's control to the passed Canvas.
`void` `setEventDispatcher(EventDispatcher dispatcher)` Sets this LightweightSystem's EventDispatcher.
`protected void` `setRootPaneFigure(LightweightSystem.RootFigure root)` Sets this LightweightSystem's root figure.
`void` `setUpdateManager(UpdateManager um)` Sets this LightweightSystem's UpdateManager.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### LightweightSystem

    public LightweightSystem(Canvas c)

  Constructs a LightweightSystem on Canvas c.

  Parameters:
    `c` - the canvas
  Since:
    2.0

### LightweightSystem

    public LightweightSystem()

  Constructs a LightweightSystem without a Canvas.

Method Detail

### addListeners

    protected void addListeners()

  Adds SWT listeners to the LightWeightSystem's Canvas. This allows for SWT events to be dispatched and handled by its `EventDispatcher`.

  WARNING: This method should not be overridden.

  Since:
    2.0

### controlResized

    protected void controlResized()

  Resizes and revalidates the root figure when the control is resized.

### getEventDispatcher

    protected EventDispatcher getEventDispatcher()

  Returns this LightwightSystem's EventDispatcher.

  Returns:
    the event dispatcher
  Since:
    2.0

### getRootFigure

    public IFigure getRootFigure()

  Returns this LightweightSystem's root figure.

  Returns:
    the root figure
  Since:
    2.0

### createEventHandler

    protected final LightweightSystem.EventHandler createEventHandler()

  Returns a new instance of this LightweightSystem's EventHandler.

  Returns:
    the newly created event handler
  Since:
    2.0

### createRootFigure

    protected LightweightSystem.RootFigure createRootFigure()

  Creates and returns the root figure.

  Returns:
    the newly created root figure

### getUpdateManager

    public UpdateManager getUpdateManager()

  Returns this LightweightSystem's UpdateManager.

  Returns:
    the update manager
  Since:
    2.0

### init

    protected void init()

  Initializes this LightweightSystem by setting the root figure.

### paint

    public void paint(GC gc)

  Invokes this LightweightSystem's `UpdateManager` to paint this LightweightSystem's Canvas and contents.

  Parameters:
    `gc` - the GC used for painting
  Since:
    2.0

### setContents

    public void setContents(IFigure figure)

  Sets the contents of the LightweightSystem to the passed figure. This figure should be the top-level Figure in a Draw2d application.

  Parameters:
    `figure` - the new root figure
  Since:
    2.0

### setControl

    public void setControl(Canvas c)

  Sets the LightweightSystem's control to the passed Canvas.

  Parameters:
    `c` - the canvas
  Since:
    2.0

### setEventDispatcher

    public void setEventDispatcher(EventDispatcher dispatcher)

  Sets this LightweightSystem's EventDispatcher.

  Parameters:
    `dispatcher` - the new event dispatcher
  Since:
    2.0

### setRootPaneFigure

    protected void setRootPaneFigure(LightweightSystem.RootFigure root)

  Sets this LightweightSystem's root figure.

  Parameters:
    `root` - the new root figure

### setUpdateManager

    public void setUpdateManager(UpdateManager um)

  Sets this LightweightSystem's UpdateManager.

  Parameters:
    `um` - the new update manager
  Since:
    2.0

Eclipse Draw2d 3.3

Copyright (c) IBM Corp. and others 2000, 2007. All Rights Reserved.