com.lightdev.tree.data
Class PersistentTreeCellEditor


java.lang.Object

  extended by javax.swing.tree.DefaultTreeCellEditor

      extended by com.lightdev.tree.data.PersistentTreeCellEditor

All Implemented Interfaces:
ActionListener, EventListener, CellEditor, TreeSelectionListener, TreeCellEditor

public class PersistentTreeCellEditor
extends DefaultTreeCellEditor

PersistentTreeCellEditor.java

This class overrides DefaultTreeCellEditor to allow for custom user object handling of a region tree of application DayMate. A region tree has user objects of class HierarchicalItem. To edit the name of one HierarchicalItem inside the tree requires to override the methods that return the default cell editor and the editor value.

Version:
1, 31.07.2005
Author:
Ulrich Hilger, Light Development, http://www.lightdev.com, info@lightdev.com, published under the terms and conditions of the BSD License, for details see file license.txt in the distribution package of this software

Nested Class Summary
 
Nested classes/interfaces inherited from class javax.swing.tree.DefaultTreeCellEditor
DefaultTreeCellEditor.DefaultTextField, DefaultTreeCellEditor.EditorContainer
 
Field Summary
 
Fields inherited from class javax.swing.tree.DefaultTreeCellEditor
borderSelectionColor, canEdit, editingComponent, editingContainer, editingIcon, font, lastPath, lastRow, offset, realEditor, renderer, timer, tree
 
Constructor Summary
PersistentTreeCellEditor(JTree tree, DefaultTreeCellRenderer renderer)
          constructor
 
Method Summary
 Object getCellEditorValue()
          overridden to return the HierarchicalItem as the user object after editing
 Component getTreeCellEditorComponent(JTree tree, Object value, boolean isSelected, boolean expanded, boolean leaf, int row)
          overridden to save the HierarchicalItem which is stored in the user object of a tree during editing
 
Methods inherited from class javax.swing.tree.DefaultTreeCellEditor
actionPerformed, addCellEditorListener, cancelCellEditing, canEditImmediately, createContainer, createTreeCellEditor, determineOffset, getBorderSelectionColor, getCellEditorListeners, getFont, inHitRegion, isCellEditable, 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

PersistentTreeCellEditor


public PersistentTreeCellEditor(JTree tree,

                                DefaultTreeCellRenderer renderer)
constructor

Parameters:
tree - the tree this editor is used for
renderer - the renderer to use
Method Detail

getCellEditorValue


public Object getCellEditorValue()
overridden to return the HierarchicalItem as the user object after editing

Specified by:
getCellEditorValue in interface CellEditor
Overrides:
getCellEditorValue in class DefaultTreeCellEditor

getTreeCellEditorComponent


public Component getTreeCellEditorComponent(JTree tree,

                                            Object value,

                                            boolean isSelected,

                                            boolean expanded,

                                            boolean leaf,

                                            int row)
overridden to save the HierarchicalItem which is stored in the user object of a tree during editing

Specified by:
getTreeCellEditorComponent in interface TreeCellEditor
Overrides:
getTreeCellEditorComponent in class DefaultTreeCellEditor