|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.jdesktop.swingx.treetable.SimpleFileSystemModel
public class SimpleFileSystemModel
A tree table model to simulate a file system.
This tree table model implementation does not extends
AbstractTreeTableModel. The file system metaphor demonstrates that
it is often easier to directly implement tree structures directly instead of
using intermediaries, such as TreeNode.
It would be possible to create this same class by extending
AbstractTreeTableModel, however the number of methods that you would
need to override almost precludes that means of implementation.
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 | |
|---|---|
protected javax.swing.event.EventListenerList |
listenerList
|
| Constructor Summary | |
|---|---|
SimpleFileSystemModel()
Creates a file system model, using the root directory as the model root. |
|
SimpleFileSystemModel(java.io.File root)
Creates a file system model, using the specified root as the
model root. |
|
| Method Summary | |
|---|---|
void |
addTreeModelListener(javax.swing.event.TreeModelListener l)
|
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 |
getHierarchicalColumn()
Returns the column that is the "tree" column. |
int |
getIndexOfChild(java.lang.Object parent,
java.lang.Object child)
|
java.io.File |
getRoot()
|
javax.swing.event.TreeModelListener[] |
getTreeModelListeners()
Gets a an array of all the listeners attached to this model. |
java.lang.Object |
getValueAt(java.lang.Object node,
int column)
Returns the value for the node at columnIndex. |
boolean |
isCellEditable(java.lang.Object node,
int column)
Returns true if the cell for the node at columnIndex is
editable. |
boolean |
isLeaf(java.lang.Object node)
|
void |
removeTreeModelListener(javax.swing.event.TreeModelListener l)
|
void |
setValueAt(java.lang.Object value,
java.lang.Object node,
int column)
Sets the value for the node at columnIndex to
value. |
void |
valueForPathChanged(javax.swing.tree.TreePath path,
java.lang.Object newValue)
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected javax.swing.event.EventListenerList listenerList
| Constructor Detail |
|---|
public SimpleFileSystemModel()
public SimpleFileSystemModel(java.io.File root)
root as the
model root.
| Method Detail |
|---|
public java.io.File getChild(java.lang.Object parent,
int index)
getChild in interface javax.swing.tree.TreeModelpublic int getChildCount(java.lang.Object parent)
getChildCount in interface javax.swing.tree.TreeModelpublic java.lang.Class<?> getColumnClass(int column)
JXTreeTable to set up a default
renderer and editor for the column.
getColumnClass in interface TreeTableModelcolumn - the index of the column
TableModel.getColumnClass(int)public int getColumnCount()
JXTreeTable uses
this method to determine how many columns it should create and display by
default.
getColumnCount in interface TreeTableModelTableModel.getColumnCount()public java.lang.String getColumnName(int column)
columnIndex. 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 TreeTableModelcolumn - the index of the column
TableModel.getColumnName(int)
public java.lang.Object getValueAt(java.lang.Object node,
int column)
node at columnIndex. The
node must be managed by this model. Unamanaged nodes should throw
an IllegalArgumentException.
getValueAt in interface TreeTableModelnode - 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 getHierarchicalColumn()
getHierarchicalColumn in interface TreeTableModel
public boolean isCellEditable(java.lang.Object node,
int column)
node at columnIndex is
editable. Otherwise, setValueAt on the cell will not change the
value of that cell. The node must be managed by this model.
Unamanaged nodes should throw an IllegalArgumentException.
isCellEditable in interface TreeTableModelnode - the node whose value to be queriedcolumn - the column whose value to be queried
TreeTableModel.setValueAt(java.lang.Object, java.lang.Object, int),
TableModel.isCellEditable(int, int)
public void setValueAt(java.lang.Object value,
java.lang.Object node,
int column)
node at columnIndex to
value. The node must be managed by this model.
Unamanaged nodes should throw an IllegalArgumentException.
setValueAt in interface TreeTableModelvalue - the new valuenode - the node whose value is to be changedcolumn - the column whose value is to be changedTreeTableModel.getValueAt(java.lang.Object, int),
TreeTableModel.isCellEditable(java.lang.Object, int),
TableModel.setValueAt(Object, int, int)public void addTreeModelListener(javax.swing.event.TreeModelListener l)
addTreeModelListener in interface javax.swing.tree.TreeModel
public int getIndexOfChild(java.lang.Object parent,
java.lang.Object child)
getIndexOfChild in interface javax.swing.tree.TreeModelpublic java.io.File getRoot()
getRoot in interface javax.swing.tree.TreeModelpublic boolean isLeaf(java.lang.Object node)
isLeaf in interface javax.swing.tree.TreeModelpublic void removeTreeModelListener(javax.swing.event.TreeModelListener l)
removeTreeModelListener in interface javax.swing.tree.TreeModel
public void valueForPathChanged(javax.swing.tree.TreePath path,
java.lang.Object newValue)
valueForPathChanged in interface javax.swing.tree.TreeModelpublic javax.swing.event.TreeModelListener[] getTreeModelListeners()
null
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||