public abstract class TreeContainerEditPolicy extends AbstractEditPolicy
TreeEditPart
.
This EditPolicy is responsible for displaying the insertion feedback in the Tree during the appropriate interactions.
This EditPolicy factors the getCommand(Request)
into three different
abstract methods which subclasses must implement.
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 |
---|
TreeContainerEditPolicy() |
Modifier and Type | Method and Description |
---|---|
void |
eraseTargetFeedback(Request req)
Does nothing by default.
|
protected int |
findIndexOfTreeItemAt(Point pt)
Calculates the index of the TreeItem at given point.
|
protected TreeItem |
findTreeItemAt(Point pt)
Calculates the
TreeItem at a specified
Point . |
protected abstract Command |
getAddCommand(ChangeBoundsRequest request)
Returns a Command for adding the children to the container.
|
Command |
getCommand(Request req)
Returns
null by default. |
protected abstract Command |
getCreateCommand(CreateRequest request)
Returns a Command for creating the object inside the container.
|
protected abstract Command |
getMoveChildrenCommand(ChangeBoundsRequest request)
Returns a Command for moving the children within the container.
|
EditPart |
getTargetEditPart(Request req)
Returns the host EditPart when appropriate.
|
void |
showTargetFeedback(Request req)
Does nothing by default.
|
activate, deactivate, debugFeedback, eraseSourceFeedback, getHost, setHost, showSourceFeedback, toString, understandsRequest
protected abstract Command getAddCommand(ChangeBoundsRequest request)
request
- the Request to add.null
or a Command to perform the addprotected abstract Command getCreateCommand(CreateRequest request)
request
- the CreateRequestnull
or a Command to perform the createprotected abstract Command getMoveChildrenCommand(ChangeBoundsRequest request)
request
- the Request to movenull
or a Command to perform the movepublic void eraseTargetFeedback(Request req)
AbstractEditPolicy
eraseTargetFeedback
in interface EditPolicy
eraseTargetFeedback
in class AbstractEditPolicy
req
- the RequestEditPolicy.eraseTargetFeedback(Request)
protected final int findIndexOfTreeItemAt(Point pt)
pt
- the Point in the Viewerprotected final TreeItem findTreeItemAt(Point pt)
TreeItem
at a specified
Point
.pt
- the draw2d Pointnull
or the TreeItempublic Command getCommand(Request req)
AbstractEditPolicy
null
by default. null
is used to
indicate that the EditPolicy does not contribute to the specified
Request
.getCommand
in interface EditPolicy
getCommand
in class AbstractEditPolicy
req
- the Requestnull
or a Command contributionEditPolicy.getCommand(Request)
public EditPart getTargetEditPart(Request req)
getTargetEditPart
in interface EditPolicy
getTargetEditPart
in class AbstractEditPolicy
req
- the Requestnull
or the appropriate target EditPart
EditPolicy.getTargetEditPart(Request)
public void showTargetFeedback(Request req)
AbstractEditPolicy
showTargetFeedback
in interface EditPolicy
showTargetFeedback
in class AbstractEditPolicy
req
- the RequestEditPolicy.showTargetFeedback(Request)
Copyright (c) IBM Corp. and others 2000, 2011. All Rights Reserved.