weka.gui.ensembleLibraryEditor.tree
Class ModelTreeNodeEditor

java.lang.Object
  extended by javax.swing.AbstractCellEditor
      extended by weka.gui.ensembleLibraryEditor.tree.ModelTreeNodeEditor
All Implemented Interfaces:
java.awt.event.ActionListener, java.awt.event.ItemListener, java.beans.PropertyChangeListener, java.io.Serializable, java.util.EventListener, javax.swing.CellEditor, javax.swing.tree.TreeCellEditor

public class ModelTreeNodeEditor
extends javax.swing.AbstractCellEditor
implements javax.swing.tree.TreeCellEditor, java.awt.event.ItemListener, java.beans.PropertyChangeListener, java.awt.event.ActionListener

This class is in charge of dynamically creating editor GUI objects on demand for the main JTree class that will display our Classifier tree model of parameters. This is in fact the CellEditor class that is registered with our tree.

Basically it delegates much of the work to the various NodeEditor classes found in this package. All it really has to do is detect what of node it is and then instantiate an editor of the appropriate type.

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

Constructor Summary
ModelTreeNodeEditor(javax.swing.JTree tree)
          default Constructor
 
Method Summary
 void actionPerformed(java.awt.event.ActionEvent e)
          The item Listener that gets registered with all node editors that have a widget that had actionPerformed events.
 java.lang.Object getCellEditorValue()
          I'm supposed to implemnent this as part of the TreeCellEDitor interface.
 java.awt.Component getTreeCellEditorComponent(javax.swing.JTree tree, java.lang.Object value, boolean selected, boolean expanded, boolean leaf, int row)
          This method uses the ModelTreeNodeRenderer class to get the individual editors and then registers this classes editing event listeners with them
 boolean isCellEditable(java.util.EventObject event)
          This tells the JTree whether or not to let nodes in the tree be edited.
 void itemStateChanged(java.awt.event.ItemEvent e)
          The item Listener that gets registered with all node editors that have a widget that had itemStateChangeg events.
 void propertyChange(java.beans.PropertyChangeEvent evt)
          The prtopertyListener that gets registered with all node editors that have a widget that had propertyStateChangeg events.
 
Methods inherited from class javax.swing.AbstractCellEditor
addCellEditorListener, cancelCellEditing, getCellEditorListeners, removeCellEditorListener, shouldSelectCell, stopCellEditing
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface javax.swing.CellEditor
addCellEditorListener, cancelCellEditing, removeCellEditorListener, shouldSelectCell, stopCellEditing
 

Constructor Detail

ModelTreeNodeEditor

public ModelTreeNodeEditor(javax.swing.JTree tree)
default Constructor

Parameters:
tree - the tree to use
Method Detail

getCellEditorValue

public java.lang.Object getCellEditorValue()
I'm supposed to implemnent this as part of the TreeCellEDitor interface. however, it's not necessary for this class so it returns null.

Specified by:
getCellEditorValue in interface javax.swing.CellEditor
Returns:
always null

isCellEditable

public boolean isCellEditable(java.util.EventObject event)
This tells the JTree whether or not to let nodes in the tree be edited. Basically all this does is return true for all nodes that aren't PropertyNodes - which don't have any interactive widgets

Specified by:
isCellEditable in interface javax.swing.CellEditor
Overrides:
isCellEditable in class javax.swing.AbstractCellEditor
Parameters:
event - the event
Returns:
true if editable

getTreeCellEditorComponent

public java.awt.Component getTreeCellEditorComponent(javax.swing.JTree tree,
                                                     java.lang.Object value,
                                                     boolean selected,
                                                     boolean expanded,
                                                     boolean leaf,
                                                     int row)
This method uses the ModelTreeNodeRenderer class to get the individual editors and then registers this classes editing event listeners with them

Specified by:
getTreeCellEditorComponent in interface javax.swing.tree.TreeCellEditor
Parameters:
tree - the associated tree
value - the value
selected - true if item is selected
expanded - true if it is expanded
leaf - true if it is a leaf
row - the row in the tree
Returns:
the rendering component

itemStateChanged

public void itemStateChanged(java.awt.event.ItemEvent e)
The item Listener that gets registered with all node editors that have a widget that had itemStateChangeg events. It just fires the editing stopped event.

Specified by:
itemStateChanged in interface java.awt.event.ItemListener
Parameters:
e - the event

propertyChange

public void propertyChange(java.beans.PropertyChangeEvent evt)
The prtopertyListener that gets registered with all node editors that have a widget that had propertyStateChangeg events. It just fires the editing stopped event.

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

actionPerformed

public void actionPerformed(java.awt.event.ActionEvent e)
The item Listener that gets registered with all node editors that have a widget that had actionPerformed events. It just fires the editing stopped event.

Specified by:
actionPerformed in interface java.awt.event.ActionListener
Parameters:
e - the event