com.pnp.xfeature.commands
Class PasteCommand

java.lang.Object
  extended by Command
      extended by com.pnp.xfeature.commands.PasteCommand

public class PasteCommand
extends Command

The Command class used to add a node saved in the clipboard to a feature model diagram

Author:
Ondrej Rohlik, created on 13.4.2005

Constructor Summary
PasteCommand(FeatureDiagramModel diagram, FeatureNodeModel node, java.lang.Object childSubtree, int nodePosition)
          Creates command that adds a node curently in the clipboard to the feature model
 
Method Summary
 void execute()
          calls pasteSubtree() method of the FeatureDiagramModel that adds the node (and its whole subtree) element to DOM model and consequently updates the canvas
 void redo()
          calls execute() method
 void undo()
          calls unpasteSubtree() method of the FeatureDiagramModel that saves the current position of the node in its parent's list of nodes (in the DOM model), removes the node from this list and consequently updates the canvas
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PasteCommand

public PasteCommand(FeatureDiagramModel diagram,
                    FeatureNodeModel node,
                    java.lang.Object childSubtree,
                    int nodePosition)
Creates command that adds a node curently in the clipboard to the feature model

Parameters:
diagram - the feature model
node - the parent node
childSubtree - reference to the node that that is to be added; since the node can have children, it is de facto reference to the whole subtree
nodePosition - position where the new element is to be inserted (among other siblings) ToDo: rename node to parent
Method Detail

execute

public void execute()
calls pasteSubtree() method of the FeatureDiagramModel that adds the node (and its whole subtree) element to DOM model and consequently updates the canvas

See Also:
org.eclipse.gef.commands.Command#execute()

redo

public void redo()
calls execute() method

See Also:
org.eclipse.gef.commands.Command#redo()

undo

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

See Also:
org.eclipse.gef.commands.Command#undo()


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