com.dlsc.flexgantt.command.treetable

## Class DefaultInsertNodeCommand

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

- All Implemented Interfaces:
    ICommand, Serializable

      public class DefaultInsertNodeCommand
      extends AbstractCommand

  A command that inserts a new child node into the list of children nodes of 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.1
  Version:
    $Revision: 1.7 $
  Author:
    Dirk Lemmermann
  See Also:
    `INodeEditPolicy.getInsertNodeCommand(Object, int, com.dlsc.flexgantt.model.treetable.ITreeTableModel)`, Serialized Form

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `DefaultInsertNodeCommand(IMutableTreeTableNode parent, int childIndex, DefaultTreeTableModel model)` 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.
    `int` | `getChildIndex()` Returns the index of the child node as it was passed to the command.
    `IMutableTreeTableNode` | `getChildNode()` Returns the newly created 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.
    `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

    - #### DefaultInsertNodeCommand

          public DefaultInsertNodeCommand(IMutableTreeTableNode parent,
                                          int childIndex,
                                          DefaultTreeTableModel model)

      Constructs a new command.
      Parameters:
        `parent` - the parent node to which a new child node will be added
        `childIndex` - the child index of the new node
        `model` - the model to which the parent node belongs
      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

    - #### getChildNode

          public IMutableTreeTableNode getChildNode()

      Returns the newly created child node.
      Returns:
        the new child node
      Since:
        1.0
      See Also:
        `createNewNode()`

    - #### getChildIndex

          public int getChildIndex()

      Returns the index of the child node as it was passed to the command.
      Returns:
        the child index
      Since:
        1.1

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