Package org.web3d.x3d.dom.swing
Class DOMTreeCellEditor
java.lang.Object
org.web3d.x3d.dom.swing.DOMTreeCellEditor
- All Implemented Interfaces:
KeyListener,EventListener,CellEditor,TreeCellEditor
An implementation of the TreeCellRenderer interface to provided a renderer
for DOM specific capabilities.
This cell renderer is very simple - it just displays a label with the text
name of the node type and any relevant information about it. It knows nothing
about X3D. If you want an X3D specific tree cell renderer, use the
DOMTreeCellRenderer
- Version:
- $Revision: 1.4 $
- Author:
- Justin Couch
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidAdd a cell editor listener.voidRequest the cell editor to cancel the current editing action.Get the value of the last edited cell component.getTreeCellEditorComponent(JTree tree, Object value, boolean selected, boolean expanded, boolean leaf, int row) Request the renderer that suits the given value type and for the given tree.booleanCheck to see if a cell is editable.voidkeyPressed(KeyEvent evt) Process a key pressed event.voidkeyReleased(KeyEvent evt) Process a key released event.voidProcess a key event on the textfield.voidRemove a cell editor listener.booleanQuery to check if the cell should be selected when it is going to be edited.booleanInstruction to stop editing this cell.
-
Constructor Details
-
DOMTreeCellEditor
public DOMTreeCellEditor()Create an instance of the tree cell editor.
-
-
Method Details
-
getTreeCellEditorComponent
public Component getTreeCellEditorComponent(JTree tree, Object value, boolean selected, boolean expanded, boolean leaf, int row) Request the renderer that suits the given value type and for the given tree.- Specified by:
getTreeCellEditorComponentin interfaceTreeCellEditor- Parameters:
tree- The source tree this node comes fromvalue- The DOMTreeNode to be renderedselected- True if the node is selectedexpanded- True if expandedleaf- True if this is a leaf noderow- The row this node is on
-
cancelCellEditing
public void cancelCellEditing()Request the cell editor to cancel the current editing action. This is ignored by this implementation.- Specified by:
cancelCellEditingin interfaceCellEditor
-
getCellEditorValue
Get the value of the last edited cell component. Returns a string representation of the value.- Specified by:
getCellEditorValuein interfaceCellEditor- Returns:
- A string representing the value
-
isCellEditable
Check to see if a cell is editable. We have to go through some hoops here because we don't want all the cells to be editable. In particular, only those that match the ones in the getComponent method above.- Specified by:
isCellEditablein interfaceCellEditor- Parameters:
evt- The mouse event that caused this method to be called
-
shouldSelectCell
Query to check if the cell should be selected when it is going to be edited. All cells can be selected- Specified by:
shouldSelectCellin interfaceCellEditor- Parameters:
evt- The mouse event selecting the cell- Returns:
- true;
-
stopCellEditing
public boolean stopCellEditing()Instruction to stop editing this cell. Ignored by this implementation.- Specified by:
stopCellEditingin interfaceCellEditor- Returns:
- true
-
addCellEditorListener
Add a cell editor listener. A listener instance can only be registered once.- Specified by:
addCellEditorListenerin interfaceCellEditor- Parameters:
l- The listener to add.
-
removeCellEditorListener
Remove a cell editor listener. If the listener is not registered this does nothing.- Specified by:
removeCellEditorListenerin interfaceCellEditor- Parameters:
l- The listener to remove
-
keyTyped
Process a key event on the textfield. For this implementation we are looking for either VK_ENTER or VK_ESCAPE to finish or cancel the editing respectively.- Specified by:
keyTypedin interfaceKeyListener- Parameters:
evt- The event to be processed.
-
keyPressed
Process a key pressed event.- Specified by:
keyPressedin interfaceKeyListener- Parameters:
evt-
-
keyReleased
Process a key released event.- Specified by:
keyReleasedin interfaceKeyListener- Parameters:
evt-
-