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
    Modifier and Type
    Class
    Description
    class 
     

    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
    Modifier and Type
    Field
    Description
    protected Map<String,org.eclipse.draw2d.ConnectionAnchor>
     
     

    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

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    void
     
    protected void
     
    org.eclipse.draw2d.Border
    Calculate the border for the widget with assume that the widget is connected.
     
    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.
     
     
    Map<String,org.eclipse.draw2d.ConnectionAnchor>
    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.
     
     
     
    Deprecated.
    Use getVar(String) instead.
     
    getMacroValue(String macroName)
    Get macro value from this widget.
     
     
     
    Get property value of the widget.
    Get PV attached to this widget by pv name.
     
    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 anchor
    The value of the widget that is in representing.
    getVar(String varName)
    Get the value of a variable which is attached to this widget by setVar(String, Object).
     
    protected void
    Hook the default AbstractOpenOPIAction with mouse click.
    protected void
    initFigure(org.eclipse.draw2d.IFigure figure)
    initialize the figure
    boolean
     
    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
     
    void
    setEnabled(boolean enable)
    Set this widget to be enabled.
    void
     
    void
    Deprecated.
    protected void
    setFigureBorder(org.eclipse.draw2d.Border border)
    Set border of the figure.
    void
    setHeight(Number height)
    Set widget's height
    void
    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
     
    void
    Set the value of the widget.
    void
    Call setValue(Object) in UI Thread.
    void
    setVar(String varName, Object varValue)
    Set variable value.
    void
    setVisible(boolean visible)
    Set this widget's visibility.
    void
    Set widget's width
    void
    Set X position of the widget
    void
    Set Y position of the widget
     

    Methods inherited from class org.eclipse.gef.editparts.AbstractGraphicalEditPart

    addChildVisual, addNodeListener, addNotify, addSourceConnection, addTargetConnection, createConnection, createOrFindConnection, fireRemovingSourceConnection, fireRemovingTargetConnection, fireSourceConnectionAdded, fireTargetConnectionAdded, 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, getChildren, getCommand, getEditPolicy, getEditPolicyIterator, getEventListeners, 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, getChildren, 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, getContentPane, getFigure, getSourceConnections, getTargetConnections, removeNodeListener, setLayoutConstraint
  • Field Details

  • Constructor Details

    • AbstractBaseEditPart

      public AbstractBaseEditPart()
  • Method Details

    • activate

      public void activate()
      Specified by:
      activate in interface org.eclipse.gef.EditPart
      Overrides:
      activate in class org.eclipse.gef.editparts.AbstractGraphicalEditPart
    • doActivate

      protected void doActivate()
      Subclass should do the activate things in this method. This method is last called from activate(). If there is code to be called as the first thing in activate(), it can be put in doCreateFigure().
    • doDeActivate

      protected void doDeActivate()
      Subclass should do the deActivate things in this method. This is the first called in deactivate().
    • addToConnectionHandler

      protected void addToConnectionHandler(String pvName, IPV pv)
    • calculateBorder

      public org.eclipse.draw2d.Border calculateBorder()
      Calculate the border for the widget with assume that the widget is connected.
      Returns:
      the border.
    • createConnectionHandler

      protected ConnectionHandler createConnectionHandler()
    • createEditPolicies

      protected void createEditPolicies()
      Specified by:
      createEditPolicies in class org.eclipse.gef.editparts.AbstractEditPart
    • createFigure

      protected org.eclipse.draw2d.IFigure createFigure()
      Specified by:
      createFigure in class org.eclipse.gef.editparts.AbstractGraphicalEditPart
    • deactivate

      public void deactivate()
      Specified by:
      deactivate in interface org.eclipse.gef.EditPart
      Overrides:
      deactivate in class org.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. Use AbstractBaseEditPart 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

      public Object getAdapter(Class key)
      Specified by:
      getAdapter in interface IAdaptable
      Overrides:
      getAdapter in class org.eclipse.gef.editparts.AbstractGraphicalEditPart
    • getName

      public String getName()
    • getAllPVs

      public Map<String,IPV> 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

      public IPV getPVByName(String pvName)
      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

      public ConnectionHandler getConnectionHandler()
    • getDisplayDisposeListener

      public Runnable getDisplayDisposeListener()
    • getExecutionMode

      public ExecutionMode getExecutionMode()
      Returns:
      the executionMode
    • getExternalObject

      @Deprecated public Object getExternalObject(String name)
      Deprecated.
      Use getVar(String) instead.
      Get the external object by name.
      Returns:
      the external object. null if no such an object was set before.
    • getVar

      public Object getVar(String varName)
      Get the value of a variable which is attached to this widget by setVar(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

      public List<AbstractWidgetAction> getHookedActions()
      Returns:
      the default AbstractWidgetAction when mouse click this widget.
    • getPropertyValue

      public Object getPropertyValue(String prop_id)
      Get property value of the widget.
      Parameters:
      prop_id - the property id.
      Returns:
      the property value.
    • getMacroValue

      public String getMacroValue(String macroName)
      Get macro value from this widget.
      Parameters:
      macroName - the name of the macro.
      Returns:
      the value of the macro.
    • getWidgetModel

      public AbstractWidgetModel 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 interface org.eclipse.gef.EditPart
      Overrides:
      isSelectable in class org.eclipse.gef.editparts.AbstractGraphicalEditPart
    • refreshVisuals

      protected void refreshVisuals()
      Overrides:
      refreshVisuals in class org.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

      public void removeAllPropertyChangeHandlers(String propID)
      Remove all the property change handlers on the specified property.
    • removeFromConnectionHandler

      protected void removeFromConnectionHandler(String pvName)
    • setExecutionMode

      public void setExecutionMode(ExecutionMode executionMode)
    • getSite

      public IWorkbenchPartSite getSite()
    • setSite

      public void setSite(IWorkbenchPartSite site)
    • setExternalObject

      @Deprecated public void setExternalObject(String name, Object var)
      Deprecated.
      Add/modify an external object from javascript.
      Parameters:
      name - the name of the object.
      var - the object.
    • setVar

      public void setVar(String varName, Object varValue)
      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

      public void setPropertyChangeHandler(String propertyId, IWidgetPropertyChangeHandler handler)
      Registers a property change handler for the specified property id.
      Parameters:
      propertyId - the property id
      handler - the property change handler
    • setPropertyValue

      public void setPropertyValue(String prop_id, Object value)
      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

      public void setPropertyValue(String prop_id, Object value, boolean forceFire)
      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

      public void setX(Number x)
      Set X position of the widget
      Parameters:
      x - x position in pixel which is relative to its parent.
    • setY

      public void setY(Number y)
      Set Y position of the widget
      Parameters:
      y - y position in pixel which is relative to its parent.
    • setWidth

      public void setWidth(Number width)
      Set widget's width
      Parameters:
      width - width in pixel.
    • setHeight

      public void setHeight(Number height)
      Set widget's height
      Parameters:
      height - height in pixel.
    • getModelSourceConnections

      protected List<ConnectionModel> getModelSourceConnections()
      Overrides:
      getModelSourceConnections in class org.eclipse.gef.editparts.AbstractGraphicalEditPart
    • getModelTargetConnections

      protected List<ConnectionModel> getModelTargetConnections()
      Overrides:
      getModelTargetConnections in class org.eclipse.gef.editparts.AbstractGraphicalEditPart
    • getSourceConnectionAnchor

      public org.eclipse.draw2d.ConnectionAnchor getSourceConnectionAnchor(org.eclipse.gef.ConnectionEditPart connection)
      Specified by:
      getSourceConnectionAnchor in interface org.eclipse.gef.NodeEditPart
    • getSourceConnectionAnchor

      public org.eclipse.draw2d.ConnectionAnchor getSourceConnectionAnchor(org.eclipse.gef.Request request)
      Specified by:
      getSourceConnectionAnchor in interface org.eclipse.gef.NodeEditPart
    • getTargetConnectionAnchor

      public org.eclipse.draw2d.ConnectionAnchor getTargetConnectionAnchor(org.eclipse.gef.ConnectionEditPart connection)
      Specified by:
      getTargetConnectionAnchor in interface org.eclipse.gef.NodeEditPart
    • getTargetConnectionAnchor

      public org.eclipse.draw2d.ConnectionAnchor getTargetConnectionAnchor(org.eclipse.gef.Request request)
      Specified by:
      getTargetConnectionAnchor in interface org.eclipse.gef.NodeEditPart
    • getTerminalNameFromAnchor

      public String getTerminalNameFromAnchor(org.eclipse.draw2d.ConnectionAnchor anchor)
      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

      public Map<String,org.eclipse.draw2d.ConnectionAnchor> 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

      public String toString()
      Overrides:
      toString in class org.eclipse.gef.editparts.AbstractEditPart
    • getValue

      public Object 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

      public void setValue(Object value)
      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, see setValueInUIThread(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

      public void setValueInUIThread(Object value)
      Call setValue(Object) in UI Thread. This method can be called in non-UI thread.