Runtime

org.eclipse.gmf.runtime.diagram.ui.editpolicies
Class XYLayoutEditPolicy

java.lang.Object
  extended byorg.eclipse.gef.editpolicies.AbstractEditPolicy
      extended byorg.eclipse.gef.editpolicies.GraphicalEditPolicy
          extended byorg.eclipse.gef.editpolicies.LayoutEditPolicy
              extended byorg.eclipse.gef.editpolicies.ConstrainedLayoutEditPolicy
                  extended byorg.eclipse.gef.editpolicies.XYLayoutEditPolicy
                      extended byorg.eclipse.gmf.runtime.diagram.ui.editpolicies.XYLayoutEditPolicy
All Implemented Interfaces:
EditPolicy, RequestConstants

public class XYLayoutEditPolicy
extends XYLayoutEditPolicy

the xy layout edit policy

See Also:
XYLayoutEditPolicy

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
XYLayoutEditPolicy()
           
 
Method Summary
protected  Command chainGuideAttachmentCommands(Request request, Command cmd)
           
protected  Command createAddCommand(EditPart child, java.lang.Object constraint)
          Called in response to a REQ_ADD (reparent) request.
protected  Command createChangeConstraintCommand(ChangeBoundsRequest request, EditPart child, java.lang.Object constraint)
           
protected  Command createChangeConstraintCommand(EditPart child, java.lang.Object constraint)
          Called in response to a REQ_RESIZE_CHILDREN request.
protected  EditPolicy createChildEditPolicy(EditPart child)
           
protected  Guide findGuideAt(int pos, boolean horizontal)
          gets the guid at a specific pos
protected  Rectangle getBoundsOffest(CreateViewRequest request, Rectangle bounds, CreateViewRequest.ViewDescriptor viewDescriptor)
          Return bounds offset by some predefined amount.
 Command getCommand(Request request)
          Creates command for REQ_CREATE requests only; all others requests are forwarded to the parent class.
protected  java.lang.Object getConstraintFor(ChangeBoundsRequest request, GraphicalEditPart child)
           
protected  java.lang.Object getConstraintFor(CreateRequest request)
           
protected  Command getCreateCommand(CreateRequest request)
          Called in response to a REQ_CREATE request.
protected  Command getDeleteDependantCommand(Request request)
          null implementation: request not handled.
protected  IFigure getHostFigure()
          Return the host's figure.
protected  Command getOrphanChildrenCommand(Request request)
          null implementation: request not handled.
 
Methods inherited from class org.eclipse.gef.editpolicies.XYLayoutEditPolicy
getConstraintFor, getConstraintFor, getCurrentConstraintFor, getLayoutOrigin, getMinimumSizeFor, getXYLayout, setXyLayout, showSizeOnDropFeedback
 
Methods inherited from class org.eclipse.gef.editpolicies.ConstrainedLayoutEditPolicy
getAddCommand, getAlignChildrenCommand, getConstraintForClone, getMoveChildrenCommand, getResizeChildrenCommand, translateToModelConstraint
 
Methods inherited from class org.eclipse.gef.editpolicies.LayoutEditPolicy
activate, createListener, createSizeOnDropFeedback, deactivate, decorateChild, decorateChildren, eraseLayoutTargetFeedback, eraseSizeOnDropFeedback, eraseTargetFeedback, getCloneCommand, getCreationFeedbackOffset, getLayoutContainer, getSizeOnDropFeedback, getSizeOnDropFeedback, getTargetEditPart, setListener, showLayoutTargetFeedback, showTargetFeedback, undecorateChild, undecorateChildren
 
Methods inherited from class org.eclipse.gef.editpolicies.GraphicalEditPolicy
addFeedback, getFeedbackLayer, 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

XYLayoutEditPolicy

public XYLayoutEditPolicy()
Method Detail

createAddCommand

protected Command createAddCommand(EditPart child,
                                   java.lang.Object constraint)
Called in response to a REQ_ADD (reparent) request. Returns a SetPropertyCommand to set the child's bounds to the supplied constraint.

Parameters:
child - element being reparented.
constraint - - rectangle containing the child's bounds (location)
Returns:
a new command or null if the compound command is empty

createChangeConstraintCommand

protected Command createChangeConstraintCommand(ChangeBoundsRequest request,
                                                EditPart child,
                                                java.lang.Object constraint)

createChangeConstraintCommand

protected Command createChangeConstraintCommand(EditPart child,
                                                java.lang.Object constraint)
Called in response to a REQ_RESIZE_CHILDREN request. This implementation creates a SetPropertyCommand and sets the ID_BOUNDS property value to the supplied constraints.

Parameters:
child - the element being resized.
constraint - the elements new bounds.
Returns:
SetBoundsCommand

getConstraintFor

protected java.lang.Object getConstraintFor(ChangeBoundsRequest request,
                                            GraphicalEditPart child)
See Also:
ConstrainedLayoutEditPolicy.getConstraintFor(org.eclipse.gef.requests.ChangeBoundsRequest, org.eclipse.gef.GraphicalEditPart)

getCreateCommand

protected Command getCreateCommand(CreateRequest request)
Called in response to a REQ_CREATE request. Returns a command to set each created element bounds and autosize properties.

Parameters:
request - a create request (understands instances of CreateViewRequest).
Returns:
a command to satify the request; null if the request is not understood.

getBoundsOffest

protected Rectangle getBoundsOffest(CreateViewRequest request,
                                    Rectangle bounds,
                                    CreateViewRequest.ViewDescriptor viewDescriptor)
Return bounds offset by some predefined amount.

Parameters:
request - the request
bounds - the rectangle bounds
viewDescriptor - the view descriptor
Returns:
rectangle

getDeleteDependantCommand

protected Command getDeleteDependantCommand(Request request)
null implementation: request not handled.


getOrphanChildrenCommand

protected Command getOrphanChildrenCommand(Request request)
null implementation: request not handled.


createChildEditPolicy

protected EditPolicy createChildEditPolicy(EditPart child)

getCommand

public Command getCommand(Request request)
Creates command for REQ_CREATE requests only; all others requests are forwarded to the parent class.

See Also:
XYLayoutEditPolicy.getCommand(Request)

getConstraintFor

protected java.lang.Object getConstraintFor(CreateRequest request)

getHostFigure

protected IFigure getHostFigure()
Return the host's figure. The super calls getFigure(). This is a problem when used with shapecompartments. Instead, return getContextPane(). In shape comaprtments this will return the correct containing figure.


chainGuideAttachmentCommands

protected Command chainGuideAttachmentCommands(Request request,
                                               Command cmd)
Parameters:
request -
cmd -
Returns:
command

findGuideAt

protected Guide findGuideAt(int pos,
                            boolean horizontal)
gets the guid at a specific pos

Parameters:
pos - the position
horizontal - the horizontal flag
Returns:
the guid

Runtime

Guidelines for using Eclipse APIs.

Copyright (c) IBM Corp., Borland Software Corp., and others 2005,2006. All rights reserved.