com.pnp.xfeature.commands
Class AddConstraintCommand

java.lang.Object
  extended by Command
      extended by com.pnp.xfeature.commands.AddCommand
          extended by com.pnp.xfeature.commands.AddConstraintCommand

public class AddConstraintCommand
extends AddCommand

The Command class used to add a new global constraint attached to a feature model diagram

Author:
Ondrej Rohlik, created on 13.4.2005

Constructor Summary
AddConstraintCommand(FeatureDiagramModel diagram, FeatureNodeModel node, java.lang.String childNodeType, int nodePosition)
          Creates command that adds new propery set element to the feature model
 
Method Summary
 void execute()
          calls addConstraint() method of the FeatureDiagramModel that adds the new element to DOM model
 void redo()
          calls addConstraint() method of the FeatureDiagramModel that adds the element to DOM model at the right position
 void undo()
          calls removeConstraint() method of the FeatureDiagramModel that removes the constraint from its parent
 
Methods inherited from class com.pnp.xfeature.commands.AddCommand
getNodePosition
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AddConstraintCommand

public AddConstraintCommand(FeatureDiagramModel diagram,
                            FeatureNodeModel node,
                            java.lang.String childNodeType,
                            int nodePosition)
Creates command that adds new propery set element to the feature model

Parameters:
diagram - the feature model
node - the parent node
childNodeType - the type o node that is to be added
nodePosition - position where the new element is to be inserted (among other siblings) ToDo: rename node to parent, remove property set
Method Detail

execute

public void execute()
calls addConstraint() method of the FeatureDiagramModel that adds the new element to DOM model

Overrides:
execute in class AddCommand
See Also:
org.eclipse.gef.commands.Command#execute()

redo

public void redo()
calls addConstraint() method of the FeatureDiagramModel that adds the element to DOM model at the right position

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

undo

public void undo()
calls removeConstraint() method of the FeatureDiagramModel that removes the constraint from its parent

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


Copyright © 2004 - 2008 ETH Zurich and P&P Software GmbH, All Rights Reserved.