|
JClass DesktopViews 6.3.0 API Documentation |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--com.klg.jclass.util.treetable.TreeWithSortableChildren
Provides a sorted mapping for children of a given node.
Nested Class Summary | |
static class |
TreeWithSortableChildren.HashObject
Guarantees that the object that you are hashing will compare uniquely only to the object being stored therein. |
Field Summary | |
protected boolean |
autoSort
|
protected int[][] |
keyColumnsArray
|
protected com.klg.jclass.util.treetable.TreeWithSortableChildren.Listener |
l
|
protected com.klg.jclass.util.JCListenerList |
listeners
|
protected boolean |
needsReordering
|
protected boolean |
needsResorting
|
protected HashMap |
nodeChildIndexMaps
|
protected com.klg.jclass.util.swing.JCRowComparator |
rowComparator
|
protected com.klg.jclass.util.treetable.TreeWithSortableChildren.RowIntComparator |
rowIntComparator
|
protected int |
sortColumn
|
protected int |
sortOrder
|
protected com.klg.jclass.util.treetable.JCTreeTableModel |
treetable
|
Fields inherited from interface com.klg.jclass.util.swing.JCRowSortModel |
FORWARD, REVERSE |
Constructor Summary | |
TreeWithSortableChildren(com.klg.jclass.util.treetable.JCTreeTableModel treetable)
Constructs a JCTreeTableModel that that wraps a given instance
of a JCTreeTableModel and provides a sorted mapping of the
children for any given leaf node. |
|
TreeWithSortableChildren(com.klg.jclass.util.treetable.JCTreeTableModel treetable,
com.klg.jclass.util.swing.JCRowComparator comparator)
Constructs a JCTreeTableModel that wraps a given instance of a
JCTreeTableModel and provides a sorted mapping of the children
for any given leaf node. |
Method Summary | |
void |
addTreeModelListener(TreeModelListener l)
Removes the specified treemodel listener. |
boolean |
getAutoSort()
Returns whether the data is automatically sorted when it changes according the current comparator. |
Object |
getChild(Object parent,
int index)
Returns the "index"th non-leaf child of this node. |
int |
getChildCount(Object parent)
Return the number of children. |
Class |
getColumnClass(int column)
Returns the class of the given column index. |
int |
getColumnCount()
Returns the number of columns. |
String |
getColumnName(int column)
Returns the column name for the given column index. |
int |
getIndexOfChild(Object parent,
Object child)
Returns the non-leaf index of this child. |
protected int[] |
getIndices(Object parent)
Gets the mapped indices; returns null if unsorted. |
int[] |
getKeyColumns(int column)
Returns the key columns used to sort the table model when clicking on a specified column. |
com.klg.jclass.util.treetable.JCTreeTableModel |
getModel()
Returns the JCTreeTable model this model wraps |
protected static Object |
getNode(TreePath path)
Given a TreePath , this method returns the last component or
"node" of the TreePath . |
Object |
getRoot()
Returns the root node of the tree. |
int |
getSortColumn()
Gets the sorting column. |
int |
getSortOrder()
Gets the sorting order to use the next time a sort is performed. |
Object |
getValueAt(Object node,
int column)
Returns the value of the specific node and column. |
boolean |
isCellEditable(Object node,
int column)
Returns whether a particular cell is editable given the node and column. |
boolean |
isDataSorted()
Returns whether or not the data set is currently sorted. |
boolean |
isLeaf(Object node)
Returns whether the child is a leaf. |
protected void |
postTreeStructureChanged(TreeModelEvent event)
Invoked after the tree has drastically changed structure from a given node down. |
protected void |
postTreeStructureChanged(TreeModelEvent event,
boolean external)
Invoked after the tree has drastically changed structure from a given node down. |
void |
removeTreeModelListener(TreeModelListener l)
Removes the specified treemodel listener. |
void |
setAutoSort(boolean autoSort)
Sets whether the data should be automatically sorted when it changes. |
void |
setDataSorted(boolean sorted)
Sorts data by current column if set to true and the data needs sorting; or, if set to false, it returns the data in its native unsorted state. |
void |
setKeyColumns(int column,
int[] keyColumns)
Sets the key columns used to sort the table model when clicking on a specified column. |
void |
setModel(com.klg.jclass.util.treetable.JCTreeTableModel newModel)
Sets the tree table model wrapped by this model. |
void |
setSortColumn(int column)
Sets the column to use the next time a sort is performed. |
void |
setSortOrder(int order)
Sets the sorting order. |
void |
setValueAt(Object value,
Object node,
int column)
Sets the value at a particular node and column. |
void |
toggleSortOrder()
Toggles the sorting order. |
void |
valueForPathChanged(TreePath path,
Object newValue)
Calls the underling trees valueForPathChanged method. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
protected com.klg.jclass.util.treetable.JCTreeTableModel treetable
protected int sortColumn
protected int sortOrder
protected com.klg.jclass.util.swing.JCRowComparator rowComparator
protected int[][] keyColumnsArray
protected com.klg.jclass.util.treetable.TreeWithSortableChildren.RowIntComparator rowIntComparator
protected HashMap nodeChildIndexMaps
protected boolean autoSort
protected boolean needsResorting
protected boolean needsReordering
protected com.klg.jclass.util.JCListenerList listeners
protected com.klg.jclass.util.treetable.TreeWithSortableChildren.Listener l
Constructor Detail |
public TreeWithSortableChildren(com.klg.jclass.util.treetable.JCTreeTableModel treetable, com.klg.jclass.util.swing.JCRowComparator comparator)
JCTreeTableModel
that wraps a given instance of a
JCTreeTableModel
and provides a sorted mapping of the children
for any given leaf node. The sort order is defined by the configurable
Comparator
property.
public TreeWithSortableChildren(com.klg.jclass.util.treetable.JCTreeTableModel treetable)
JCTreeTableModel
that that wraps a given instance
of a JCTreeTableModel
and provides a sorted mapping of the
children for any given leaf node. The sort order is defined by the
configurable Comparator
property.
Method Detail |
public com.klg.jclass.util.treetable.JCTreeTableModel getModel()
JCTreeTable
model this model wraps
public void setModel(com.klg.jclass.util.treetable.JCTreeTableModel newModel)
public boolean getAutoSort()
getAutoSort
in interface JCRowSortModel
public void setAutoSort(boolean autoSort)
setAutoSort
in interface JCRowSortModel
autoSort
- public void setKeyColumns(int column, int[] keyColumns)
setKeyColumns
in interface JCRowSortModel
column
- index of column in TableModelkeyColumns
- columns to use as keys to sort when sorting
on the specified column.public int[] getKeyColumns(int column)
getKeyColumns
in interface JCRowSortModel
column
-
public boolean isDataSorted()
isDataSorted
in interface JCRowSortModel
public void setDataSorted(boolean sorted)
setDataSorted
in interface JCRowSortModel
sorted
- public int getSortColumn()
getSortColumn
in interface JCRowSortModel
public void setSortColumn(int column)
setSortColumn
in interface JCRowSortModel
column
- only valid column indicies are allowedpublic int getSortOrder()
getSortOrder
in interface JCRowSortModel
public void setSortOrder(int order)
setSortOrder
in interface JCRowSortModel
order
- public void toggleSortOrder()
toggleSortOrder
in interface JCRowSortModel
protected int[] getIndices(Object parent)
public void addTreeModelListener(TreeModelListener l)
addTreeModelListener
in interface TreeModel
public void removeTreeModelListener(TreeModelListener l)
removeTreeModelListener
in interface TreeModel
public Object getChild(Object parent, int index)
getChild
in interface TreeModel
public int getChildCount(Object parent)
getChildCount
in interface TreeModel
public int getIndexOfChild(Object parent, Object child)
getIndexOfChild
in interface TreeModel
public Object getRoot()
getRoot
in interface TreeModel
public boolean isLeaf(Object node)
isLeaf
in interface TreeModel
public void valueForPathChanged(TreePath path, Object newValue)
valueForPathChanged
in interface TreeModel
public Object getValueAt(Object node, int column)
getValueAt
in interface JCTreeTableModel
node
- the node to be queriedcolumn
- the index of the column
JCTreeTableModel.setValueAt(java.lang.Object, java.lang.Object, int)
public boolean isCellEditable(Object node, int column)
isCellEditable
in interface JCTreeTableModel
node
- the node to be checked for editabiltilycolumn
- the index of the column
JCTreeTableModel.setValueAt(java.lang.Object, java.lang.Object, int)
public void setValueAt(Object value, Object node, int column)
setValueAt
in interface JCTreeTableModel
value
- the new valuenode
- the node whose value is to be changedcolumn
- the column whose value is to be changedJCTreeTableModel.getValueAt(java.lang.Object, int)
,
JCTreeTableModel.isCellEditable(java.lang.Object, int)
public Class getColumnClass(int column)
getColumnClass
in interface JCTreeTableModel
column
- the index of the column
public int getColumnCount()
getColumnCount
in interface JCTreeTableModel
public String getColumnName(int column)
getColumnName
in interface JCTreeTableModel
column
- the index of the column whose name is required
protected static Object getNode(TreePath path)
TreePath
, this method returns the last component or
"node" of the TreePath
.
protected void postTreeStructureChanged(TreeModelEvent event)
Invoked after the tree has drastically changed structure from a given node down. If the path returned by e.getPath() is of length one and the first element does not identify the current root node the first element should become the new root of the tree.
event
- The event generated by the change. If a null event is passed,
an "all changed" event is generated.protected void postTreeStructureChanged(TreeModelEvent event, boolean external)
Invoked after the tree has drastically changed structure from a given node down. If the path returned by e.getPath() is of length one and the first element does not identify the current root node the first element should become the new root of the tree.
event
- The event generated by the change. If a null event is passed,
an "all changed" event is generated.external
- If true, this method is called externally thru the Listener.
In this case we need to reset the internal index maps. If false, this
method is called internally and is meant to inform listeners of an internal
change. In this case the index maps are already updated and should not be
reset.
|
Copyright © 2004 Quest Software Inc.. All rights reserved. |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |