Modelers

org.topcased.modeler.edit.policies
Class EListLayoutEditPolicy

java.lang.Object
  extended by org.eclipse.gef.editpolicies.AbstractEditPolicy
      extended by org.eclipse.gef.editpolicies.GraphicalEditPolicy
          extended by org.eclipse.gef.editpolicies.LayoutEditPolicy
              extended by org.eclipse.gef.editpolicies.OrderedLayoutEditPolicy
                  extended by org.topcased.modeler.edit.policies.EListLayoutEditPolicy
All Implemented Interfaces:
org.eclipse.gef.EditPolicy, org.eclipse.gef.RequestConstants

public class EListLayoutEditPolicy
extends org.eclipse.gef.editpolicies.OrderedLayoutEditPolicy

A Layout that allow creation of eObjects in relation with an eStructuralFeature of the parent eObject or not. Creation : 09 jan. 2006


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
EListLayoutEditPolicy(EStructuralFeature feature)
          The Constructor
EListLayoutEditPolicy(EStructuralFeature feature, boolean isSynchronized)
          The Constructor
 
Method Summary
protected  org.eclipse.gef.commands.Command createAddCommand(org.eclipse.gef.EditPart child, org.eclipse.gef.EditPart after)
           
protected  org.eclipse.gef.commands.Command createMoveChildCommand(org.eclipse.gef.EditPart child, org.eclipse.gef.EditPart after)
           
protected  org.eclipse.gef.commands.Command getCreateCommand(org.eclipse.gef.requests.CreateRequest request)
           
protected  org.eclipse.gef.commands.Command getCreateCommand(org.eclipse.gef.EditDomain domain, GraphNode newObject, GraphNode newParent, EObject newContainerParent, org.eclipse.draw2d.geometry.Point location, org.eclipse.draw2d.geometry.Dimension dimension, java.util.List featuresList, boolean needModelUpdate)
          Generate the command.
protected  org.eclipse.gef.commands.Command getCreateCommand(GraphNode parent, GraphNode child, org.eclipse.draw2d.geometry.Point loc, org.eclipse.draw2d.geometry.Dimension dim, java.util.List featuresList, boolean needModelUpdate)
          Returns the command for the GraphElement creation
protected  org.eclipse.gef.commands.Command getDeleteDependantCommand(org.eclipse.gef.Request request)
           
protected  org.eclipse.gef.EditPart getInsertionReference(org.eclipse.gef.Request request)
           
protected  EObject getParentContainerEObject(GraphElement parent, DiagramElement child)
          By default, it is the model object associated with the parent node that should contain the child
protected  boolean isExternalObjectAllowed(GraphNode parent, GraphNode child)
          Returns true if an external object can be displayed in this container.
protected  boolean isSeveralDisplayAllowed(GraphNode parent, GraphNode child, boolean needModelUpdate)
          Returns true if a model object can be displayed several time in the same list.
protected  boolean isValid(EObject child, EObject parent)
          Check if the current EObject is a valid child for the parent EObject.
 
Methods inherited from class org.eclipse.gef.editpolicies.OrderedLayoutEditPolicy
createChildEditPolicy, getAddCommand, getMoveChildrenCommand
 
Methods inherited from class org.eclipse.gef.editpolicies.LayoutEditPolicy
activate, createListener, createSizeOnDropFeedback, deactivate, decorateChild, decorateChildren, eraseLayoutTargetFeedback, eraseSizeOnDropFeedback, eraseTargetFeedback, getCloneCommand, getCommand, getCreationFeedbackOffset, getLayoutContainer, getOrphanChildrenCommand, getSizeOnDropFeedback, getSizeOnDropFeedback, getTargetEditPart, setListener, showLayoutTargetFeedback, showSizeOnDropFeedback, showTargetFeedback, undecorateChild, undecorateChildren
 
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

EListLayoutEditPolicy

public EListLayoutEditPolicy(EStructuralFeature feature)
The Constructor

Parameters:
feature - the EStructural feature that should be listed

EListLayoutEditPolicy

public EListLayoutEditPolicy(EStructuralFeature feature,
                             boolean isSynchronized)
The Constructor

Parameters:
feature - the EStructural feature that should be listed
Method Detail

getCreateCommand

protected org.eclipse.gef.commands.Command getCreateCommand(org.eclipse.gef.requests.CreateRequest request)
Specified by:
getCreateCommand in class org.eclipse.gef.editpolicies.LayoutEditPolicy
See Also:
LayoutEditPolicy.getCreateCommand(org.eclipse.gef.requests.CreateRequest)

isValid

protected boolean isValid(EObject child,
                          EObject parent)
Check if the current EObject is a valid child for the parent EObject.

Parameters:
child - the child EObject
parent - the parent EObject
Returns:
true if the child can be added

createAddCommand

protected org.eclipse.gef.commands.Command createAddCommand(org.eclipse.gef.EditPart child,
                                                            org.eclipse.gef.EditPart after)
Specified by:
createAddCommand in class org.eclipse.gef.editpolicies.OrderedLayoutEditPolicy
See Also:
OrderedLayoutEditPolicy.createAddCommand(org.eclipse.gef.EditPart, org.eclipse.gef.EditPart)

createMoveChildCommand

protected org.eclipse.gef.commands.Command createMoveChildCommand(org.eclipse.gef.EditPart child,
                                                                  org.eclipse.gef.EditPart after)
Specified by:
createMoveChildCommand in class org.eclipse.gef.editpolicies.OrderedLayoutEditPolicy
See Also:
OrderedLayoutEditPolicy.createMoveChildCommand(org.eclipse.gef.EditPart, org.eclipse.gef.EditPart)

getInsertionReference

protected org.eclipse.gef.EditPart getInsertionReference(org.eclipse.gef.Request request)
Specified by:
getInsertionReference in class org.eclipse.gef.editpolicies.OrderedLayoutEditPolicy
See Also:
OrderedLayoutEditPolicy.getInsertionReference(org.eclipse.gef.Request)

getDeleteDependantCommand

protected org.eclipse.gef.commands.Command getDeleteDependantCommand(org.eclipse.gef.Request request)
Overrides:
getDeleteDependantCommand in class org.eclipse.gef.editpolicies.LayoutEditPolicy
See Also:
LayoutEditPolicy.getDeleteDependantCommand(org.eclipse.gef.Request)

isSeveralDisplayAllowed

protected boolean isSeveralDisplayAllowed(GraphNode parent,
                                          GraphNode child,
                                          boolean needModelUpdate)
Returns true if a model object can be displayed several time in the same list.
This method can be overridden by subclasses to fit with diagram requirement.
Default behavior is only one representation of an object is allowed.

Parameters:
parent - The container
child - the child GraphNode
needModelUpdate - true if the model is modified by the command
Returns:
false

isExternalObjectAllowed

protected boolean isExternalObjectAllowed(GraphNode parent,
                                          GraphNode child)
Returns true if an external object can be displayed in this container. External objects are objects included in a different container.
This method can be overridden by subclasses to fit with diagram requirement.
Default behavior is only local objects are allowed.

Parameters:
parent - The container
child - the child GraphNode
Returns:
false

getCreateCommand

protected org.eclipse.gef.commands.Command getCreateCommand(GraphNode parent,
                                                            GraphNode child,
                                                            org.eclipse.draw2d.geometry.Point loc,
                                                            org.eclipse.draw2d.geometry.Dimension dim,
                                                            java.util.List featuresList,
                                                            boolean needModelUpdate)
Returns the command for the GraphElement creation

Parameters:
parent - The container
child - The child to add
loc - The position
dim - The selected area
featuresList - the avalaible model element feature of the parentNode node where the model element of the childNode node can be added
needModelUpdate - true if the model must be updated with this children, false if we only went to add its graphical representation.
Returns:
The command

getCreateCommand

protected org.eclipse.gef.commands.Command getCreateCommand(org.eclipse.gef.EditDomain domain,
                                                            GraphNode newObject,
                                                            GraphNode newParent,
                                                            EObject newContainerParent,
                                                            org.eclipse.draw2d.geometry.Point location,
                                                            org.eclipse.draw2d.geometry.Dimension dimension,
                                                            java.util.List featuresList,
                                                            boolean needModelUpdate)
Generate the command. By default, the generic CreateGraphNodeCommand is returned. This function should be overriden to return a custumized command.

Parameters:
domain - the EditDomain (used to init the name)
newObject - the node to create
newParent - the parentNode node
newContainerParent - the model object that should contain the new childNode object
location - the location of the created node
dimension - the size of the created node
featuresList - the avalaible model element feature of the parentNode node where the model element of the childNode node can be added
needModelUpdate - true if the model must be modified during this command, false if objects already exist in the mode.
Returns:
the command

getParentContainerEObject

protected EObject getParentContainerEObject(GraphElement parent,
                                            DiagramElement child)
By default, it is the model object associated with the parent node that should contain the child

Parameters:
parent - the parent node
Returns:
the model object that should contain the child object

Modelers

Copyright (c) 2005 TOPCASED Contributors 2005 - 2007. All rights reserved.