com.pnp.xfeature.commands
Class AddPropertyCommand

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

public class AddPropertyCommand
extends AddCommand

The Command class used to add a new property to a feature model diagram

Author:
Ondrej Rohlik, 21.4.2005

Constructor Summary
AddPropertyCommand(FeatureDiagramModel diagram, FeatureNodeModel node, java.lang.String childNodeType, int nodePosition, java.lang.String propertySet, org.w3c.dom.Node propertySetNode)
          Creates command that adds new property to the feature model
 
Method Summary
 void execute()
          calls addProperty() method of the FeatureDiagramModel that adds the new element to DOM model as a child of specified property set, the property view is updated automaticaly be Eclipse
 void redo()
          calls returnProperty() method of the FeatureDiagramModel that adds the element to DOM model at the right position in the list of properties of parent's property set
 void undo()
          calls unAddProperty() method of the FeatureDiagramModel that saves the current position of the node in its parent's list of nodes (in the DOM model) and removes the node from this list
 
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

AddPropertyCommand

public AddPropertyCommand(FeatureDiagramModel diagram,
                          FeatureNodeModel node,
                          java.lang.String childNodeType,
                          int nodePosition,
                          java.lang.String propertySet,
                          org.w3c.dom.Node propertySetNode)
Creates command that adds new property 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)
propertySet - the property set to which this property belongs ToDo: rename node to parent
Method Detail

execute

public void execute()
calls addProperty() method of the FeatureDiagramModel that adds the new element to DOM model as a child of specified property set, the property view is updated automaticaly be Eclipse

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

redo

public void redo()
calls returnProperty() method of the FeatureDiagramModel that adds the element to DOM model at the right position in the list of properties of parent's property set

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

undo

public void undo()
calls unAddProperty() method of the FeatureDiagramModel that saves the current position of the node in its parent's list of nodes (in the DOM model) and removes the node from this list

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.