com.dlsc.flexgantt.command.treetable
Class DefaultChangeKeyCommand

java.lang.Object
  extended by com.dlsc.flexgantt.command.AbstractCommand
      extended by com.dlsc.flexgantt.command.treetable.DefaultChangeKeyCommand
All Implemented Interfaces:
ICommand, java.io.Serializable

public class DefaultChangeKeyCommand
extends AbstractCommand

A command that will change the key value of a tree table node. This command can only be used in situations where the tree table model is an instance of DefaultTreeTableModel and the node implements ITreeTableNode.

Since:
1.0
Author:
Dirk Lemmermann
See Also:
INodeEditPolicy.isKeyEditable(Object, com.dlsc.flexgantt.model.treetable.ITreeTableModel), INodeEditPolicy.getChangeKeyCommand(Object, com.dlsc.flexgantt.model.treetable.ITreeTableModel, Object), Serialized Form

Constructor Summary
DefaultChangeKeyCommand(DefaultMutableTreeTableNode node, DefaultTreeTableModel model, java.lang.Object key)
          Constructs a new command.
 
Method Summary
 void executeCommand(IProgressMonitor monitor)
          Executes the command.
 DefaultTreeTableModel getModel()
          Returns the tree table model to which the node belongs.
 java.lang.Object getNewKey()
          Returns the new key value.
 ITreeTableNode getNode()
          Returns the node that was modified.
 java.lang.Object getOldKey()
          Returns the old key value.
 void undoCommand(IProgressMonitor monitor)
          Undos the command.
 
Methods inherited from class com.dlsc.flexgantt.command.AbstractCommand
getName, isRedoable, isRelevant, isUndoable, redoCommand
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultChangeKeyCommand

public DefaultChangeKeyCommand(DefaultMutableTreeTableNode node,
                               DefaultTreeTableModel model,
                               java.lang.Object key)
Constructs a new command.

Parameters:
node - the node that will be modified
model - the model to which the node belongs
key - the new value of the node's key
Since:
1.0
See Also:
ITreeTableNode.setKey(Object)
Method Detail

executeCommand

public void executeCommand(IProgressMonitor monitor)
Description copied from interface: ICommand
Executes the command.

Parameters:
monitor - a progress monitor

undoCommand

public void undoCommand(IProgressMonitor monitor)
Description copied from interface: ICommand
Undos the command.

Parameters:
monitor - a progress monitor

getModel

public DefaultTreeTableModel getModel()
Returns the tree table model to which the node belongs.

Returns:
the node's tree table model
Since:
1.0

getNewKey

public java.lang.Object getNewKey()
Returns the new key value.

Returns:
the node's new key value
Since:
1.0

getOldKey

public java.lang.Object getOldKey()
Returns the old key value. This method can only be called after the command has been executed.

Returns:
the node's old key value
Since:
1.0

getNode

public ITreeTableNode getNode()
Returns the node that was modified.

Returns:
the modified tree table node
Since:
1.0