Class AbstractConnectionEditPart

All Implemented Interfaces:
IAdaptable, ConnectionEditPart, EditPart, GraphicalEditPart, LayerConstants, RequestConstants

public abstract class AbstractConnectionEditPart extends AbstractGraphicalEditPart implements ConnectionEditPart, LayerConstants
The base implementation for ConnectionEditPart.
  • Constructor Details

    • AbstractConnectionEditPart

      public AbstractConnectionEditPart()
  • Method Details

    • activateFigure

      protected void activateFigure()
      Activates the Figure representing this, by setting up the start and end connections, and adding the figure to the Connection Layer.
      See Also:
    • addNotify

      public void addNotify()
      Description copied from interface: EditPart
      Called after the EditPart has been added to its parent. This is used to indicate to the EditPart that it should refresh itself for the first time.
      Specified by:
      addNotify in interface EditPart
      Overrides:
      addNotify in class AbstractGraphicalEditPart
      See Also:
    • createFigure

      protected IFigure createFigure()
      Returns a newly created Figure to represent these type of EditParts.
      Specified by:
      createFigure in class AbstractGraphicalEditPart
      Returns:
      The created Figure.
    • deactivateFigure

      protected void deactivateFigure()
      Deactivates the Figure representing this, by removing it from the connection layer, and resetting the source and target connections to null.
    • getAdapter

      public <T> T getAdapter(Class<T> adapter)
      AbstractConnectionEditPart extends getAdapter() to overrides the AccessibleAnchorProvider adapter returned by the superclass. When treating a connection as a node for other connections, it makes sense to target its midpoint, and not the edge of its bounds.
      Specified by:
      getAdapter in interface IAdaptable
      Overrides:
      getAdapter in class AbstractGraphicalEditPart
      Parameters:
      adapter - the adapter Class
      Returns:
      the adapter
      See Also:
    • getConnectionFigure

      public Connection getConnectionFigure()
      Convenience method for casting this GraphicalEditPart's Figure to a Connection
      Returns:
      the Figure as a Connection
    • getDragTracker

      public DragTracker getDragTracker(Request req)
      Description copied from class: AbstractGraphicalEditPart
      Overridden to return a default DragTracker for GraphicalEditParts.
      Specified by:
      getDragTracker in interface EditPart
      Overrides:
      getDragTracker in class AbstractGraphicalEditPart
      Parameters:
      req - a Request indicating the context of the drag
      Returns:
      null or a DragTracker
      See Also:
    • getSource

      public EditPart getSource()
      Specified by:
      getSource in interface ConnectionEditPart
      Returns:
      the EditPart at the source end of this connection.
      See Also:
    • getTarget

      public EditPart getTarget()
      Specified by:
      getTarget in interface ConnectionEditPart
      Returns:
      the EditPart at the target end of this connection.
      See Also:
    • getSourceConnectionAnchor

      protected ConnectionAnchor getSourceConnectionAnchor()
      Returns the ConnectionAnchor for the source end of the connection. If the source is an instance of NodeEditPart, that interface will be used to determine the proper ConnectionAnchor. If the source is not an instance of NodeEditPart, this method should be overridden to return the correct ConnectionAnchor. Failure to do this will cause a default anchor to be used so that the connection figure will be made visible to the developer.
      Returns:
      ConnectionAnchor for the source end of the Connection
    • getTargetConnectionAnchor

      protected ConnectionAnchor getTargetConnectionAnchor()
      Returns the ConnectionAnchor for the target end of the connection. If the target is an instance of NodeEditPart, that interface will be used to determine the proper ConnectionAnchor. If the target is not an instance of NodeEditPart, this method should be overridden to return the correct ConnectionAnchor. Failure to do this will cause a default anchor to be used so that the connection figure will be made visible to the developer.
      Returns:
      ConnectionAnchor for the target end of the Connection
    • refresh

      public void refresh()
      Extended here to also refresh the ConnectionAnchors.
      Specified by:
      refresh in interface EditPart
      Overrides:
      refresh in class AbstractGraphicalEditPart
      See Also:
    • refreshSourceAnchor

      protected void refreshSourceAnchor()
      Updates the source ConnectionAnchor. Subclasses should override getSourceConnectionAnchor() if necessary, and not this method.
    • refreshTargetAnchor

      protected void refreshTargetAnchor()
      Updates the target ConnectionAnchor. Subclasses should override getTargetConnectionAnchor() if necessary, and not this method.
    • removeNotify

      public void removeNotify()
      Extended here to remove the ConnectionEditPart's connection figure from the connection layer.
      Specified by:
      removeNotify in interface EditPart
      Overrides:
      removeNotify in class AbstractGraphicalEditPart
      See Also:
    • setParent

      public void setParent(EditPart parent)
      Extended to implement automatic addNotify and removeNotify handling.
      Specified by:
      setParent in interface EditPart
      Overrides:
      setParent in class AbstractEditPart
      Parameters:
      parent - the parent EditPart
      See Also:
    • setSource

      public void setSource(EditPart editPart)
      Sets the source EditPart of this connection.
      Specified by:
      setSource in interface ConnectionEditPart
      Parameters:
      editPart - EditPart which is the source.
    • setTarget

      public void setTarget(EditPart editPart)
      Sets the target EditPart of this connection.
      Specified by:
      setTarget in interface ConnectionEditPart
      Parameters:
      editPart - EditPart which is the target.