edu.stanford.hci.dtools.deviceeditor.components.commands
Class DeviceModelCreateCommand

java.lang.Object
  extended by org.eclipse.gef.commands.Command
      extended by edu.stanford.hci.dtools.deviceeditor.components.commands.DeviceModelCreateCommand

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

A command to add a DeviceModel to a DeviceDiagram. The command can be undone or redone.

This software is distributed under the BSD License.

This code is partially based on code that is copyright (c) 2004 Elias Volanakis. See License.txt

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

Constructor Summary
DeviceModelCreateCommand(DeviceDiagramModel parent, org.eclipse.gef.requests.CreateRequest req)
          Create a command that will add a new ShapeModel to a DiagramModel.
 
Method Summary
 boolean canUndo()
           
 void execute()
           
 void redo()
           
 void undo()
           
 
Methods inherited from class org.eclipse.gef.commands.Command
canExecute, chain, dispose, getDebugLabel, getLabel, setDebugLabel, setLabel
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DeviceModelCreateCommand

public DeviceModelCreateCommand(DeviceDiagramModel parent,
                                org.eclipse.gef.requests.CreateRequest req)
Create a command that will add a new ShapeModel to a DiagramModel.

Parameters:
parent - the DiagramModel that will hold the new element
req - a request to create a new ShapeModel
Throws:
java.lang.IllegalArgumentException - if any parameter is null, or the request does not provide a new ShapeModel instance
Method Detail

canUndo

public boolean canUndo()
Overrides:
canUndo 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

undo

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