com.dlsc.flexgantt.policy.treetable
Class DefaultNodeEditPolicy

java.lang.Object
  extended by com.dlsc.flexgantt.policy.AbstractPolicy
      extended by 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
Author:
Dirk Lemmermann

Constructor Summary
DefaultNodeEditPolicy()
           
 
Method Summary
 ICommand getChangeKeyCommand(java.lang.Object node, ITreeTableModel model, java.lang.Object key)
          Returns a command object that will perform the modification of the key value of the given node.
 ICommand getChangeValueCommand(java.lang.Object node, ITreeTableModel model, java.lang.Object value, int index)
          Returns a command object that will perform the modification of the key value of the given node.
 ICommand getCreateNodeCommand(java.lang.Object node, ITreeTableModel model, java.lang.Object key, java.lang.Object[] values)
          Returns a command object that will perform the creation of a new tree / hierarchy node in the given tree table model.
 ICommand getDeleteNodeCommand(java.lang.Object node, ITreeTableModel model)
          Returns a command object that will perform the actual deletion of the given node.
 boolean isCreateEnabled(ITreeTableModel model)
          Determines if the tree table supports the creation of new tree nodes by the user.
 boolean isDeletable(java.lang.Object node, ITreeTableModel model)
          Determines if the node can be deleted by the user.
 boolean isKeyEditable(java.lang.Object node, ITreeTableModel model)
          Determines if the key value of the given tree / hierarchy node can be edited by the user.
 boolean isSelectable(java.lang.Object node, ITreeTableModel model)
          Determines if the node can be selected by the user.
 boolean isValueEditable(java.lang.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(java.lang.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(java.lang.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(java.lang.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(java.lang.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

getDeleteNodeCommand

public ICommand getDeleteNodeCommand(java.lang.Object node,
                                     ITreeTableModel model)
Description copied from interface: INodeEditPolicy
Returns a command object that will perform the actual deletion of the given node. This method will only get called if the node is deletable.

Specified by:
getDeleteNodeCommand in interface INodeEditPolicy
Parameters:
node - 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(java.lang.Object node,
                                     ITreeTableModel model,
                                     java.lang.Object key,
                                     java.lang.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

getChangeKeyCommand

public ICommand getChangeKeyCommand(java.lang.Object node,
                                    ITreeTableModel model,
                                    java.lang.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(java.lang.Object node,
                                      ITreeTableModel model,
                                      java.lang.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