Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## ix.iface.ui.table
Class AbstractTreeTableModel

    java.lang.Object
      javax.swing.table.AbstractTableModel
          ix.iface.ui.table.AbstractIXTableModel
              ix.iface.ui.table.AbstractTreeTableModel

All Implemented Interfaces:
  TableMouseListener, java.io.Serializable, javax.swing.table.TableModel

Direct Known Subclasses:
  ActionTreeTableModel, AgendaItemTableModel, AROEditorPanel.ClassTreeTableModel

    public abstract class AbstractTreeTableModel

extends AbstractIXTableModel
implements TableMouseListener

An abstract class for tree table models. Creates IXTreeTableNode objects to wrap around the data objects. These IXTreeTableNode objects hold id information (base-object and parent line) and expansion information (indentation of the node and whether it is expanded or not).

Will add a column 0 or 1 that uses icons to show tree information (right arrow for collapsed nodes, down arrow for expanded nodes, nothing for leaf nodes). The column is 0 if the table is not markable, 1 if it is (marks are always in column 0) Will indent the string in column 1 or 2 to show tree structure. By default, the children of nodes are not displayed When clicking on the node's tree-icon column, the following happens:

- if the node is a leaf: nothing
- if the node has children and they are displayed: un-display them
- if the node has children and they are NOT displayed: display them

Multiple parents are no problem because by default nodes children are not displayed. When a child is displayed more than once, it has a different parent-line and different IXTreeTableNode obejcts are used.

As an example, see ix.iview.table.ActionTreeTableModel

See Also:
  Serialized Form

Nested Class Summary

Nested classes/interfaces inherited from class ix.iface.ui.table.AbstractIXTableModel
`AbstractIXTableModel.TableMarkListener`

Field Summary
`static char` | `CLOSEDC` the character used to indicate an un-expanded node
`static javax.swing.ImageIcon` | `CLOSEDI`
`static int` | `INDENT_STEP` the indentation steps used to indent children
`static char` | `LEAFC` the character used to indicate a leaf (no children)
`static javax.swing.ImageIcon` | `LEAFI`
`int` | `nameColumn` the column to be used as a name column
`java.util.HashMap` | `nodeMap` A map for looking up a TreeNode for a Object.
`protected java.util.ArrayList` | `nodes` a collection of IXTreeTableNodes that have been generated
`static char` | `OPENC` the character used to indicate an expanded node
`static javax.swing.ImageIcon` | `OPENI`
`int` | `treeIconColumn` the column to be used as a tree-icon column

Fields inherited from class ix.iface.ui.table.AbstractIXTableModel
`columnClasses, columnFields, columnNames, markedRows, objectClass, rows, rowsMarkable`

Fields inherited from class javax.swing.table.AbstractTableModel
`listenerList`

Constructor Summary
`AbstractTreeTableModel(boolean markable)` Makes an empty model.
`AbstractTreeTableModel(boolean markable, javax.swing.tree.TreeNode[] theNodes)` Makes a model that contains the given nodes at top level.

Method Summary
`void` | `addData(java.lang.Object data)` Adds the given TreeNode object to the table's rows and notifies listeners.
`void` | `addTreeNode(java.lang.Object object, javax.swing.tree.TreeNode tNode)` Associate the given TreeNode to the given object
`void` | `addTreeTableModelListener(TreeTableStructureListener l)`
`void` | `cellClicked(java.awt.event.MouseEvent me, int rowIndex, int columnIndex)` If the left button was clicked on the tree-column, expand/collapse node.
`void` | `clearData()` Removes all data objects from the table's rows and notifies listeners.
`void` | `clearTable()`
`protected void` | `deriveColumnFields()` Collects usable fields from the objectClass; puts the name field in front.
`void` | `expandNode(IXTreeTableNode eNode, int rowIndex)` Gathers the node's children and splices them into the table.
`void` | `fireNodeStructureChanged(IXTreeTableNode node)` A node gained or lost children
`void` | `fireObjectChanged(java.lang.Object o)` The given object changed - find its tree node, fire that and redo children
`void` | `fireTreeStructureChanged()` The tree lost/gained nodes (more drastic than nodeStructureChanged
`void` | `forceExpandNode(IXTreeTableNode eNode, int rowIndex)`
`abstract java.lang.Object` | `getCellValueAt(java.lang.Object node, int columnIndex)` Gets the object's value for the given column index.
`abstract java.lang.String` | `getNameString(javax.swing.tree.TreeNode node)` Gets the string to use for the tree-column (the name of the node).
`int` | `getNodeRow(javax.swing.tree.TreeNode tNode)`
`int` | `getObjectRow(java.lang.Object object)` Gets the row index of the given object
`boolean` | `getParentsBold()` Returns the flag that determines whether the names of parent nodes are displayed bold or not.
`java.lang.Object` | `getRowNode(int rowIndex)`
`java.lang.Object` | `getRowObject(int rowIndex)` Gets the object that is in the given row.
`javax.swing.tree.TreeNode` | `getTreeNode(java.lang.Object object)` Get the (possibly new) TreeNode that is associlated with the given Object.
`javax.swing.tree.TreeNode` | `getTreeNode(java.lang.Object object, java.util.List parents, int indentation)`
`java.lang.Object` | `getTreeNodeType(IXTreeTableNode eNode)` Gets a character or icon to use as a reflection of the node's tree-status.
`protected java.lang.Object` | `getTreeValueAt(IXTreeTableNode eNode)` Gets the value that indicates the tree-position (indented name).
`java.lang.Object` | `getValueAt(int rowIndex, int columnIndex)` Get the value for a cell in the table defined by the parameters.
`boolean` | `isCellEditable(int row, int col)`
`boolean` | `isExpanding()`
`boolean` | `isParentsBold()` Returns the flag that determines whether the names of parent nodes are displayed bold or not.
`java.lang.String` | `ixTTNListToString(java.util.List nodes)`
`abstract IXTreeTableNode` | `makeIXTreeTableNode(java.lang.Object node)`
`IXTreeTableNode` | `makeIXTreeTableNode(java.lang.Object node, java.util.List parents, int indentation)` indentation is number of blanks to put in front of node (n*INDENT_STEP)
`protected boolean` | `removeChildData(IXTreeTableNode eNode)`
`protected void` | `removeChildren(IXTreeTableNode eNode, int index)`
`void` | `removeData(java.lang.Object data)` Removes the given TreeNode object from the table's rows (including its children) and notifies listeners.
`void` | `removeDataNode(IXTreeTableNode eNode)` Completely forget about the node (and its children)
`void` | `removeNodes(int number, int place)` Removes the given number of nodes from the given index place in the table.
`void` | `removeTreeNode(java.lang.Object object)` Forget the association of the given TreeNode to the given object
`void` | `setColumnFields(java.lang.Class objectClass, java.lang.String[] fieldNames)` Sets the fields to be used as columns in the table
`void` | `setColumnNames(java.lang.String[] fieldNames)` Sets the column titles to be used in the table
`void` | `setColumnPlaces()` Sets the column fplaces for tree info and name depending on whether the table is markable or not.
`void` | `setData(java.util.Collection theNodes)` Sets the table's rows to the given TreeNode objects and notifies listeners.
`void` | `setData(java.lang.Object[] theNodes)` Sets the table's rows to the given TreeNode objects and notifies listeners.
`void` | `setParentsBold(boolean boldParents)` Sets the flag that determines whether the names of parent nodes are displayed bold or not.
`void` | `unexpandNode(IXTreeTableNode eNode, int index)` Removes the node's children from the table and notes it as unexpanded.
`void` | `updateData(java.util.Collection theNodes)` Sets the table's rows to the given TreeNode objects, maintaining current expansions and notifies listeners.

Methods inherited from class ix.iface.ui.table.AbstractIXTableModel
`addData, addMarkListener, clearMarks, defaultGetCellValueAt, defaultSetColumnFields, fireTableMarkAdded, fireTableMarkCleared, fireTableMarkedAll, fireTableMarkRemoved, getColumnClass, getColumnCount, getColumnName, getColumnNames, getData, getMarkedObjects, getMarkedRows, getRowCount, isMarkable, isMarked, isMarkedEmpty, markAll, markRow, removeMarkListener, replaceData, setColumnClasses, setValueAt, unmarkRow`

Methods inherited from class javax.swing.table.AbstractTableModel
`addTableModelListener, findColumn, fireTableCellUpdated, fireTableChanged, fireTableDataChanged, fireTableRowsDeleted, fireTableRowsInserted, fireTableRowsUpdated, fireTableStructureChanged, getListeners, getTableModelListeners, removeTableModelListener`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### treeIconColumn

    public int treeIconColumn

  the column to be used as a tree-icon column

### nameColumn

    public int nameColumn

  the column to be used as a name column

### INDENT_STEP

    public static final int INDENT_STEP

  the indentation steps used to indent children

  See Also:
    Constant Field Values

### LEAFC

    public static final char LEAFC

  the character used to indicate a leaf (no children)

  See Also:
    Constant Field Values

### OPENC

    public static final char OPENC

  the character used to indicate an expanded node

  See Also:
    Constant Field Values

### CLOSEDC

    public static final char CLOSEDC

  the character used to indicate an un-expanded node

  See Also:
    Constant Field Values

### LEAFI

    public static final javax.swing.ImageIcon LEAFI

### OPENI

    public static final javax.swing.ImageIcon OPENI

### CLOSEDI

    public static final javax.swing.ImageIcon CLOSEDI

### nodes

    protected java.util.ArrayList nodes

  a collection of IXTreeTableNodes that have been generated

### nodeMap

    public java.util.HashMap nodeMap

  A map for looking up a TreeNode for a Object. Use: put(Object, TreeNode)

Constructor Detail

### AbstractTreeTableModel

    public AbstractTreeTableModel(boolean markable)

  Makes an empty model.

### AbstractTreeTableModel

    public AbstractTreeTableModel(boolean markable,
                                  javax.swing.tree.TreeNode[] theNodes)

  Makes a model that contains the given nodes at top level.

Method Detail

### addTreeTableModelListener

    public void addTreeTableModelListener(TreeTableStructureListener l)

### fireTreeStructureChanged

    public void fireTreeStructureChanged()

  The tree lost/gained nodes (more drastic than nodeStructureChanged

### fireNodeStructureChanged

    public void fireNodeStructureChanged(IXTreeTableNode node)

  A node gained or lost children

### setData

    public void setData(java.util.Collection theNodes)

  Sets the table's rows to the given TreeNode objects and notifies listeners. Creates a top-level IXTreeTableNode object for each data object. Overwrites the super method.

### setData

    public void setData(java.lang.Object[] theNodes)

  Sets the table's rows to the given TreeNode objects and notifies listeners. Creates a top-level IXTreeTableNode object for each data object. Overwrites the super method.

  Overrides:
    `setData` in class `AbstractIXTableModel`

### clearData

    public void clearData()

  Description copied from class: `AbstractIXTableModel`
  Removes all data objects from the table's rows and notifies listeners.

  Overrides:
    `clearData` in class `AbstractIXTableModel`

### clearTable

    public void clearTable()

### updateData

    public void updateData(java.util.Collection theNodes)

  Sets the table's rows to the given TreeNode objects, maintaining current expansions and notifies listeners. As setData, but it maintains current expansions whereas setData removes them.

### addData

    public void addData(java.lang.Object data)

  Adds the given TreeNode object to the table's rows and notifies listeners. Creates a top-level IXTreeTableNode object for the data object. Overwrites the super method.

  Overrides:
    `addData` in class `AbstractIXTableModel`

### removeData

    public void removeData(java.lang.Object data)

  Removes the given TreeNode object from the table's rows (including its children) and notifies listeners. Overwrites the super method.

  Overrides:
    `removeData` in class `AbstractIXTableModel`

### removeDataNode

    public void removeDataNode(IXTreeTableNode eNode)

  Completely forget about the node (and its children)

### removeNodes

    public void removeNodes(int number,
                            int place)

  Removes the given number of nodes from the given index place in the table. Also notifies listeners. This happens when nodes are collapsed.

### setColumnPlaces

    public void setColumnPlaces()

  Sets the column fplaces for tree info and name depending on whether the table is markable or not.

### setColumnNames

    public void setColumnNames(java.lang.String[] fieldNames)

  Sets the column titles to be used in the table

  Overrides:
    `setColumnNames` in class `AbstractIXTableModel`

### setColumnFields

    public void setColumnFields(java.lang.Class objectClass,
                                java.lang.String[] fieldNames)

  Sets the fields to be used as columns in the table

  Overrides:
    `setColumnFields` in class `AbstractIXTableModel`

### getRowObject

    public java.lang.Object getRowObject(int rowIndex)

  Description copied from class: `AbstractIXTableModel`
  Gets the object that is in the given row.

  Overrides:
    `getRowObject` in class `AbstractIXTableModel`
  Returns:
    the object or null if there is no such row.

### getRowNode

    public java.lang.Object getRowNode(int rowIndex)

### getObjectRow

    public int getObjectRow(java.lang.Object object)

  Description copied from class: `AbstractIXTableModel`
  Gets the row index of the given object

  Overrides:
    `getObjectRow` in class `AbstractIXTableModel`
  Returns:
    the object's index or -1 if there is no such object.

### getNodeRow

    public int getNodeRow(javax.swing.tree.TreeNode tNode)

### setParentsBold

    public void setParentsBold(boolean boldParents)

  Sets the flag that determines whether the names of parent nodes are displayed bold or not.

### getParentsBold

    public boolean getParentsBold()

  Returns the flag that determines whether the names of parent nodes are displayed bold or not.

### isParentsBold

    public boolean isParentsBold()

  Returns the flag that determines whether the names of parent nodes are displayed bold or not.

### isCellEditable

    public boolean isCellEditable(int row,
                                  int col)

  Specified by:
    `isCellEditable` in interface `javax.swing.table.TableModel`
  Overrides:
    `isCellEditable` in class `AbstractIXTableModel`

### getValueAt

    public java.lang.Object getValueAt(int rowIndex,
                                       int columnIndex)

  Get the value for a cell in the table defined by the parameters. only the node name is different from normal node tables, so the other cells can be done by any old table model.

  Specified by:
    `getValueAt` in interface `javax.swing.table.TableModel`
  Overrides:
    `getValueAt` in class `AbstractIXTableModel`

### getTreeValueAt

    protected java.lang.Object getTreeValueAt(IXTreeTableNode eNode)

  Gets the value that indicates the tree-position (indented name).

  Returns:
    an object that can be rendered by the table.

### isExpanding

    public boolean isExpanding()

### expandNode

    public void expandNode(IXTreeTableNode eNode,
                           int rowIndex)

  Gathers the node's children and splices them into the table.

### forceExpandNode

    public void forceExpandNode(IXTreeTableNode eNode,
                                int rowIndex)

### unexpandNode

    public void unexpandNode(IXTreeTableNode eNode,
                             int index)

  Removes the node's children from the table and notes it as unexpanded.

### removeChildren

    protected void removeChildren(IXTreeTableNode eNode,
                                  int index)

### removeChildData

    protected boolean removeChildData(IXTreeTableNode eNode)

### getTreeNodeType

    public java.lang.Object getTreeNodeType(IXTreeTableNode eNode)

  Gets a character or icon to use as a reflection of the node's tree-status. E.g. + for collapsed with children, - for expanded with children, empty for no children.

### cellClicked

    public void cellClicked(java.awt.event.MouseEvent me,
                            int rowIndex,
                            int columnIndex)

  If the left button was clicked on the tree-column, expand/collapse node.

  Specified by:
    `cellClicked` in interface `TableMouseListener`
  Parameters:
    `me` - the original MouseEvent.
    `rowIndex` - the index of the row that has been clicked
    `columnIndex` - the index of the column that has been clicked

### getCellValueAt

    public abstract java.lang.Object getCellValueAt(java.lang.Object node,
                                                    int columnIndex)

  Gets the object's value for the given column index. The index has been adjusted to ignore mark column and tree-icon column.

  Specified by:
    `getCellValueAt` in class `AbstractIXTableModel`
  Returns:
    an object that can be rendered by the table.

### getNameString

    public abstract java.lang.String getNameString(javax.swing.tree.TreeNode node)

  Gets the string to use for the tree-column (the name of the node).

### fireObjectChanged

    public void fireObjectChanged(java.lang.Object o)

  The given object changed - find its tree node, fire that and redo children

### deriveColumnFields

    protected void deriveColumnFields()

  Collects usable fields from the objectClass; puts the name field in front. Does not adjust for tree-icon or markings.

  Overrides:
    `deriveColumnFields` in class `AbstractIXTableModel`

### getTreeNode

    public javax.swing.tree.TreeNode getTreeNode(java.lang.Object object)

  Get the (possibly new) TreeNode that is associlated with the given Object.

### getTreeNode

    public javax.swing.tree.TreeNode getTreeNode(java.lang.Object object,
                                                 java.util.List parents,
                                                 int indentation)

### addTreeNode

    public void addTreeNode(java.lang.Object object,
                            javax.swing.tree.TreeNode tNode)

  Associate the given TreeNode to the given object

### removeTreeNode

    public void removeTreeNode(java.lang.Object object)

  Forget the association of the given TreeNode to the given object

### makeIXTreeTableNode

    public abstract IXTreeTableNode makeIXTreeTableNode(java.lang.Object node)

### makeIXTreeTableNode

    public IXTreeTableNode makeIXTreeTableNode(java.lang.Object node,
                                               java.util.List parents,
                                               int indentation)

  indentation is number of blanks to put in front of node (n*INDENT_STEP)

### ixTTNListToString

    public java.lang.String ixTTNListToString(java.util.List nodes)

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD