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:
org.eclipse.core.runtime.IAdaptable, org.eclipse.swt.graphics.Drawable

public class GFFigureCanvas extends org.eclipse.swt.widgets.Canvas implements org.eclipse.core.runtime.IAdaptable
A Canvas that contains Figures.

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

  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static int
    Always show scrollbar.
    static int
    Automatically show scrollbar when needed.
    static int
    Never show scrollbar.

    Fields inherited from class org.eclipse.swt.widgets.Composite

    embeddedHandle

    Fields inherited from class org.eclipse.swt.widgets.Widget

    handle
  • Constructor Summary

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

    Modifier and Type
    Method
    Description
    org.eclipse.swt.graphics.Point
    computeSize(int wHint, int hHint, boolean changed)
     
    getAdapter(Class adapter)
     
    org.eclipse.draw2d.IFigure
    Gets the contents.
    org.eclipse.draw2d.geometry.Rectangle
     
    org.eclipse.swt.graphics.Font
     
    int
    Gets the horizontal scroll bar visibility.
    org.eclipse.draw2d.LightweightSystem
    Gets the lightweight system.
    int
    Gets the vertical scroll bar visibility.
    org.eclipse.draw2d.Viewport
    Returns the Viewport.
    void
    Regain horizontal space.
    void
    Regain space.
    void
    Regain vertical space.
    void
     
    void
    scrollSmoothTo(int x, int y)
    Scroll smooth to.
    void
    scrollTo(int x, int y)
    Scroll to.
    void
    scrollToX(org.eclipse.swt.events.SelectionEvent event, int hOffset)
    Scrolls the contents horizontally so that they are offset by hOffset.
    void
    scrollToY(org.eclipse.swt.events.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
     
    void
    setFont(org.eclipse.swt.graphics.Font font)
     
    void
    Sets the horizontal scrollbar visibility.
    void
    Sets both the horizontal and vertical scrollbar visibility to the given value.
    void
    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, checkSubclass, drawBackground, getBackgroundMode, getChildren, getLayout, getLayoutDeferred, getTabList, isLayoutDeferred, layout, layout, layout, layout, layout, setBackgroundMode, setFocus, setLayout, setLayoutDeferred, setTabList, toString

    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, isAutoScalable, 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, checkWidget, dispose, getData, getData, getDisplay, getListeners, getStyle, isAutoDirection, isDisposed, isListening, notifyListeners, removeDisposeListener, removeListener, removeListener, reskin, setData, setData

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
  • Field Details

    • 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 Details

    • GFFigureCanvas

      public GFFigureCanvas(org.eclipse.swt.widgets.Composite parent, DiagramBehavior diagramBehavior)
      Creates a new FigureCanvas with the given parent.
      Parameters:
      parent - the parent
      diagramEditor - the diagram editor
    • GFFigureCanvas

      public GFFigureCanvas(org.eclipse.swt.widgets.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(org.eclipse.swt.widgets.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(org.eclipse.swt.widgets.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 Details

    • computeSize

      public org.eclipse.swt.graphics.Point computeSize(int wHint, int hHint, boolean changed)
      Overrides:
      computeSize in class org.eclipse.swt.widgets.Control
    • getContents

      public org.eclipse.draw2d.IFigure getContents()
      Gets the contents.
      Returns:
      the contents of the Viewport.
    • getFont

      public org.eclipse.swt.graphics.Font getFont()
      Overrides:
      getFont in class org.eclipse.swt.widgets.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(org.eclipse.swt.events.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(org.eclipse.swt.events.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(org.eclipse.swt.graphics.Font font)
      Overrides:
      setFont in class org.eclipse.swt.widgets.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 Object getAdapter(Class adapter)
      Specified by:
      getAdapter in interface org.eclipse.core.runtime.IAdaptable