com.dlsc.flexgantt.command.treetable

## Class DefaultCreateNodeCommand

- java.lang.Object
- - com.dlsc.flexgantt.command.AbstractCommand
  - - com.dlsc.flexgantt.command.treetable.DefaultCreateNodeCommand

- All Implemented Interfaces:
    ICommand, Serializable

      public class DefaultCreateNodeCommand
      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
  Version:
    $Revision: 1.7 $
  Author:
    Dirk Lemmermann
  See Also:
    `INodeEditPolicy.getCreateNodeCommand(Object, com.dlsc.flexgantt.model.treetable.ITreeTableModel, Object, Object[])`, Serialized Form

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `DefaultCreateNodeCommand(IMutableTreeTableNode parent, DefaultTreeTableModel model, Object key, Object[] values)` Constructs a new command.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `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.
    `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.
    `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, setName`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### DefaultCreateNodeCommand

          public DefaultCreateNodeCommand(IMutableTreeTableNode parent,
                                          DefaultTreeTableModel model,
                                          Object key,
                                          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)
                              throws CommandException

      Description copied from interface: `ICommand`
      Executes the command.
      Parameters:
        `monitor` - a progress monitor
      Throws:
        `CommandException` - if anything during the execution of the command has gone wrong

    - #### undoCommand

          public void undoCommand(IProgressMonitor monitor)
                           throws CommandException

      Description copied from interface: `ICommand`
      Undos the command.
      Parameters:
        `monitor` - a progress monitor
      Throws:
        `CommandException` - if anything during the execution of the command has gone wrong

    - #### 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 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 Object[] getValues()

      Returns the initial column values that will be assigned to the new child node.
      Returns:
        the initial column values
      Since:
        1.0

Copyright © 2006–2020 Dirk Lemmermann Software & Consulting. All rights reserved.