edu.usc.cse.desi.command
Class AddComponentCommand

java.lang.Object
  extended byorg.eclipse.gef.commands.Command
      extended byedu.usc.cse.desi.command.AddComponentCommand

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

This command is created and executed when an existing Component gets added to a Host or a Super-Component.

Author:
Nels Started Apr 6, 2004

Field Summary
private  AbstractNodeViewModel child
           
private  AbstractNodeViewModel parent
           
 
Fields inherited from class org.eclipse.gef.commands.Command
 
Constructor Summary
AddComponentCommand()
           
 
Method Summary
 boolean canExecute()
          Returns true if this command can be executed.
 void execute()
          Execute this command.
 AbstractNodeViewModel getChild()
          Get the child AbstractViewModel from this command.
 AbstractNodeViewModel getParent()
          Get the parent AbstractViewModel from this command.
 void redo()
          Redo this command.
 void setChild(AbstractNodeViewModel model)
          Set the child AbstractViewModel for this command.
 void setParent(AbstractNodeViewModel model)
          Set the parent AbstractViewModel for this command.
 void undo()
          Undo this command.
 
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
 

Field Detail

child

private AbstractNodeViewModel child

parent

private AbstractNodeViewModel parent
Constructor Detail

AddComponentCommand

public AddComponentCommand()
Method Detail

execute

public void execute()
Execute this command. Add the child to the parent.


canExecute

public boolean canExecute()
Returns true if this command can be executed. Check Model types.


undo

public void undo()
Undo this command. Remove the child from the parent.


redo

public void redo()
Redo this command. Re-add the child to the parent.


getChild

public AbstractNodeViewModel getChild()
Get the child AbstractViewModel from this command.

Returns:
AbstractNodeViewModel

getParent

public AbstractNodeViewModel getParent()
Get the parent AbstractViewModel from this command.

Returns:
AbstractNodeViewModel

setChild

public void setChild(AbstractNodeViewModel model)
Set the child AbstractViewModel for this command.

Parameters:
model - AbstractNodeViewModel

setParent

public void setParent(AbstractNodeViewModel model)
Set the parent AbstractViewModel for this command.

Parameters:
model - AbstractNodeViewModel