GEF v2.0

org.eclipse.gef.editpolicies
Class LayoutEditPolicy

java.lang.Object
  |
  +--org.eclipse.gef.editpolicies.AbstractEditPolicy
        |
        +--org.eclipse.gef.editpolicies.GraphicalEditPolicy
              |
              +--org.eclipse.gef.editpolicies.LayoutEditPolicy
All Implemented Interfaces:
EditPolicy, RequestConstants
Direct Known Subclasses:
ConstrainedLayoutEditPolicy, OrderedLayoutEditPolicy

public abstract class LayoutEditPolicy
extends GraphicalEditPolicy

EditPolicy handles creating commands; providing target feedback; building/converting model and layout constraints; and refreshing layout constraints based on model changes. The EditPolicy handles the relationship between a EditPart (which wraps the actual visual figure) and underlying model object.


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_CHILD, REQ_ALIGN_CHILDREN, REQ_ANCESTOR_DELETED, REQ_CONNECTION_END, REQ_CONNECTION_START, REQ_CREATE, REQ_CREATE_BENDPOINT, REQ_DELETE, REQ_DELETE_BENDPOINT, REQ_DELETE_DEPENDANT, REQ_DIRECT_EDIT, REQ_MOVE, REQ_MOVE_BENDPOINT, REQ_MOVE_CHILD, REQ_MOVE_CHILDREN, REQ_ORPHAN, REQ_ORPHAN_CHILDREN, REQ_RECONNECT_END, REQ_RECONNECT_SOURCE, REQ_RECONNECT_START, REQ_RECONNECT_TARGET, REQ_RESIZE, REQ_RESIZE_CHILD, REQ_RESIZE_CHILDREN, REQ_SELECTION, REQ_SELECTION_HOVER, REQ_SOURCE_DELETED, REQ_TARGET_DELETED
 
Constructor Summary
LayoutEditPolicy()
           
 
Method Summary
 void activate()
          Called to activate this EditPolicy.
protected abstract  EditPolicy createChildEditPolicy(EditPart child)
           
protected  EditPartListener createListener()
           
 void deactivate()
          This policy should shutdown and remove all listeners established in activate().
protected  void decorateChild(EditPart child)
           
protected  void decorateChildren()
           
protected  void eraseDragTargetFeedback(Request request)
           
protected  void eraseSizeOnDropFeedback(Request request)
           
 void eraseTargetFeedback(Request request)
          Erases target feedback based on the given request.
protected  Command getAddCommand(Request request)
           
 Command getCommand(Request request)
          Returns the command for a given request, or null if the EditPolicy does not work with that request type.
protected abstract  Command getCreateCommand(CreateRequest request)
           
protected abstract  Command getDeleteDependantCommand(Request request)
          Returned command should remove the child from this layout.
protected  IFigure getFigure()
          Deprecated. call getHostFigure
protected  IFigure getLayoutContainer()
           
protected abstract  Command getMoveChildrenCommand(Request request)
           
protected  Command getOrphanChildrenCommand(Request request)
           
protected  IFigure getSizeOnDropFeedback()
           
 EditPart getTargetEditPart(Request request)
          Returns the host EditPart if the EditPolicy works with the given request type, otherwise return null.
protected  void setListener(EditPartListener listener)
           
protected  void showDragTargetFeedback(Request request)
           
protected  void showSizeOnDropFeedback(CreateRequest request)
           
 void showTargetFeedback(Request request)
          Shows or updates target feedback if the receiver works with the request type.
protected  void undecorateChild(EditPart child)
           
protected  void undecorateChildren()
           
 
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, initialize, setHost, showSourceFeedback, toString, understandsRequest
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

LayoutEditPolicy

public LayoutEditPolicy()
Method Detail

activate

public void activate()
Description copied from class: AbstractEditPolicy
Called to activate this EditPolicy. When activated, this edit policy may wish to add listeners to its host, its host's model, or some other Object. These listeners should be freed in AbstractEditPolicy.deactivate(). AbstractEditPolicy.initialize() is called to do any setup work that does not need to be undone. There is a current bug that initialize() is called every time activate is called. It will only be called once in the future
Overrides:
activate in class AbstractEditPolicy
Following copied from interface: org.eclipse.gef.EditPolicy
See Also:
EditPart.activate(), EditPolicy.deactivate(), EditPart.installEditPolicy(Object, EditPolicy)

createChildEditPolicy

protected abstract EditPolicy createChildEditPolicy(EditPart child)

createListener

protected EditPartListener createListener()

deactivate

public void deactivate()
Description copied from interface: EditPolicy
This policy should shutdown and remove all listeners established in activate(). deactivate() will be called either when the host is deactivated, or when this policy is uninstalled from its host.
Overrides:
deactivate in class AbstractEditPolicy
Following copied from interface: org.eclipse.gef.EditPolicy
See Also:
EditPart.deactivate(), EditPolicy.activate(), EditPart.removeEditPolicy(Object)

decorateChild

protected void decorateChild(EditPart child)

decorateChildren

protected void decorateChildren()

eraseDragTargetFeedback

protected void eraseDragTargetFeedback(Request request)

eraseSizeOnDropFeedback

protected void eraseSizeOnDropFeedback(Request request)

eraseTargetFeedback

public void eraseTargetFeedback(Request request)
Description copied from interface: EditPolicy
Erases target feedback based on the given request. Does nothing if the EditPolicy does not apply to the given request.
Overrides:
eraseTargetFeedback in class AbstractEditPolicy

getAddCommand

protected Command getAddCommand(Request request)

getCommand

public Command getCommand(Request request)
Description copied from interface: EditPolicy
Returns the command for a given request, or null if the EditPolicy does not work with that request type. null is treated as a no-op by the caller, or a zero contribution. The EditPolicy must return an UnexectuableCommand if it wishes to prevent the operation from being performed.
Overrides:
getCommand in class AbstractEditPolicy

getCreateCommand

protected abstract Command getCreateCommand(CreateRequest request)

getDeleteDependantCommand

protected abstract Command getDeleteDependantCommand(Request request)
Returned command should remove the child from this layout. The child will not be re-added elsewhere.

getFigure

protected IFigure getFigure()
Deprecated. call getHostFigure


getLayoutContainer

protected IFigure getLayoutContainer()

getMoveChildrenCommand

protected abstract Command getMoveChildrenCommand(Request request)

getOrphanChildrenCommand

protected Command getOrphanChildrenCommand(Request request)

getSizeOnDropFeedback

protected IFigure getSizeOnDropFeedback()

getTargetEditPart

public EditPart getTargetEditPart(Request request)
Description copied from interface: EditPolicy
Returns the host EditPart if the EditPolicy works with the given request type, otherwise return null. For all practical uses, this method has "boolean" behavior. It is possible, although rarely useful, to return an EditPart other than the host.
Overrides:
getTargetEditPart in class AbstractEditPolicy

setListener

protected void setListener(EditPartListener listener)

showDragTargetFeedback

protected void showDragTargetFeedback(Request request)

showSizeOnDropFeedback

protected void showSizeOnDropFeedback(CreateRequest request)

showTargetFeedback

public void showTargetFeedback(Request request)
Description copied from interface: EditPolicy
Shows or updates target feedback if the receiver works with the request type. This method may be called repeatedly for the purpose of updating feedback based on changes to the request object. Does nothing if the EditPolicy does not recognize the given request.
Overrides:
showTargetFeedback in class AbstractEditPolicy

undecorateChild

protected void undecorateChild(EditPart child)

undecorateChildren

protected void undecorateChildren()

GEF v2.0