Class ArrayEditPart

java.lang.Object
org.eclipse.gef.editparts.AbstractEditPart
org.eclipse.gef.editparts.AbstractGraphicalEditPart
All Implemented Interfaces:
IPVWidgetEditpart, IAdaptable, org.eclipse.gef.EditPart, org.eclipse.gef.GraphicalEditPart, org.eclipse.gef.NodeEditPart, org.eclipse.gef.RequestConstants

public class ArrayEditPart extends AbstractContainerEditpart implements IPVWidgetEditpart
Editpart for array widget.
  • Constructor Details

    • ArrayEditPart

      public ArrayEditPart()
  • Method Details

    • doActivate

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

      public void activate()
      Specified by:
      activate in interface org.eclipse.gef.EditPart
      Overrides:
      activate in class AbstractBaseEditPart
    • initValueArray

      protected void initValueArray()
    • calculateBorder

      public org.eclipse.draw2d.Border calculateBorder()
      Description copied from class: AbstractBaseEditPart
      Calculate the border for the widget with assume that the widget is connected.
      Overrides:
      calculateBorder in class AbstractBaseEditPart
      Returns:
      the border.
    • createChild

      protected org.eclipse.gef.EditPart createChild(Object model)
      Overrides:
      createChild in class org.eclipse.gef.editparts.AbstractEditPart
    • removeChild

      protected void removeChild(org.eclipse.gef.EditPart child)
      Overrides:
      removeChild in class org.eclipse.gef.editparts.AbstractEditPart
    • hookChild

      protected void hookChild(org.eclipse.gef.EditPart editPart, int indexOfArrayChild, boolean directChild)
      Hook child with array index
      Parameters:
      editPart -
    • createConnectionHandler

      protected ConnectionHandler createConnectionHandler()
      Overrides:
      createConnectionHandler in class AbstractBaseEditPart
    • createEditPolicies

      protected void createEditPolicies()
      Overrides:
      createEditPolicies in class AbstractContainerEditpart
    • deactivate

      public void deactivate()
      Specified by:
      deactivate in interface org.eclipse.gef.EditPart
      Overrides:
      deactivate in class AbstractContainerEditpart
    • doCreateFigure

      protected org.eclipse.draw2d.IFigure doCreateFigure()
      Description copied from class: AbstractBaseEditPart
      Create and initialize the widget figure with the property values in model.
      Specified by:
      doCreateFigure in class AbstractBaseEditPart
      Returns:
      the widget figure
    • getAdapter

      public Object getAdapter(Class key)
      Specified by:
      getAdapter in interface IAdaptable
      Overrides:
      getAdapter in class AbstractContainerEditpart
    • getAllPVNames

      public String[] getAllPVNames()
      Specified by:
      getAllPVNames in interface IPVWidgetEditpart
      Returns:
      A String array with all PV names from PV properties.
    • getArrayFigure

      public ArrayFigure getArrayFigure()
    • getContentPane

      public org.eclipse.draw2d.IFigure getContentPane()
      Specified by:
      getContentPane in interface org.eclipse.gef.GraphicalEditPart
      Overrides:
      getContentPane in class org.eclipse.gef.editparts.AbstractGraphicalEditPart
    • getControlPV

      public IPV getControlPV()
      Specified by:
      getControlPV in interface IPVWidgetEditpart
      Returns:
      the control PV. null if no control PV on this widget.
    • getDragTracker

      public org.eclipse.gef.DragTracker getDragTracker(org.eclipse.gef.Request request)
      Specified by:
      getDragTracker in interface org.eclipse.gef.EditPart
      Overrides:
      getDragTracker in class org.eclipse.gef.editparts.AbstractGraphicalEditPart
    • getModelChildren

      protected List<AbstractWidgetModel> getModelChildren()
      Overrides:
      getModelChildren in class AbstractContainerEditpart
    • getUnSyncablePropIds

      protected List<String> getUnSyncablePropIds()
    • getPV

      public IPV getPV()
      Get the PV corresponding to the PV Name property. It is same as calling getPV("pv_name").
      Specified by:
      getPV in interface IPVWidgetEditpart
      Returns:
      the PV corresponding to the PV Name property. null if PV Name is not configured for this widget.
    • getPV

      public IPV getPV(String pvPropId)
      Get the pv by PV property id.
      Specified by:
      getPV in interface IPVWidgetEditpart
      Parameters:
      pvPropId - the PV property id.
      Returns:
      the corresponding pv for the pvPropId. null if the pv doesn't exist.
    • getPVName

      public String getPVName()
      Specified by:
      getPVName in interface IPVWidgetEditpart
      Returns:
      the first PV name.
    • getPVValue

      public VType getPVValue(String pvPropId)
      Get value from one of the attached PVs.
      Specified by:
      getPVValue in interface IPVWidgetEditpart
      Parameters:
      pvPropId - the property id of the PV. It is "pv_name" for the main PV.
      Returns:
      the value of the PV.
    • getWidgetModel

      public ArrayModel getWidgetModel()
      Overrides:
      getWidgetModel in class AbstractContainerEditpart
    • getIndex

      public int getIndex(AbstractBaseEditPart child)
      Get the array index on the child widget.
      Parameters:
      child -
      Returns:
      the array index on the child widget. -1 if the child is not an array element or it is not a child of the array widget.
    • initFigure

      protected void initFigure(org.eclipse.draw2d.IFigure figure)
      Description copied from class: AbstractBaseEditPart
      initialize the figure
      Overrides:
      initFigure in class AbstractBaseEditPart
    • performDirectEdit

      protected void performDirectEdit()
    • performRequest

      public void performRequest(org.eclipse.gef.Request request)
      Specified by:
      performRequest in interface org.eclipse.gef.EditPart
      Overrides:
      performRequest in class org.eclipse.gef.editparts.AbstractEditPart
    • registerBasePropertyChangeHandlers

      protected void registerBasePropertyChangeHandlers()
      Overrides:
      registerBasePropertyChangeHandlers in class AbstractContainerEditpart
    • registerPropertyChangeHandlers

      protected void registerPropertyChangeHandlers()
      Description copied from class: AbstractBaseEditPart
      Register the property change handlers. Subclass should register its property change handlers in this method.
      Specified by:
      registerPropertyChangeHandlers in class AbstractBaseEditPart
    • setIgnoreOldPVValue

      public void setIgnoreOldPVValue(boolean ignoreOldValue)
    • setPVValue

      public void setPVValue(String pvPropId, Object value)
      Set PV to given value. Should accept Double, Double[], Integer, String, maybe more.
      Specified by:
      setPVValue in interface IPVWidgetEditpart
    • getValue

      public Object getValue()
      Description copied from class: AbstractContainerEditpart
      By default, it returns an Object Array of its children's value. If AbstractContainerEditpart.setValue(Object) was called with a non Object[] input value, it will return the value of its first child.
      Overrides:
      getValue in class AbstractContainerEditpart
      Returns:
      The value of the widget.
    • setValue

      public void setValue(Object value)
      Description copied from class: AbstractContainerEditpart
      If input value is instance of Object[] and its length is equal or larger than children size, it will write each element of value to each child according children's order. Otherwise, it will write the input value as an whole Object to every child.
      Overrides:
      setValue in class AbstractContainerEditpart
      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.
    • updateWidgetSize

      protected void updateWidgetSize()
    • addSetPVValueListener

      public void addSetPVValueListener(IPVWidgetEditpart.ISetPVValueListener listener)
      Specified by:
      addSetPVValueListener in interface IPVWidgetEditpart
    • isPVControlWidget

      public boolean isPVControlWidget()
      Specified by:
      isPVControlWidget in interface IPVWidgetEditpart
    • setControlEnabled

      public void setControlEnabled(boolean enabled)
      Specified by:
      setControlEnabled in interface IPVWidgetEditpart