Class AbstractBaseEditPart
java.lang.Object
org.eclipse.gef.editparts.AbstractEditPart
org.eclipse.gef.editparts.AbstractGraphicalEditPart
org.csstudio.opibuilder.editparts.AbstractBaseEditPart
- All Implemented Interfaces:
IAdaptable
,org.eclipse.gef.EditPart
,org.eclipse.gef.GraphicalEditPart
,org.eclipse.gef.NodeEditPart
,org.eclipse.gef.RequestConstants
- Direct Known Subclasses:
AbstractContainerEditpart
,AbstractLayoutEditpart
,AbstractPVWidgetEditPart
,AbstractWidgetEditPart
,TableEditPart
,WebBrowserEditPart
public abstract class AbstractBaseEditPart
extends org.eclipse.gef.editparts.AbstractGraphicalEditPart
implements org.eclipse.gef.NodeEditPart
-
Nested Class Summary
Nested classes/interfaces inherited from class org.eclipse.gef.editparts.AbstractGraphicalEditPart
org.eclipse.gef.editparts.AbstractGraphicalEditPart.AccessibleGraphicalEditPart, org.eclipse.gef.editparts.AbstractGraphicalEditPart.DefaultAccessibleAnchorProvider
Nested classes/interfaces inherited from class org.eclipse.gef.editparts.AbstractEditPart
org.eclipse.gef.editparts.AbstractEditPart.EditPolicyIterator
-
Field Summary
Fields inherited from class org.eclipse.gef.editparts.AbstractGraphicalEditPart
figure, sourceConnections, targetConnections
Fields inherited from class org.eclipse.gef.editparts.AbstractEditPart
children, FLAG_ACTIVE, FLAG_FOCUS, MAX_FLAG
Fields inherited from interface org.eclipse.gef.EditPart
SELECTED, SELECTED_NONE, SELECTED_PRIMARY
Fields inherited from interface org.eclipse.gef.RequestConstants
REQ_ADD, REQ_ALIGN, REQ_ALIGN_CHILDREN, REQ_CLONE, REQ_CONNECTION_END, REQ_CONNECTION_START, REQ_CREATE, REQ_CREATE_BENDPOINT, REQ_DELETE, REQ_DELETE_DEPENDANT, REQ_DIRECT_EDIT, REQ_MOVE, REQ_MOVE_BENDPOINT, REQ_MOVE_CHILDREN, REQ_OPEN, REQ_ORPHAN, REQ_ORPHAN_CHILDREN, REQ_RECONNECT_SOURCE, REQ_RECONNECT_TARGET, REQ_RESIZE, REQ_RESIZE_CHILDREN, REQ_SELECTION, REQ_SELECTION_HOVER
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
activate()
protected void
addToConnectionHandler
(String pvName, IPV pv) org.eclipse.draw2d.Border
Calculate the border for the widget with assume that the widget is connected.protected ConnectionHandler
protected void
protected org.eclipse.draw2d.IFigure
void
protected void
Subclass should do the activate things in this method.protected abstract org.eclipse.draw2d.IFigure
Create and initialize the widget figure with the property values in model.protected void
Subclass should do the deActivate things in this method.protected void
doRefreshVisuals
(org.eclipse.draw2d.IFigure refreshableFigure) Resizes the figure.void
executeAction
(int index) Run a widget action which is attached to the widget.protected void
Fill the anchor map with all predefined anchors.getAdapter
(Class key) Get the anchor map on this widget.protected org.eclipse.draw2d.ConnectionAnchor
getClosestAnchorAt
(org.eclipse.draw2d.geometry.Point p) Get the closest anchor to point p.getExternalObject
(String name) Deprecated.getMacroValue
(String macroName) Get macro value from this widget.protected List<ConnectionModel>
protected List<ConnectionModel>
getName()
getPropertyValue
(String prop_id) Get property value of the widget.getPVByName
(String pvName) Get PV attached to this widget by pv name.getSite()
org.eclipse.draw2d.ConnectionAnchor
getSourceConnectionAnchor
(org.eclipse.gef.ConnectionEditPart connection) org.eclipse.draw2d.ConnectionAnchor
getSourceConnectionAnchor
(org.eclipse.gef.Request request) org.eclipse.draw2d.ConnectionAnchor
getTargetConnectionAnchor
(org.eclipse.gef.ConnectionEditPart connection) org.eclipse.draw2d.ConnectionAnchor
getTargetConnectionAnchor
(org.eclipse.gef.Request request) getTerminalNameFromAnchor
(org.eclipse.draw2d.ConnectionAnchor anchor) Get name of the terminal by anchorgetValue()
The value of the widget that is in representing.Get the value of a variable which is attached to this widget bysetVar(String, Object)
.protected void
Hook the default AbstractOpenOPIAction with mouse click.protected void
initFigure
(org.eclipse.draw2d.IFigure figure) initialize the figureboolean
protected void
protected void
protected abstract void
Register the property change handlers.void
Remove all the property change handlers on the specified property.protected void
removeFromConnectionHandler
(String pvName) void
setEnabled
(boolean enable) Set this widget to be enabled.void
setExecutionMode
(ExecutionMode executionMode) void
setExternalObject
(String name, Object var) Deprecated.usesetVar(String, Object)
instead.protected void
setFigureBorder
(org.eclipse.draw2d.Border border) Set border of the figure.void
Set widget's heightvoid
setPropertyChangeHandler
(String propertyId, IWidgetPropertyChangeHandler handler) Registers a property change handler for the specified property id.void
setPropertyValue
(String prop_id, Object value) Set the property value of the widget.void
setPropertyValue
(String prop_id, Object value, boolean forceFire) Set the property value of the widget.void
setSelectable
(boolean isSelectable) void
setSite
(IWorkbenchPartSite site) void
Set the value of the widget.void
setValueInUIThread
(Object value) CallsetValue(Object)
in UI Thread.void
Set variable value.void
setVisible
(boolean visible) Set this widget's visibility.void
Set widget's widthvoid
Set X position of the widgetvoid
Set Y position of the widgettoString()
Methods inherited from class org.eclipse.gef.editparts.AbstractGraphicalEditPart
addChildVisual, addNodeListener, addNotify, addSourceConnection, addTargetConnection, createConnection, createOrFindConnection, fireRemovingSourceConnection, fireRemovingTargetConnection, fireSourceConnectionAdded, fireTargetConnectionAdded, getChildren, getContentPane, getDragTracker, getFigure, getLayer, getSourceConnections, getTargetConnections, primAddSourceConnection, primAddTargetConnection, primRemoveSourceConnection, primRemoveTargetConnection, refresh, refreshSourceConnections, refreshTargetConnections, registerVisuals, removeChildVisual, removeNodeListener, removeNotify, removeSourceConnection, removeTargetConnection, reorderChild, reorderSourceConnection, reorderTargetConnection, setFigure, setLayoutConstraint, unregisterVisuals
Methods inherited from class org.eclipse.gef.editparts.AbstractEditPart
activateEditPolicies, addChild, addEditPartListener, createChild, deactivateEditPolicies, debug, debugFeedback, eraseSourceFeedback, eraseTargetFeedback, fireActivated, fireChildAdded, fireDeactivated, fireRemovingChild, fireSelectionChanged, getAccessibleEditPart, getCommand, getEditPolicy, getEditPolicyIterable, getEditPolicyIterator, getEventListeners, getEventListenersIterable, getFlag, getModel, getModelChildren, getParent, getRoot, getSelected, getTargetEditPart, getViewer, hasFocus, installEditPolicy, isActive, performRequest, refreshChildren, register, registerAccessibility, registerModel, removeChild, removeEditPartListener, removeEditPolicy, setFlag, setFocus, setModel, setParent, setSelected, showSourceFeedback, showTargetFeedback, understandsRequest, unregister, unregisterAccessibility, unregisterModel
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface org.eclipse.gef.EditPart
addEditPartListener, addNotify, eraseSourceFeedback, eraseTargetFeedback, getCommand, getDragTracker, getEditPolicy, getModel, getParent, getRoot, getSelected, getTargetEditPart, getViewer, hasFocus, installEditPolicy, isActive, performRequest, refresh, removeEditPartListener, removeEditPolicy, removeNotify, setFocus, setModel, setParent, setSelected, showSourceFeedback, showTargetFeedback, understandsRequest
Methods inherited from interface org.eclipse.gef.GraphicalEditPart
addNodeListener, getChildren, getContentPane, getFigure, getSourceConnections, getTargetConnections, removeNodeListener, setLayoutConstraint
-
Field Details
-
propertyListenerMap
-
anchorMap
-
-
Constructor Details
-
AbstractBaseEditPart
public AbstractBaseEditPart()
-
-
Method Details
-
activate
public void activate()- Specified by:
activate
in interfaceorg.eclipse.gef.EditPart
- Overrides:
activate
in classorg.eclipse.gef.editparts.AbstractGraphicalEditPart
-
doActivate
protected void doActivate()Subclass should do the activate things in this method. This method is last called fromactivate()
. If there is code to be called as the first thing inactivate()
, it can be put indoCreateFigure()
. -
doDeActivate
protected void doDeActivate()Subclass should do the deActivate things in this method. This is the first called indeactivate()
. -
addToConnectionHandler
-
calculateBorder
public org.eclipse.draw2d.Border calculateBorder()Calculate the border for the widget with assume that the widget is connected.- Returns:
- the border.
-
createConnectionHandler
-
createEditPolicies
protected void createEditPolicies()- Specified by:
createEditPolicies
in classorg.eclipse.gef.editparts.AbstractEditPart
-
createFigure
protected org.eclipse.draw2d.IFigure createFigure()- Specified by:
createFigure
in classorg.eclipse.gef.editparts.AbstractGraphicalEditPart
-
deactivate
public void deactivate()- Specified by:
deactivate
in interfaceorg.eclipse.gef.EditPart
- Overrides:
deactivate
in classorg.eclipse.gef.editparts.AbstractGraphicalEditPart
-
doCreateFigure
protected abstract org.eclipse.draw2d.IFigure doCreateFigure()Create and initialize the widget figure with the property values in model.- Returns:
- the widget figure
-
doRefreshVisuals
protected void doRefreshVisuals(org.eclipse.draw2d.IFigure refreshableFigure) Resizes the figure. UseAbstractBaseEditPart
to implement more complex refreshing behavior.- Parameters:
refreshableFigure
- the figure
-
executeAction
public void executeAction(int index) Run a widget action which is attached to the widget.- Parameters:
index
- the index of the action in the actions list.
-
getAdapter
- Specified by:
getAdapter
in interfaceIAdaptable
- Overrides:
getAdapter
in classorg.eclipse.gef.editparts.AbstractGraphicalEditPart
-
getName
-
getAllPVs
- Returns:
- the map with all PVs. PV name is the key. It is not allowed to change the Map by client. null if no PV on this widget.
-
getPVByName
Get PV attached to this widget by pv name. It includes the PVs in Rules and Scripts.- Parameters:
pvName
- name of the PV.- Returns:
- the PV. null if no such PV exists.
-
getConnectionHandler
-
getDisplayDisposeListener
-
getExecutionMode
- Returns:
- the executionMode
-
getExternalObject
Deprecated.UsegetVar(String)
instead.Get the external object by name.- Returns:
- the external object. null if no such an object was set before.
-
getVar
Get the value of a variable which is attached to this widget bysetVar(String, Object)
.- Parameters:
varName
- name of the variable- Returns:
- value of the variable. null if no variable in this name has been attached to this widget.
-
getHookedActions
- Returns:
- the default
AbstractWidgetAction
when mouse click this widget.
-
getPropertyValue
Get property value of the widget.- Parameters:
prop_id
- the property id.- Returns:
- the property value.
-
getMacroValue
Get macro value from this widget.- Parameters:
macroName
- the name of the macro.- Returns:
- the value of the macro.
-
getWidgetModel
-
hookMouseClickAction
protected void hookMouseClickAction()Hook the default AbstractOpenOPIAction with mouse click. -
initFigure
protected void initFigure(org.eclipse.draw2d.IFigure figure) initialize the figure- Parameters:
figure
-
-
isSelectable
public boolean isSelectable()- Specified by:
isSelectable
in interfaceorg.eclipse.gef.EditPart
- Overrides:
isSelectable
in classorg.eclipse.gef.editparts.AbstractGraphicalEditPart
-
refreshVisuals
protected void refreshVisuals()- Overrides:
refreshVisuals
in classorg.eclipse.gef.editparts.AbstractEditPart
-
registerBasePropertyChangeHandlers
protected void registerBasePropertyChangeHandlers() -
registerPropertyChangeHandlers
protected abstract void registerPropertyChangeHandlers()Register the property change handlers. Subclass should register its property change handlers in this method. -
removeAllPropertyChangeHandlers
Remove all the property change handlers on the specified property. -
removeFromConnectionHandler
-
setExecutionMode
-
getSite
-
setSite
-
setExternalObject
Deprecated.usesetVar(String, Object)
instead.Add/modify an external object from javascript.- Parameters:
name
- the name of the object.var
- the object.
-
setVar
Set variable value. If the variable does not exist, it will be added to this widget first. *- Parameters:
varName
- name of the variable.varValue
- value of the variable, which can be any type.
-
setFigureBorder
protected void setFigureBorder(org.eclipse.draw2d.Border border) Set border of the figure. If the border has been set for connection or null value indication, the figure's border will not change.- Parameters:
border
-
-
setPropertyChangeHandler
Registers a property change handler for the specified property id.- Parameters:
propertyId
- the property idhandler
- the property change handler
-
setPropertyValue
Set the property value of the widget. If the new value is same as the old value, it will be ignored.- Parameters:
prop_id
- the property id.value
- the value.
-
setPropertyValue
Set the property value of the widget.- Parameters:
prop_id
- the property id.value
- the value.forceFire
- If true, the property will be set again even if the new value is same as old value. If false, only property value will be set and no listener will be fired.
-
setSelectable
public void setSelectable(boolean isSelectable) -
setEnabled
public void setEnabled(boolean enable) Set this widget to be enabled.- Parameters:
enable
- true if the widget should be enabled.
-
setVisible
public void setVisible(boolean visible) Set this widget's visibility.- Parameters:
visible
- true if the widget should be visible.
-
setX
Set X position of the widget- Parameters:
x
- x position in pixel which is relative to its parent.
-
setY
Set Y position of the widget- Parameters:
y
- y position in pixel which is relative to its parent.
-
setWidth
Set widget's width- Parameters:
width
- width in pixel.
-
setHeight
Set widget's height- Parameters:
height
- height in pixel.
-
getModelSourceConnections
- Overrides:
getModelSourceConnections
in classorg.eclipse.gef.editparts.AbstractGraphicalEditPart
-
getModelTargetConnections
- Overrides:
getModelTargetConnections
in classorg.eclipse.gef.editparts.AbstractGraphicalEditPart
-
getSourceConnectionAnchor
public org.eclipse.draw2d.ConnectionAnchor getSourceConnectionAnchor(org.eclipse.gef.ConnectionEditPart connection) - Specified by:
getSourceConnectionAnchor
in interfaceorg.eclipse.gef.NodeEditPart
-
getSourceConnectionAnchor
public org.eclipse.draw2d.ConnectionAnchor getSourceConnectionAnchor(org.eclipse.gef.Request request) - Specified by:
getSourceConnectionAnchor
in interfaceorg.eclipse.gef.NodeEditPart
-
getTargetConnectionAnchor
public org.eclipse.draw2d.ConnectionAnchor getTargetConnectionAnchor(org.eclipse.gef.ConnectionEditPart connection) - Specified by:
getTargetConnectionAnchor
in interfaceorg.eclipse.gef.NodeEditPart
-
getTargetConnectionAnchor
public org.eclipse.draw2d.ConnectionAnchor getTargetConnectionAnchor(org.eclipse.gef.Request request) - Specified by:
getTargetConnectionAnchor
in interfaceorg.eclipse.gef.NodeEditPart
-
getTerminalNameFromAnchor
Get name of the terminal by anchor- Parameters:
anchor
- the anchor- Returns:
- terminal name of the anchor. null if no name was found.
-
fillAnchorMap
protected void fillAnchorMap()Fill the anchor map with all predefined anchors. -
getAnchorMap
Get the anchor map on this widget. Caller should not change the map.- Returns:
- all the anchors on this widget as in a anchor map. key is the connection terminal name.
-
getClosestAnchorAt
protected org.eclipse.draw2d.ConnectionAnchor getClosestAnchorAt(org.eclipse.draw2d.geometry.Point p) Get the closest anchor to point p.- Parameters:
p
- the reference point- Returns:
- the closest anchor to point p
-
toString
- Overrides:
toString
in classorg.eclipse.gef.editparts.AbstractEditPart
-
getValue
The value of the widget that is in representing. It is not the value of the attached PV even though they are equals in most cases. The value type is specified by the widget, for example, boolean for boolean widget, double for meter and gauge.- Returns:
- The value of the widget.
-
setValue
Set the value of the widget. This only takes effect on the visual presentation of the widget and will not write the value to the PV attached to this widget. Since setting value to a widget usually results in figure repaint, this method should be called in UI thread. To call it in non-UI thread, seesetValueInUIThread(Object)
.- Parameters:
value
- the value to be set. It must be the compatible type for the widget. For example, a boolean widget only accept boolean or number.- Throws:
RuntimeException
- if the value is not an acceptable type.
-
setValueInUIThread
CallsetValue(Object)
in UI Thread. This method can be called in non-UI thread.
-
getVar(String)
instead.