org.concord.biologica.ui
Class TreeViewNode

java.lang.Object
  |
  +--javax.swing.tree.DefaultMutableTreeNode
        |
        +--org.concord.biologica.ui.TreeViewNode
All Implemented Interfaces:
java.lang.Cloneable, java.util.EventListener, javax.swing.tree.MutableTreeNode, java.beans.PropertyChangeListener, java.io.Serializable, javax.swing.tree.TreeNode

public final class TreeViewNode
extends javax.swing.tree.DefaultMutableTreeNode
implements java.beans.PropertyChangeListener

A node of the tree in the left hand panel of the Species main window.

Every node has a corresponding EngineObject. The visible manifestation of the node will show the textual representation of the object, perhaps a symbol indicating the type of object (e.g. species, chromosome, etc.) and the parents and children of the object.

Child nodes are created when getChildCount() or isLeaf() is called, not when the node is initially created.

Version:
$Revision: 1.1.1.1 $ $Date: 2001/04/28 00:39:21 $
Author:
$Author: ed $
See Also:
Serialized Form

Field Summary
static int CHARACTERISTIC_NODE_TYPE
           
static int ENVIRONMENT_NODE_TYPE
           
static int GENE_NODE_TYPE
           
static int ORGANISM_ALLELE_NODE_TYPE
           
static int ORGANISM_ALLELE_PAIR_NODE_TYPE
           
static int ORGANISM_CHROMOSOME_NODE_TYPE
           
static int ORGANISM_CHROMOSOME_PAIR_NODE_TYPE
           
static int ORGANISM_NODE_TYPE
           
static int RULE_NODE_TYPE
           
static int SPECIES_ALLELE_NODE_TYPE
           
static int SPECIES_CHROMOSOME_NODE_TYPE
           
static int SPECIES_IMAGE_COLUMN_NODE_TYPE
           
static int SPECIES_IMAGE_NODE_TYPE
           
static int SPECIES_IMAGE_ROW_NODE_TYPE
           
static int SPECIES_NODE_TYPE
           
static int TERRAIN_NODE_TYPE
           
static int TRAIT_NODE_TYPE
           
static int WORLD_NODE_TYPE
          Node types, assuming the tree looks like world | +- species 1 | | | +- chromosome 1 of species 1 | | | | | +- gene 1 of species 1 on chromosome 1 | | | | | | | +- allele 1 of gene 1 of species 1 on chromosome 1 | | | +- allele 2 of gene 1 of species 1 on chromosome 1 | | | | | +- gene 2 of species 1 on chromosome 1 | | | | | +- allele 1 of gene 2 of species 1 on chromosome 1 | | +- allele 2 of gene 2 of species 1 on chromosome 1 | | | +- chromosome 2 of species 1 | | | | | +- gene 3 of species 1 on chromosome 2 | | | | | | | +- allele 1 of gene 3 of species 1 on chromosome 2 | | | +- allele 2 of gene 3 of species 1 on chromosome 2 | | | | | +- gene 4 of species 1 on chromosome 2 | | | | | +- allele 1 of gene 4 of species 1 on chromosome 2 | | +- allele 2 of gene 4 of species 1 on chromosome 2 | | | +- other chromosomes ...
 
Fields inherited from class javax.swing.tree.DefaultMutableTreeNode
allowsChildren, children, EMPTY_ENUMERATION, parent, userObject
 
Constructor Summary
TreeViewNode(TreeView aTreeView, EngineObject anEngineObject)
          Constructs a new TreeViewNode object.
 
Method Summary
protected  void createChildNodes()
          Create the child nodes of this node.
 javax.swing.tree.TreeNode getChildAt(int index)
          Return the child at the given index.
 int getChildCount()
          Return the number of children.
 boolean getHasFocus()
          Get whether this node has focus.
 int getNodeType()
          Returns node type of this node.
 boolean isLeaf()
          Returns if this node is a leaf node (has no children) or not.
 boolean isLocked()
          Return the locked state of this node.
 boolean isSelected()
          Return the selected state of this node
 void propertyChange(java.beans.PropertyChangeEvent event)
          Handle property change events
 void setHasFocus(boolean hasFocus)
          Set whether this node has focus.
 void setSelected(boolean aSelected)
          Set the selected state of this node.
 java.lang.String toString()
          Get the string corresponding to this node.
 
Methods inherited from class javax.swing.tree.DefaultMutableTreeNode
add, breadthFirstEnumeration, children, clone, depthFirstEnumeration, getAllowsChildren, getChildAfter, getChildBefore, 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
 

Field Detail

WORLD_NODE_TYPE

public static final int WORLD_NODE_TYPE
Node types, assuming the tree looks like world | +- species 1 | | | +- chromosome 1 of species 1 | | | | | +- gene 1 of species 1 on chromosome 1 | | | | | | | +- allele 1 of gene 1 of species 1 on chromosome 1 | | | +- allele 2 of gene 1 of species 1 on chromosome 1 | | | | | +- gene 2 of species 1 on chromosome 1 | | | | | +- allele 1 of gene 2 of species 1 on chromosome 1 | | +- allele 2 of gene 2 of species 1 on chromosome 1 | | | +- chromosome 2 of species 1 | | | | | +- gene 3 of species 1 on chromosome 2 | | | | | | | +- allele 1 of gene 3 of species 1 on chromosome 2 | | | +- allele 2 of gene 3 of species 1 on chromosome 2 | | | | | +- gene 4 of species 1 on chromosome 2 | | | | | +- allele 1 of gene 4 of species 1 on chromosome 2 | | +- allele 2 of gene 4 of species 1 on chromosome 2 | | | +- other chromosomes ... | | | +- trait 1 of species 1 | | | | | +- characteristic 1 of trait 1 | | +- characteristic 2 of trait 1 | | | +- trait 2 of species 1 | | | | | +- characteristic 1 of trait 2 | | +- characteristic 2 of trait 2 | | | +- other traits... | | | +- rule 1 of species 1 | +- rule 2 of species 1 | +- other rules... | | | +- species image 1 of species 1 | | | | | +- species image column 1 of species image 1 | | +- species image column 2 of species image 1 | | +- other species image columns... | | | | | +- species image row 1 of species image 1 | | +- species image row 2 of species image 1 | | +- other species image rows... | | | +- species image 2 of species 1 | | | | | +- species image column 1 of species image 2 | | +- species image column 2 of species image 2 | | +- other species image columns... | | | | | +- species image row 1 of species image 2 | | +- species image row 2 of species image 2 | | +- other species image rows... | | | +- other species images, species image columns and rows... | +- species 2 | | | +- ... | +- organism 1 | | | +- organism chromosome pair 1 | | | | | +- organism allele pair 1 | | +- organism allele pair 2 | | +- other organism allele pairs... | | | +- organism chromosome pair 2 | +- other organism chromosome pairs... | +- organism 2 +- ... | +- terrain 1 +- terrain 2 +- ... | +- environment 1 +- environment 2 +- ...

SPECIES_NODE_TYPE

public static final int SPECIES_NODE_TYPE

SPECIES_CHROMOSOME_NODE_TYPE

public static final int SPECIES_CHROMOSOME_NODE_TYPE

GENE_NODE_TYPE

public static final int GENE_NODE_TYPE

SPECIES_ALLELE_NODE_TYPE

public static final int SPECIES_ALLELE_NODE_TYPE

RULE_NODE_TYPE

public static final int RULE_NODE_TYPE

TRAIT_NODE_TYPE

public static final int TRAIT_NODE_TYPE

CHARACTERISTIC_NODE_TYPE

public static final int CHARACTERISTIC_NODE_TYPE

ENVIRONMENT_NODE_TYPE

public static final int ENVIRONMENT_NODE_TYPE

ORGANISM_NODE_TYPE

public static final int ORGANISM_NODE_TYPE

TERRAIN_NODE_TYPE

public static final int TERRAIN_NODE_TYPE

SPECIES_IMAGE_NODE_TYPE

public static final int SPECIES_IMAGE_NODE_TYPE

SPECIES_IMAGE_COLUMN_NODE_TYPE

public static final int SPECIES_IMAGE_COLUMN_NODE_TYPE

SPECIES_IMAGE_ROW_NODE_TYPE

public static final int SPECIES_IMAGE_ROW_NODE_TYPE

ORGANISM_CHROMOSOME_NODE_TYPE

public static final int ORGANISM_CHROMOSOME_NODE_TYPE

ORGANISM_ALLELE_NODE_TYPE

public static final int ORGANISM_ALLELE_NODE_TYPE

ORGANISM_CHROMOSOME_PAIR_NODE_TYPE

public static final int ORGANISM_CHROMOSOME_PAIR_NODE_TYPE

ORGANISM_ALLELE_PAIR_NODE_TYPE

public static final int ORGANISM_ALLELE_PAIR_NODE_TYPE
Constructor Detail

TreeViewNode

public TreeViewNode(TreeView aTreeView,
                    EngineObject anEngineObject)
Constructs a new TreeViewNode object.

Parameters:
aTreeView - TreeView - tree view containing this node
anEngineObject - EngineObject - the object for this node, may not be null
Throws:
java.lang.IllegalArgumentException - - input argument(s) illegal
Method Detail

isLeaf

public boolean isLeaf()
Returns if this node is a leaf node (has no children) or not.

Overrides:
isLeaf in class javax.swing.tree.DefaultMutableTreeNode
Returns:
boolean - true if node is a leaf, else false

getChildCount

public int getChildCount()
Return the number of children.

Overrides:
getChildCount in class javax.swing.tree.DefaultMutableTreeNode
Returns:
int - number of children

getChildAt

public javax.swing.tree.TreeNode getChildAt(int index)
Return the child at the given index.

We override this method to ensure that the child nodes are created.

Overrides:
getChildAt in class javax.swing.tree.DefaultMutableTreeNode
Parameters:
index - int - child index
Returns:
the TreeNode in this node's child array at the specified index

createChildNodes

protected void createChildNodes()
Create the child nodes of this node.

Called when we know we finally need to create child nodes, presumably because some event occurred where we need to show the child nodes.


toString

public java.lang.String toString()
Get the string corresponding to this node.
Overrides:
toString in class javax.swing.tree.DefaultMutableTreeNode
Returns:
String - string to be displayed for this node.

getNodeType

public int getNodeType()
Returns node type of this node.

Returns:
int - node type - one of above values

getHasFocus

public boolean getHasFocus()
Get whether this node has focus.

Returns:
boolean - true if has focus, false if doesn't have focus

setHasFocus

public void setHasFocus(boolean hasFocus)
Set whether this node has focus.

Parameters:
hasFocus - boolean - true if has focus, false if doesn't have focus

isSelected

public boolean isSelected()
Return the selected state of this node
Returns:
boolean - selected state of this node (true == selected)

setSelected

public void setSelected(boolean aSelected)
Set the selected state of this node.

Parameters:
aSelected - boolean - selected state of this node

isLocked

public boolean isLocked()
Return the locked state of this node.
Returns:
boolean - locked state of this node

propertyChange

public void propertyChange(java.beans.PropertyChangeEvent event)
Handle property change events
Specified by:
propertyChange in interface java.beans.PropertyChangeListener
Parameters:
event - PropertyChangeEvent - the property change event