org.gerhardb.lib.filetree
Class DirectoryTreeNode
java.lang.Object
javax.swing.tree.DefaultMutableTreeNode
org.gerhardb.lib.filetree.DirectoryTreeNode
- All Implemented Interfaces:
- java.lang.Cloneable, javax.swing.tree.MutableTreeNode, java.io.Serializable, javax.swing.tree.TreeNode
- public class DirectoryTreeNode
- extends javax.swing.tree.DefaultMutableTreeNode
A directory node designed to count its files and populate
all of its sub-directories.
The sub-directory population occurs in a depth-first fashion.
Specifically, for a given root, its children are identified and files counted.
Then the same recursively occurs for each sub-directory of the root.
This allows the highest level directory to be displayed immediately while
other directories are populating. If a user chooses an unpopulated
sub-directory, then that sub-directory is immediately populated, but its
children are not recursed until the normal time.
Hence this can have serveral states:
UNPOPULATED - no population has beguon.
POPULATING - counting the files and subdirectories for this node.
POPULATED - finished counting files and subdirectories for this node,
but have not started on recursive subdirectory population.
KIDS_POPULATING - POPULATED plus recursion of kids has started.
KIDS_POPULATED - Fully populated for this node.
This is ALWAYS a directory and is tested on construction.
- See Also:
- Serialized Form
Fields inherited from class javax.swing.tree.DefaultMutableTreeNode |
allowsChildren, children, EMPTY_ENUMERATION, parent, userObject |
Methods inherited from class javax.swing.tree.DefaultMutableTreeNode |
add, breadthFirstEnumeration, children, clone, depthFirstEnumeration, getAllowsChildren, getChildAfter, getChildAt, getChildBefore, getChildCount, getDepth, getFirstChild, getFirstLeaf, getIndex, getLastChild, getLastLeaf, getLeafCount, getLevel, getNextLeaf, getNextNode, getNextSibling, getParent, getPath, getPathToRoot, getPreviousLeaf, getPreviousNode, getPreviousSibling, getRoot, getSharedAncestor, getSiblingCount, getUserObject, getUserObjectPath, insert, isNodeAncestor, isNodeChild, isNodeDescendant, isNodeRelated, isNodeSibling, isRoot, pathFromAncestorEnumeration, postorderEnumeration, preorderEnumeration, remove, remove, removeAllChildren, removeFromParent, setAllowsChildren, setParent, setUserObject |
Methods inherited from class java.lang.Object |
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
UNPOPULATED
public static final int UNPOPULATED
- See Also:
- Constant Field Values
POPULATING
public static final int POPULATING
- See Also:
- Constant Field Values
POPULATED
public static final int POPULATED
- See Also:
- Constant Field Values
KIDS_POPULATING
public static final int KIDS_POPULATING
- See Also:
- Constant Field Values
KIDS_POPULATED
public static final int KIDS_POPULATED
- See Also:
- Constant Field Values
myStatus
protected int myStatus
myTree
protected DirectoryTree myTree
myDisplayName
protected java.lang.String myDisplayName
myDirectory
protected java.io.File myDirectory
myFileCount
protected int myFileCount
DirectoryTreeNode
public DirectoryTreeNode(DirectoryTree tree,
java.io.File f)
throws java.io.FileNotFoundException
cancelRecursiveLoading
public static void cancelRecursiveLoading()
resetRecursiveLoading
public static void resetRecursiveLoading()
status
public int status()
isLeaf
public boolean isLeaf()
getAbsolutePath
public java.lang.String getAbsolutePath()
getFile
public java.io.File getFile()
getName
public java.lang.String getName()
incrementChildCount
public void incrementChildCount()
decrementChildCount
public void decrementChildCount()
quickPopulate
public void quickPopulate()
doChildCount
public void doChildCount()
recount
public void recount()
addNode
public void addNode(java.lang.String dirName)
- Adding a new file or directory after constructing the FileTree.
Returns the index of the inserted node.
newSubDir
public void newSubDir()
renameDir
public void renameDir()
deleteDir
public void deleteDir()
updateTreeLabels
public void updateTreeLabels()
toString
public java.lang.String toString()
Copyright © 2002 Gerhard Beck. All rights reserved. Subject to GPL.