net.sf.jga.swing
Class GenericCellEditor<T>
java.lang.Object
javax.swing.AbstractCellEditor
javax.swing.DefaultCellEditor
net.sf.jga.swing.GenericCellEditor<T>
- All Implemented Interfaces:
- java.io.Serializable, javax.swing.CellEditor, javax.swing.table.TableCellEditor, javax.swing.tree.TreeCellEditor
public class GenericCellEditor<T>
- extends javax.swing.DefaultCellEditor
CellEditor that uses a pair of functors to parse/format a value. Empty
strings, or strings containing only whitespace will correspond to null
values of type T.
Copyright © 2003-2005 David A. Hall
- Author:
- David A. Hall
- See Also:
- Serialized Form
Nested classes/interfaces inherited from class javax.swing.DefaultCellEditor |
javax.swing.DefaultCellEditor.EditorDelegate |
Field Summary |
protected javax.swing.JTextField |
_component
|
Fields inherited from class javax.swing.DefaultCellEditor |
clickCountToStart, delegate, editorComponent |
Fields inherited from class javax.swing.AbstractCellEditor |
changeEvent, listenerList |
Method Summary |
int |
getHorizontalAlignment()
Returns the horizontal alignment: one of the values defined by JTextField. |
void |
setHorizontalAlignment(int alignment)
Sets the horizontal alignment to one of the values defined by JTextField. |
boolean |
stopCellEditing()
Retrieves the value from the editor component, giving a visual clue when
the value is invalid |
java.lang.String |
toString()
|
Methods inherited from class javax.swing.DefaultCellEditor |
cancelCellEditing, getCellEditorValue, getClickCountToStart, getComponent, getTableCellEditorComponent, 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, wait, wait, wait |
Methods inherited from interface javax.swing.CellEditor |
addCellEditorListener, removeCellEditorListener |
_component
protected javax.swing.JTextField _component
GenericCellEditor
public GenericCellEditor(java.lang.Class<T> type)
- Builds a GenericCellEdior using default format for the given class. The
resulting editor can support any class that defines toString() and also
has a one argument constructor that takes a String.
GenericCellEditor
public GenericCellEditor(UnaryFunctor<T,java.lang.String> formatter,
UnaryFunctor<java.lang.String,T> parser)
- Builds the GenericCellEditor using the given functor pair.
GenericCellEditor
public GenericCellEditor(UnaryFunctor<T,java.lang.String> formatter,
UnaryFunctor<java.lang.String,T> parser,
T defaultValue)
- Builds the GenericCellEditor using the given functor pair and default
value for empty strings.
stopCellEditing
public boolean stopCellEditing()
- Retrieves the value from the editor component, giving a visual clue when
the value is invalid
- Specified by:
stopCellEditing
in interface javax.swing.CellEditor
- Overrides:
stopCellEditing
in class javax.swing.DefaultCellEditor
getHorizontalAlignment
public int getHorizontalAlignment()
- Returns the horizontal alignment: one of the values defined by JTextField.
setHorizontalAlignment
public void setHorizontalAlignment(int alignment)
- Sets the horizontal alignment to one of the values defined by JTextField.
toString
public java.lang.String toString()
- Overrides:
toString
in class java.lang.Object
Copyright © 2002-2006 David A. Hall. All Rights Reserved.