Apache JMeter

org.apache.jorphan.gui
Class AbstractTreeTableModel

java.lang.Object
  extended by javax.swing.table.AbstractTableModel
      extended by javax.swing.table.DefaultTableModel
          extended by org.apache.jorphan.gui.AbstractTreeTableModel
All Implemented Interfaces:
Serializable, TableModel, TreeTableModel
Direct Known Subclasses:
DefaultTreeTableModel

public abstract class AbstractTreeTableModel
extends DefaultTableModel
implements TreeTableModel

See Also:
Serialized Form

Field Summary
protected  List<Class<?>> classes
           
protected  List<String> headers
           
protected  EventListenerList listener
           
protected  List<Object> objects
           
protected  List<Functor> readFunctors
           
protected  TreeNode rootNode
           
protected  List<Functor> writeFunctors
           
 
Fields inherited from class javax.swing.table.DefaultTableModel
columnIdentifiers, dataVector
 
Fields inherited from class javax.swing.table.AbstractTableModel
listenerList
 
Constructor Summary
AbstractTreeTableModel(String[] headers, Functor[] readFunctors, Functor[] writeFunctors, Class<?>[] editorClasses)
           
AbstractTreeTableModel(TreeNode root)
           
 
Method Summary
 void addTableModelListener(TableModelListener l)
          
 void clearData()
           
 void fireTreeNodesChanged(TreeNode source, Object[] path, int[] indexes, Object[] children)
           
 Object getChild(Object parent, int index)
           
 int getChildCount(Object parent)
           
 Class<?> getColumnClass(int arg0)
          
 int getColumnCount()
          The implementation is exactly the same as ObjectTableModel.getColumnCount.
 String getColumnName(int columnIndex)
          
 Object getRootNode()
          The root node for the TreeTable
 int getRowCount()
          The implementation is exactly the same as ObjectTableModel.getRowCount.
 Object getValueAt(int rowIndex, int columnIndex)
          Subclasses need to implement the logic for the method and return the value at the specific cell.
 Object getValueAt(Object node, int col)
          The method is similar to getValueAt(int,int).
 boolean isCellEditable(int rowIndex, int columnIndex)
          By default the abstract class returns true.
 boolean isCellEditable(Object node, int col)
          the method is similar to isCellEditable(int,int).
 boolean isLeaf(Object node)
          the implementation checks if the Object is a treenode.
 void nodeStructureChanged(TreeNode node)
           
 void removeTableModelListener(TableModelListener l)
          
 void setValueAt(Object aValue, int rowIndex, int columnIndex)
          
 void setValueAt(Object val, Object node, int column)
          the method is similar to isCellEditable(int,int).
 
Methods inherited from class javax.swing.table.DefaultTableModel
addColumn, addColumn, addColumn, addRow, addRow, convertToVector, convertToVector, getDataVector, insertRow, insertRow, moveRow, newDataAvailable, newRowsAdded, removeRow, rowsRemoved, setColumnCount, setColumnIdentifiers, setColumnIdentifiers, setDataVector, setDataVector, setNumRows, setRowCount
 
Methods inherited from class javax.swing.table.AbstractTableModel
findColumn, fireTableCellUpdated, fireTableChanged, fireTableDataChanged, fireTableRowsDeleted, fireTableRowsInserted, fireTableRowsUpdated, fireTableStructureChanged, getListeners, getTableModelListeners
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

rootNode

protected final TreeNode rootNode

listener

protected final EventListenerList listener

objects

protected final transient List<Object> objects

headers

protected final transient List<String> headers

classes

protected final transient List<Class<?>> classes

readFunctors

protected final transient List<Functor> readFunctors

writeFunctors

protected final transient List<Functor> writeFunctors
Constructor Detail

AbstractTreeTableModel

public AbstractTreeTableModel(TreeNode root)

AbstractTreeTableModel

public AbstractTreeTableModel(String[] headers,
                              Functor[] readFunctors,
                              Functor[] writeFunctors,
                              Class<?>[] editorClasses)
Method Detail

getRootNode

public Object getRootNode()
The root node for the TreeTable

Returns:
the root node

getValueAt

public Object getValueAt(Object node,
                         int col)
The method is similar to getValueAt(int,int). Instead of int, the row is an object.

Specified by:
getValueAt in interface TreeTableModel
Returns:
the value at the column

isCellEditable

public boolean isCellEditable(Object node,
                              int col)
the method is similar to isCellEditable(int,int). Instead of int, the row is an object.

Specified by:
isCellEditable in interface TreeTableModel
Returns:
if cell is editable

setValueAt

public void setValueAt(Object val,
                       Object node,
                       int column)
the method is similar to isCellEditable(int,int). Instead of int, the row is an object.

Specified by:
setValueAt in interface TreeTableModel

getColumnCount

public int getColumnCount()
The implementation is exactly the same as ObjectTableModel.getColumnCount.

Specified by:
getColumnCount in interface TableModel
Overrides:
getColumnCount in class DefaultTableModel

getRowCount

public int getRowCount()
The implementation is exactly the same as ObjectTableModel.getRowCount.

Specified by:
getRowCount in interface TableModel
Overrides:
getRowCount in class DefaultTableModel

isCellEditable

public boolean isCellEditable(int rowIndex,
                              int columnIndex)
By default the abstract class returns true. It is up to subclasses to override the implementation.

Specified by:
isCellEditable in interface TableModel
Overrides:
isCellEditable in class DefaultTableModel

getColumnClass

public Class<?> getColumnClass(int arg0)

Specified by:
getColumnClass in interface TableModel
Overrides:
getColumnClass in class AbstractTableModel

getValueAt

public Object getValueAt(int rowIndex,
                         int columnIndex)
Subclasses need to implement the logic for the method and return the value at the specific cell.

Specified by:
getValueAt in interface TableModel
Overrides:
getValueAt in class DefaultTableModel

setValueAt

public void setValueAt(Object aValue,
                       int rowIndex,
                       int columnIndex)

Specified by:
setValueAt in interface TableModel
Overrides:
setValueAt in class DefaultTableModel

getColumnName

public String getColumnName(int columnIndex)

Specified by:
getColumnName in interface TableModel
Overrides:
getColumnName in class DefaultTableModel

getChildCount

public int getChildCount(Object parent)

getChild

public Object getChild(Object parent,
                       int index)

isLeaf

public boolean isLeaf(Object node)
the implementation checks if the Object is a treenode. If it is, it returns isLeaf(), otherwise it returns false.

Parameters:
node -
Returns:
whether object is a leaf node or not

addTableModelListener

public void addTableModelListener(TableModelListener l)

Specified by:
addTableModelListener in interface TableModel
Overrides:
addTableModelListener in class AbstractTableModel

removeTableModelListener

public void removeTableModelListener(TableModelListener l)

Specified by:
removeTableModelListener in interface TableModel
Overrides:
removeTableModelListener in class AbstractTableModel

nodeStructureChanged

public void nodeStructureChanged(TreeNode node)

fireTreeNodesChanged

public void fireTreeNodesChanged(TreeNode source,
                                 Object[] path,
                                 int[] indexes,
                                 Object[] children)

clearData

public void clearData()

Apache JMeter

Copyright © 1998-2013 Apache Software Foundation. All Rights Reserved.