org.tbee.swing.table
Class GenericEditor
java.lang.Object
javax.swing.AbstractCellEditor
javax.swing.DefaultCellEditor
org.tbee.swing.table.DefaultCellEditor
org.tbee.swing.table.GenericEditor
- All Implemented Interfaces:
- java.io.Serializable, javax.swing.CellEditor, javax.swing.table.TableCellEditor, javax.swing.tree.TreeCellEditor
public class GenericEditor
- extends DefaultCellEditor
Extracted from javax.swing.JTable, but removed the border logic
This class uses toString and the string constructor of the column class (as returned by the table model) to render and parse the value.
This would create a number editor:
static class NumberEditor extends GenericEditor {
public NumberEditor() {
((JTextField)getComponent()).setHorizontalAlignment(JTextField.RIGHT);
}
}
And this a boolean editor:
static class BooleanEditor extends DefaultCellEditor {
public BooleanEditor() {
super(new JCheckBox());
JCheckBox checkBox = (JCheckBox)getComponent();
checkBox.setHorizontalAlignment(JCheckBox.CENTER);
}
}
- Author:
- user
- See Also:
- Serialized Form
| Nested classes/interfaces inherited from class javax.swing.DefaultCellEditor |
javax.swing.DefaultCellEditor.EditorDelegate |
|
Field Summary |
protected java.lang.Class[] |
iArgTypes
|
protected java.lang.reflect.Constructor |
iConstructor
|
protected java.lang.Object |
iValue
|
static java.lang.String |
SOURCECODE_VERSION
Standard variable for determining version of a class file. |
| 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()
|
java.awt.Component |
getTableCellEditorComponent(javax.swing.JTable table,
java.lang.Object value,
boolean isSelected,
int row,
int column)
Convert object to string and render |
boolean |
stopCellEditing()
Convert string to object using string constructor and return value |
| Methods inherited from class javax.swing.DefaultCellEditor |
cancelCellEditing, getClickCountToStart, getComponent, getTreeCellEditorComponent, isCellEditable, setClickCountToStart, shouldSelectCell |
| 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 |
SOURCECODE_VERSION
public static final java.lang.String SOURCECODE_VERSION
- Standard variable for determining version of a class file.
- See Also:
- Constant Field Values
iArgTypes
protected java.lang.Class[] iArgTypes
iConstructor
protected java.lang.reflect.Constructor iConstructor
iValue
protected java.lang.Object iValue
GenericEditor
public GenericEditor()
stopCellEditing
public boolean stopCellEditing()
- Convert string to object using string constructor and return value
- Specified by:
stopCellEditing in interface javax.swing.CellEditor- Overrides:
stopCellEditing in class javax.swing.DefaultCellEditor
getTableCellEditorComponent
public java.awt.Component getTableCellEditorComponent(javax.swing.JTable table,
java.lang.Object value,
boolean isSelected,
int row,
int column)
- Convert object to string and render
- Specified by:
getTableCellEditorComponent in interface javax.swing.table.TableCellEditor- Overrides:
getTableCellEditorComponent in class DefaultCellEditor
getCellEditorValue
public java.lang.Object getCellEditorValue()
- Specified by:
getCellEditorValue in interface javax.swing.CellEditor- Overrides:
getCellEditorValue in class javax.swing.DefaultCellEditor
Copyright © 2010. All Rights Reserved.