did.xml
Class DIDTreeCellEditor

java.lang.Object
  |
  +--javax.swing.tree.DefaultTreeCellEditor
        |
        +--did.xml.DIDTreeCellEditor

public class DIDTreeCellEditor
extends javax.swing.tree.DefaultTreeCellEditor

File:         DIDTreeCellEditor.java
Version:      1.1
Description:  This class is called when the user triple clicks on a node of the DIDTree.
An editing facility (the default is a text box) through with the value of the node can be
changed is then passed back to the DIDTree which renders it using the correct icon from
the TreeCellRenderer.
NOTE: Used in conjuction with the valueForPathChanged() method of the TreeModel, this class
can alter the value of a DOM node.  Since the toString() method of the DIDNode returns the 
DOM node's name and value, changing the DOM node's value also has the effect of simultaneously
changing the display properties of the node to which it belongs.

Modification Log:
Date          Name    Comment
xx-xx-xxxx    XXX	   xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx


Inner classes inherited from class javax.swing.tree.DefaultTreeCellEditor
javax.swing.tree.DefaultTreeCellEditor.DefaultTextField, javax.swing.tree.DefaultTreeCellEditor.EditorContainer
 
Fields inherited from class javax.swing.tree.DefaultTreeCellEditor
borderSelectionColor, canEdit, editingComponent, editingContainer, editingIcon, font, lastPath, lastRow, offset, realEditor, renderer, timer, tree
 
Constructor Summary
DIDTreeCellEditor(javax.swing.JTree tree)
          Method used to instantiate this class.
 
Method Summary
 java.awt.Component getTreeCellEditorComponent(javax.swing.JTree tree, java.lang.Object value, boolean isSelected, boolean expanded, boolean leaf, int row)
          Method used to configure the editor which is passed onto the realEditor.
 boolean isCellEditable(java.util.EventObject e)
          Method used to determine if a particular cell should be editable.
 
Methods inherited from class javax.swing.tree.DefaultTreeCellEditor
actionPerformed, addCellEditorListener, cancelCellEditing, canEditImmediately, createContainer, createTreeCellEditor, determineOffset, getBorderSelectionColor, getCellEditorValue, getFont, inHitRegion, prepareForEditing, removeCellEditorListener, setBorderSelectionColor, setFont, setTree, shouldSelectCell, shouldStartEditingTimer, startEditingTimer, stopCellEditing, valueChanged
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DIDTreeCellEditor

public DIDTreeCellEditor(javax.swing.JTree tree)
Method used to instantiate this class.
Parameters:
tree - A reference to the JTree for which this class will render editing components.
Method Detail

getTreeCellEditorComponent

public java.awt.Component getTreeCellEditorComponent(javax.swing.JTree tree,
                                                     java.lang.Object value,
                                                     boolean isSelected,
                                                     boolean expanded,
                                                     boolean leaf,
                                                     int row)
Method used to configure the editor which is passed onto the realEditor. In this implementation the value placed in the editor is set by retrieving the value of the DIDNode's DOM node.
Overrides:
getTreeCellEditorComponent in class javax.swing.tree.DefaultTreeCellEditor
Returns:
The component for editing.
See Also:
DIDDefaultTreeModel.valueForPathChanged(javax.swing.tree.TreePath, java.lang.Object)

isCellEditable

public boolean isCellEditable(java.util.EventObject e)
Method used to determine if a particular cell should be editable. In this implementation editability is determine by the position of the node on the tree. Only leaf nodes that do not have node name of "x" or "y" should be editable. NOTE: Not allowing the user to exit node with names of x or y solves a problem of syncing the XML with the ROI. This is a temporary fix as a efficient method was not able to be developed in the time allotted.
Overrides:
isCellEditable in class javax.swing.tree.DefaultTreeCellEditor
Parameters:
e - The event the editor should use to consider whether to begin editing or not.
Returns:
True if editing can be started.