public class TreeTableCellEditor
extends javax.swing.AbstractCellEditor
implements javax.swing.table.TableCellEditor
TableCellEditor
that is supplied in the constructor.
For example, in the following tree representation, the spacing and +/-
icons would be added to each tree node by this editor, while the data text
would be added by the component returned from the delegate
TableCellEditor
.
- Cars + BMW - Ford Taurus Focus - Lexus ES 300 LS 600h L
Constructor and Description |
---|
TreeTableCellEditor(javax.swing.table.TableCellEditor delegate,
TreeList treeList)
Decorate the component returned from the
delegate with
extra components that display the tree nodes location within the tree. |
Modifier and Type | Method and Description |
---|---|
protected javax.swing.table.TableCellEditor |
createDelegateEditor()
Build the delegate TableCellEditor that handles editing the data of
each tree node.
|
void |
dispose()
Cleanup the data within this editor as it is no longer being used and
must be prepared for garbage collection.
|
java.lang.Object |
getCellEditorValue() |
javax.swing.table.TableCellEditor |
getDelegate()
Returns the delegate TableCellEditor being decorated.
|
protected int |
getIndent(TreeNodeData treeNodeData,
boolean showExpanderForEmptyParent)
Returns the number of pixels to indent the contents of the editor.
|
protected int |
getSpacer(TreeNodeData treeNodeData,
boolean showExpanderForEmptyParent)
Returns the number of pixels of space between the expand/collapse button
and the node component.
|
java.awt.Component |
getTableCellEditorComponent(javax.swing.JTable table,
java.lang.Object value,
boolean isSelected,
int row,
int column)
Return a decorated form of the component returned by the data
TableCellEditor . |
boolean |
isCellEditable(java.util.EventObject event)
This method checks if the
event is a MouseEvent
and determines if it occurred overtop of the component created by the
delegate TableCellEditor. |
boolean |
shouldSelectCell(java.util.EventObject anEvent) |
addCellEditorListener, cancelCellEditing, fireEditingCanceled, fireEditingStopped, getCellEditorListeners, removeCellEditorListener, stopCellEditing
public TreeTableCellEditor(javax.swing.table.TableCellEditor delegate, TreeList treeList)
delegate
with
extra components that display the tree nodes location within the tree.
If delegate
is null then a
DefaultCellEditor
using a JTextField
will be used as
the delegate.delegate
- the editor that produces the data for the tree nodetreeList
- the data structure that answers questions about the tree
node and the tree that contains itprotected javax.swing.table.TableCellEditor createDelegateEditor()
public java.awt.Component getTableCellEditorComponent(javax.swing.JTable table, java.lang.Object value, boolean isSelected, int row, int column)
TableCellEditor
.getTableCellEditorComponent
in interface javax.swing.table.TableCellEditor
protected int getIndent(TreeNodeData treeNodeData, boolean showExpanderForEmptyParent)
treeNodeData
- hierarhical information about the node within the treeshowExpanderForEmptyParent
- true indicates the expander
button should always be present, even when no children yet existprotected int getSpacer(TreeNodeData treeNodeData, boolean showExpanderForEmptyParent)
treeNodeData
- hierarhical information about the node within the treeshowExpanderForEmptyParent
- true indicates the expander
button should always be present, even when no children yet existpublic boolean isCellEditable(java.util.EventObject event)
event
is a MouseEvent
and determines if it occurred overtop of the component created by the
delegate TableCellEditor. If so, it translates the coordinates of the
event
so they are relative to that component and then asks
the delegate TableCellEditor if it believes supports cell editing.
Effectively, this implies that clicks overtop of other areas of the
editor component are ignored. In truth, they are handled elsewhere (a
MouseListener on the JTable installed within TreeTableSupport).isCellEditable
in interface javax.swing.CellEditor
isCellEditable
in class javax.swing.AbstractCellEditor
event
- the event attempting to begin a cell editpublic boolean shouldSelectCell(java.util.EventObject anEvent)
shouldSelectCell
in interface javax.swing.CellEditor
shouldSelectCell
in class javax.swing.AbstractCellEditor
public java.lang.Object getCellEditorValue()
getCellEditorValue
in interface javax.swing.CellEditor
public javax.swing.table.TableCellEditor getDelegate()
public void dispose()
Glazed Lists, Copyright © 2003 publicobject.com, O'Dell Engineering.
Documentation build by mockbuild at 2012-03-02 14:06