Copyright © 2011 Citra Technologies. All Rights Reserved.

com.citra.table.remote
Class DefaultRemoteTreeTableModel

java.lang.Object
  extended by com.citra.treetable.AbstractTreeTableModel
      extended by com.citra.treetable.TreeModelMap
          extended by com.citra.table.remote.DefaultRemoteTreeTableModel
All Implemented Interfaces:
RemoteTreeTableModel, TreeTableModel, Serializable, EventListener, TreeModelListener, TreeModel

public class DefaultRemoteTreeTableModel
extends TreeModelMap
implements RemoteTreeTableModel

DefaultRemoteTreeTableModel is the default implementation of a RemoteTreeTableModel. This class wraps around a cacheable treetable model and uses an internal thread in order to asynchronously retrieve the data from the underlying model.

See Also:
Serialized Form

Field Summary
protected  CacheableTreeTableModel cacheTreeModel
          the cacheable treetable model to query.
protected  Object pendingValue
          the default object to return when a cell value is pending.
 
Fields inherited from class com.citra.treetable.TreeModelMap
treeModel
 
Fields inherited from class com.citra.treetable.AbstractTreeTableModel
listenerList, root
 
Fields inherited from interface com.citra.treetable.TreeTableModel
CHANGE_COLUMN_SOURCE
 
Constructor Summary
DefaultRemoteTreeTableModel(CacheableTreeTableModel model)
          Constructs a DefaultRemoteTreeTableModel.
 
Method Summary
 void addRemoteTableListener(RemoteTableListener l)
          Adds a RemoteTableListener that is notified each time the RemoteTableModel will start or stop querying the underlying treetable model.
 void fireRemoteAction(int type)
          Notifies listeners of this RemoteTreeTableModel's status.
 int getChildCount(Object parent)
          Returns the number of children of parent. Returns 0 if the node is a leaf or if it has no children. parent must be a node previously obtained from this data source.
 Class getColumnClass(int column)
          Returns the class of all the cells in the column.
 int getColumnCount()
          Returns the number of columns.
 String getColumnName(int column)
          Returns the name of the column at columnIndex as it will be displayed by the table
 Object getPendingValue(Object node, int column)
          Returns the object to display if a cell value is pending.
 Object getValueAt(Object node, int column)
          Returns the value to be displayed for node, at column index column.
 boolean isCellEditable(Object node, int column)
          Returns true if node at columnIndex is editable.
 void removeRemoteTableListener(RemoteTableListener l)
          Removes a RemoteTableListener from the list that is notified each time the RemoteTableModel will start or stop querying the underlying treetable model.
 void setTreeModel(TreeModel newModel)
          Sets the underlying tree model to newModel
 void setValueAt(Object aValue, Object node, int column)
          Sets the value for node at columnIndex to aValue.
 void stop()
          Stops the thread that asynchronously queries the underlying cacheable treetable model.
 
Methods inherited from class com.citra.treetable.TreeModelMap
getChild, getIndexOfChild, getPathToRoot, getPathToRoot, getRoot, getTreeModel, isLeaf, nodeChanged, nodesChanged, nodeStructureChanged, treeNodesChanged, treeNodesInserted, treeNodesRemoved, treeStructureChanged, valueForPathChanged
 
Methods inherited from class com.citra.treetable.AbstractTreeTableModel
addTreeModelListener, fireTreeNodesChanged, fireTreeNodesInserted, fireTreeNodesRemoved, fireTreeStructureChanged, fireTreeTableStructureChanged, fireTreeTableStructureChanged, isAggregate, isFooter, isHeader, removeTreeModelListener, setRoot
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.citra.treetable.TreeTableModel
isAggregate, isFooter, isHeader
 
Methods inherited from interface javax.swing.tree.TreeModel
addTreeModelListener, getChild, getIndexOfChild, getRoot, isLeaf, removeTreeModelListener, valueForPathChanged
 

Field Detail

cacheTreeModel

protected CacheableTreeTableModel cacheTreeModel
the cacheable treetable model to query.


pendingValue

protected Object pendingValue
the default object to return when a cell value is pending.

Constructor Detail

DefaultRemoteTreeTableModel

public DefaultRemoteTreeTableModel(CacheableTreeTableModel model)
Constructs a DefaultRemoteTreeTableModel.

Method Detail

addRemoteTableListener

public void addRemoteTableListener(RemoteTableListener l)
Adds a RemoteTableListener that is notified each time the RemoteTableModel will start or stop querying the underlying treetable model.

Specified by:
addRemoteTableListener in interface RemoteTreeTableModel
Parameters:
l - the RemoteTableListener to add

fireRemoteAction

public void fireRemoteAction(int type)
Notifies listeners of this RemoteTreeTableModel's status.

Parameters:
type - the type of the event - either STARTED or STOPPED.

getChildCount

public int getChildCount(Object parent)
Returns the number of children of parent. Returns 0 if the node is a leaf or if it has no children. parent must be a node previously obtained from this data source.

Specified by:
getChildCount in interface TreeModel
Overrides:
getChildCount in class TreeModelMap
Parameters:
parent - a node in the tree, obtained from this data source
Returns:
the number of children of the node parent

getColumnClass

public Class getColumnClass(int column)
Returns the class of all the cells in the column.

Specified by:
getColumnClass in interface TreeTableModel
Parameters:
column - the index of the column
Returns:
the class of all the cells in the column.

getColumnCount

public int getColumnCount()
Returns the number of columns.

Specified by:
getColumnCount in interface TreeTableModel
Returns:
the number of columns.

getColumnName

public String getColumnName(int column)
Returns the name of the column at columnIndex as it will be displayed by the table

Specified by:
getColumnName in interface TreeTableModel
Parameters:
column - the index of the column
Returns:
the name of the column

getPendingValue

public Object getPendingValue(Object node,
                              int column)
Returns the object to display if a cell value is pending.

Specified by:
getPendingValue in interface RemoteTreeTableModel
Parameters:
node - the node to consider
column - the node's column index
Returns:
the pending value

getValueAt

public Object getValueAt(Object node,
                         int column)
Returns the value to be displayed for node, at column index column.

Specified by:
getValueAt in interface TreeTableModel
Parameters:
node - the node to query
column - the column index
Returns:
the value

isCellEditable

public boolean isCellEditable(Object node,
                              int column)
Returns true if node at columnIndex is editable.

Specified by:
isCellEditable in interface TreeTableModel
Parameters:
node - the node to consider
column - the column index
Returns:
true if the node at columnIndex is editable, false otherwise

removeRemoteTableListener

public void removeRemoteTableListener(RemoteTableListener l)
Removes a RemoteTableListener from the list that is notified each time the RemoteTableModel will start or stop querying the underlying treetable model.

Specified by:
removeRemoteTableListener in interface RemoteTreeTableModel
Parameters:
l - the RemoteTableListener to remove

setTreeModel

public void setTreeModel(TreeModel newModel)
Sets the underlying tree model to newModel

Overrides:
setTreeModel in class TreeModelMap
Parameters:
newModel - the new tree model to assign.

setValueAt

public void setValueAt(Object aValue,
                       Object node,
                       int column)
Sets the value for node at columnIndex to aValue.

Specified by:
setValueAt in interface TreeTableModel
Parameters:
aValue - the new value
node - the node whose value is to be changed
column - the column whose value is to be changed

stop

public void stop()
Stops the thread that asynchronously queries the underlying cacheable treetable model.


Copyright © 2011 Citra Technologies. All Rights Reserved.