public final class TFileTreeModel
extends java.lang.Object
implements javax.swing.tree.TreeModel
TreeModel which traverses TFile instances.
The TArchiveDetector of the root of this tree model is used to
detect any archive files in the directory tree.| Constructor and Description |
|---|
TFileTreeModel(net.java.truevfs.access.TFile root,
java.io.FileFilter filter,
java.util.Comparator<? super net.java.truevfs.access.TFile> comparator)
Creates a new
TFileTreeModel which browses the specified
root file. |
| Modifier and Type | Method and Description |
|---|---|
void |
addTreeModelListener(javax.swing.event.TreeModelListener l)
Adds a listener to this model.
|
void |
cp_p(net.java.truevfs.access.TFile oldNode,
net.java.truevfs.access.TFile node)
Copies
oldNode to node
preserving its last modification time
and updates the tree accordingly. |
void |
cp_r(net.java.truevfs.access.TFile oldNode,
net.java.truevfs.access.TFile node)
Copies
oldNode to node recursively
and updates the tree accordingly. |
void |
cp_rp(net.java.truevfs.access.TFile oldNode,
net.java.truevfs.access.TFile node)
Copies
oldNode to node recursively
preserving its last modification time
and updates the tree accordingly. |
void |
cp(java.io.InputStream in,
net.java.truevfs.access.TFile node)
Copies
in to node
and updates the tree accordingly. |
void |
cp(net.java.truevfs.access.TFile oldNode,
net.java.truevfs.access.TFile node)
Copies
oldNode to node
and updates the tree accordingly. |
boolean |
createNewFile(net.java.truevfs.access.TFile node)
Creates
node as a new file in the file system
and updates the tree accordingly. |
protected void |
fireTreeNodesChanged(javax.swing.event.TreeModelEvent evt)
This method calls
TreeModelListener.treeStructureChanged(TreeModelEvent)
on all listeners of this TreeModel. |
protected void |
fireTreeNodesInserted(javax.swing.event.TreeModelEvent evt)
This method calls
TreeModelListener.treeStructureChanged(TreeModelEvent)
on all listeners of this TreeModel. |
protected void |
fireTreeNodesRemoved(javax.swing.event.TreeModelEvent evt)
This method calls
TreeModelListener.treeStructureChanged(TreeModelEvent)
on all listeners of this TreeModel. |
protected void |
fireTreeStructureChanged(javax.swing.event.TreeModelEvent evt)
This method calls
TreeModelListener.treeStructureChanged(TreeModelEvent)
on all listeners of this TreeModel. |
net.java.truevfs.access.TFile |
getChild(java.lang.Object parent,
int index) |
int |
getChildCount(java.lang.Object parent) |
int |
getIndexOfChild(java.lang.Object parent,
java.lang.Object child) |
net.java.truevfs.access.TFile |
getRoot() |
boolean |
isLeaf(java.lang.Object node) |
void |
mkdir(net.java.truevfs.access.TFile node,
boolean recursive)
Ensures that
node exists as a (virtual) directory in the
(federated) file system and updates the tree accordingly. |
void |
mv(net.java.truevfs.access.TFile oldNode,
net.java.truevfs.access.TFile node)
Moves
oldNode to node
and updates the tree accordingly. |
void |
nodeChanged(net.java.truevfs.access.TFile node)
Updates the given node in the tree.
|
void |
nodeInserted(net.java.truevfs.access.TFile node)
Inserts the given node in the tree.
|
void |
nodeInsertedOrStructureChanged(net.java.truevfs.access.TFile node)
Inserts the given node in the tree or reloads the tree structure for
the given node if it already exists.
|
void |
nodeRemoved(net.java.truevfs.access.TFile node)
Removes the given node from the tree.
|
void |
refresh()
Refreshes the tree structure for the entire tree.
|
void |
refresh(net.java.truevfs.access.TFile node)
Alias for
structureChanged(TFile). |
void |
removeTreeModelListener(javax.swing.event.TreeModelListener l)
Removes a listener from this model.
|
void |
rm_r(net.java.truevfs.access.TFile node)
Deletes the file or (probably not empty) directory
node
and updates the tree accordingly. |
void |
rm(net.java.truevfs.access.TFile node)
Deletes the file or empty directory
node
and updates the tree accordingly. |
void |
structureChanged(net.java.truevfs.access.TFile node)
Reloads the tree structure for the given node.
|
void |
valueForPathChanged(javax.swing.tree.TreePath path,
java.lang.Object newValue) |
public TFileTreeModel(@CheckForNull
net.java.truevfs.access.TFile root,
@CheckForNull
java.io.FileFilter filter,
java.util.Comparator<? super net.java.truevfs.access.TFile> comparator)
TFileTreeModel which browses the specified
root file.
If file is an instance of TFile,
its archive detector is used to detect any archive files in the
directory tree.root - The root of this TFileTreeModel.
If this is null, an empty tree is created.filter - Used to filter the files and directories which are
present in this TreeModel.
If this is null, all files are accepted.comparator - A comparator for TFile instances
or super classes.
This must not be null.java.lang.NullPointerException - If comparator is null.java.lang.IllegalArgumentException - If root isn't
null and comparing it to itself didn't result in
0.java.lang.ClassCastException - If root isn't
null and comparator isn't a
Comparator for TFile or super
class instances.public net.java.truevfs.access.TFile getRoot()
getRoot in interface javax.swing.tree.TreeModelpublic net.java.truevfs.access.TFile 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 boolean isLeaf(java.lang.Object node)
isLeaf in interface javax.swing.tree.TreeModelpublic void valueForPathChanged(javax.swing.tree.TreePath path,
java.lang.Object newValue)
valueForPathChanged in interface javax.swing.tree.TreeModelpublic int getIndexOfChild(java.lang.Object parent,
java.lang.Object child)
getIndexOfChild in interface javax.swing.tree.TreeModelpublic boolean createNewFile(net.java.truevfs.access.TFile node)
throws java.io.IOException
node as a new file in the file system
and updates the tree accordingly.
If you would like to create a new file with initial content, please
use cp(InputStream, TFile) instead.
Note that the current selection may get lost.java.io.IOException - on any I/O error.public void mkdir(net.java.truevfs.access.TFile node,
boolean recursive)
throws java.io.IOException
node exists as a (virtual) directory in the
(federated) file system and updates the tree accordingly.
Note that the current selection may get lost.recursive - whether or not any missing ancestor directories shall
get created if required.java.io.IOException - on any I/O error.public void cp(@WillClose
java.io.InputStream in,
net.java.truevfs.access.TFile node)
throws java.io.IOException
in to node
and updates the tree accordingly.
Note that the given stream is always closed and
that the current selection may get lost.java.io.IOException - on any I/O error.public void cp(net.java.truevfs.access.TFile oldNode,
net.java.truevfs.access.TFile node)
throws java.io.IOException
oldNode to node
and updates the tree accordingly.
Note that the current selection may get lost.java.io.IOException - on any I/O error.public void cp_r(net.java.truevfs.access.TFile oldNode,
net.java.truevfs.access.TFile node)
throws java.io.IOException
oldNode to node recursively
and updates the tree accordingly.
Note that the current selection may get lost.java.io.IOException - on any I/O error.public void cp_p(net.java.truevfs.access.TFile oldNode,
net.java.truevfs.access.TFile node)
throws java.io.IOException
oldNode to node
preserving its last modification time
and updates the tree accordingly.
Note that the current selection may get lost.java.io.IOException - on any I/O error.public void cp_rp(net.java.truevfs.access.TFile oldNode,
net.java.truevfs.access.TFile node)
throws java.io.IOException
oldNode to node recursively
preserving its last modification time
and updates the tree accordingly.
Note that the current selection may get lost.java.io.IOException - on any I/O error.public void mv(net.java.truevfs.access.TFile oldNode,
net.java.truevfs.access.TFile node)
throws java.io.IOException
oldNode to node
and updates the tree accordingly.
Note that the current selection may get lost.java.io.IOException - on any I/O error.public void rm(net.java.truevfs.access.TFile node)
throws java.io.IOException
node
and updates the tree accordingly.
Note that the current selection may get lost.java.io.IOException - on any I/O error.public void rm_r(net.java.truevfs.access.TFile node)
throws java.io.IOException
node
and updates the tree accordingly.
Note that the current selection may get lost.java.io.IOException - on any I/O error.public void nodeInsertedOrStructureChanged(net.java.truevfs.access.TFile node)
TreeModelListener.treeNodesInserted(TreeModelEvent)
on all listeners of this TreeModel.public void nodeInserted(net.java.truevfs.access.TFile node)
node already exists, nothing happens.
This method calls TreeModelListener.treeNodesInserted(TreeModelEvent)
on all listeners of this TreeModel.public void nodeChanged(net.java.truevfs.access.TFile node)
TreeModelListener.treeNodesChanged(TreeModelEvent)
on all listeners of this TreeModel.public void nodeRemoved(net.java.truevfs.access.TFile node)
TreeModelListener.treeNodesRemoved(TreeModelEvent)
on all listeners of this TreeModel.public void refresh()
TreeModelListener.treeStructureChanged(TreeModelEvent)
on all listeners of this TreeModel.public final void refresh(net.java.truevfs.access.TFile node)
structureChanged(TFile).public void structureChanged(net.java.truevfs.access.TFile node)
TreeModelListener.treeStructureChanged(TreeModelEvent)
on all listeners of this TreeModel.public void addTreeModelListener(javax.swing.event.TreeModelListener l)
addTreeModelListener in interface javax.swing.tree.TreeModell - The listener to add.public void removeTreeModelListener(javax.swing.event.TreeModelListener l)
removeTreeModelListener in interface javax.swing.tree.TreeModell - The listener to remove.protected void fireTreeNodesChanged(javax.swing.event.TreeModelEvent evt)
TreeModelListener.treeStructureChanged(TreeModelEvent)
on all listeners of this TreeModel.
May be used to tell the listeners about a change in the file system.protected void fireTreeNodesInserted(javax.swing.event.TreeModelEvent evt)
TreeModelListener.treeStructureChanged(TreeModelEvent)
on all listeners of this TreeModel.
May be used to tell the listeners about a change in the file system.protected void fireTreeNodesRemoved(javax.swing.event.TreeModelEvent evt)
TreeModelListener.treeStructureChanged(TreeModelEvent)
on all listeners of this TreeModel.
May be used to tell the listeners about a change in the file system.protected void fireTreeStructureChanged(javax.swing.event.TreeModelEvent evt)
TreeModelListener.treeStructureChanged(TreeModelEvent)
on all listeners of this TreeModel.
May be used to tell the listeners about a change in the file system.