|
Eclipse GEF 2.1 |
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.eclipse.gef.editpolicies.AbstractEditPolicy | +--org.eclipse.gef.editpolicies.GraphicalEditPolicy | +--org.eclipse.gef.editpolicies.LayoutEditPolicy | +--org.eclipse.gef.editpolicies.ConstrainedLayoutEditPolicy
For use with LayoutManager
that require a constraint.
ConstraintedLayoutEditPolicy understands RequestConstants.REQ_ALIGN_CHILDREN
in addition to the Requests handled in the superclass.
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_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 | |
ConstrainedLayoutEditPolicy()
|
Method Summary | |
protected abstract Command |
createAddCommand(EditPart child,
Object constraint)
Returns the Command to perform an Add with the specified child and
constraint. |
protected abstract Command |
createChangeConstraintCommand(EditPart child,
Object constraint)
Returns the Command to change the specified child's constraint. |
protected EditPolicy |
createChildEditPolicy(EditPart child)
A NonResizableEditPolicy is used by default for children. |
protected Command |
getAddCommand(Request generic)
Overrides getAddCommand() to generate the proper constraint for each child
being added. |
protected Command |
getAlignChildrenCommand(AlignmentRequest request)
Returns the command to align a group of children. |
Command |
getCommand(Request request)
Factors out RESIZE and ALIGN requests, otherwise calls super . |
protected Object |
getConstraintFor(ChangeBoundsRequest request,
GraphicalEditPart child)
Generates a draw2d constraint object derived from the specified child EditPart using the provided Request. |
protected Object |
getConstraintFor(CreateRequest request)
Generates a draw2d constraint for the given CreateRequest . |
protected abstract Object |
getConstraintFor(Point point)
Generates a draw2d constraint given a Point . |
protected abstract Object |
getConstraintFor(Rectangle rect)
Generates a draw2d constraint given a Rectangle . |
protected Point |
getLayoutOrigin()
Returns the layout's origin relative to the LayoutEditPolicy.getLayoutContainer() . |
protected Command |
getMoveChildrenCommand(Request request)
Returns the Command to move a group of children. |
protected Command |
getResizeChildrenCommand(ChangeBoundsRequest request)
Returns the Command to resize a group of children. |
protected Object |
translateToModelConstraint(Object figureConstraint)
Converts a constraint from the format used by LayoutManagers, to the form stored in the model. |
Methods inherited from class org.eclipse.gef.editpolicies.LayoutEditPolicy |
activate, createListener, deactivate, decorateChild, decorateChildren, eraseDragTargetFeedback, eraseLayoutTargetFeedback, eraseSizeOnDropFeedback, eraseTargetFeedback, getCreateCommand, getDeleteDependantCommand, getLayoutContainer, getOrphanChildrenCommand, getSizeOnDropFeedback, getTargetEditPart, setListener, showDragTargetFeedback, showLayoutTargetFeedback, showSizeOnDropFeedback, showTargetFeedback |
Methods inherited from class org.eclipse.gef.editpolicies.GraphicalEditPolicy |
addFeedback, 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 ConstrainedLayoutEditPolicy()
Method Detail |
protected abstract Command createAddCommand(EditPart child, Object constraint)
Command
to perform an Add with the specified child and
constraint. The constraint has been converted from a draw2d constraint to an object
suitable for the model by calling translateToModelConstraint(Object)
.
child
- the EditPart of the child being addedconstraint
- the model constraint, after being translated
protected abstract Command createChangeConstraintCommand(EditPart child, Object constraint)
Command
to change the specified child's constraint. The
constraint has been converted from a draw2d constraint to an object suitable for the
model
child
- the EditPart of the child being changedconstraint
- the new constraint, after being translated
protected 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 EditPart
EditPolicy.PRIMARY_DRAG_ROLE
LayoutEditPolicy.createChildEditPolicy(EditPart)
protected Command getAddCommand(Request generic)
getAddCommand()
to generate the proper constraint for each child
being added. Once the constraint is calculated, createAddCommand(EditPart,Object)
is called. Subclasses must implement this method.
getAddCommand
in class LayoutEditPolicy
generic
- the ADD Request
LayoutEditPolicy.getAddCommand(Request)
protected Command getAlignChildrenCommand(AlignmentRequest request)
getResizeChildrenCommand(ChangeBoundsRequest)
is returned.
request
- the AligmentRequest
public Command getCommand(Request request)
super
.
getCommand
in interface EditPolicy
getCommand
in class LayoutEditPolicy
EditPolicy.getCommand(Request)
protected Object getConstraintFor(ChangeBoundsRequest request, GraphicalEditPart child)
translateToModelConstraint(Object)
.
request
- the ChangeBoundsRequestchild
- the child EditPart for which the constraint should be generated
protected abstract Object getConstraintFor(Point point)
Point
. This method is called during
creation, when only a mouse location is available.
point
- the Point relative to the layout origin
protected abstract Object getConstraintFor(Rectangle rect)
Rectangle
. This method is called
during most operations.
rect
- the Rectangle relative to the layout origin
protected Object getConstraintFor(CreateRequest request)
CreateRequest
. If the
CreateRequest has a size, getConstraintFor(Rectangle)
is called with a
Rectangle of that size and the result is returned. This is used during size-on-drop
creation. Otherwise, getConstraintFor(Point)
is returned.
The CreateRequest's location is relative the Viewer. The location is made layout-relative before calling one of the methods mentioned above.
request
- the CreateRequest
protected Object translateToModelConstraint(Object figureConstraint)
figureConstraint
- the draw2d constraint
protected Command getResizeChildrenCommand(ChangeBoundsRequest request)
Command
to resize a group of children.
request
- the ChangeBoundsRequest
protected Command getMoveChildrenCommand(Request request)
Command
to move a group of children. By default, move is
treated the same as a resize.
getMoveChildrenCommand
in class LayoutEditPolicy
request
- the Request
LayoutEditPolicy.getMoveChildrenCommand(Request)
protected Point getLayoutOrigin()
LayoutEditPolicy.getLayoutContainer()
. 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.
|
Eclipse GEF 2.1 |
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |