org.eclipse.graphiti.ui.internal.editor

## Class GFFigureCanvas

- java.lang.Object
- - org.eclipse.swt.widgets.Widget
  - - org.eclipse.swt.widgets.Control
    - - org.eclipse.swt.widgets.Scrollable
      - - org.eclipse.swt.widgets.Composite
        - - org.eclipse.swt.widgets.Canvas
          - - org.eclipse.graphiti.ui.internal.editor.GFFigureCanvas

All Implemented Interfaces:
  IAdaptable, Drawable

    public class GFFigureCanvas
    extends Canvas
    implements IAdaptable

A Canvas that contains `Figures`.

Note: Only one of the styles RIGHT_TO_LEFT, LEFT_TO_RIGHT may be specified.

### Field Summary

Fields
`static int` `ALWAYS` Always show scrollbar.
`static int` `AUTOMATIC` Automatically show scrollbar when needed.
`static int` `NEVER` Never show scrollbar.

### Fields inherited from class org.eclipse.swt.widgets.Control

`view`

### Constructor Summary

Constructors
Constructor and Description
`GFFigureCanvas(Composite parent, DiagramBehavior diagramBehavior)` Creates a new FigureCanvas with the given parent.
`GFFigureCanvas(Composite parent, int style, DiagramBehavior diagramBehavior)` Constructor.
`GFFigureCanvas(Composite parent, int style, org.eclipse.draw2d.LightweightSystem lws, DiagramBehavior diagramBehavior)` Constructor.
`GFFigureCanvas(Composite parent, org.eclipse.draw2d.LightweightSystem lws, DiagramBehavior diagramBehavior)` Constructs a new FigureCanvas with the given parent and LightweightSystem.

### Method Summary

All Methods Instance Methods Concrete Methods
`Point` `computeSize(int wHint, int hHint, boolean changed)`
`java.lang.Object` `getAdapter(java.lang.Class adapter)`
`org.eclipse.draw2d.IFigure` `getContents()` Gets the contents.
`org.eclipse.draw2d.geometry.Rectangle` `getDiagramBoundsFromEditPartChildren()`
`Font` `getFont()`
`int` `getHorizontalScrollBarVisibility()` Gets the horizontal scroll bar visibility.
`org.eclipse.draw2d.LightweightSystem` `getLightweightSystem()` Gets the lightweight system.
`int` `getVerticalScrollBarVisibility()` Gets the vertical scroll bar visibility.
`org.eclipse.draw2d.Viewport` `getViewport()` Returns the Viewport.
`void` `regainHorizontalSpace()` Regain horizontal space.
`void` `regainSpace()` Regain space.
`void` `regainVerticalSpace()` Regain vertical space.
`void` `removeCornerPixels()`
`void` `scrollSmoothTo(int x, int y)` Scroll smooth to.
`void` `scrollTo(int x, int y)` Scroll to.
`void` `scrollToX(SelectionEvent event, int hOffset)` Scrolls the contents horizontally so that they are offset by `hOffset`.
`void` `scrollToY(SelectionEvent event, int vOffset)` Scrolls the contents vertically so that they are offset by `vOffset`.
`void` `setBorder(org.eclipse.draw2d.Border border)` Sets the given border on the LightweightSystem's root figure.
`void` `setContents(org.eclipse.draw2d.IFigure figure)` Sets the contents of the `Viewport`.
`void` `setCornerPixels()`
`void` `setFont(Font font)`
`void` `setHorizontalScrollBarVisibility(int v)` Sets the horizontal scrollbar visibility.
`void` `setScrollBarVisibility(int both)` Sets both the horizontal and vertical scrollbar visibility to the given value.
`void` `setVerticalScrollBarVisibility(int v)` Sets the vertical scrollbar visibility.
`void` `setViewport(org.eclipse.draw2d.Viewport vp)` Sets the Viewport.

### Methods inherited from class org.eclipse.swt.widgets.Canvas

`drawBackground, getCaret, getIME, scroll, setCaret, setIME`

### Methods inherited from class org.eclipse.swt.widgets.Composite

`changed, drawBackground, getBackgroundMode, getChildren, getLayout, getLayoutDeferred, getTabList, isLayoutDeferred, layout, layout, layout, layout, layout, setBackgroundMode, setFocus, setLayout, setLayoutDeferred, setTabList`

### Methods inherited from class org.eclipse.swt.widgets.Scrollable

`computeTrim, getClientArea, getHorizontalBar, getScrollbarsMode, getVerticalBar`

### Methods inherited from class org.eclipse.swt.widgets.Control

`addControlListener, addDragDetectListener, addFocusListener, addGestureListener, addHelpListener, addKeyListener, addMenuDetectListener, addMouseListener, addMouseMoveListener, addMouseTrackListener, addMouseWheelListener, addPaintListener, addTouchListener, addTraverseListener, computeSize, dragDetect, dragDetect, forceFocus, getAccessible, getBackground, getBackgroundImage, getBorderWidth, getBounds, getCursor, getDragDetect, getEnabled, getForeground, getLayoutData, getLocation, getMenu, getMonitor, getOrientation, getParent, getRegion, getShell, getSize, getTextDirection, getToolTipText, getTouchEnabled, getVisible, internal_dispose_GC, internal_new_GC, isEnabled, isFocusControl, isReparentable, isVisible, moveAbove, moveBelow, pack, pack, print, redraw, redraw, removeControlListener, removeDragDetectListener, removeFocusListener, removeGestureListener, removeHelpListener, removeKeyListener, removeMenuDetectListener, removeMouseListener, removeMouseMoveListener, removeMouseTrackListener, removeMouseWheelListener, removePaintListener, removeTouchListener, removeTraverseListener, requestLayout, setBackground, setBackgroundImage, setBounds, setBounds, setCapture, setCursor, setDragDetect, setEnabled, setForeground, setLayoutData, setLocation, setLocation, setMenu, setOrientation, setParent, setRedraw, setRegion, setSize, setSize, setTextDirection, setToolTipText, setTouchEnabled, setVisible, toControl, toControl, toDisplay, toDisplay, traverse, traverse, traverse, update`

### Methods inherited from class org.eclipse.swt.widgets.Widget

`addDisposeListener, addListener, dispose, getData, getData, getDisplay, getListeners, getStyle, isAutoDirection, isDisposed, isListening, notifyListeners, removeDisposeListener, removeListener, reskin, setData, setData, toString`

### Methods inherited from class java.lang.Object

`equals, getClass, hashCode, notify, notifyAll, wait, wait, wait`

### Methods inherited from interface org.eclipse.swt.graphics.Drawable

`isAutoScalable`

### Field Detail

#### NEVER

    public static int NEVER

Never show scrollbar.

#### AUTOMATIC

    public static int AUTOMATIC

Automatically show scrollbar when needed.

#### ALWAYS

    public static int ALWAYS

Always show scrollbar.

### Constructor Detail

#### GFFigureCanvas

    public GFFigureCanvas(Composite parent,
                          DiagramBehavior diagramBehavior)

Creates a new FigureCanvas with the given parent.

Parameters:
  `parent` - the parent
  `diagramEditor` - the diagram editor

#### GFFigureCanvas

    public GFFigureCanvas(Composite parent,
                          int style,
                          DiagramBehavior diagramBehavior)

Constructor.

Parameters:
  `parent` - the parent composite
  `style` - look at class javadoc for valid styles
  `diagramEditor` - the diagram editor
Since:
  3.1

#### GFFigureCanvas

    public GFFigureCanvas(Composite parent,
                          org.eclipse.draw2d.LightweightSystem lws,
                          DiagramBehavior diagramBehavior)

Constructs a new FigureCanvas with the given parent and LightweightSystem.

Parameters:
  `parent` - the parent
  `lws` - the LightweightSystem
  `diagramEditor` - the diagram editor

#### GFFigureCanvas

    public GFFigureCanvas(Composite parent,
                          int style,
                          org.eclipse.draw2d.LightweightSystem lws,
                          DiagramBehavior diagramBehavior)

Constructor.

Parameters:
  `parent` - the parent composite
  `style` - look at class javadoc for valid styles
  `lws` - the lightweight system
  `diagramEditor` - the diagram editor
Since:
  3.1

### Method Detail

#### computeSize

    public Point computeSize(int wHint,
                             int hHint,
                             boolean changed)

Overrides:
  `computeSize` in class `Composite`

#### getContents

    public org.eclipse.draw2d.IFigure getContents()

Gets the contents.

Returns:
  the contents of the `Viewport`.

#### getFont

    public Font getFont()

Overrides:
  `getFont` in class `Control`

#### getHorizontalScrollBarVisibility

    public int getHorizontalScrollBarVisibility()

Gets the horizontal scroll bar visibility.

Returns:
  the horizontal scrollbar visibility.

#### getLightweightSystem

    public org.eclipse.draw2d.LightweightSystem getLightweightSystem()

Gets the lightweight system.

Returns:
  the LightweightSystem

#### getVerticalScrollBarVisibility

    public int getVerticalScrollBarVisibility()

Gets the vertical scroll bar visibility.

Returns:
  the vertical scrollbar visibility.

#### getViewport

    public org.eclipse.draw2d.Viewport getViewport()

Returns the Viewport. If it's `null`, a new one is created.

Returns:
  the viewport

#### scrollToX

    public void scrollToX(SelectionEvent event,
                          int hOffset)

Scrolls the contents horizontally so that they are offset by `hOffset`.

Parameters:
  `hOffset` - the new horizontal offset
  `event` - the event

#### scrollToY

    public void scrollToY(SelectionEvent event,
                          int vOffset)

Scrolls the contents vertically so that they are offset by `vOffset`.

Parameters:
  `vOffset` - the new vertical offset
  `event` - the event

#### regainSpace

    public void regainSpace()

Regain space.

#### regainHorizontalSpace

    public void regainHorizontalSpace()

Regain horizontal space.

#### regainVerticalSpace

    public void regainVerticalSpace()

Regain vertical space.

#### getDiagramBoundsFromEditPartChildren

    public org.eclipse.draw2d.geometry.Rectangle getDiagramBoundsFromEditPartChildren()

#### scrollSmoothTo

    public void scrollSmoothTo(int x,
                               int y)

Scroll smooth to.

Parameters:
  `x` - the x
  `y` - the y

#### scrollTo

    public void scrollTo(int x,
                         int y)

Scroll to.

Parameters:
  `x` - the x
  `y` - the y

#### setBorder

    public void setBorder(org.eclipse.draw2d.Border border)

Sets the given border on the LightweightSystem's root figure.

Parameters:
  `border` - The new border

#### setContents

    public void setContents(org.eclipse.draw2d.IFigure figure)

Sets the contents of the `Viewport`.

Parameters:
  `figure` - the new contents

#### setFont

    public void setFont(Font font)

Overrides:
  `setFont` in class `Canvas`

#### setHorizontalScrollBarVisibility

    public void setHorizontalScrollBarVisibility(int v)

Sets the horizontal scrollbar visibility. Possible values are `AUTOMATIC`, `ALWAYS`, and `NEVER`.

Parameters:
  `v` - the new visibility

#### setScrollBarVisibility

    public void setScrollBarVisibility(int both)

Sets both the horizontal and vertical scrollbar visibility to the given value. Possible values are `AUTOMATIC`, `ALWAYS`, and `NEVER`.

Parameters:
  `both` - the new visibility

#### setVerticalScrollBarVisibility

    public void setVerticalScrollBarVisibility(int v)

Sets the vertical scrollbar visibility. Possible values are `AUTOMATIC`, `ALWAYS`, and `NEVER`.

Parameters:
  `v` - the new visibility

#### setViewport

    public void setViewport(org.eclipse.draw2d.Viewport vp)

Sets the Viewport. The given Viewport must use "fake" scrolling. That is, it must be constructed using `new Viewport(true)`.

Parameters:
  `vp` - the new viewport

#### removeCornerPixels

    public void removeCornerPixels()

#### setCornerPixels

    public void setCornerPixels()

#### getAdapter

    public java.lang.Object getAdapter(java.lang.Class adapter)

Specified by:
  `getAdapter` in interface `IAdaptable`