weka.gui.ensembleLibraryEditor.tree
Class DefaultNode

java.lang.Object
  extended by javax.swing.tree.DefaultMutableTreeNode
      extended by weka.gui.ensembleLibraryEditor.tree.DefaultNode
All Implemented Interfaces:
java.beans.PropertyChangeListener, java.io.Serializable, java.lang.Cloneable, java.util.EventListener, javax.swing.tree.MutableTreeNode, javax.swing.tree.TreeNode

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

This class is responsible for representing objects that we haven't explicitly written custom tree node editors for. In other words - Objects that are "weird". It didn't make sense for us to try to come up with a nice tree representation for absolutely everything, e.g. CostMatrixes or ArrayLists. This class is responsible for representing Classifier parameter values that are not numbers, an enumeration of values (e.g. true/false), or Objects that have their own GenericObjectEditors (like other Classifiers). So in these cases we can just use the default editor that came with the object.

Version:
$Revision: 1.1 $
Author:
Robert Jung (mrbobjung@gmail.com)
See Also:
Serialized Form

Field Summary
 
Fields inherited from class javax.swing.tree.DefaultMutableTreeNode
EMPTY_ENUMERATION
 
Constructor Summary
DefaultNode(java.lang.String name, java.lang.String toolTipText, java.lang.Object value, java.beans.PropertyEditor propertyEditor)
          The constructor initializes the members of this node.
 
Method Summary
 java.beans.PropertyEditor getEditor()
          this returns the property editor that was provided for this object.
 java.lang.String getName()
          gets the name of the parameter value represented by this node
 java.lang.String getToolTipText()
          getter for the tooltip text
 void propertyChange(java.beans.PropertyChangeEvent evt)
          This implements the PropertyChangeListener for this node that gets registered with its Editor.
 void setUserObject(java.lang.Object o)
          this is a simple filter for the setUserObject method.
 java.lang.String toString()
          ToString method simply prints out the user object toString for this 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, 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
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

DefaultNode

public DefaultNode(java.lang.String name,
                   java.lang.String toolTipText,
                   java.lang.Object value,
                   java.beans.PropertyEditor propertyEditor)
The constructor initializes the members of this node.

Parameters:
name - the name of the value represented by this node
toolTipText - the tool tip text to be displayed
value - the intial value
propertyEditor - the editor provided for this node
Method Detail

getEditor

public java.beans.PropertyEditor getEditor()
this returns the property editor that was provided for this object. This propertyEditor object is initially chosen inside of the GenericObjectNode updateTree() method if you are interested in where it comes from.

Returns:
the default editor for this node

getToolTipText

public java.lang.String getToolTipText()
getter for the tooltip text

Returns:
tooltip text

getName

public java.lang.String getName()
gets the name of the parameter value represented by this node

Returns:
the name of this parameter

setUserObject

public void setUserObject(java.lang.Object o)
this is a simple filter for the setUserObject method. We basically don't want null values to be passed in.

Specified by:
setUserObject in interface javax.swing.tree.MutableTreeNode
Overrides:
setUserObject in class javax.swing.tree.DefaultMutableTreeNode
Parameters:
o - the user object

toString

public java.lang.String toString()
ToString method simply prints out the user object toString for this node

Overrides:
toString in class javax.swing.tree.DefaultMutableTreeNode
Returns:
a string representation

propertyChange

public void propertyChange(java.beans.PropertyChangeEvent evt)
This implements the PropertyChangeListener for this node that gets registered with its Editor. All we really have to do is change the Object value stored internally at this node when its editor says the value changed.

Specified by:
propertyChange in interface java.beans.PropertyChangeListener
Parameters:
evt - the event