|
Eclipse GEF 3.1 |
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.eclipse.gef.editpolicies.AbstractEditPolicy
org.eclipse.gef.editpolicies.GraphicalEditPolicy
org.eclipse.gef.editpolicies.LayoutEditPolicy
Provides support for interacting with children GraphicalEditParts
with the
host figure's current LayoutManager
.
LayoutEditPolicies are responsible for moving, resizing, reparenting, 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 Summary |
Fields inherited from interface org.eclipse.gef.EditPolicy |
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 |
Fields inherited from interface org.eclipse.gef.RequestConstants |
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 Summary | |
LayoutEditPolicy()
|
Method Summary | |
void |
activate()
Extends activate() to allow proper decoration of children. |
protected abstract EditPolicy |
createChildEditPolicy(EditPart child)
Returns the "satellite" EditPolicy used to decorate the child. |
protected EditPartListener |
createListener()
creates the EditPartListener for observing when children are added to the host. |
protected IFigure |
createSizeOnDropFeedback(CreateRequest createRequest)
Override to provide custom feedback figure for the given create request. |
void |
deactivate()
Overrides deactivate to remove the EditPartListener. |
protected void |
decorateChild(EditPart child)
Decorates the child with a EditPolicy.PRIMARY_DRAG_ROLE such as ResizableEditPolicy . |
protected void |
decorateChildren()
Decorates all existing children. |
protected void |
eraseLayoutTargetFeedback(Request request)
Erases target layout feedback. |
protected void |
eraseSizeOnDropFeedback(Request request)
Erases size-on-drop feedback used during creation. |
void |
eraseTargetFeedback(Request request)
Calls two more specific methods depending on the Request. |
protected Command |
getAddCommand(Request request)
Override to return the Command to perform an ADD . |
protected Command |
getCloneCommand(ChangeBoundsRequest request)
Override to contribute to clone requests. |
Command |
getCommand(Request request)
Factors incoming requests into various specific methods. |
protected abstract Command |
getCreateCommand(CreateRequest request)
Returns the Command to perform a create. |
protected Insets |
getCreationFeedbackOffset(CreateRequest request)
Returns any insets that need to be applied to the creation feedback's bounds. |
protected abstract Command |
getDeleteDependantCommand(Request request)
Returns the Command to delete a child. |
protected IFigure |
getLayoutContainer()
Returns the host's contentPane . |
protected abstract Command |
getMoveChildrenCommand(Request request)
Returns the Command to move a group of children. |
protected Command |
getOrphanChildrenCommand(Request request)
Returns the Command to orphan a group of children. |
protected IFigure |
getSizeOnDropFeedback()
Lazily creates and returns the Figure to use for size-on-drop feedback. |
protected IFigure |
getSizeOnDropFeedback(CreateRequest createRequest)
Lazily creates and returns the Figure to use for size-on-drop feedback. |
EditPart |
getTargetEditPart(Request request)
Returns the host if the Request is an ADD, MOVE, or CREATE. |
protected void |
setListener(EditPartListener listener)
Sets the EditPartListener used to decorate new children. |
protected void |
showLayoutTargetFeedback(Request request)
Shows target layout feedback. |
protected void |
showSizeOnDropFeedback(CreateRequest request)
Shows size-on-drop feedback during creation. |
void |
showTargetFeedback(Request request)
Factors feedback requests into two more specific methods. |
protected void |
undecorateChild(EditPart child)
Removes the decoration added in decorateChild(EditPart) . |
protected void |
undecorateChildren()
Removes all decorations added by decorateChildren() . |
Methods inherited from class org.eclipse.gef.editpolicies.GraphicalEditPolicy |
addFeedback, getFeedbackLayer, getHostFigure, getLayer, removeFeedback |
Methods inherited from class org.eclipse.gef.editpolicies.AbstractEditPolicy |
debugFeedback, eraseSourceFeedback, getHost, setHost, showSourceFeedback, toString, understandsRequest |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
public LayoutEditPolicy()
Method Detail |
public void activate()
activate
in interface EditPolicy
activate
in class AbstractEditPolicy
EditPolicy.activate()
protected abstract EditPolicy createChildEditPolicy(EditPart child)
child
- the child EditPart
EditPolicy.PRIMARY_DRAG_ROLE
protected EditPartListener createListener()
protected IFigure createSizeOnDropFeedback(CreateRequest createRequest)
createRequest
- the create request
public void deactivate()
deactivate
in interface EditPolicy
deactivate
in class AbstractEditPolicy
EditPolicy.deactivate()
protected void decorateChild(EditPart child)
EditPolicy.PRIMARY_DRAG_ROLE
such as ResizableEditPolicy
.
child
- the child EditPart being decoratedprotected void decorateChildren()
protected void eraseLayoutTargetFeedback(Request request)
showLayoutTargetFeedback(Request)
.
request
- the Requestprotected void eraseSizeOnDropFeedback(Request request)
request
- the Requestpublic void eraseTargetFeedback(Request request)
eraseTargetFeedback
in interface EditPolicy
eraseTargetFeedback
in class AbstractEditPolicy
EditPolicy.eraseTargetFeedback(Request)
protected Command getAddCommand(Request request)
Command
to perform an ADD
. By default, null
is returned.
request
- the ADD Request
protected Command getCloneCommand(ChangeBoundsRequest request)
request
- the clone request
public Command getCommand(Request request)
getCommand
in interface EditPolicy
getCommand
in class AbstractEditPolicy
EditPolicy.getCommand(Request)
protected abstract Command getCreateCommand(CreateRequest request)
Command
to perform a create.
request
- the CreateRequest
protected Insets getCreationFeedbackOffset(CreateRequest request)
request
- the create request
protected abstract Command getDeleteDependantCommand(Request request)
Command
to delete a child.
request
- the Request
protected IFigure getLayoutContainer()
contentPane
. 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.
LayoutManager
protected abstract Command getMoveChildrenCommand(Request request)
Command
to move a group of children.
request
- the Request
protected Command getOrphanChildrenCommand(Request request)
Command
to 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.
request
- the Request
null
or a Command to perform an orphanprotected IFigure getSizeOnDropFeedback(CreateRequest createRequest)
createRequest
- the createRequest
protected IFigure getSizeOnDropFeedback()
public EditPart getTargetEditPart(Request request)
getTargetEditPart
in interface EditPolicy
getTargetEditPart
in class AbstractEditPolicy
EditPolicy.getTargetEditPart(Request)
protected void setListener(EditPartListener listener)
null
, it will be hooked.
The listener must be remembered in case this EditPolicy is removed from the host and replaced with another LayoutEditPolicy.
listener
- null
or the listener.protected void showLayoutTargetFeedback(Request request)
By default, no feedback is shown.
request
- the RequesteraseLayoutTargetFeedback(Request)
protected void showSizeOnDropFeedback(CreateRequest request)
request
- the CreateRequestpublic void showTargetFeedback(Request request)
showTargetFeedback
in interface EditPolicy
showTargetFeedback
in class AbstractEditPolicy
EditPolicy.showTargetFeedback(Request)
protected void undecorateChild(EditPart child)
decorateChild(EditPart)
.
child
- the child whose decoration is being removed.protected void undecorateChildren()
decorateChildren()
.
|
Eclipse GEF 3.1 |
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |