|
TrueZIP File* 7.0-rc1 | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectde.schlichtherle.truezip.file.swing.TFileTreeModel
@DefaultAnnotation(value=edu.umd.cs.findbugs.annotations.NonNull.class) public final class TFileTreeModel
A 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.
| Field Summary | |
|---|---|
private Map<TFile,TFile[]> |
cache
Used to cache the contents of directories. |
private Comparator<? super TFile> |
comparator
A comparator for TFile or super classes. |
private FileFilter |
filter
|
private EventListenerList |
listeners
|
private TFile |
root
|
| Constructor Summary | |
|---|---|
TFileTreeModel(TFile root,
FileFilter filter,
Comparator<? super TFile> comparator)
Creates a new TFileTreeModel which browses the specified
root file. |
|
| Method Summary | |
|---|---|
void |
addTreeModelListener(TreeModelListener l)
Adds a listener to this model. |
boolean |
archiveCopyAllTo(TFile oldNode,
TFile node)
Copies oldNode to node recursively, preserving
its last modification time
and updates the tree accordingly. |
boolean |
archiveCopyTo(TFile oldNode,
TFile node)
Copies oldNode to node, preserving
its last modification time
and updates the tree accordingly. |
boolean |
copyAllTo(TFile oldNode,
TFile node)
Copies oldNode to node recursively
and updates the tree accordingly. |
boolean |
copyFrom(TFile node,
InputStream in)
Creates node as a new file with the contents read from
in and updates the tree accordingly. |
boolean |
copyTo(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. |
boolean |
delete(TFile node)
Deletes the file or empty directory node
and updates the tree accordingly. |
boolean |
deleteAll(TFile node)
Deletes the file or (probably not empty) directory node
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. |
(package private) void |
forget(TFile node)
Clears the internal cache associated with node and all
of its children. |
private void |
forget(TFile node,
boolean childrenToo)
Clears the internal cache associated with node. |
TFile |
getChild(Object parent,
int index)
|
int |
getChildCount(Object parent)
|
private TFile[] |
getChildren(TFile parent)
|
int |
getIndexOfChild(Object parent,
Object child)
|
TFile |
getRoot()
|
boolean |
isLeaf(Object node)
|
boolean |
mkdir(TFile node)
Creates node as a new directory
and updates the tree accordingly. |
boolean |
mkdirs(TFile node)
Creates node as a new directory, including all parents,
and updates the tree accordingly. |
private TFile[] |
newPath(TFile node)
Returns an array of TFile objects indicating the path
from the root to the given node. |
private TFile[] |
newPath(TFile node,
int level)
|
(package private) TreePath |
newTreePath(TFile node)
Returns a new TreePath for the given node or
null if node is not part of this file tree or
is null. |
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. |
boolean |
renameTo(TFile oldNode,
TFile newNode)
Renames oldNode to newNode
and updates the tree accordingly. |
void |
structureChanged(TFile node)
Reloads the tree structure for the given node. |
void |
valueForPathChanged(TreePath path,
Object newValue)
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
private final Map<TFile,TFile[]> cache
TFile -> TFile[] instances.
@CheckForNull private final TFile root
@CheckForNull private final FileFilter filter
private final Comparator<? super TFile> comparator
TFile or super classes.
private final EventListenerList listeners
| Constructor Detail |
|---|
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.| Method Detail |
|---|
public TFile getRoot()
getRoot in interface TreeModel
@Nullable
public TFile getChild(Object parent,
int index)
getChild in interface TreeModelpublic int getChildCount(Object parent)
getChildCount in interface TreeModelpublic boolean isLeaf(Object node)
isLeaf in interface TreeModel
public void valueForPathChanged(TreePath path,
Object newValue)
valueForPathChanged in interface TreeModel
public int getIndexOfChild(Object parent,
Object child)
getIndexOfChild in interface TreeModel@Nullable private TFile[] getChildren(TFile parent)
@Nullable TreePath newTreePath(TFile node)
TreePath for the given node or
null if node is not part of this file tree or
is null.
@Nullable private TFile[] newPath(TFile node)
TFile objects indicating the path
from the root to the given node.
node - The TFile object to get the path for.
TFile objects, suitable as a constructor
argument for TreePath or null if
node is not part of this file tree or is
null.
@Nullable
private TFile[] newPath(@CheckForNull
TFile node,
int level)
public boolean createNewFile(TFile node)
throws IOException
node as a new file in the file system
and updates the tree accordingly.
However, the current selection may get lost.
If you would like to create a new file with initial content, please
use copyFrom(de.schlichtherle.truezip.file.TFile, InputStream).
IOException - If an I/O error occurs.public boolean mkdir(TFile node)
node as a new directory
and updates the tree accordingly.
However, the current selection may get lost.
IOException - If an I/O error occurs.public boolean mkdirs(TFile node)
node as a new directory, including all parents,
and updates the tree accordingly.
However, the current selection may get lost.
IOException - If an I/O error occurs.
public boolean copyFrom(TFile node,
InputStream in)
node as a new file with the contents read from
in and updates the tree accordingly.
However, the current selection may get lost.
Note that the given stream is always closed.
IOException - If an I/O error occurs.
public boolean copyTo(TFile oldNode,
TFile node)
oldNode to node
and updates the tree accordingly.
However, the current selection may get lost.
public boolean copyAllTo(TFile oldNode,
TFile node)
oldNode to node recursively
and updates the tree accordingly.
However, the current selection may get lost.
public boolean archiveCopyTo(TFile oldNode,
TFile node)
oldNode to node, preserving
its last modification time
and updates the tree accordingly.
However, the current selection may get lost.
public boolean archiveCopyAllTo(TFile oldNode,
TFile node)
oldNode to node recursively, preserving
its last modification time
and updates the tree accordingly.
However, the current selection may get lost.
public boolean renameTo(TFile oldNode,
TFile newNode)
oldNode to newNode
and updates the tree accordingly.
However, the current selection may get lost.
public boolean delete(TFile node)
node
and updates the tree accordingly.
However, the current selection may get lost.
IOException - If an I/O error occurs.public boolean deleteAll(TFile node)
node
and updates the tree accordingly.
However, the current selection may get lost.
IOException - If an I/O error occurs.public void nodeInsertedOrStructureChanged(TFile node)
TreeModelListener.treeNodesInserted(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 nodeChanged(TFile node)
TreeModelListener.treeNodesChanged(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 structureChanged(TFile node)
TreeModelListener.treeStructureChanged(TreeModelEvent)
on all listeners of this TreeModel.
void forget(TFile node)
node and all
of its children.
private void forget(@Nullable
TFile node,
boolean childrenToo)
node.
childrenToo - If and only if true, the internal
cache for all children is cleared, too.public void addTreeModelListener(TreeModelListener l)
addTreeModelListener in interface TreeModell - The listener to add.public void removeTreeModelListener(TreeModelListener l)
removeTreeModelListener in interface TreeModell - The listener to remove.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.
|
TrueZIP File* 7.0-rc1 | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||