org.openbp.swing.components.treetable
Class TreeTableCellEditor
java.lang.Object
javax.swing.AbstractCellEditor
javax.swing.DefaultCellEditor
org.openbp.swing.components.treetable.TreeTableCellEditor
- All Implemented Interfaces:
- java.io.Serializable, javax.swing.CellEditor, javax.swing.table.TableCellEditor, javax.swing.tree.TreeCellEditor
public class TreeTableCellEditor
- extends javax.swing.DefaultCellEditor
Default TreeTableCellEditor used by the JTreeTable to obtain the editor component
for the tree if set to editable.
- Author:
- Erich Lauterbach
- See Also:
- Serialized Form
| Nested classes/interfaces inherited from class javax.swing.DefaultCellEditor |
javax.swing.DefaultCellEditor.EditorDelegate |
|
Field Summary |
protected JTreeTable |
treeTable
TreeTable mediator used to communicate with the other Tree Tabel elements. |
| Fields inherited from class javax.swing.DefaultCellEditor |
clickCountToStart, delegate, editorComponent |
| Fields inherited from class javax.swing.AbstractCellEditor |
changeEvent, listenerList |
|
Method Summary |
java.lang.Object |
getCellEditorValue()
See javax.swing.DefaultCellEditor.getTableCellEditorComponent (JTable table, Object value, boolean isSelected, int row, int column)
By default this always returns a null. |
java.awt.Component |
getTableCellEditorComponent(javax.swing.JTable table,
java.lang.Object value,
boolean isSelected,
int row,
int column)
See javax.swing.DefaultCellEditor.getTableCellEditorComponent (JTable table, Object value, boolean isSelected, int row, int column) |
boolean |
isCellEditable(java.util.EventObject e)
Overridden to return false, and if the event is a mouse event
it is forwarded to the tree. |
| Methods inherited from class javax.swing.DefaultCellEditor |
cancelCellEditing, getClickCountToStart, getComponent, getTreeCellEditorComponent, setClickCountToStart, shouldSelectCell, stopCellEditing |
| Methods inherited from class javax.swing.AbstractCellEditor |
addCellEditorListener, fireEditingCanceled, fireEditingStopped, getCellEditorListeners, removeCellEditorListener |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Methods inherited from interface javax.swing.CellEditor |
addCellEditorListener, removeCellEditorListener |
treeTable
protected JTreeTable treeTable
- TreeTable mediator used to communicate with the other Tree Tabel elements.
TreeTableCellEditor
public TreeTableCellEditor(JTreeTable treeTable)
- Default Constructor
- Parameters:
treeTable - Tree table this cell editor is used for
getTableCellEditorComponent
public java.awt.Component getTableCellEditorComponent(javax.swing.JTable table,
java.lang.Object value,
boolean isSelected,
int row,
int column)
- See javax.swing.DefaultCellEditor.getTableCellEditorComponent (JTable table, Object value, boolean isSelected, int row, int column)
- Specified by:
getTableCellEditorComponent in interface javax.swing.table.TableCellEditor- Overrides:
getTableCellEditorComponent in class javax.swing.DefaultCellEditor
isCellEditable
public boolean isCellEditable(java.util.EventObject e)
- Overridden to return false, and if the event is a mouse event
it is forwarded to the tree.
The behavior for this is debatable, and should really be offered
as a property. By returning false, all keyboard actions are
implemented in terms of the table. By returning true, the
tree would get a chance to do something with the keyboard
events. For the most part this is ok. But for certain keys,
such as left/right, the tree will expand/collapse where as
the table focus should really move to a different column. Page
up/down should also be implemented in terms of the table.
By returning false this also has the added benefit that clicking
outside of the bounds of the tree node, but still in the tree
column will select the row, whereas if this returned true
that wouldn't be the case.
By returning false we are also enforcing the policy that
the tree will never be editable (at least by a key sequence).
- Specified by:
isCellEditable in interface javax.swing.CellEditor- Overrides:
isCellEditable in class javax.swing.DefaultCellEditor
getCellEditorValue
public java.lang.Object getCellEditorValue()
- See javax.swing.DefaultCellEditor.getTableCellEditorComponent (JTable table, Object value, boolean isSelected, int row, int column)
By default this always returns a null.
- Specified by:
getCellEditorValue in interface javax.swing.CellEditor- Overrides:
getCellEditorValue in class javax.swing.DefaultCellEditor
Copyright © 2011. All Rights Reserved.