com.dlsc.flexgantt.command.treetable
Class DefaultNodeCreateCommand

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

public class DefaultNodeCreateCommand
extends AbstractCommand

A command that creates a new child node for a given parent node and tree table model. The command can only be used in situations where the model is an instance of DefaultTreeTableModel and the parent and the new child node are instances of IMutableTreeTableNode.

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

Constructor Summary
DefaultNodeCreateCommand(IMutableTreeTableNode parent, DefaultTreeTableModel model, java.lang.Object key, java.lang.Object[] values)
          Constructs a new command.
 
Method Summary
protected  IMutableTreeTableNode createNewNode()
          Creates the new child node instance of type DefaultGanttChartNode.
 void executeCommand(IProgressMonitor monitor)
          Executes the command.
protected  void fillNode(ITreeTableNode node)
          Fills the newly created tree table node with the initial key and column values.
 IMutableTreeTableNode getChildNode()
          Returns the newly created child node.
 java.lang.Object getKey()
          Returns the initial key value that will be assigned to the new child node.
 DefaultTreeTableModel getModel()
          The model to which the parent node and the new child node belong.
 IMutableTreeTableNode getParentNode()
          Returns the parent node that received a new child node.
 java.lang.Object[] getValues()
          Returns the initial column values that will be assigned to the new child node.
 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

DefaultNodeCreateCommand

public DefaultNodeCreateCommand(IMutableTreeTableNode parent,
                                DefaultTreeTableModel model,
                                java.lang.Object key,
                                java.lang.Object[] values)
Constructs a new command.

Parameters:
parent - the parent node to which a new child node will be added
model - the model to which the parent node belongs
key - the initial key value of the new child node
values - the initial column values of the new child node
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

createNewNode

protected IMutableTreeTableNode createNewNode()
Creates the new child node instance of type DefaultGanttChartNode. Subclasses are free to override in order to return specialized tree node types.

Returns:
the new child node
Since:
1.0

getParentNode

public IMutableTreeTableNode getParentNode()
Returns the parent node that received a new child node.

Returns:
the parent node that received a new child node
Since:
1.0

getModel

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

Returns:
the model to which the parent node and the new child node belong
Since:
1.0

fillNode

protected void fillNode(ITreeTableNode node)
Fills the newly created tree table node with the initial key and column values.

Parameters:
node - the new child node that will be populated with initial values for its key and columns
Since:
1.0

getChildNode

public IMutableTreeTableNode getChildNode()
Returns the newly created child node.

Returns:
the new child node
Since:
1.0
See Also:
createNewNode()

getKey

public java.lang.Object getKey()
Returns the initial key value that will be assigned to the new child node.

Returns:
the initial key value
Since:
1.0

getValues

public java.lang.Object[] getValues()
Returns the initial column values that will be assigned to the new child node.

Returns:
the initial column values
Since:
1.0