org.gerhardb.lib.filetree
Class DirectoryTreeNode

java.lang.Object
  extended by javax.swing.tree.DefaultMutableTreeNode
      extended by org.gerhardb.lib.filetree.DirectoryTreeNode
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable, javax.swing.tree.MutableTreeNode, 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.

This is ALWAYS a directory and is tested on construction.

See Also:
Serialized Form

Nested Class Summary
 class DirectoryTreeNode.TreeTotals
           
 
Field Summary
protected  int myNodeAllFileCount
           
protected  long myNodeAllFileSize
           
protected  int myNodeDirCount
           
protected  int myNodeImageFileCount
           
protected  long myNodeImageFileSize
           
 
Fields inherited from class javax.swing.tree.DefaultMutableTreeNode
allowsChildren, children, EMPTY_ENUMERATION, parent, userObject
 
Constructor Summary
DirectoryTreeNode(DirectoryTree tree, java.io.File f, ILoadingMessage loadingMsg)
           
 
Method Summary
static void cancelRecursiveLoading()
           
 void decrementFileCount(long newFileSize)
           
 void deleteDir()
           
 java.lang.String getAbsolutePath()
           
 int getDirCountForTree()
           
 java.io.File getDirectory()
           
 java.io.File getFile()
           
 int getImageFileCount()
           
 long getImageFileSize()
           
 java.lang.String getName()
           
 int getTotalFileCount()
           
 long getTotalFileSize()
           
 DirectoryTreeNode.TreeTotals getTreeTotals()
           
 void incrementFileCount(long newFileSize)
           
static void main(java.lang.String[] args)
           
 void newSubDir()
           
 void populate(ILoadingMessage loadingMsg)
           
 void recount()
           
 void reloadNodes(ModalProgressDialogFlex flex)
           
 void reloadNodes(java.awt.Window topWindow)
           
 void renameDir()
           
static void resetRecursiveLoading()
           
 java.lang.String toString()
           
 
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, isLeaf, 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
 

Field Detail

myNodeDirCount

protected int myNodeDirCount

myNodeAllFileCount

protected int myNodeAllFileCount

myNodeImageFileCount

protected int myNodeImageFileCount

myNodeAllFileSize

protected long myNodeAllFileSize

myNodeImageFileSize

protected long myNodeImageFileSize
Constructor Detail

DirectoryTreeNode

public DirectoryTreeNode(DirectoryTree tree,
                         java.io.File f,
                         ILoadingMessage loadingMsg)
                  throws java.io.FileNotFoundException
Throws:
java.io.FileNotFoundException
Method Detail

cancelRecursiveLoading

public static void cancelRecursiveLoading()

resetRecursiveLoading

public static void resetRecursiveLoading()

getDirectory

public java.io.File getDirectory()

getAbsolutePath

public java.lang.String getAbsolutePath()

getFile

public java.io.File getFile()

getName

public java.lang.String getName()

getDirCountForTree

public int getDirCountForTree()

getTotalFileCount

public int getTotalFileCount()

getImageFileCount

public int getImageFileCount()

getTotalFileSize

public long getTotalFileSize()

getImageFileSize

public long getImageFileSize()

getTreeTotals

public DirectoryTreeNode.TreeTotals getTreeTotals()

populate

public void populate(ILoadingMessage loadingMsg)

recount

public void recount()

incrementFileCount

public void incrementFileCount(long newFileSize)

decrementFileCount

public void decrementFileCount(long newFileSize)

reloadNodes

public void reloadNodes(java.awt.Window topWindow)

reloadNodes

public void reloadNodes(ModalProgressDialogFlex flex)

newSubDir

public void newSubDir()

renameDir

public void renameDir()

deleteDir

public void deleteDir()

toString

public java.lang.String toString()
Overrides:
toString in class javax.swing.tree.DefaultMutableTreeNode

main

public static void main(java.lang.String[] args)


Copyright ? 2007 Gerhard Beck. All rights reserved. Subject to GPL.