org.apache.jorphan.gui

## Class AbstractTreeTableModel

- java.lang.Object
- - javax.swing.table.AbstractTableModel
  - - javax.swing.table.DefaultTableModel
    - - org.apache.jorphan.gui.AbstractTreeTableModel

- All Implemented Interfaces:
    java.io.Serializable, javax.swing.table.TableModel, TreeTableModel
  Direct Known Subclasses:
    DefaultTreeTableModel

      public abstract class AbstractTreeTableModel
      extends javax.swing.table.DefaultTableModel
      implements TreeTableModel

  See Also:
    Serialized Form

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected java.util.List<java.lang.Class<?>>` | `classes`
    `protected java.util.List<java.lang.String>` | `headers`
    `protected javax.swing.event.EventListenerList` | `listener`
    `protected java.util.List<java.lang.Object>` | `objects`
    `protected java.util.List<Functor>` | `readFunctors`
    `protected javax.swing.tree.TreeNode` | `rootNode`
    `protected java.util.List<Functor>` | `writeFunctors`

    - ### Fields inherited from class javax.swing.table.DefaultTableModel

      `columnIdentifiers, dataVector`

    - ### Fields inherited from class javax.swing.table.AbstractTableModel

      `listenerList`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `AbstractTreeTableModel(java.lang.String[] headers, Functor[] readFunctors, Functor[] writeFunctors, java.lang.Class<?>[] editorClasses)`
    `AbstractTreeTableModel(javax.swing.tree.TreeNode root)`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `addTableModelListener(javax.swing.event.TableModelListener l)`
    `void` | `clearData()`
    `void` | `fireTreeNodesChanged(javax.swing.tree.TreeNode source, java.lang.Object[] path, int[] indexes, java.lang.Object[] children)`
    `java.lang.Object` | `getChild(java.lang.Object parent, int index)`
    `int` | `getChildCount(java.lang.Object parent)`
    `java.lang.Class<?>` | `getColumnClass(int arg0)`
    `int` | `getColumnCount()` The implementation is exactly the same as ObjectTableModel.getColumnCount.
    `java.lang.String` | `getColumnName(int columnIndex)`
    `java.lang.Object` | `getRootNode()` The root node for the TreeTable
    `int` | `getRowCount()` The implementation is exactly the same as ObjectTableModel.getRowCount.
    `java.lang.Object` | `getValueAt(int rowIndex, int columnIndex)` Subclasses need to implement the logic for the method and return the value at the specific cell.
    `java.lang.Object` | `getValueAt(java.lang.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(java.lang.Object node, int col)` the method is similar to isCellEditable(int,int).
    `boolean` | `isLeaf(java.lang.Object node)` the implementation checks if the Object is a treenode.
    `void` | `nodeStructureChanged(javax.swing.tree.TreeNode node)`
    `void` | `removeTableModelListener(javax.swing.event.TableModelListener l)`
    `void` | `setValueAt(java.lang.Object aValue, int rowIndex, int columnIndex)`
    `void` | `setValueAt(java.lang.Object val, java.lang.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 javax.swing.tree.TreeNode rootNode

    - #### listener

          protected final javax.swing.event.EventListenerList listener

    - #### objects

          protected final transient java.util.List<java.lang.Object> objects

    - #### headers

          protected final transient java.util.List<java.lang.String> headers

    - #### classes

          protected final transient java.util.List<java.lang.Class<?>> classes

    - #### readFunctors

          protected final transient java.util.List<Functor> readFunctors

    - #### writeFunctors

          protected final transient java.util.List<Functor> writeFunctors

  - ### Constructor Detail

    - #### AbstractTreeTableModel

          public AbstractTreeTableModel(javax.swing.tree.TreeNode root)

    - #### AbstractTreeTableModel

          public AbstractTreeTableModel(java.lang.String[] headers,
                                        Functor[] readFunctors,
                                        Functor[] writeFunctors,
                                        java.lang.Class<?>[] editorClasses)

  - ### Method Detail

    - #### getRootNode

          public java.lang.Object getRootNode()

      The root node for the TreeTable
      Returns:
        the root node

    - #### getValueAt

          public java.lang.Object getValueAt(java.lang.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`
      Parameters:
        `node` - the node which value is to be fetched
        `col` - the column of the node
      Returns:
        the value at the column

    - #### isCellEditable

          public boolean isCellEditable(java.lang.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`
      Parameters:
        `node` - the node which value is to be fetched
        `col` - the column of the node
      Returns:
        `true` if cell is editable

    - #### setValueAt

          public void setValueAt(java.lang.Object val,
                                 java.lang.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`
      Parameters:
        `val` - the value to be set
        `node` - the node which value is to be set
        `column` - the column of the node

    - #### getColumnCount

          public int getColumnCount()

      The implementation is exactly the same as ObjectTableModel.getColumnCount.

      Specified by:
        `getColumnCount` in interface `javax.swing.table.TableModel`
      Overrides:
        `getColumnCount` in class `javax.swing.table.DefaultTableModel`

    - #### getRowCount

          public int getRowCount()

      The implementation is exactly the same as ObjectTableModel.getRowCount.

      Specified by:
        `getRowCount` in interface `javax.swing.table.TableModel`
      Overrides:
        `getRowCount` in class `javax.swing.table.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 `javax.swing.table.TableModel`
      Overrides:
        `isCellEditable` in class `javax.swing.table.DefaultTableModel`

    - #### getColumnClass

          public java.lang.Class<?> getColumnClass(int arg0)

      Specified by:
        `getColumnClass` in interface `javax.swing.table.TableModel`
      Overrides:
        `getColumnClass` in class `javax.swing.table.AbstractTableModel`

    - #### getValueAt

          public java.lang.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 `javax.swing.table.TableModel`
      Overrides:
        `getValueAt` in class `javax.swing.table.DefaultTableModel`

    - #### setValueAt

          public void setValueAt(java.lang.Object aValue,
                                 int rowIndex,
                                 int columnIndex)

      Specified by:
        `setValueAt` in interface `javax.swing.table.TableModel`
      Overrides:
        `setValueAt` in class `javax.swing.table.DefaultTableModel`

    - #### getColumnName

          public java.lang.String getColumnName(int columnIndex)

      Specified by:
        `getColumnName` in interface `javax.swing.table.TableModel`
      Overrides:
        `getColumnName` in class `javax.swing.table.DefaultTableModel`

    - #### getChildCount

          public int getChildCount(java.lang.Object parent)

    - #### getChild

          public java.lang.Object getChild(java.lang.Object parent,
                                           int index)

    - #### isLeaf

          public boolean isLeaf(java.lang.Object node)

      the implementation checks if the Object is a treenode. If it is, it returns `isLeaf()`, otherwise it returns `false`.
      Parameters:
        `node` - object to be checked for `isLeaf()`
      Returns:
        `true` if object is a leaf node, `false` otherwise

    - #### addTableModelListener

          public void addTableModelListener(javax.swing.event.TableModelListener l)

      Specified by:
        `addTableModelListener` in interface `javax.swing.table.TableModel`
      Overrides:
        `addTableModelListener` in class `javax.swing.table.AbstractTableModel`

    - #### removeTableModelListener

          public void removeTableModelListener(javax.swing.event.TableModelListener l)

      Specified by:
        `removeTableModelListener` in interface `javax.swing.table.TableModel`
      Overrides:
        `removeTableModelListener` in class `javax.swing.table.AbstractTableModel`

    - #### nodeStructureChanged

          public void nodeStructureChanged(javax.swing.tree.TreeNode node)

    - #### fireTreeNodesChanged

          public void fireTreeNodesChanged(javax.swing.tree.TreeNode source,
                                           java.lang.Object[] path,
                                           int[] indexes,
                                           java.lang.Object[] children)

    - #### clearData

          public void clearData()

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