public abstract class OrderedLayoutEditPolicy extends LayoutEditPolicy
LayoutManagers
that take no
constraints. Such layout managers typically position children in getChildren()
. Therefore,
this EditPolicy must perform the inverse mapping. Given a mouse location from
the User, the policy must determine the index at which the child[ren] should
be added/created.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 |
---|
OrderedLayoutEditPolicy() |
Modifier and Type | Method and Description |
---|---|
protected abstract Command |
createAddCommand(EditPart child,
EditPart after)
Returns the
Command to add the specified child after a
reference EditPart . |
protected EditPolicy |
createChildEditPolicy(EditPart child)
Since Ordered layouts generally don't use constraints, a
NonResizableEditPolicy is used by default for children. |
protected abstract Command |
createMoveChildCommand(EditPart child,
EditPart after)
Returns the
Command to move the specified child before the
given reference EditPart . |
protected Command |
getAddCommand(Request req)
This method is overridden from the superclass to calculate the
index at which the children should be added.
|
protected abstract EditPart |
getInsertionReference(Request request)
Calculates a reference
EditPart using the specified
Request . |
protected Command |
getMoveChildrenCommand(Request request)
A move is interpreted here as a change in order of the children.
|
protected boolean |
isLayoutHorizontal()
Returns whether the layout container's layout manager has a horizontal
orientation or not.
|
activate, createListener, createSizeOnDropFeedback, deactivate, decorateChild, decorateChildren, eraseLayoutTargetFeedback, eraseSizeOnDropFeedback, eraseTargetFeedback, getCloneCommand, getCommand, getCreateCommand, getCreationFeedbackOffset, getDeleteDependantCommand, getLayoutContainer, getLayoutOrigin, getOrphanChildrenCommand, getSizeOnDropFeedback, getSizeOnDropFeedback, getTargetEditPart, setListener, showLayoutTargetFeedback, showSizeOnDropFeedback, showTargetFeedback, translateFromAbsoluteToLayoutRelative, translateFromLayoutRelativeToAbsolute, undecorateChild, undecorateChildren
addFeedback, getFeedbackLayer, getHostFigure, getLayer, removeFeedback
debugFeedback, eraseSourceFeedback, getHost, setHost, showSourceFeedback, toString, understandsRequest
protected abstract Command createAddCommand(EditPart child, EditPart after)
Command
to add the specified child after a
reference EditPart
. If the reference is null
,
the child should be added as the first child.child
- the child being addedafter
- null
or a reference EditPartprotected EditPolicy createChildEditPolicy(EditPart child)
NonResizableEditPolicy
is used by default for children.
Subclasses may override this method to supply a different EditPolicy.createChildEditPolicy
in class LayoutEditPolicy
child
- the child EditPartEditPolicy.PRIMARY_DRAG_ROLE
LayoutEditPolicy.createChildEditPolicy(EditPart)
protected abstract Command createMoveChildCommand(EditPart child, EditPart after)
Command
to move the specified child before the
given reference EditPart
. If the reference is
null
, the child should be moved in front of all children.
A move is a change in the order of the children, which indirectly causes a change in location on the screen.
child
- the child being movedafter
- null
or the EditPart that should be after (or to
the right of) the child being movedprotected Command getAddCommand(Request req)
null
is used to indicate
that the child[ren] should be added at the beginning.
Subclasses must override createAddCommand(EditPart, EditPart)
,
and should not override this method.
getAddCommand
in class LayoutEditPolicy
req
- the ADD RequestLayoutEditPolicy.getAddCommand(Request)
protected abstract EditPart getInsertionReference(Request request)
EditPart
using the specified
Request
. The EditPart returned is used to mark the index
coming after that EditPart. null
is used to
indicate the index that comes after no EditPart, that is, it
indicates the very last index.request
- the Requestnull
or a reference EditPartprotected Command getMoveChildrenCommand(Request request)
createMoveChildCommand(EditPart, EditPart)
, which subclasses
must implement. Subclasses should not override this method.getMoveChildrenCommand
in class LayoutEditPolicy
request
- the RequestLayoutEditPolicy.getMoveChildrenCommand(Request)
protected boolean isLayoutHorizontal()
true
if the layout container's layout manager has a
horizontal orientation, false
otherwiseCopyright (c) IBM Corp. and others 2000, 2011. All Rights Reserved.