SAM

org.topcased.modeler.sam.commands
Class MovePortCommand

java.lang.Object
  extended by org.eclipse.gef.commands.Command
      extended by org.topcased.modeler.sam.commands.MovePortCommand

public class MovePortCommand
extends org.eclipse.gef.commands.Command

The Command used to move a Port contained by MultiPort to the container of the MultiPort or move a Port to a MultiPort in the same hierarchy of the Port Creation : 21 dec 2005


Constructor Summary
MovePortCommand(GraphNode parent, GraphNode child, org.eclipse.draw2d.geometry.Point position, int attach)
          Constructor
 
Method Summary
protected  int calculateChildAttachment(org.eclipse.draw2d.geometry.Point loc, org.eclipse.draw2d.geometry.Rectangle container)
          Calculate the nearest border where the graphNode should be attached at the creation depending on its location (Point) and its container (Rectangle)
 boolean canExecute()
           
 void execute()
           
 void redo()
          Add a new DataPort object to the SynchronisationGate model object
protected  void redoModel()
          Update the model
 void undo()
          Remove the last added DataPort
protected  void undoModel()
          Undo the model modifications
 
Methods inherited from class org.eclipse.gef.commands.Command
canUndo, chain, dispose, getDebugLabel, getLabel, setDebugLabel, setLabel
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MovePortCommand

public MovePortCommand(GraphNode parent,
                       GraphNode child,
                       org.eclipse.draw2d.geometry.Point position,
                       int attach)
Constructor

Parameters:
parent - the parentEditPart that will contain the PortEditPart
child - the PortEditPart that is moved
position - the new position
attach - the new attachment
Method Detail

canExecute

public boolean canExecute()
Overrides:
canExecute in class org.eclipse.gef.commands.Command
See Also:
Command.canExecute()

execute

public void execute()
Overrides:
execute in class org.eclipse.gef.commands.Command
See Also:
Command.execute()

redo

public void redo()
Add a new DataPort object to the SynchronisationGate model object

Overrides:
redo in class org.eclipse.gef.commands.Command
See Also:
Command.redo()

redoModel

protected void redoModel()
Update the model


undo

public void undo()
Remove the last added DataPort

Overrides:
undo in class org.eclipse.gef.commands.Command
See Also:
Command.undo()

undoModel

protected void undoModel()
Undo the model modifications


calculateChildAttachment

protected int calculateChildAttachment(org.eclipse.draw2d.geometry.Point loc,
                                       org.eclipse.draw2d.geometry.Rectangle container)
Calculate the nearest border where the graphNode should be attached at the creation depending on its location (Point) and its container (Rectangle)

Parameters:
loc - the location where the user has clicked in the container coordinates.
container - the container Figure
Returns:
a PositionConstant

SAM

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