|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object javax.swing.table.AbstractTableModel ix.iface.ui.table.AbstractIXTableModel ix.iface.ui.table.AbstractTreeTableModel
public abstract class AbstractTreeTableModel
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:
As an example, see ix.iview.table.ActionTreeTableModel
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 |
---|
public int treeIconColumn
public int nameColumn
public static final int INDENT_STEP
public static final char LEAFC
public static final char OPENC
public static final char CLOSEDC
public static final javax.swing.ImageIcon LEAFI
public static final javax.swing.ImageIcon OPENI
public static final javax.swing.ImageIcon CLOSEDI
protected java.util.ArrayList nodes
public java.util.HashMap nodeMap
Constructor Detail |
---|
public AbstractTreeTableModel(boolean markable)
public AbstractTreeTableModel(boolean markable, javax.swing.tree.TreeNode[] theNodes)
Method Detail |
---|
public void addTreeTableModelListener(TreeTableStructureListener l)
public void fireTreeStructureChanged()
public void fireNodeStructureChanged(IXTreeTableNode node)
public void setData(java.util.Collection theNodes)
public void setData(java.lang.Object[] theNodes)
setData
in class AbstractIXTableModel
public void clearData()
AbstractIXTableModel
clearData
in class AbstractIXTableModel
public void clearTable()
public void updateData(java.util.Collection theNodes)
public void addData(java.lang.Object data)
addData
in class AbstractIXTableModel
public void removeData(java.lang.Object data)
removeData
in class AbstractIXTableModel
public void removeDataNode(IXTreeTableNode eNode)
public void removeNodes(int number, int place)
public void setColumnPlaces()
public void setColumnNames(java.lang.String[] fieldNames)
setColumnNames
in class AbstractIXTableModel
public void setColumnFields(java.lang.Class objectClass, java.lang.String[] fieldNames)
setColumnFields
in class AbstractIXTableModel
public java.lang.Object getRowObject(int rowIndex)
AbstractIXTableModel
getRowObject
in class AbstractIXTableModel
public java.lang.Object getRowNode(int rowIndex)
public int getObjectRow(java.lang.Object object)
AbstractIXTableModel
getObjectRow
in class AbstractIXTableModel
public int getNodeRow(javax.swing.tree.TreeNode tNode)
public void setParentsBold(boolean boldParents)
public boolean getParentsBold()
public boolean isParentsBold()
public boolean isCellEditable(int row, int col)
isCellEditable
in interface javax.swing.table.TableModel
isCellEditable
in class AbstractIXTableModel
public java.lang.Object getValueAt(int rowIndex, int columnIndex)
getValueAt
in interface javax.swing.table.TableModel
getValueAt
in class AbstractIXTableModel
protected java.lang.Object getTreeValueAt(IXTreeTableNode eNode)
public boolean isExpanding()
public void expandNode(IXTreeTableNode eNode, int rowIndex)
public void forceExpandNode(IXTreeTableNode eNode, int rowIndex)
public void unexpandNode(IXTreeTableNode eNode, int index)
protected void removeChildren(IXTreeTableNode eNode, int index)
protected boolean removeChildData(IXTreeTableNode eNode)
public java.lang.Object getTreeNodeType(IXTreeTableNode eNode)
public void cellClicked(java.awt.event.MouseEvent me, int rowIndex, int columnIndex)
cellClicked
in interface TableMouseListener
me
- the original MouseEvent.rowIndex
- the index of the row that has been clickedcolumnIndex
- the index of the column that has been clickedpublic abstract java.lang.Object getCellValueAt(java.lang.Object node, int columnIndex)
getCellValueAt
in class AbstractIXTableModel
public abstract java.lang.String getNameString(javax.swing.tree.TreeNode node)
public void fireObjectChanged(java.lang.Object o)
protected void deriveColumnFields()
deriveColumnFields
in class AbstractIXTableModel
public javax.swing.tree.TreeNode getTreeNode(java.lang.Object object)
public javax.swing.tree.TreeNode getTreeNode(java.lang.Object object, java.util.List parents, int indentation)
public void addTreeNode(java.lang.Object object, javax.swing.tree.TreeNode tNode)
public void removeTreeNode(java.lang.Object object)
public abstract IXTreeTableNode makeIXTreeTableNode(java.lang.Object node)
public IXTreeTableNode makeIXTreeTableNode(java.lang.Object node, java.util.List parents, int indentation)
public java.lang.String ixTTNListToString(java.util.List nodes)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |