edu.stanford.hci.dtools.statechart.model.commands
Class ConnectionCreateCommand

java.lang.Object
  extended by org.eclipse.gef.commands.Command
      extended by edu.stanford.hci.dtools.statechart.model.commands.ConnectionCreateCommand

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

This software is distributed under the BSD License.

Author:
Bjoern Hartmann ( bjoern(AT)stanford.edu ), Michael Bernstein ( mbernst(AT)stanford.edu )

Constructor Summary
ConnectionCreateCommand(StateModel sourceState, IOModel sourceComponent)
          Instantiate a command that can create a connection between two shapes.
 
Method Summary
 boolean canExecute()
           
 void execute()
           
 void redo()
           
 void setTarget(StateModel targetState, IOModel targetComponent)
          Set the target endpoint for the connection.
 void undo()
           
 
Methods inherited from class org.eclipse.gef.commands.Command
canUndo, chain, dispose, getDebugLabel, getLabel, setDebugLabel, setLabel
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ConnectionCreateCommand

public ConnectionCreateCommand(StateModel sourceState,
                               IOModel sourceComponent)
Instantiate a command that can create a connection between two shapes.

Parameters:
source - the source endpoint (a non-null ShapeModel instance)
lineStyle - the desired line style. See ConnectionModel#setLineStyle(int) for details
Throws:
java.lang.IllegalArgumentException - if source is null
See Also:
ConnectionModel.setLineStyle(int)
Method Detail

canExecute

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

execute

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

redo

public void redo()
Overrides:
redo in class org.eclipse.gef.commands.Command

setTarget

public void setTarget(StateModel targetState,
                      IOModel targetComponent)
Set the target endpoint for the connection.

Parameters:
target - that target endpoint (a non-null ShapeModel instance)
Throws:
java.lang.IllegalArgumentException - if target is null

undo

public void undo()
Overrides:
undo in class org.eclipse.gef.commands.Command