|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.jdesktop.swingx.treetable.AbstractTreeTableModel
org.jdesktop.swingx.treetable.FileSystemModel
public class FileSystemModel
A tree table model to simulate a file system.
This tree table model implementation extends AbstractTreeTableModel.
The file system metaphor demonstrates that it is often easier to directly
implement tree structures directly instead of using intermediaries, such as
TreeTableNode.
A comparison of this class with SimpleFileSystemModel, shows that
extending AbstractTreeTableModel is often easier than creating a model
from scratch.
A "full" version of this model might allow editing of file names, the deletion of files, and the movement of files. This simple implementation does not intend to tackle such problems, but this implementation may be extended to handle such details.
| Field Summary |
|---|
| Fields inherited from class org.jdesktop.swingx.treetable.AbstractTreeTableModel |
|---|
modelSupport, root |
| Constructor Summary | |
|---|---|
FileSystemModel()
Creates a file system model using the root directory as the model root. |
|
FileSystemModel(java.io.File root)
Creates a file system model using the specified root. |
|
| Method Summary | |
|---|---|
java.io.File |
getChild(java.lang.Object parent,
int index)
|
int |
getChildCount(java.lang.Object parent)
|
java.lang.Class<?> |
getColumnClass(int column)
Returns the most specific superclass for all the cell values in the column. |
int |
getColumnCount()
Returns the number of columns in the model. |
java.lang.String |
getColumnName(int column)
Returns the name of the column at columnIndex. |
int |
getIndexOfChild(java.lang.Object parent,
java.lang.Object child)
|
java.io.File |
getRoot()
|
java.lang.Object |
getValueAt(java.lang.Object node,
int column)
Returns the value for the node at columnIndex. |
boolean |
isLeaf(java.lang.Object node)
Returns true if node is a leaf. |
void |
setRoot(java.io.File root)
Sets the root for this tree table model. |
| Methods inherited from class org.jdesktop.swingx.treetable.AbstractTreeTableModel |
|---|
addTreeModelListener, getHierarchicalColumn, getTreeModelListeners, isCellEditable, removeTreeModelListener, setValueAt, valueForPathChanged |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public FileSystemModel()
public FileSystemModel(java.io.File root)
root.
root - the root for this model; this may be different than the root
directory for a file system.| Method Detail |
|---|
public java.io.File getChild(java.lang.Object parent,
int index)
public int getChildCount(java.lang.Object parent)
public java.lang.Class<?> getColumnClass(int column)
JXTreeTable to set up a default
renderer and editor for the column.
getColumnClass in interface TreeTableModelgetColumnClass in class AbstractTreeTableModelcolumn - the index of the column
TableModel.getColumnClass(int)public int getColumnCount()
TreeTableModelJXTreeTable uses
this method to determine how many columns it should create and display by
default.
TableModel.getColumnCount()public java.lang.String getColumnName(int column)
AbstractTreeTableModelcolumnIndex. This is used to
initialize the table's column header name. Note: this name does not need
to be unique; two columns in a table can have the same name.
getColumnName in interface TreeTableModelgetColumnName in class AbstractTreeTableModelcolumn - the index of the column
TableModel.getColumnName(int)
public java.lang.Object getValueAt(java.lang.Object node,
int column)
TreeTableModelnode at columnIndex. The
node must be managed by this model. Unamanaged nodes should throw
an IllegalArgumentException.
node - the node whose value is to be queriedcolumn - the column whose value is to be queried
TreeTableModel.setValueAt(java.lang.Object, java.lang.Object, int),
TableModel.getValueAt(int, int)
public int getIndexOfChild(java.lang.Object parent,
java.lang.Object child)
public java.io.File getRoot()
getRoot in interface javax.swing.tree.TreeModelgetRoot in class AbstractTreeTableModelpublic void setRoot(java.io.File root)
root - the new root node to setpublic boolean isLeaf(java.lang.Object node)
true if node is a leaf.
isLeaf in interface javax.swing.tree.TreeModelisLeaf in class AbstractTreeTableModelnode - a node in the tree, obtained from this data source
node is a leaf
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||