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
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 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
ConstructorDescriptionAbstractSWTWidgetFigure
(AbstractBaseEditPart editpart) Construct the figure with SWT.NONE as style bit.AbstractSWTWidgetFigure
(AbstractBaseEditPart editpart, int style) Construct the figure. -
Method Summary
Modifier and TypeMethodDescriptionprotected abstract T
createSWTWidget
(Composite parent, int style) Create the SWT widget.This method will be call in constructorAbstractSWTWidgetFigure(AbstractBaseEditPart, int)
protected void
dispose()
Dispose SWT widget.Get the SWT widget on this figure.protected void
layout()
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
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
-
Field Details
-
runmode
protected boolean runmode -
editPart
-
-
Constructor Details
-
AbstractSWTWidgetFigure
Construct the figure with SWT.NONE as style bit.- Parameters:
editpart
- the editpart that holds this figure
-
AbstractSWTWidgetFigure
Construct the figure.- Parameters:
editpart
- the editpart that holds this figure.style
- style of the SWT widget, which will be passed tocreateSWTWidget(Composite, int)
.
-
-
Method Details
-
layout
protected void layout()- Overrides:
layout
in classorg.eclipse.draw2d.Figure
-
getSWTWidget
Get the SWT widget on this figure.- Returns:
- the SWT widget.
-
createSWTWidget
Create the SWT widget.This method will be call in constructorAbstractSWTWidgetFigure(AbstractBaseEditPart, int)
- Parameters:
parent
- the parent composite.style
- style of the SWT widget, which is passed from the constructorAbstractSWTWidgetFigure(AbstractBaseEditPart, int)
- Returns:
- the SWT widget.
-
setCursor
- Specified by:
setCursor
in interfaceorg.eclipse.draw2d.IFigure
- Overrides:
setCursor
in classorg.eclipse.draw2d.Figure
-
setEnabled
public void setEnabled(boolean value) - Specified by:
setEnabled
in interfaceorg.eclipse.draw2d.IFigure
- Overrides:
setEnabled
in classorg.eclipse.draw2d.Figure
-
setVisible
public void setVisible(boolean visible) - Specified by:
setVisible
in interfaceorg.eclipse.draw2d.IFigure
- Overrides:
setVisible
in classorg.eclipse.draw2d.Figure
-
getForegroundColor
- Specified by:
getForegroundColor
in interfaceorg.eclipse.draw2d.IFigure
- Overrides:
getForegroundColor
in classorg.eclipse.draw2d.Figure
-
getBackgroundColor
- Specified by:
getBackgroundColor
in interfaceorg.eclipse.draw2d.IFigure
- Overrides:
getBackgroundColor
in classorg.eclipse.draw2d.Figure
-
setForegroundColor
- Specified by:
setForegroundColor
in interfaceorg.eclipse.draw2d.IFigure
- Overrides:
setForegroundColor
in classorg.eclipse.draw2d.Figure
-
setBackgroundColor
- Specified by:
setBackgroundColor
in interfaceorg.eclipse.draw2d.IFigure
- Overrides:
setBackgroundColor
in classorg.eclipse.draw2d.Figure
-
paintClientArea
protected void paintClientArea(org.eclipse.draw2d.Graphics graphics) - Overrides:
paintClientArea
in classorg.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
- Specified by:
setFont
in interfaceorg.eclipse.draw2d.IFigure
- Overrides:
setFont
in classorg.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.
-