com.dlsc.flexgantt.command.treetable

## Class DefaultChangeKeyCommand

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

- All Implemented Interfaces:
    ICommand, 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
  Version:
    $Revision: 1.6 $
  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

    Constructors
    Constructor and Description
    `DefaultChangeKeyCommand(DefaultMutableTreeTableNode node, DefaultTreeTableModel model, Object key)` Constructs a new command.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `executeCommand(IProgressMonitor monitor)` Executes the command.
    `DefaultTreeTableModel` | `getModel()` Returns the tree table model to which the node belongs.
    `Object` | `getNewKey()` Returns the new key value.
    `ITreeTableNode` | `getNode()` Returns the node that was modified.
    `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, setName`

    - ### 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,
                                         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)
                              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

    - #### 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 Object getNewKey()

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

    - #### getOldKey

          public 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

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