org.jppf.ui.treetable
Class AbstractJPPFTreeTableModel

java.lang.Object
  extended by org.jppf.ui.treetable.AbstractTreeTableModel
      extended by org.jppf.ui.treetable.AbstractJPPFTreeTableModel
All Implemented Interfaces:
TreeModel, TreeTableModel
Direct Known Subclasses:
JobTreeTableModel, NodeTreeTableModel

public abstract class AbstractJPPFTreeTableModel
extends AbstractTreeTableModel

Abstract tree table model implementation for tree table-based options.

Author:
Laurent Cohen

Field Summary
protected  String BASE
          Base name for localization bundle lookups.
 
Fields inherited from class org.jppf.ui.treetable.AbstractTreeTableModel
listenerList, root
 
Constructor Summary
AbstractJPPFTreeTableModel(TreeNode root)
          Initialize this model with the specified tree root.
 
Method Summary
 void changeNode(DefaultMutableTreeNode node)
          Handle a node update.
 Object getChild(Object parent, int index)
          Return the child at the specified index from the specified parent node.
 int getChildCount(Object parent)
          Get the number of children for the specified node.
 Class getColumnClass(int column)
          Determine the class of th specified column.
 void insertNodeInto(DefaultMutableTreeNode child, DefaultMutableTreeNode parent, int pos)
          Insert the specified child into the specified parent's list of children at the specified position.
 boolean isCellEditable(Object node, int column)
          Tells if a cell can be edited.
protected  String localize(String message)
          Get a localized message given its unique name and the current locale.
 void removeNodeFromParent(DefaultMutableTreeNode node)
          Remove a node from the tree.
 void setValueAt(Object value, Object node, int column)
          Called when done editing a cell.
 
Methods inherited from class org.jppf.ui.treetable.AbstractTreeTableModel
addTreeModelListener, fireTreeNodesChanged, fireTreeNodesInserted, fireTreeNodesRemoved, fireTreeStructureChanged, getIndexOfChild, getRoot, isLeaf, removeTreeModelListener, valueForPathChanged
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.jppf.ui.treetable.TreeTableModel
getColumnCount, getColumnName, getValueAt
 

Field Detail

BASE

protected String BASE
Base name for localization bundle lookups.

Constructor Detail

AbstractJPPFTreeTableModel

public AbstractJPPFTreeTableModel(TreeNode root)
Initialize this model with the specified tree root.

Parameters:
root - - the root of the tree.
Method Detail

isCellEditable

public boolean isCellEditable(Object node,
                              int column)
Tells if a cell can be edited.

Specified by:
isCellEditable in interface TreeTableModel
Overrides:
isCellEditable in class AbstractTreeTableModel
Parameters:
node - not used.
column - not used.
Returns:
true if the cell can be edited, false otherwise.
See Also:
AbstractTreeTableModel.isCellEditable(java.lang.Object, int)

setValueAt

public void setValueAt(Object value,
                       Object node,
                       int column)
Called when done editing a cell. This method has an empty implementation and does nothing.

Specified by:
setValueAt in interface TreeTableModel
Overrides:
setValueAt in class AbstractTreeTableModel
Parameters:
value - not used.
node - not used.
column - not used.
See Also:
AbstractTreeTableModel.setValueAt(java.lang.Object, java.lang.Object, int)

getChild

public Object getChild(Object parent,
                       int index)
Return the child at the specified index from the specified parent node.

Parameters:
parent - the parent to get the child from.
index - the index at which to get the child
Returns:
the child node, or null if the index is not valid.
See Also:
TreeModel.getChild(java.lang.Object, int)

getChildCount

public int getChildCount(Object parent)
Get the number of children for the specified node.

Parameters:
parent - the node for which to get the number of children.
Returns:
the number of children as an int.
See Also:
TreeModel.getChildCount(java.lang.Object)

insertNodeInto

public void insertNodeInto(DefaultMutableTreeNode child,
                           DefaultMutableTreeNode parent,
                           int pos)
Insert the specified child into the specified parent's list of children at the specified position.

Parameters:
child - - the node to insert into the parent.
parent - - the node into which to insert the child.
pos - - the position at which to insert the node.

removeNodeFromParent

public void removeNodeFromParent(DefaultMutableTreeNode node)
Remove a node from the tree.

Parameters:
node - - the node to remove from the parent.

changeNode

public void changeNode(DefaultMutableTreeNode node)
Handle a node update.

Parameters:
node - - the node to update.

getColumnClass

public Class getColumnClass(int column)
Determine the class of th specified column.

Specified by:
getColumnClass in interface TreeTableModel
Overrides:
getColumnClass in class AbstractTreeTableModel
Parameters:
column - - the column index.
Returns:
a Class instance.
See Also:
AbstractTreeTableModel.getColumnClass(int)

localize

protected String localize(String message)
Get a localized message given its unique name and the current locale.

Parameters:
message - the unique name of the localized message.
Returns:
a message in the current locale, or the default locale if the localization for the current locale is not found.


Copyright © 2005-2010 JPPF Team.