Class LayoutEditPolicy
- All Implemented Interfaces:
- EditPolicy,- RequestConstants
- Direct Known Subclasses:
- ConstrainedLayoutEditPolicy,- OrderedLayoutEditPolicy
GraphicalEditParts with the host figure's current
 LayoutManager.
 
 LayoutEditPolicies are responsible for moving, resizing, re-parenting, and
 creating children. The should provide Commands for all of these
 operations. Feedback on the container can also be useful for some layouts
 like grids.
 
 LayoutEditPolicies will decorate the host's children with "satellite"
 EditPolicies. These policies are installed using the
 EditPolicy.PRIMARY_DRAG_ROLE. Simple layouts will use either
 ResizableEditPolicy or NonResizableEditPolicy, depending on
 how the LayoutManager works, and/or attributes of the child EditPart.
- 
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 TypeMethodDescriptionvoidactivate()Extends activate() to allow proper decoration of children.protected abstract EditPolicycreateChildEditPolicy(EditPart child) Returns the "satellite" EditPolicy used to decorate the child.protected EditPartListenercreates the EditPartListener for observing when children are added to the host.protected IFigurecreateSizeOnDropFeedback(CreateRequest createRequest) Override to provide custom feedback figure for the given create request.voidOverrides deactivate to remove the EditPartListener.protected voiddecorateChild(EditPart child) Decorates the child with aEditPolicy.PRIMARY_DRAG_ROLEsuch asResizableEditPolicy.protected voidDecorates all existing children.protected voideraseLayoutTargetFeedback(Request request) Erases target layout feedback.protected voideraseSizeOnDropFeedback(Request request) Erases size-on-drop feedback used during creation.voideraseTargetFeedback(Request request) Calls two more specific methods depending on the Request.protected CommandgetAddCommand(Request request) Override to return theCommandto perform anADD.protected CommandgetCloneCommand(ChangeBoundsRequest request) Override to contribute to clone requests.getCommand(Request request) Factors incoming requests into various specific methods.protected abstract CommandgetCreateCommand(CreateRequest request) Returns theCommandto perform a create.protected InsetsgetCreationFeedbackOffset(CreateRequest request) Returns any insets that need to be applied to the creation feedback's bounds.protected CommandgetDeleteDependantCommand(Request request) Returns theCommandto delete a child.protected IFigureReturns the host'scontentPane.protected PointReturns the layout's origin relative to thegetLayoutContainer().protected abstract CommandgetMoveChildrenCommand(Request request) Returns theCommandto move a group of children.protected CommandgetOrphanChildrenCommand(Request request) Returns theCommandto orphan a group of children.protected IFigureLazily creates and returns the Figure to use for size-on-drop feedback.protected IFiguregetSizeOnDropFeedback(CreateRequest createRequest) Lazily creates and returns the Figure to use for size-on-drop feedback.getTargetEditPart(Request request) Returns the host if the Request is an ADD, MOVE, or CREATE.protected voidsetListener(EditPartListener listener) Sets the EditPartListener used to decorate new children.protected voidshowLayoutTargetFeedback(Request request) Shows target layout feedback.protected voidshowSizeOnDropFeedback(CreateRequest request) Shows size-on-drop feedback during creation.voidshowTargetFeedback(Request request) Factors feedback requests into two more specific methods.protected voidTranslates aTranslatablein absolute coordinates to be layout-relative, i.e. relative to thegetLayoutContainer()'s origin, which is obtained viagetLayoutOrigin().protected voidTranslates aTranslatablein layout-relative coordinates, i.e.protected voidundecorateChild(EditPart child) Removes the decoration added indecorateChild(EditPart).protected voidRemoves all decorations added bydecorateChildren().Methods 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- 
LayoutEditPolicypublic LayoutEditPolicy()
 
- 
- 
Method Details- 
activatepublic void activate()Extends activate() to allow proper decoration of children.- Specified by:
- activatein interface- EditPolicy
- Overrides:
- activatein class- AbstractEditPolicy
- See Also:
 
- 
createChildEditPolicyReturns the "satellite" EditPolicy used to decorate the child.- Parameters:
- child- the child EditPart
- Returns:
- an EditPolicy to be installed as the
         EditPolicy.PRIMARY_DRAG_ROLE
 
- 
createListenercreates the EditPartListener for observing when children are added to the host.- Returns:
- EditPartListener
 
- 
createSizeOnDropFeedbackOverride to provide custom feedback figure for the given create request.- Parameters:
- createRequest- the create request
- Returns:
- custom feedback figure
 
- 
deactivatepublic void deactivate()Overrides deactivate to remove the EditPartListener.- Specified by:
- deactivatein interface- EditPolicy
- Overrides:
- deactivatein class- AbstractEditPolicy
- See Also:
 
- 
decorateChildDecorates the child with aEditPolicy.PRIMARY_DRAG_ROLEsuch asResizableEditPolicy.- Parameters:
- child- the child EditPart being decorated
 
- 
decorateChildrenprotected void decorateChildren()Decorates all existing children. This method is called on activation.
- 
eraseLayoutTargetFeedbackErases target layout feedback. This method is the inverse ofshowLayoutTargetFeedback(Request).- Parameters:
- request- the Request
 
- 
eraseSizeOnDropFeedbackErases size-on-drop feedback used during creation.- Parameters:
- request- the Request
 
- 
eraseTargetFeedbackCalls two more specific methods depending on the Request.- Specified by:
- eraseTargetFeedbackin interface- EditPolicy
- Overrides:
- eraseTargetFeedbackin class- AbstractEditPolicy
- Parameters:
- request- the Request
- See Also:
 
- 
getAddCommand- Parameters:
- request- the ADD Request
- Returns:
- A command to perform the ADD.
 
- 
getCloneCommandOverride to contribute to clone requests.- Parameters:
- request- the clone request
- Returns:
- the command contribution to the clone
 
- 
getCommandFactors incoming requests into various specific methods.- Specified by:
- getCommandin interface- EditPolicy
- Overrides:
- getCommandin class- AbstractEditPolicy
- Parameters:
- request- the Request
- Returns:
- nullor a Command contribution
- See Also:
 
- 
getCreateCommandReturns theCommandto perform a create.- Parameters:
- request- the CreateRequest
- Returns:
- a Command to perform a create
 
- 
getCreationFeedbackOffsetReturns any insets that need to be applied to the creation feedback's bounds.- Parameters:
- request- the create request
- Returns:
- insets, if necessary
 
- 
getDeleteDependantCommandReturns theCommandto delete a child. This method does not get called unless the child forwards an additional request to the container editpart.- Parameters:
- request- the Request
- Returns:
- the Command to delete the child
 
- 
getLayoutContainerReturns the host'scontentPane. The contentPane is the Figure which parents the childrens' figures. It is also the figure which has the LayoutManager that corresponds to this EditPolicy. All operations should be interpreted with respect to this figure.- Returns:
- the Figure that owns the corresponding LayoutManager
 
- 
getMoveChildrenCommandReturns theCommandto move a group of children.- Parameters:
- request- the Request
- Returns:
- the Command to perform the move
 
- 
getOrphanChildrenCommandReturns theCommandto orphan a group of children. The contribution to orphan might contain two parts, both of which are optional. The first part is to actually remove the children from their existing parent. Some application models will perform an orphan implicitly when the children are added to their new parent. The second part is to perform some adjustments on the remaining children. For example, a Table layout might simplify itself by collapsing any unused columns and rows.- Parameters:
- request- the Request
- Returns:
- nullor a Command to perform an orphan
 
- 
getSizeOnDropFeedbackLazily creates and returns the Figure to use for size-on-drop feedback.- Parameters:
- createRequest- the createRequest
- Returns:
- the size-on-drop feedback figure
 
- 
getSizeOnDropFeedbackLazily creates and returns the Figure to use for size-on-drop feedback.- Returns:
- the size-on-drop feedback figure
 
- 
getTargetEditPartReturns the host if the Request is an ADD, MOVE, or CREATE.- Specified by:
- getTargetEditPartin interface- EditPolicy
- Overrides:
- getTargetEditPartin class- AbstractEditPolicy
- Parameters:
- request- the Request
- Returns:
- nullor the appropriate target- EditPart
- See Also:
 
- 
setListenerSets the EditPartListener used to decorate new children. If the listener is currently set, it will be unhooked. If the new value is notnull, it will be hooked.The listener must be remembered in case this EditPolicy is removed from the host and replaced with another LayoutEditPolicy. - Parameters:
- listener-- nullor the listener.
 
- 
showLayoutTargetFeedbackShows target layout feedback. During moves, reparents, and creation, this method is called to allow the LayoutEditPolicy to temporarily show features of its layout that will help the User understand what will happen if the operation is performed in the current location.By default, no feedback is shown. - Parameters:
- request- the Request
- See Also:
 
- 
showSizeOnDropFeedbackShows size-on-drop feedback during creation.- Parameters:
- request- the CreateRequest
 
- 
showTargetFeedbackFactors feedback requests into two more specific methods.- Specified by:
- showTargetFeedbackin interface- EditPolicy
- Overrides:
- showTargetFeedbackin class- AbstractEditPolicy
- Parameters:
- request- the Request
- See Also:
 
- 
undecorateChildRemoves the decoration added indecorateChild(EditPart).- Parameters:
- child- the child whose decoration is being removed.
 
- 
undecorateChildrenprotected void undecorateChildren()Removes all decorations added bydecorateChildren().
- 
getLayoutOriginReturns the layout's origin relative to thegetLayoutContainer(). In other words, what Point on the parent Figure does the LayoutManager use a reference when generating the child figure's bounds from the child's constraint.By default, it is assumed that the layout manager positions children relative to the client area of the layout container. Thus, when processing Viewer-relative Points or Rectangles, the clientArea's location (top-left corner) will be subtracted from the Point/Rectangle, resulting in an offset from the LayoutOrigin. - Returns:
- Point
- Since:
- 3.7 Moved up from ConstrainedLayoutEditPolicy
 
- 
translateFromAbsoluteToLayoutRelativeTranslates aTranslatablein absolute coordinates to be layout-relative, i.e. relative to thegetLayoutContainer()'s origin, which is obtained viagetLayoutOrigin().- Parameters:
- t- the Translatable in absolute coordinates to be translated to layout-relative coordinates.
- Since:
- 3.7
 
- 
translateFromLayoutRelativeToAbsoluteTranslates aTranslatablein layout-relative coordinates, i.e. relative togetLayoutContainer()'s origin which is obtained viagetLayoutOrigin(), into absolute coordinates.- Parameters:
- t- the Translatable in layout-relative coordinates to be translated into absolute coordinates.
- Since:
- 3.7
 
 
-