magi.toolkit.dialogs.dirchooser
Class DirectoryNode

java.lang.Object
  |
  +--javax.swing.tree.DefaultMutableTreeNode
        |
        +--magi.toolkit.dialogs.dirchooser.DirectoryNode
All Implemented Interfaces:
java.lang.Cloneable, java.lang.Comparable, javax.swing.tree.MutableTreeNode, java.io.Serializable, javax.swing.tree.TreeNode

public class DirectoryNode
extends javax.swing.tree.DefaultMutableTreeNode
implements java.lang.Comparable

DirectoryNode is a thin wrapper for DefaultMutableTreeNode, to create nodes of the DirectoryChooser tree view. This class adds an 'icon type' which can be used to set the icon in the tree to different display values. Also maintains the node's 'children loaded' status for load-on-demand tree building.

Author:
Paul Atkinson, Magi Systems Pty Ltd.
See Also:
Serialized Form

Field Summary
static int ICONTYPE_DIRECTORY
           
static int ICONTYPE_DRIVE
           
static int ICONTYPE_MY_COMPUTER
           
 
Fields inherited from class javax.swing.tree.DefaultMutableTreeNode
allowsChildren, children, EMPTY_ENUMERATION, parent, userObject
 
Constructor Summary
DirectoryNode(int iconType, java.lang.String dirName, java.lang.String fullPath, boolean allowsChildren)
          Create a new directory node.
 
Method Summary
 boolean childrenAreLoaded()
          Returns true if the child nodes of this parent have already been loaded.
 int compareTo(java.lang.Object o)
          Comparitor used to sort directories in the list.
 java.lang.String getFullPath()
          Returns the full path required to navigate to this directory on the drive.
 int getIconType()
          Returns the icon type for this node.
 void setChildrenLoaded(boolean loaded)
          Sets the 'children loaded' flag once all child nodes have been loaded into this parent node.
 
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, toString
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

ICONTYPE_MY_COMPUTER

public static final int ICONTYPE_MY_COMPUTER
See Also:
Constant Field Values

ICONTYPE_DRIVE

public static final int ICONTYPE_DRIVE
See Also:
Constant Field Values

ICONTYPE_DIRECTORY

public static final int ICONTYPE_DIRECTORY
See Also:
Constant Field Values
Constructor Detail

DirectoryNode

public DirectoryNode(int iconType,
                     java.lang.String dirName,
                     java.lang.String fullPath,
                     boolean allowsChildren)
Create a new directory node.

Parameters:
iconType - the icon to display, one of the ICONTYPE constants defined in this class.
dirName - the name of this directory node (to display for the user).
fullPath - the full directory path to this node on the drive.
allowsChildren - is true when child nodes are allowed to be added.
Method Detail

getIconType

public int getIconType()
Returns the icon type for this node. One of the ICONTYPE constants defined in this class.


setChildrenLoaded

public void setChildrenLoaded(boolean loaded)
Sets the 'children loaded' flag once all child nodes have been loaded into this parent node.


childrenAreLoaded

public boolean childrenAreLoaded()
Returns true if the child nodes of this parent have already been loaded. Child nodes are only loaded on demand (as needed).


getFullPath

public java.lang.String getFullPath()
Returns the full path required to navigate to this directory on the drive.


compareTo

public int compareTo(java.lang.Object o)
Comparitor used to sort directories in the list.

Specified by:
compareTo in interface java.lang.Comparable