com.dlsc.flexgantt.policy.treetable

## Class DefaultNodeEditPolicy

- java.lang.Object
- - com.dlsc.flexgantt.policy.AbstractPolicy
  - - com.dlsc.flexgantt.policy.treetable.DefaultNodeEditPolicy

- All Implemented Interfaces:
    IPolicy, INodeEditPolicy

      public class DefaultNodeEditPolicy
      extends AbstractPolicy
      implements INodeEditPolicy

  The default implementation of the edit policy for tree table nodes. For a general description of the purpose of this policy please refer to `INodeEditPolicy`.
  Since:
    1.0
  Version:
    $Revision: 1.13 $
  Author:
    Dirk Lemmermann

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `DefaultNodeEditPolicy()`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `ICommand` | `getChangeKeyCommand(Object node, ITreeTableModel model, Object key)` Returns a command object that will perform the modification of the key value of the given node.
    `ICommand` | `getChangeValueCommand(Object node, ITreeTableModel model, Object value, int index)` Returns a command object that will perform the modification of the key value of the given node.
    `ICommand` | `getCreateNodeCommand(Object node, ITreeTableModel model, Object key, Object[] values)` Returns a command object that will perform the creation of a new tree / hierarchy node in the given tree table model.
    `ICommand` | `getDeleteNodesCommand(List<Object> nodes, ITreeTableModel model)` Returns a command object that will perform the actual deletion of the given nodes.
    `ICommand` | `getInsertNodeCommand(Object node, int childIndex, ITreeTableModel model)` Returns a command object that will perform the insertion of a new tree / hierarchy node in the given tree table model.
    `ICommand` | `getReassignmentCommand(Object[] nodes, Object oldParent, int[] oldChildIndices, Object newParent, int[] newChildIndices, ITreeTableModel model)` Returns the command that will be used to perform the reassingment of a set of given nodes from one parent node to a new one.
    `boolean` | `isCreateEnabled(ITreeTableModel model)` Determines if the tree table supports the creation of new tree nodes by the user.
    `boolean` | `isDeletable(Object node, ITreeTableModel model)` Determines if the node can be deleted by the user.
    `boolean` | `isKeyEditable(Object node, ITreeTableModel model)` Determines if the key value of the given tree / hierarchy node can be edited by the user.
    `boolean` | `isReassignable(Object node, Object newParentNode, ITreeTableModel model)` Determines whether the first given tree table node can be reassigned to the second tree table node by the user or not.
    `boolean` | `isSelectable(Object node, ITreeTableModel model)` Determines if the node can be selected by the user.
    `boolean` | `isValueEditable(Object node, ITreeTableModel model, int modelIndex)` Determines if the column value with the given model index can be edited by the user.

    - ### Methods inherited from class com.dlsc.flexgantt.policy.AbstractPolicy

      `assertClass`

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

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

- - ### Constructor Detail

    - #### DefaultNodeEditPolicy

          public DefaultNodeEditPolicy()

  - ### Method Detail

    - #### isKeyEditable

          public boolean isKeyEditable(Object node,
                                       ITreeTableModel model)

      Description copied from interface: `INodeEditPolicy`
      Determines if the key value of the given tree / hierarchy node can be edited by the user.
      Specified by:
        `isKeyEditable` in interface `INodeEditPolicy`
      Parameters:
        `node` - the node that is the target of the editing operation
        `model` - the tree table model to which the node belongs
      Returns:
        TRUE if the key value can be modified by the user

    - #### isValueEditable

          public boolean isValueEditable(Object node,
                                         ITreeTableModel model,
                                         int modelIndex)

      Description copied from interface: `INodeEditPolicy`
      Determines if the column value with the given model index can be edited by the user.
      Specified by:
        `isValueEditable` in interface `INodeEditPolicy`
      Parameters:
        `node` - the node that is the target of the editing operation
        `model` - the tree table model to which the node belongs
        `modelIndex` - the model index under which the column value can be looked up and stored
      Returns:
        TRUE if the column value can be modified by the user

    - #### isDeletable

          public boolean isDeletable(Object node,
                                     ITreeTableModel model)

      Description copied from interface: `INodeEditPolicy`
      Determines if the node can be deleted by the user.
      Specified by:
        `isDeletable` in interface `INodeEditPolicy`
      Parameters:
        `node` - the node that will be deleted
        `model` - the tree table model to which the node belongs
      Returns:
        TRUE if the node can be deleted by the user

    - #### isSelectable

          public boolean isSelectable(Object node,
                                      ITreeTableModel model)

      Description copied from interface: `INodeEditPolicy`
      Determines if the node can be selected by the user.
      Specified by:
        `isSelectable` in interface `INodeEditPolicy`
      Parameters:
        `node` - the node that will be selected
        `model` - the tree table model to which the node belongs
      Returns:
        TRUE if the node can be selected by the user

    - #### isCreateEnabled

          public boolean isCreateEnabled(ITreeTableModel model)

      Description copied from interface: `INodeEditPolicy`
      Determines if the tree table supports the creation of new tree nodes by the user.
      Specified by:
        `isCreateEnabled` in interface `INodeEditPolicy`
      Parameters:
        `model` - the tree table model that will be modified if a new node gets created
      Returns:
        TRUE if the user can create new nodes in the tree table

    - #### isReassignable

          public boolean isReassignable(Object node,
                                        Object newParentNode,
                                        ITreeTableModel model)

      Description copied from interface: `INodeEditPolicy`
      Determines whether the first given tree table node can be reassigned to the second tree table node by the user or not.
      Specified by:
        `isReassignable` in interface `INodeEditPolicy`
      Parameters:
        `node` - the tree table node that will be checked
        `newParentNode` - the node that is the candidate to become the new parent of node
        `model` - the tree table model to which the node belongs
      Returns:
        TRUE if the node is indentable

    - #### getDeleteNodesCommand

          public ICommand getDeleteNodesCommand(List<Object> nodes,
                                                ITreeTableModel model)

      Description copied from interface: `INodeEditPolicy`
      Returns a command object that will perform the actual deletion of the given nodes. The command has to make sure that the nodes are being deleted in the order in which they are stored in the list. Only this can guarantee that parent nodes are present during an undo operation of the command.
      Specified by:
        `getDeleteNodesCommand` in interface `INodeEditPolicy`
      Parameters:
        `nodes` - the node that needs to be deleted
        `model` - the model from which the node will be removed
      Returns:
        a command object that will perform the node's deletion
      See Also:
        `INodeEditPolicy.isDeletable(Object, ITreeTableModel)`

    - #### getCreateNodeCommand

          public ICommand getCreateNodeCommand(Object node,
                                               ITreeTableModel model,
                                               Object key,
                                               Object[] values)

      Description copied from interface: `INodeEditPolicy`
      Returns a command object that will perform the creation of a new tree / hierarchy node in the given tree table model.
      Specified by:
        `getCreateNodeCommand` in interface `INodeEditPolicy`
      Parameters:
        `node` - the parent node to which the new node will be added
        `model` - the tree table model to which the node will be added
        `key` - the initial key value of the new node
        `values` - the initial column values of the new node
      Returns:
        a command object that will create the new node

    - #### getInsertNodeCommand

          public ICommand getInsertNodeCommand(Object node,
                                               int childIndex,
                                               ITreeTableModel model)

      Description copied from interface: `INodeEditPolicy`
      Returns a command object that will perform the insertion of a new tree / hierarchy node in the given tree table model.
      Specified by:
        `getInsertNodeCommand` in interface `INodeEditPolicy`
      Parameters:
        `node` - the parent node to which the new node will be added
        `childIndex` - the location of the new node within the list of children nodes
        `model` - the tree table model to which the node will be added
      Returns:
        a command object that will create the new node

    - #### getChangeKeyCommand

          public ICommand getChangeKeyCommand(Object node,
                                              ITreeTableModel model,
                                              Object key)

      Description copied from interface: `INodeEditPolicy`
      Returns a command object that will perform the modification of the key value of the given node.
      Specified by:
        `getChangeKeyCommand` in interface `INodeEditPolicy`
      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
      Returns:
        a command object that will change the node's key value

    - #### getChangeValueCommand

          public ICommand getChangeValueCommand(Object node,
                                                ITreeTableModel model,
                                                Object value,
                                                int index)

      Description copied from interface: `INodeEditPolicy`
      Returns a command object that will perform the modification of the key value of the given node.
      Specified by:
        `getChangeValueCommand` in interface `INodeEditPolicy`
      Parameters:
        `node` - the node that will be modified
        `model` - the model to which the node belongs
        `value` - the new column value
        `index` - the model index of the column value
      Returns:
        a command object that will change the node's key value

    - #### getReassignmentCommand

          public ICommand getReassignmentCommand(Object[] nodes,
                                                 Object oldParent,
                                                 int[] oldChildIndices,
                                                 Object newParent,
                                                 int[] newChildIndices,
                                                 ITreeTableModel model)

      Description copied from interface: `INodeEditPolicy`
      Returns the command that will be used to perform the reassingment of a set of given nodes from one parent node to a new one.
      Specified by:
        `getReassignmentCommand` in interface `INodeEditPolicy`
      Parameters:
        `nodes` - the nodes that will be reassigned
        `oldParent` - the tree node that is the current parent node
        `oldChildIndices` - the child indices of the nodes that will be reassigned
        `newParent` - the tree node that will be the new parent node of the reassigned nodes
        `newChildIndices` - the child indices that will be assigned to the reassigned nodes
        `model` - the tree table model to which the nodes belong
      Returns:
        the reassignment command

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