com.lightdev.tree.data
Class PersistentTreeCellEditor
java.lang.Object
javax.swing.tree.DefaultTreeCellEditor
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
| Fields inherited from class javax.swing.tree.DefaultTreeCellEditor |
borderSelectionColor, canEdit, editingComponent, editingContainer, editingIcon, font, lastPath, lastRow, offset, realEditor, renderer, timer, tree |
| 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 |
PersistentTreeCellEditor
public PersistentTreeCellEditor(JTree tree,
DefaultTreeCellRenderer renderer)
- constructor
- Parameters:
tree - the tree this editor is used forrenderer - the renderer to use
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