weka.gui.ensembleLibraryEditor.tree
Class PropertyNode

java.lang.Object
  extended by javax.swing.tree.DefaultMutableTreeNode
      extended by weka.gui.ensembleLibraryEditor.tree.PropertyNode
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable, javax.swing.tree.MutableTreeNode, javax.swing.tree.TreeNode

public class PropertyNode
extends javax.swing.tree.DefaultMutableTreeNode

This node class represents individual parameters of generic objects (in practice this means classifiers). So all direct children of a classifier or other generic objects in the tree are going to be property nodes. Note that these nodes do not themselves have editors all editing in the user interface actaully happens in the child nodes of this class that it controls. On top of creating these child nodes and initializing them with the correct editing configuration, this class is also responsible for obtaining all of the possible values from the child nodes.

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
PropertyNode(javax.swing.JTree tree, AddModelsPanel panel, java.lang.String name, java.lang.String toolTipText, java.lang.Object value, java.beans.PropertyEditor pe)
          The constructor initialiazes the member variables of this node, Note that the "value" of this generic object is stored as the treeNode user object.
 
Method Summary
 void addEditorNodes(java.lang.String name, java.lang.String toolTipText)
          This method figures out what kind of parameter type this node represents and then creates the appropriate set of child nodes for editing.
 boolean canDeselect(javax.swing.tree.DefaultMutableTreeNode node)
          informs a requesting child node whether or not it has permission to be deselected.
 boolean canSelect(NumberNode node)
          This method informs a child number node whether or not it is allowed to be selected.
 java.util.Vector getAllValues()
          This method gets the range of values as specified by the child editor nodes.
 java.lang.String getName()
          getter for the name to be displayed for this node
 java.beans.PropertyEditor getPropertyEditor()
          this returns the property editor that was provided for this object.
 java.lang.String getToolTipText()
          getter for the tooltip text
 java.lang.String toString()
          returns a string representation
 
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, setUserObject
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

PropertyNode

public PropertyNode(javax.swing.JTree tree,
                    AddModelsPanel panel,
                    java.lang.String name,
                    java.lang.String toolTipText,
                    java.lang.Object value,
                    java.beans.PropertyEditor pe)
The constructor initialiazes the member variables of this node, Note that the "value" of this generic object is stored as the treeNode user object. After the values are initialized the constructor calls the addEditorNodes to create all the child nodes necessary to allow users to specify ranges of parameter values meaningful for the parameter that this node represents.

Parameters:
tree - the tree to use
panel - the pabel
name - the name
toolTipText - the tooltip
value - the actual value
pe - the property editor
Method Detail

getToolTipText

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

Returns:
tooltip text

getName

public java.lang.String getName()
getter for the name to be displayed for this node

Returns:
the name

getPropertyEditor

public java.beans.PropertyEditor getPropertyEditor()
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

toString

public java.lang.String toString()
returns a string representation

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

addEditorNodes

public void addEditorNodes(java.lang.String name,
                           java.lang.String toolTipText)
This method figures out what kind of parameter type this node represents and then creates the appropriate set of child nodes for editing.

Parameters:
name - the name
toolTipText - the tooltip

getAllValues

public java.util.Vector getAllValues()
This method gets the range of values as specified by the child editor nodes.

Returns:
all values

canSelect

public boolean canSelect(NumberNode node)
This method informs a child number node whether or not it is allowed to be selected. NumberNodes are the only ones that need to ask permission first. This simply makes sure that iterator nodes can't be selected when the max node is not selected.

Parameters:
node - the node to check
Returns:
true of the node can be selected

canDeselect

public boolean canDeselect(javax.swing.tree.DefaultMutableTreeNode node)
informs a requesting child node whether or not it has permission to be deselected. Note that only NumberNodes and CheckBoxNodes are the only one's that have any notion of being deselected and therefore should be the only one's calling this method.

Parameters:
node - the node to check
Returns:
true if it can be de-selected