Class BendpointEditPolicy

  • All Implemented Interfaces:
    java.beans.PropertyChangeListener, java.util.EventListener, IAdaptable, EditPolicy, RequestConstants

    public abstract class BendpointEditPolicy
    extends SelectionHandlesEditPolicy
    implements java.beans.PropertyChangeListener
    Used to add bendpoint handles on a ConnectionEditPart.

    BendpointEditPolicy will automatically observe the Connection figure. If the number of bends in the Connection changes, the handles will be updated.

    • Constructor Detail

      • BendpointEditPolicy

        public BendpointEditPolicy()
    • Method Detail

      • eraseConnectionFeedback

        protected void eraseConnectionFeedback​(BendpointRequest request)
        Erases all bendpoint feedback. Since the original Connection figure is used for feedback, we just restore the original constraint that was saved before feedback started to show.
        Parameters:
        request - the BendpointRequest
      • getConnection

        protected org.eclipse.draw2d.Connection getConnection()
        Convenience method for obtaining the host's Connection figure.
        Returns:
        the Connection figure
      • getCreateBendpointCommand

        protected abstract Command getCreateBendpointCommand​(BendpointRequest request)
        Implement this method to return a Command that will create a bendpoint.
        Parameters:
        request - the BendpointRequest
        Returns:
        a Command to create a bendpoint
      • getDeleteBendpointCommand

        protected abstract Command getDeleteBendpointCommand​(BendpointRequest request)
        Implement this method to return a Command that will delete a bendpoint.
        Parameters:
        request - the BendpointRequest
        Returns:
        a Command to delete a bendpoint
      • getMoveBendpointCommand

        protected abstract Command getMoveBendpointCommand​(BendpointRequest request)
        Implement this method to return a Command that will move a bendpoint.
        Parameters:
        request - the BendpointRequest
        Returns:
        a Command to move a bendpoint
      • propertyChange

        public void propertyChange​(java.beans.PropertyChangeEvent evt)
        If the number of bendpoints changes, handles are updated.
        Specified by:
        propertyChange in interface java.beans.PropertyChangeListener
        See Also:
        PropertyChangeListener.propertyChange(PropertyChangeEvent)
      • restoreOriginalConstraint

        protected void restoreOriginalConstraint()
        Restores the original constraint that was saved before feedback began to show.
      • saveOriginalConstraint

        protected void saveOriginalConstraint()
        Since the original figure is used for feedback, this method saves the original constraint, so that is can be restored when the feedback is erased.
      • showCreateBendpointFeedback

        protected void showCreateBendpointFeedback​(BendpointRequest request)
        Shows feedback when a bendpoint is being created. The original figure is used for feedback and the original constraint is saved, so that it can be restored when feedback is erased.
        Parameters:
        request - the BendpointRequest
      • showDeleteBendpointFeedback

        protected void showDeleteBendpointFeedback​(BendpointRequest request)
        Shows feedback when a bendpoint is being deleted. This method is only called once when the bendpoint is first deleted, not every mouse move. The original figure is used for feedback and the original constraint is saved, so that it can be restored when feedback is erased.
        Parameters:
        request - the BendpointRequest
      • showMoveBendpointFeedback

        protected void showMoveBendpointFeedback​(BendpointRequest request)
        Shows feedback when a bendpoint is being moved. Also checks to see if the bendpoint should be deleted and then calls showDeleteBendpointFeedback(BendpointRequest) if needed. The original figure is used for feedback and the original constraint is saved, so that it can be restored when feedback is erased.
        Parameters:
        request - the BendpointRequest