|
TrueZIP File* 7.0-rc1 | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectjava.awt.Component
java.awt.Container
javax.swing.JComponent
javax.swing.JTree
de.schlichtherle.truezip.file.swing.TFileTree
@DefaultAnnotation(value=edu.umd.cs.findbugs.annotations.NonNull.class) public final class TFileTree
A custom JTree to browse files and directories.
There are a couple of file creation/modification/removal methods added
which notify the tree of any changes in the file system and update the
current path expansions and selection.
| Nested Class Summary | |
|---|---|
private class |
TFileTree.Controller
|
private static class |
TFileTree.FileComparator
Compares two files by their status and path name, so that directories are always ordered before other files. |
| Nested classes/interfaces inherited from class javax.swing.JTree |
|---|
JTree.AccessibleJTree, JTree.DropLocation, JTree.DynamicUtilTreeNode, JTree.EmptySelectionModel, JTree.TreeModelHandler, JTree.TreeSelectionRedirector |
| Nested classes/interfaces inherited from class javax.swing.JComponent |
|---|
JComponent.AccessibleJComponent |
| Nested classes/interfaces inherited from class java.awt.Container |
|---|
Container.AccessibleAWTContainer |
| Nested classes/interfaces inherited from class java.awt.Component |
|---|
Component.AccessibleAWTComponent, Component.BaselineResizeBehavior, Component.BltBufferStrategy, Component.FlipBufferStrategy |
| Field Summary | |
|---|---|
private static Collator |
COLLATOR
A collator for file names which considers case according to the platform's standard. |
private TFileTree.Controller |
controller
|
private String |
defaultSuffix
|
private boolean |
displayingSuffixes
|
private TFile |
editedNode
|
private boolean |
editingSuffixes
|
static Comparator<TFile> |
FILE_NAME_COMPARATOR
A comparator which sorts directory entries to the beginning. |
private static String |
PROPERTY_DEFAULT_SUFFIX
The name of the property defaultSuffix. |
private static String |
PROPERTY_DISPLAYING_SUFFIXES
The name of the property displayingSuffixes. |
private static String |
PROPERTY_EDITING_SUFFIXES
The name of the property editingSuffixes. |
private static long |
serialVersionUID
|
| Fields inherited from class javax.swing.JComponent |
|---|
accessibleContext, listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW |
| Fields inherited from class java.awt.Component |
|---|
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT |
| Fields inherited from interface java.awt.image.ImageObserver |
|---|
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH |
| Constructor Summary | |
|---|---|
TFileTree()
Creates an empty TFileTree with no root. |
|
TFileTree(TFile root)
Creates a new TFileTree which traverses the given
root root file. |
|
TFileTree(TFileTreeModel model)
Creates a new TFileTree which traverses the given
TFileTreeModel. |
|
| Method Summary | |
|---|---|
boolean |
archiveCopyAllTo(TFile oldNode,
TFile node)
Forwards the call to the TFileTreeModel
and scrolls the tree so that the recursively copied node
is selected and visible. |
boolean |
archiveCopyTo(TFile oldNode,
TFile node)
Forwards the call to the TFileTreeModel
and scrolls the tree so that the copied node
is selected and visible. |
void |
cancelEditing()
|
String |
convertValueToText(Object value,
boolean selected,
boolean expanded,
boolean leaf,
int row,
boolean hasFocus)
|
boolean |
copyAllTo(TFile oldNode,
TFile node)
Forwards the call to the TFileTreeModel
and scrolls the tree so that the recursively copied node
is selected and visible. |
boolean |
copyFrom(TFile node,
InputStream in)
Forwards the call to the TFileTreeModel
and scrolls the tree so that the copied node
is selected and visible. |
boolean |
copyTo(TFile oldNode,
TFile node)
Forwards the call to the TFileTreeModel
and scrolls the tree so that the copied node
is selected and visible. |
boolean |
createNewFile(TFile node)
Forwards the call to the TFileTreeModel
and scrolls the tree so that the newly created file
is selected and visible. |
boolean |
delete(TFile node)
Forwards the call to the TFileTreeModel
and scrolls the tree so that the successor to the deleted node
is selected and visible. |
boolean |
deleteAll(TFile node)
Forwards the call to the TFileTreeModel
and scrolls the tree so that the successor to the deleted node
is selected and visible. |
String |
getDefaultSuffix()
Getter for bound property defaultSuffix. |
(package private) TFile |
getEditedNode()
Returns the node that is currently edited, if any. |
TFileTreeModel |
getModel()
|
private String |
getSuffix(String base)
|
boolean |
isDisplayingSuffixes()
Getter for bound property displayingSuffixes. |
boolean |
isEditing()
|
boolean |
isEditingSuffixes()
Getter for bound property editingSuffixes. |
boolean |
mkdir(TFile node)
Forwards the call to the TFileTreeModel
and scrolls the tree so that the newly created directory
is selected and visible. |
boolean |
mkdirs(TFile node)
Forwards the call to the TFileTreeModel
and scrolls the tree so that the newly created directory
is selected and visible. |
protected void |
onEditingStopped(ChangeEvent evt)
Called when the editing of a cell has been stopped. |
void |
refresh()
Refreshes the entire tree, restores the expanded and selected paths and scrolls to the lead selection path if necessary. |
void |
refresh(TFile node)
Refreshes the subtree for the given node, restores the expanded and selected paths and scrolls to the lead selection path if necessary. |
void |
refresh(TreePath[] paths)
Refreshes the subtree for the given paths, restores the expanded and selected paths and scrolls to the lead selection path if necessary. |
boolean |
renameTo(TFile oldNode,
TFile node)
Forwards the call to the TFileTreeModel,
restores the expanded paths, selects node and scrolls to
it if necessary. |
void |
scrollNodeToVisible(TFile node)
|
void |
setDefaultSuffix(String defaultSuffix)
Setter for bound property defaultSuffixes. |
void |
setDisplayingSuffixes(boolean displayingSuffixes)
Setter for bound property displayingSuffixes. |
void |
setEditable(boolean editable)
|
void |
setEditingSuffixes(boolean editingSuffixes)
Setter for bound property editingSuffixes. |
private void |
setExpandedDescendants(Enumeration<TreePath> expansions)
|
void |
setModel(TreeModel model)
|
void |
setSelectionNode(TFile node)
|
void |
setSelectionNodes(TFile[] nodes)
|
void |
startEditingAtPath(TreePath path)
|
boolean |
stopEditing()
|
private TreePath |
substPath(TreePath tp,
TreePath oldPath,
TreePath path)
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
private static final Collator COLLATOR
public static final Comparator<TFile> FILE_NAME_COMPARATOR
private static final String PROPERTY_DISPLAYING_SUFFIXES
displayingSuffixes.
private static final String PROPERTY_EDITING_SUFFIXES
editingSuffixes.
private static final String PROPERTY_DEFAULT_SUFFIX
defaultSuffix.
private static final long serialVersionUID
private final TFileTree.Controller controller
private boolean displayingSuffixes
private boolean editingSuffixes
@CheckForNull private String defaultSuffix
@CheckForNull private TFile editedNode
| Constructor Detail |
|---|
public TFileTree()
TFileTree with no root.
You shouldn't use this constructor.
It's only provided to implement the JavaBean pattern.
public TFileTree(TFile root)
TFileTree which traverses the given
root root file.
public TFileTree(TFileTreeModel model)
TFileTree which traverses the given
TFileTreeModel.
| Method Detail |
|---|
public TFileTreeModel getModel()
getModel in class JTreepublic void setModel(TreeModel model)
setModel in class JTreeClassCastException - if model is not an instance
of TFileTreeModel.public void setEditable(boolean editable)
setEditable in class JTreepublic boolean isDisplayingSuffixes()
public void setDisplayingSuffixes(boolean displayingSuffixes)
false, the suffix of files will not be displayed
in this tree.
Defaults to true.
displayingSuffixes - New value of property displayingSuffixes.public boolean isEditingSuffixes()
public void setEditingSuffixes(boolean editingSuffixes)
false, the suffix of a file will be truncated
before editing its name starts.
Defaults to true.
editingSuffixes - New value of property editingSuffixes.@Nullable public String getDefaultSuffix()
public void setDefaultSuffix(@CheckForNull
String defaultSuffix)
null and is ignored for
directories.
defaultSuffix - The new default suffix.
If not null, this parameter is fixed to always
start with a '.'.@Nullable TFile getEditedNode()
public boolean isEditing()
isEditing in class JTreepublic void startEditingAtPath(TreePath path)
startEditingAtPath in class JTreepublic void cancelEditing()
cancelEditing in class JTreepublic boolean stopEditing()
stopEditing in class JTreeprotected void onEditingStopped(ChangeEvent evt)
evt - The change event passed to
CellEditorListener.editingStopped(ChangeEvent).@Nullable private String getSuffix(String base)
public String convertValueToText(Object value,
boolean selected,
boolean expanded,
boolean leaf,
int row,
boolean hasFocus)
convertValueToText in class JTreepublic void refresh()
public void refresh(TFile node)
node - The file or directory to refresh.
This may not be null.public void refresh(TreePath[] paths)
paths - The array of TreePaths to refresh.
This may be null.private void setExpandedDescendants(Enumeration<TreePath> expansions)
public boolean createNewFile(TFile node)
throws IOException
TFileTreeModel
and scrolls the tree so that the newly created file
is selected and visible.
If you would like to create a new file with initial content, please
check copyFrom(de.schlichtherle.truezip.file.TFile, InputStream).
IOExceptionpublic boolean mkdir(TFile node)
TFileTreeModel
and scrolls the tree so that the newly created directory
is selected and visible.
public boolean mkdirs(TFile node)
TFileTreeModel
and scrolls the tree so that the newly created directory
is selected and visible.
public boolean copyFrom(TFile node,
InputStream in)
TFileTreeModel
and scrolls the tree so that the copied node
is selected and visible.
public boolean copyTo(TFile oldNode,
TFile node)
TFileTreeModel
and scrolls the tree so that the copied node
is selected and visible.
public boolean copyAllTo(TFile oldNode,
TFile node)
TFileTreeModel
and scrolls the tree so that the recursively copied node
is selected and visible.
public boolean archiveCopyTo(TFile oldNode,
TFile node)
TFileTreeModel
and scrolls the tree so that the copied node
is selected and visible.
public boolean archiveCopyAllTo(TFile oldNode,
TFile node)
TFileTreeModel
and scrolls the tree so that the recursively copied node
is selected and visible.
public boolean renameTo(TFile oldNode,
TFile node)
TFileTreeModel,
restores the expanded paths, selects node and scrolls to
it if necessary.
private TreePath substPath(TreePath tp,
TreePath oldPath,
TreePath path)
public boolean delete(TFile node)
TFileTreeModel
and scrolls the tree so that the successor to the deleted node
is selected and visible.
public boolean deleteAll(TFile node)
TFileTreeModel
and scrolls the tree so that the successor to the deleted node
is selected and visible.
public void setSelectionNode(TFile node)
public void setSelectionNodes(TFile[] nodes)
public void scrollNodeToVisible(TFile node)
|
TrueZIP File* 7.0-rc1 | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||