public abstract class BendpointEditPolicy extends SelectionHandlesEditPolicy implements java.beans.PropertyChangeListener
ConnectionEditPart
.
BendpointEditPolicy will automatically observe the
Connection
figure. If the number of bends in the
Connection
changes, the handles will be updated.
handles
COMPONENT_ROLE, CONNECTION_BENDPOINTS_ROLE, CONNECTION_ENDPOINTS_ROLE, CONNECTION_ROLE, CONTAINER_ROLE, DIRECT_EDIT_ROLE, GRAPHICAL_NODE_ROLE, LAYOUT_ROLE, NODE_ROLE, PRIMARY_DRAG_ROLE, SELECTION_FEEDBACK_ROLE, TREE_CONTAINER_ROLE
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 and Description |
---|
BendpointEditPolicy() |
Modifier and Type | Method and Description |
---|---|
void |
activate()
activate() is extended to add a listener to the
Connection figure. |
protected java.util.List |
createSelectionHandles()
Creates selection handles for the bendpoints.
|
void |
deactivate()
deactivate() is extended to remove the property change
listener on the Connection figure. |
protected void |
eraseConnectionFeedback(BendpointRequest request)
Erases all bendpoint feedback.
|
void |
eraseSourceFeedback(Request request)
Does nothing by default.
|
Command |
getCommand(Request request)
Factors the Request into either a MOVE, a DELETE, or a CREATE of a
bendpoint.
|
protected Connection |
getConnection()
Convenience method for obtaining the host's
Connection
figure. |
protected abstract Command |
getCreateBendpointCommand(BendpointRequest request)
Implement this method to return a Command that will create a bendpoint.
|
protected abstract Command |
getDeleteBendpointCommand(BendpointRequest request)
Implement this method to return a Command that will delete a bendpoint.
|
protected abstract Command |
getMoveBendpointCommand(BendpointRequest request)
Implement this method to return a Command that will move a bendpoint.
|
void |
propertyChange(java.beans.PropertyChangeEvent evt)
If the number of bendpoints changes, handles are updated.
|
protected void |
restoreOriginalConstraint()
Restores the original constraint that was saved before feedback began to
show.
|
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.
|
protected void |
showCreateBendpointFeedback(BendpointRequest request)
Shows feedback when a bendpoint is being created.
|
protected void |
showDeleteBendpointFeedback(BendpointRequest request)
Shows feedback when a bendpoint is being deleted.
|
protected void |
showMoveBendpointFeedback(BendpointRequest request)
Shows feedback when a bendpoint is being moved.
|
void |
showSourceFeedback(Request request)
Shows feedback when appropriate.
|
addSelectionHandles, getAdapter, hideSelection, removeSelectionHandles, showSelection
addSelectionListener, getTargetEditPart, hideFocus, removeSelectionListener, setFocus, setSelectedState, showFocus, showPrimarySelection
addFeedback, getFeedbackLayer, getHostFigure, getLayer, removeFeedback
debugFeedback, eraseTargetFeedback, getHost, setHost, showTargetFeedback, toString, understandsRequest
public void activate()
activate()
is extended to add a listener to the
Connection
figure.activate
in interface EditPolicy
activate
in class SelectionEditPolicy
EditPolicy.activate()
protected java.util.List createSelectionHandles()
BendpointMoveHandle
s on them with a single
BendpointCreationHandle
between 2 consecutive explicit
bendpoints. If implicit bendpoints (such as those created by the
AutomaticRouter
) are used, one BendpointCreationHandle
is
placed in the middle of the Connection.createSelectionHandles
in class SelectionHandlesEditPolicy
null
SelectionHandlesEditPolicy.createSelectionHandles()
public void deactivate()
deactivate()
is extended to remove the property change
listener on the Connection
figure.deactivate
in interface EditPolicy
deactivate
in class SelectionEditPolicy
EditPolicy.deactivate()
protected void eraseConnectionFeedback(BendpointRequest request)
Connection
figure is used for feedback, we just restore the original constraint that
was saved before feedback started to show.request
- the BendpointRequestpublic void eraseSourceFeedback(Request request)
AbstractEditPolicy
eraseSourceFeedback
in interface EditPolicy
eraseSourceFeedback
in class AbstractEditPolicy
request
- the RequestEditPolicy.eraseSourceFeedback(Request)
public Command getCommand(Request request)
getCommand
in interface EditPolicy
getCommand
in class AbstractEditPolicy
request
- the Requestnull
or a Command contributionEditPolicy.getCommand(Request)
protected Connection getConnection()
Connection
figure.protected abstract Command getCreateBendpointCommand(BendpointRequest request)
request
- the BendpointRequestprotected abstract Command getDeleteBendpointCommand(BendpointRequest request)
request
- the BendpointRequestprotected abstract Command getMoveBendpointCommand(BendpointRequest request)
request
- the BendpointRequestpublic void propertyChange(java.beans.PropertyChangeEvent evt)
propertyChange
in interface java.beans.PropertyChangeListener
PropertyChangeListener.propertyChange(PropertyChangeEvent)
protected void restoreOriginalConstraint()
protected void saveOriginalConstraint()
protected void showCreateBendpointFeedback(BendpointRequest request)
request
- the BendpointRequestprotected void showDeleteBendpointFeedback(BendpointRequest request)
request
- the BendpointRequestprotected void showMoveBendpointFeedback(BendpointRequest request)
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.request
- the BendpointRequestpublic void showSourceFeedback(Request request)
showSourceFeedback
in interface EditPolicy
showSourceFeedback
in class AbstractEditPolicy
request
- the RequestshowCreateBendpointFeedback(BendpointRequest)
,
showMoveBendpointFeedback(BendpointRequest)
Copyright (c) IBM Corp. and others 2000, 2011. All Rights Reserved.