com.lightdev.lib.xml.ui
Class XmlTreeCellEditor

java.lang.Object
  extended by javax.swing.tree.DefaultTreeCellEditor
      extended by com.lightdev.lib.xml.ui.XmlTreeCellEditor
All Implemented Interfaces:
ActionListener, EventListener, CellEditor, TreeSelectionListener, TreeCellEditor

public class XmlTreeCellEditor
extends DefaultTreeCellEditor

Cell editor for JXmlTree

Version:
1, March 5, 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
See Also:
JXmlTree

Nested Class Summary
 
Nested classes/interfaces inherited from class javax.swing.tree.DefaultTreeCellEditor
DefaultTreeCellEditor.DefaultTextField, DefaultTreeCellEditor.EditorContainer
 
Constructor Summary
XmlTreeCellEditor(JXmlTree tree, DefaultTreeCellRenderer renderer, TreeCellEditor editor)
          constructor
 
Method Summary
 void cancelCellEditing()
          Tells the editor to cancel editing and not accept any partially edited value.
 Object getCellEditorValue()
          Returns the value contained in the editor.
 XmlTag getTag()
          get the XmlTag for the rendered cell
 Component getTreeCellEditorComponent(JTree tree, Object value, boolean isSelected, boolean expanded, boolean leaf, int row)
          Sets an initial value for the editor.
 boolean stopCellEditing()
          Tells the editor to stop editing and accept any partially edited value as the value of the editor.
 
Methods inherited from class javax.swing.tree.DefaultTreeCellEditor
actionPerformed, addCellEditorListener, getBorderSelectionColor, getCellEditorListeners, getFont, isCellEditable, removeCellEditorListener, setBorderSelectionColor, setFont, shouldSelectCell, valueChanged
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

XmlTreeCellEditor

public XmlTreeCellEditor(JXmlTree tree,
                         DefaultTreeCellRenderer renderer,
                         TreeCellEditor editor)
constructor

Parameters:
tree - JXmlTree tree to provide this editor for
renderer - DefaultTreeCellRenderer renderer to use
editor - TreeCellEditor editor to use
Method Detail

getTreeCellEditorComponent

public Component getTreeCellEditorComponent(JTree tree,
                                            Object value,
                                            boolean isSelected,
                                            boolean expanded,
                                            boolean leaf,
                                            int row)
Sets an initial value for the editor.

Specified by:
getTreeCellEditorComponent in interface TreeCellEditor
Overrides:
getTreeCellEditorComponent in class DefaultTreeCellEditor
Parameters:
tree - the JTree that is asking the editor to edit; this parameter can be null
value - the value of the cell to be edited
isSelected - true is the cell is to be renderer with selection highlighting
expanded - true if the node is expanded
leaf - true if the node is a leaf node
row - the row index of the node being edited
Returns:
the component for editing

getTag

public XmlTag getTag()
get the XmlTag for the rendered cell

Returns:
XmlTag

getCellEditorValue

public Object getCellEditorValue()
Returns the value contained in the editor.

Specified by:
getCellEditorValue in interface CellEditor
Overrides:
getCellEditorValue in class DefaultTreeCellEditor
Returns:
the value contained in the editor

stopCellEditing

public boolean stopCellEditing()
Tells the editor to stop editing and accept any partially edited value as the value of the editor.

Specified by:
stopCellEditing in interface CellEditor
Overrides:
stopCellEditing in class DefaultTreeCellEditor
Returns:
true if editing was stopped; false otherwise

cancelCellEditing

public void cancelCellEditing()
Tells the editor to cancel editing and not accept any partially edited value.

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