Package org.eclipse.gef.editpolicies
Class OrderedLayoutEditPolicy
java.lang.Object
org.eclipse.gef.editpolicies.AbstractEditPolicy
org.eclipse.gef.editpolicies.GraphicalEditPolicy
org.eclipse.gef.editpolicies.LayoutEditPolicy
org.eclipse.gef.editpolicies.OrderedLayoutEditPolicy
- All Implemented Interfaces:
- EditPolicy,- RequestConstants
- Direct Known Subclasses:
- FlowLayoutEditPolicy
A LayoutEditPolicy for use with 
LayoutManagers that take no
 constraints. Such layout managers typically position children in <x,y>
 coordinates based on their order 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.- Since:
- 2.0
- 
Field SummaryFields inherited from interface org.eclipse.gef.EditPolicyCOMPONENT_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_ROLEFields inherited from interface org.eclipse.gef.RequestConstantsREQ_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 SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionprotected abstract CommandcreateAddCommand(EditPart child, EditPart after) Returns theCommandto add the specified child after a referenceEditPart.protected EditPolicycreateChildEditPolicy(EditPart child) Since Ordered layouts generally don't use constraints, aNonResizableEditPolicyis used by default for children.protected abstract CommandcreateMoveChildCommand(EditPart child, EditPart after) Returns theCommandto move the specified child before the given referenceEditPart.protected CommandgetAddCommand(Request req) This method is overridden from the superclass to calculate the index at which the children should be added.protected abstract EditPartgetInsertionReference(Request request) Calculates a referenceEditPartusing the specifiedRequest.protected CommandgetMoveChildrenCommand(Request request) A move is interpreted here as a change in order of the children.protected booleanReturns whether the layout container's layout manager has a horizontal orientation or not.Methods inherited from class org.eclipse.gef.editpolicies.LayoutEditPolicyactivate, 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, undecorateChildrenMethods inherited from class org.eclipse.gef.editpolicies.GraphicalEditPolicyaddFeedback, getFeedbackLayer, getHost, getHostFigure, getLayer, removeFeedbackMethods inherited from class org.eclipse.gef.editpolicies.AbstractEditPolicydebugFeedback, eraseSourceFeedback, setHost, showSourceFeedback, toString, understandsRequest
- 
Constructor Details- 
OrderedLayoutEditPolicypublic OrderedLayoutEditPolicy()
 
- 
- 
Method Details- 
createAddCommandReturns theCommandto add the specified child after a referenceEditPart. If the reference isnull, the child should be added as the first child.- Parameters:
- child- the child being added
- after-- nullor a reference EditPart
- Returns:
- a Command to add the child
 
- 
createChildEditPolicySince Ordered layouts generally don't use constraints, aNonResizableEditPolicyis used by default for children. Subclasses may override this method to supply a different EditPolicy.- Specified by:
- createChildEditPolicyin class- LayoutEditPolicy
- Parameters:
- child- the child EditPart
- Returns:
- an EditPolicy to be installed as the
         EditPolicy.PRIMARY_DRAG_ROLE
- See Also:
 
- 
createMoveChildCommandReturns theCommandto move the specified child before the given referenceEditPart. If the reference isnull, 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. - Parameters:
- child- the child being moved
- after-- nullor the EditPart that should be after (or to the right of) the child being moved
- Returns:
- a Command to move the child
 
- 
getAddCommandThis method is overridden from the superclass to calculate the index at which the children should be added. The index is determined by finding a reference EditPart, and adding the new child[ren] after that reference part.nullis 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.- Overrides:
- getAddCommandin class- LayoutEditPolicy
- Parameters:
- req- the ADD Request
- Returns:
- A command to perform the ADD.
- See Also:
 
- 
getInsertionReferenceCalculates a referenceEditPartusing the specifiedRequest. The EditPart returned is used to mark the index coming after that EditPart.nullis used to indicate the index that comes after no EditPart, that is, it indicates the very last index.- Parameters:
- request- the Request
- Returns:
- nullor a reference EditPart
 
- 
getMoveChildrenCommandA move is interpreted here as a change in order of the children. This method obtains the proper index, and then callscreateMoveChildCommand(EditPart, EditPart), which subclasses must implement. Subclasses should not override this method.- Specified by:
- getMoveChildrenCommandin class- LayoutEditPolicy
- Parameters:
- request- the Request
- Returns:
- the Command to perform the move
- See Also:
 
- 
isLayoutHorizontalprotected boolean isLayoutHorizontal()Returns whether the layout container's layout manager has a horizontal orientation or not.- Returns:
- trueif the layout container's layout manager has a horizontal orientation,- falseotherwise
- Since:
- 3.7
 
 
-