com.dlsc.flexgantt.command.treetable
Class DefaultNodeDeleteCommand

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

public class DefaultNodeDeleteCommand
extends AbstractCommand

A command that deletes a tree table node from the model. This command can only be used in situations where the tree table model is an instance of DefaultTreeTableModel and the deleted child node and its parent node are both implementors of the IMutableTreeTableNode interface.

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

Constructor Summary
DefaultNodeDeleteCommand(IMutableTreeTableNode child, DefaultTreeTableModel model)
          Constructs a new command.
 
Method Summary
 void executeCommand(IProgressMonitor monitor)
          Executes the command.
 int getChildIndex()
          Returns the index of the deleted child node within the list of children of the parent node.
 IMutableTreeTableNode getChildNode()
          Returns the deleted child node.
 DefaultTreeTableModel getModel()
          Returns the model to which the parent and the child node belong.
 IMutableTreeTableNode getParentNode()
          Returns the parent node of the node that will be / was deleted.
 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

DefaultNodeDeleteCommand

public DefaultNodeDeleteCommand(IMutableTreeTableNode child,
                                DefaultTreeTableModel model)
Constructs a new command.

Parameters:
child - the child node that will be deleted
model - the model to which the node belongs
Since:
1.0
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

getChildIndex

public int getChildIndex()
Returns the index of the deleted child node within the list of children of the parent node.

Returns:
the deleted node's child index
Since:
1.0

getChildNode

public IMutableTreeTableNode getChildNode()
Returns the deleted child node.

Returns:
the deleted child node
Since:
1.0

getModel

public DefaultTreeTableModel getModel()
Returns the model to which the parent and the child node belong.

Returns:
the nodes' model
Since:
1.0

getParentNode

public IMutableTreeTableNode getParentNode()
Returns the parent node of the node that will be / was deleted.

Returns:
the deleted node's parent node
Since:
1.0