public interface MyTreeTableModel<T extends MyTreeNode> extends TreeModel
getColumnSizePercentage(int)
method, to allow the resizing of the column, along with the
table resizing (see FilePanelTableImp.componentResized(java.awt.event.ComponentEvent)
Modifier and Type | Method and Description |
---|---|
int |
attachObject(Object o)
Attach a new Object into the current hierarchy.
|
boolean |
cleanHierarchy()
This method removes all empty folders.
|
void |
fireTreeNodesChanged(Object source,
TreePath path,
int[] childIndices,
T[] children)
This method must be called when one or more nodes are changed.
|
void |
fireTreeNodesInserted(Object source,
TreePath path,
int[] childIndices,
T[] children)
This method must be called when one or more nodes are changed.
|
void |
fireTreeNodesRemoved(Object source,
TreePath path,
int[] childIndices,
T[] children)
This method must be called when one or more nodes are changed.
|
void |
fireTreeStructureChanged(Object source,
TreePath path,
int[] childIndices,
T[] children)
This method must be called when one or more nodes are changed.
|
Class<?> |
getColumnClass(int column)
Returns the type (class) of a column.
|
int |
getColumnCount()
Returns the number of available columns.
|
String |
getColumnName(int column)
Returns the column name.
|
int |
getColumnSizePercentage(int col)
Retrieves the default colum percentage size of a column, that is: its percentage of the available width.
|
T |
getRoot()
Get the visible root of the JTree view.
|
TreePath |
getTreePath(T item)
This method build a
TreePath for the given item. |
TreePath |
getTreePathForObject(Object o)
Get the
TreePath for the given object. |
Object |
getValueAt(T node,
int column)
Returns the value of a node in a column.
|
boolean |
isCellEditable(T node,
int column)
Check if a cell of a node in one column is editable.
|
void |
reload()
Invoke this method if you've modified the TreeNodes upon which this model depends.
|
void |
reload(T node)
Invoke this method if you've modified the TreeNodes upon which this model depends.
|
void |
remove(T item)
Removes an item from the TreeView.
|
void |
removeAndClean(T item)
Removes an item from the TreeView, detach its descendant, and remove the parent node if this node was the only
child of the parent.
|
void |
setRoot(T root)
Set the visible root of the JTree view.
|
void |
setTree(MyTreeTableCellRenderer tree) |
void |
setValueAt(Object aValue,
T node,
int column)
Sets a value for a node in one column.
|
addTreeModelListener, getChild, getChildCount, getIndexOfChild, isLeaf, removeTreeModelListener, valueForPathChanged
T getRoot()
void setRoot(T root)
root
- void remove(T item)
item
- removeAndClean(MyTreeNode)
void removeAndClean(T item)
item
- boolean cleanHierarchy()
reload()
method is called.void reload()
Invoke this method if you've modified the TreeNodes upon which this model depends. The model will notify all of its listeners that the model has changed. It will fire the events, necessary to update the layout caches and repaint the tree. The tree will not be properly refreshed if you call the JTree.repaint instead.
This method will refresh the information about whole tree from the root. If only part of the tree should be
refreshed, it is more effective to call #reload(TreeNode)
.
Note: code taken from the JDK DefaultTreeModel.
void reload(T node)
node
- - the tree node, from which the tree nodes have changed (inclusive). If you do not know this node,
call reload()
instead.int getColumnCount()
String getColumnName(int column)
column
- Column numberint getColumnSizePercentage(int col)
col
- The index of the column to query.Class<?> getColumnClass(int column)
column
- Column numberint attachObject(Object o) throws IllegalStateException, IllegalArgumentException, JUploadExceptionStopAddingFiles
o
- IllegalStateException
- If this method is called on an instance, which doesn't possess this capabilityIllegalArgumentException
- If the given Object is not of the right type, to allow an attachment into the
current hierarchyJUploadExceptionStopAddingFiles
- When an error occurs, indicating that not all files were addedObject getValueAt(T node, int column)
node
- Nodecolumn
- Column numberboolean isCellEditable(T node, int column)
node
- Nodecolumn
- Column numbervoid setValueAt(Object aValue, T node, int column)
aValue
- New valuenode
- Nodecolumn
- Column numbervoid setTree(MyTreeTableCellRenderer tree)
tree
- the tree to setvoid fireTreeNodesChanged(Object source, TreePath path, int[] childIndices, T[] children)
source
- - the Object responsible for generating the event (typically the creator of the event object passes
this for its value)path
- - a TreePath object that identifies the path to the parent of the modified item(s)childIndices
- - an array of int that specifies the index values of the modified itemschildren
- - an array of Object containing the inserted, removed, or changed objectsTreeModelListener
void fireTreeNodesInserted(Object source, TreePath path, int[] childIndices, T[] children)
source
- - the Object responsible for generating the event (typically the creator of the event object passes
this for its value)path
- - a TreePath object that identifies the path to the parent of the modified item(s)childIndices
- - an array of int that specifies the index values of the modified itemschildren
- - an array of Object containing the inserted, removed, or changed objectsTreeModelListener
void fireTreeNodesRemoved(Object source, TreePath path, int[] childIndices, T[] children)
source
- - the Object responsible for generating the event (typically the creator of the event object passes
this for its value)path
- - a TreePath object that identifies the path to the parent of the modified item(s)childIndices
- - an array of int that specifies the index values of the modified itemschildren
- - an array of Object containing the inserted, removed, or changed objectsTreeModelListener
void fireTreeStructureChanged(Object source, TreePath path, int[] childIndices, T[] children)
source
- - the Object responsible for generating the event (typically the creator of the event object passes
this for its value)path
- - a TreePath object that identifies the path to the parent of the modified item(s)childIndices
- - an array of int that specifies the index values of the modified itemschildren
- - an array of Object containing the inserted, removed, or changed objectsTreeModelListener
TreePath getTreePath(T item)
TreePath
for the given item. This item should be in the current tree.item
- IllegalArgumentException
- If item is not in the tree represented by this model.TreePath getTreePathForObject(Object o)
TreePath
for the given object. This method is optional. It is typically only applicable if this
hierarchy maps on another hierarchy (for instance a hierarchy of files, based on a local file system)o
- IllegalStateException
- If this method is called on an instance, which doesn't possess this capabilityIllegalArgumentException
- If the given Object is not of the right type, to allow an attachment into the
current hierarchyCopyright © 2015. All rights reserved.