SAM

org.topcased.modeler.sam.edit.policies
Class SAMDiagramLayoutEditPolicy

java.lang.Object
  extended by ModelerLayoutEditPolicy
      extended by org.topcased.modeler.sam.edit.policies.SAMDiagramLayoutEditPolicy

public class SAMDiagramLayoutEditPolicy
extends ModelerLayoutEditPolicy

This is a custom LayoutEditPolicy that handles Ports layout. Ports are attached to the borders of the editing area. Added support for drag and drops of systems/automatas from the oultline. Created 7 juin 2005


Constructor Summary
SAMDiagramLayoutEditPolicy()
          Default contructor.
 
Method Summary
protected  org.eclipse.gef.commands.Command createAddCommand(org.eclipse.gef.EditPart child, java.lang.Object constraint, org.eclipse.draw2d.geometry.Point mouseLocation)
          Create and return the Command used to perform the DND of a Port
protected  org.eclipse.gef.commands.Command getAddCommand(org.eclipse.gef.Request generic)
          Copy the code of the LayoutEditPolicy and pass to the createAddCommand the mouseLocation given by the request
protected  org.eclipse.gef.commands.Command getAutoLayoutCommand(AutoLayoutRequest request)
          Overriden so as to disallow the autolayout requested during external drag and drops (it doesn't work well with our references to other systems)
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, int attach, java.util.List featuresList, boolean needModelUpdate)
          This is called when performing a drag and drop from the outline into a diagram, thus it has been customized to deal with instance creation.
protected  boolean isAttachedToBorder(GraphNode node)
           
protected  boolean isExternalObjectAllowed(GraphNode parent, GraphNode child)
          Overriden to allow drag and drops of systems/automatas from the outline.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SAMDiagramLayoutEditPolicy

public SAMDiagramLayoutEditPolicy()
Default contructor. None border are available for anchoring a port.

Method Detail

isAttachedToBorder

protected boolean isAttachedToBorder(GraphNode node)
See Also:
org.topcased.modeler.edit.policies.ModelerLayoutEditPolicy#isAttachedToBorder(org.topcased.modeler.di.model.GraphNode)

getAddCommand

protected org.eclipse.gef.commands.Command getAddCommand(org.eclipse.gef.Request generic)
Copy the code of the LayoutEditPolicy and pass to the createAddCommand the mouseLocation given by the request

See Also:
LayoutEditPolicy.getAddCommand(org.eclipse.gef.Request)

createAddCommand

protected org.eclipse.gef.commands.Command createAddCommand(org.eclipse.gef.EditPart child,
                                                            java.lang.Object constraint,
                                                            org.eclipse.draw2d.geometry.Point mouseLocation)
Create and return the Command used to perform the DND of a Port

Parameters:
child -
constraint -
mouseLocation -
Returns:
the Command to perform the DND 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,
                                                            int attach,
                                                            java.util.List featuresList,
                                                            boolean needModelUpdate)
This is called when performing a drag and drop from the outline into a diagram, thus it has been customized to deal with instance creation.

See Also:
org.topcased.modeler.edit.policies.ModelerLayoutEditPolicy#getCreateCommand(org.eclipse.gef.EditDomain, org.topcased.modeler.di.model.GraphNode, org.topcased.modeler.di.model.GraphNode, org.eclipse.emf.ecore.EObject, org.eclipse.draw2d.geometry.Point, org.eclipse.draw2d.geometry.Dimension, int, java.util.List, boolean)

isExternalObjectAllowed

protected boolean isExternalObjectAllowed(GraphNode parent,
                                          GraphNode child)
Overriden to allow drag and drops of systems/automatas from the outline.

See Also:
org.topcased.modeler.edit.policies.ModelerLayoutEditPolicy#isExternalObjectAllowed(org.topcased.modeler.di.model.GraphNode, org.topcased.modeler.di.model.GraphNode)

getAutoLayoutCommand

protected org.eclipse.gef.commands.Command getAutoLayoutCommand(AutoLayoutRequest request)
Overriden so as to disallow the autolayout requested during external drag and drops (it doesn't work well with our references to other systems)

See Also:
org.topcased.modeler.edit.policies.ModelerLayoutEditPolicy#getAutoLayoutCommand(org.topcased.modeler.requests.AutoLayoutRequest)

SAM

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