Constructor and Description |
---|
TFileTreeModel(TFile root,
FileFilter filter,
Comparator<? super TFile> comparator)
Creates a new
TFileTreeModel which browses the specified
root file. |
Modifier and Type | Method and Description |
---|---|
void |
addTreeModelListener(TreeModelListener l)
Adds a listener to this model.
|
void |
cp_p(TFile oldNode,
TFile node)
Copies
oldNode to node
preserving its last modification time
and updates the tree accordingly. |
void |
cp_r(TFile oldNode,
TFile node)
Copies
oldNode to node recursively
and updates the tree accordingly. |
void |
cp_rp(TFile oldNode,
TFile node)
Copies
oldNode to node recursively
preserving its last modification time
and updates the tree accordingly. |
void |
cp(InputStream in,
TFile node)
Copies
in to node
and updates the tree accordingly. |
void |
cp(TFile oldNode,
TFile node)
Copies
oldNode to node
and updates the tree accordingly. |
boolean |
createNewFile(TFile node)
Creates
node as a new file in the file system
and updates the tree accordingly. |
protected void |
fireTreeNodesChanged(TreeModelEvent evt)
This method calls
TreeModelListener.treeStructureChanged(TreeModelEvent)
on all listeners of this TreeModel . |
protected void |
fireTreeNodesInserted(TreeModelEvent evt)
This method calls
TreeModelListener.treeStructureChanged(TreeModelEvent)
on all listeners of this TreeModel . |
protected void |
fireTreeNodesRemoved(TreeModelEvent evt)
This method calls
TreeModelListener.treeStructureChanged(TreeModelEvent)
on all listeners of this TreeModel . |
protected void |
fireTreeStructureChanged(TreeModelEvent evt)
This method calls
TreeModelListener.treeStructureChanged(TreeModelEvent)
on all listeners of this TreeModel . |
TFile |
getChild(Object parent,
int index) |
int |
getChildCount(Object parent) |
int |
getIndexOfChild(Object parent,
Object child) |
TFile |
getRoot() |
boolean |
isLeaf(Object node) |
void |
mkdir(TFile node,
boolean recursive)
Ensures that
node exists as a (virtual) directory in the
(federated) file system and updates the tree accordingly. |
void |
mv(TFile oldNode,
TFile node)
Moves
oldNode to node
and updates the tree accordingly. |
void |
nodeChanged(TFile node)
Updates the given node in the tree.
|
void |
nodeInserted(TFile node)
Inserts the given node in the tree.
|
void |
nodeInsertedOrStructureChanged(TFile node)
Inserts the given node in the tree or reloads the tree structure for
the given node if it already exists.
|
void |
nodeRemoved(TFile node)
Removes the given node from the tree.
|
void |
refresh()
Refreshes the tree structure for the entire tree.
|
void |
refresh(TFile node)
Alias for
structureChanged(TFile) . |
void |
removeTreeModelListener(TreeModelListener l)
Removes a listener from this model.
|
void |
rm_r(TFile node)
Deletes the file or (probably not empty) directory
node
and updates the tree accordingly. |
void |
rm(TFile node)
Deletes the file or empty directory
node
and updates the tree accordingly. |
void |
structureChanged(TFile node)
Reloads the tree structure for the given node.
|
void |
valueForPathChanged(TreePath path,
Object newValue) |
public TFileTreeModel(@CheckForNull TFile root, @CheckForNull FileFilter filter, Comparator<? super 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
.NullPointerException
- If comparator
is null
.IllegalArgumentException
- If root
isn't
null
and comparing it to itself didn't result in
0
.ClassCastException
- If root
isn't
null
and comparator
isn't a
Comparator
for TFile
or super
class instances.public void addTreeModelListener(TreeModelListener l)
addTreeModelListener
in interface TreeModel
l
- The listener to add.public void cp_p(TFile oldNode, TFile node) throws IOException
oldNode
to node
preserving its last modification time
and updates the tree accordingly.
Note that the current selection may get lost.IOException
- on any I/O error.public void cp_r(TFile oldNode, TFile node) throws IOException
oldNode
to node
recursively
and updates the tree accordingly.
Note that the current selection may get lost.IOException
- on any I/O error.public void cp_rp(TFile oldNode, TFile node) throws IOException
oldNode
to node
recursively
preserving its last modification time
and updates the tree accordingly.
Note that the current selection may get lost.IOException
- on any I/O error.public void cp(@WillClose InputStream in, TFile node) throws 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.IOException
- on any I/O error.public void cp(TFile oldNode, TFile node) throws IOException
oldNode
to node
and updates the tree accordingly.
Note that the current selection may get lost.IOException
- on any I/O error.public boolean createNewFile(TFile node) throws 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.IOException
- on any I/O error.protected void fireTreeNodesChanged(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(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(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(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.public int getChildCount(Object parent)
getChildCount
in interface TreeModel
public int getIndexOfChild(Object parent, Object child)
getIndexOfChild
in interface TreeModel
public void mkdir(TFile node, boolean recursive) throws 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.IOException
- on any I/O error.public void mv(TFile oldNode, TFile node) throws IOException
oldNode
to node
and updates the tree accordingly.
Note that the current selection may get lost.IOException
- on any I/O error.public void nodeChanged(TFile node)
TreeModelListener.treeNodesChanged(TreeModelEvent)
on all listeners of this TreeModel
.public void nodeInserted(TFile node)
node
already exists, nothing happens.
This method calls TreeModelListener.treeNodesInserted(TreeModelEvent)
on all listeners of this TreeModel
.public void nodeInsertedOrStructureChanged(TFile node)
TreeModelListener.treeNodesInserted(TreeModelEvent)
on all listeners of this TreeModel
.public void nodeRemoved(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(TFile node)
structureChanged(TFile)
.public void removeTreeModelListener(TreeModelListener l)
removeTreeModelListener
in interface TreeModel
l
- The listener to remove.public void rm_r(TFile node) throws IOException
node
and updates the tree accordingly.
Note that the current selection may get lost.IOException
- on any I/O error.public void rm(TFile node) throws IOException
node
and updates the tree accordingly.
Note that the current selection may get lost.IOException
- on any I/O error.public void structureChanged(TFile node)
TreeModelListener.treeStructureChanged(TreeModelEvent)
on all listeners of this TreeModel
.public void valueForPathChanged(TreePath path, Object newValue)
valueForPathChanged
in interface TreeModel
Copyright © 2005–2018 Schlichtherle IT Services. All rights reserved.