org.bioquery.gui
Class BQTreeNode

java.lang.Object
  |
  +--javax.swing.tree.DefaultMutableTreeNode
        |
        +--org.bioquery.gui.BQTreeNode
All Implemented Interfaces:
java.lang.Cloneable, javax.swing.tree.MutableTreeNode, java.io.Serializable, javax.swing.tree.TreeNode

public class BQTreeNode
extends javax.swing.tree.DefaultMutableTreeNode

A MutableTreeNode customized to present files and directories. This TreeNode is initialized by a file path String and determines whether a node is a file or directory based on whether the path ends with a FileSeparator character. Files are automatically leaves, while directories are not.

Author:
James Brundege
See Also:
Serialized Form

Fields inherited from class javax.swing.tree.DefaultMutableTreeNode
allowsChildren, children, EMPTY_ENUMERATION, parent, userObject
 
Constructor Summary
BQTreeNode()
           
BQTreeNode(java.lang.Object userObject)
           
BQTreeNode(java.lang.Object userObject, boolean allowsChildren)
           
 
Method Summary
 java.lang.String getFilePath()
           
 java.lang.String getFileSeparator()
           
 boolean getIsLoaded()
           
 boolean getModifiable()
           
 boolean isLeaf()
          Overrides parent method to link the isLeaf() designation with the getAllowsChildren() designation, which should ideally be explicitly set in the constructor.
 void setFileSeparator(java.lang.String separator)
           
 void setIsLoaded(boolean loaded)
           
 void setModifiable(boolean canModify)
           
 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, 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
 

Constructor Detail

BQTreeNode

public BQTreeNode()

BQTreeNode

public BQTreeNode(java.lang.Object userObject)

BQTreeNode

public BQTreeNode(java.lang.Object userObject,
                  boolean allowsChildren)
Method Detail

isLeaf

public boolean isLeaf()
Overrides parent method to link the isLeaf() designation with the getAllowsChildren() designation, which should ideally be explicitly set in the constructor.

This has the effect of declaring any node that can have children as a node, rather than a leaf, even if it has no children yet. Only nodes declared terminal with no potential children are leaves. This reverses the default implementation of DefaultMutableTreeNode to one more compatible with a file system, where there is a clear distinction between files and directories.
Overrides:
isLeaf in class javax.swing.tree.DefaultMutableTreeNode

getFileSeparator

public java.lang.String getFileSeparator()

setFileSeparator

public void setFileSeparator(java.lang.String separator)

getIsLoaded

public boolean getIsLoaded()

setIsLoaded

public void setIsLoaded(boolean loaded)

getModifiable

public boolean getModifiable()

setModifiable

public void setModifiable(boolean canModify)

getFilePath

public java.lang.String getFilePath()

toString

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