Class AbstractSWTWidgetFigure<T extends Control>

java.lang.Object
org.eclipse.draw2d.Figure
org.csstudio.opibuilder.widgets.figures.AbstractSWTWidgetFigure<T>
All Implemented Interfaces:
org.eclipse.draw2d.IFigure
Direct Known Subclasses:
AbstractWebBrowserFigure, ComboFigure, NativeButtonFigure, NativeTextFigure, SpreadSheetTableFigure

public abstract class AbstractSWTWidgetFigure<T extends Control> extends org.eclipse.draw2d.Figure
The abstract figure for all SWT widget based figure. Note that there are some known issues regarding using SWT native widget in draw2D figure:
  • The order of SWT widget is always on top of draw2D figures. The order between between SWT widgets works but it is initialized during OPI startup, so change its order with change order action will only be reflected after reopen/run the opi.
  • Moving/Resizing a SWT widget is much slower than draw2D figure
  • Nested Class Summary

    Nested classes/interfaces inherited from class org.eclipse.draw2d.Figure

    org.eclipse.draw2d.Figure.FigureIterator, org.eclipse.draw2d.Figure.IdentitySearch, org.eclipse.draw2d.Figure.ReverseFigureChildrenIterator

    Nested classes/interfaces inherited from interface org.eclipse.draw2d.IFigure

    org.eclipse.draw2d.IFigure.NoInsets
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
     
    protected boolean
     

    Fields inherited from class org.eclipse.draw2d.Figure

    bgColor, border, bounds, fgColor, flags, font, MAX_FLAG, maxSize, minSize, NO_MANAGER, prefSize, toolTip

    Fields inherited from interface org.eclipse.draw2d.IFigure

    MAX_DIMENSION, MIN_DIMENSION, NO_INSETS
  • Constructor Summary

    Constructors
    Constructor
    Description
    Construct the figure with SWT.NONE as style bit.
    Construct the figure.
  • Method Summary

    Modifier and Type
    Method
    Description
    protected abstract T
    createSWTWidget(Composite parent, int style)
    Create the SWT widget.This method will be call in constructor AbstractSWTWidgetFigure(AbstractBaseEditPart, int)
    protected void
    Dispose SWT widget.
     
     
    Get the SWT widget on this figure.
    protected void
     
    protected void
    paintClientArea(org.eclipse.draw2d.Graphics graphics)
     
    protected void
    paintOutlineFigure(org.eclipse.draw2d.Graphics graphics)
    Paint an outline figure so it can be viewed in outline view in edit mode.
    protected void
    relocate the widget so it follows the figure position.
    protected void
     
    void
     
    void
    setCursor(Cursor cursor)
     
    void
    setEnabled(boolean value)
     
    void
     
    void
     
    void
    setVisible(boolean visible)
     

    Methods inherited from class org.eclipse.draw2d.Figure

    add, add, add, add, addAncestorListener, addCoordinateListener, addFigureListener, addFocusListener, addKeyListener, addLayoutListener, addListener, addMouseListener, addMouseMotionListener, addNotify, addPropertyChangeListener, addPropertyChangeListener, containsPoint, containsPoint, erase, findDescendantAtExcluding, findFigureAt, findFigureAt, findFigureAt, findFigureAtExcluding, findMouseEventTargetAt, findMouseEventTargetInDescendantsAt, fireCoordinateSystemChanged, fireFigureMoved, fireMoved, firePropertyChange, firePropertyChange, firePropertyChange, getBorder, getBounds, getChildren, getChildrenRevIterable, getClientArea, getClientArea, getClippingStrategy, getCursor, getFlag, getFont, getInsets, getLayoutManager, getListeners, getListenersIterable, getLocalBackgroundColor, getLocalFont, getLocalForegroundColor, getLocation, getMaximumSize, getMinimumSize, getMinimumSize, getParent, getPreferredSize, getPreferredSize, getSize, getToolTip, getUpdateManager, handleFocusGained, handleFocusLost, handleKeyPressed, handleKeyReleased, handleMouseDoubleClicked, handleMouseDragged, handleMouseEntered, handleMouseExited, handleMouseHover, handleMouseMoved, handleMousePressed, handleMouseReleased, hasFocus, internalGetEventDispatcher, intersects, invalidate, invalidateTree, isCoordinateSystem, isEnabled, isFocusTraversable, isMirrored, isMouseEventTarget, isOpaque, isRequestFocusEnabled, isShowing, isValid, isValidationRoot, isVisible, optimizeClip, paint, paintBorder, paintChildren, paintFigure, primTranslate, remove, removeAll, removeAncestorListener, removeCoordinateListener, removeFigureListener, removeFocusListener, removeKeyListener, removeLayoutListener, removeListener, removeMouseListener, removeMouseMotionListener, removeNotify, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, requestFocus, revalidate, setBorder, setBounds, setChildrenDirection, setChildrenEnabled, setChildrenOrientation, setClippingStrategy, setConstraint, setFlag, setFocusTraversable, setLayoutManager, setLocation, setMaximumSize, setMinimumSize, setOpaque, setParent, setPreferredSize, setPreferredSize, setRequestFocusEnabled, setSize, setSize, setToolTip, setValid, translate, translateFromParent, translateToAbsolute, translateToParent, translateToRelative, useLocalCoordinates, validate

    Methods inherited from class java.lang.Object

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

  • Constructor Details

    • AbstractSWTWidgetFigure

      public AbstractSWTWidgetFigure(AbstractBaseEditPart editpart)
      Construct the figure with SWT.NONE as style bit.
      Parameters:
      editpart - the editpart that holds this figure
    • AbstractSWTWidgetFigure

      public AbstractSWTWidgetFigure(AbstractBaseEditPart editpart, int style)
      Construct the figure.
      Parameters:
      editpart - the editpart that holds this figure.
      style - style of the SWT widget, which will be passed to createSWTWidget(Composite, int).
  • Method Details

    • layout

      protected void layout()
      Overrides:
      layout in class org.eclipse.draw2d.Figure
    • getSWTWidget

      public T getSWTWidget()
      Get the SWT widget on this figure.
      Returns:
      the SWT widget.
    • createSWTWidget

      protected abstract T createSWTWidget(Composite parent, int style)
      Create the SWT widget.This method will be call in constructor AbstractSWTWidgetFigure(AbstractBaseEditPart, int)
      Parameters:
      parent - the parent composite.
      style - style of the SWT widget, which is passed from the constructor AbstractSWTWidgetFigure(AbstractBaseEditPart, int)
      Returns:
      the SWT widget.
    • setCursor

      public void setCursor(Cursor cursor)
      Specified by:
      setCursor in interface org.eclipse.draw2d.IFigure
      Overrides:
      setCursor in class org.eclipse.draw2d.Figure
    • setEnabled

      public void setEnabled(boolean value)
      Specified by:
      setEnabled in interface org.eclipse.draw2d.IFigure
      Overrides:
      setEnabled in class org.eclipse.draw2d.Figure
    • setVisible

      public void setVisible(boolean visible)
      Specified by:
      setVisible in interface org.eclipse.draw2d.IFigure
      Overrides:
      setVisible in class org.eclipse.draw2d.Figure
    • getForegroundColor

      public Color getForegroundColor()
      Specified by:
      getForegroundColor in interface org.eclipse.draw2d.IFigure
      Overrides:
      getForegroundColor in class org.eclipse.draw2d.Figure
    • getBackgroundColor

      public Color getBackgroundColor()
      Specified by:
      getBackgroundColor in interface org.eclipse.draw2d.IFigure
      Overrides:
      getBackgroundColor in class org.eclipse.draw2d.Figure
    • setForegroundColor

      public void setForegroundColor(Color fg)
      Specified by:
      setForegroundColor in interface org.eclipse.draw2d.IFigure
      Overrides:
      setForegroundColor in class org.eclipse.draw2d.Figure
    • setBackgroundColor

      public void setBackgroundColor(Color bg)
      Specified by:
      setBackgroundColor in interface org.eclipse.draw2d.IFigure
      Overrides:
      setBackgroundColor in class org.eclipse.draw2d.Figure
    • paintClientArea

      protected void paintClientArea(org.eclipse.draw2d.Graphics graphics)
      Overrides:
      paintClientArea in class org.eclipse.draw2d.Figure
    • paintOutlineFigure

      protected void paintOutlineFigure(org.eclipse.draw2d.Graphics graphics)
      Paint an outline figure so it can be viewed in outline view in edit mode. It is a white filled rectangle with gray border by default. Subclass may override it accordingly.
      Parameters:
      graphics - The Graphics used to paint
    • repaintWidget

      protected void repaintWidget()
    • relocateWidget

      protected void relocateWidget()
      relocate the widget so it follows the figure position.
    • setFont

      public void setFont(Font f)
      Specified by:
      setFont in interface org.eclipse.draw2d.IFigure
      Overrides:
      setFont in class org.eclipse.draw2d.Figure
    • dispose

      protected void dispose()
      Dispose SWT widget. The SWT widget will be automatically disposed when widget editpart is deactivated. Subclass should not dispose the SWT widget again.