|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjavax.swing.AbstractCellEditor
javax.swing.DefaultCellEditor
org.jdesktop.swingx.table.NumberEditorExt
public class NumberEditorExt
Issue #393-swingx: localized NumberEditor. Added feature to use StrictNumberFormatter.
| Nested Class Summary |
|---|
| Nested classes/interfaces inherited from class javax.swing.DefaultCellEditor |
|---|
DefaultCellEditor.EditorDelegate |
| Field Summary |
|---|
| Fields inherited from class javax.swing.DefaultCellEditor |
|---|
clickCountToStart, delegate, editorComponent |
| Fields inherited from class javax.swing.AbstractCellEditor |
|---|
changeEvent, listenerList |
| Constructor Summary | |
|---|---|
NumberEditorExt()
Instantiates an editor with default NumberFormat and default NumberFormatter. |
|
NumberEditorExt(boolean useStrictFormatter)
Instantiates an editor with default NumberFormat and NumberFormatter depending on useStrictFormatter. |
|
NumberEditorExt(NumberFormat format)
Instantiates an editor with the given NumberFormat and default NumberFormatter. |
|
NumberEditorExt(NumberFormat format,
boolean useStrictFormatter)
Instantiates an editor with the given NumberFormat and NumberFormatter depending on useStrictFormatter. |
|
| Method Summary | |
|---|---|
Number |
getCellEditorValue()
Forwards the message from the CellEditor to
the delegate. |
JFormattedTextField |
getComponent()
Returns a reference to the editor component. |
protected Number |
getNumber()
Returns the editor value as number. |
Component |
getTableCellEditorComponent(JTable table,
Object value,
boolean isSelected,
int row,
int column)
Override and set the border back to normal in case there was an error previously |
protected boolean |
hasStrictFormatter()
|
protected boolean |
isValid()
Returns a boolean indicating whether the current text is valid for instantiating the expected Number type. |
boolean |
stopCellEditing()
Forwards the message from the CellEditor to
the delegate. |
| Methods inherited from class javax.swing.DefaultCellEditor |
|---|
cancelCellEditing, getClickCountToStart, 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 |
| Constructor Detail |
|---|
public NumberEditorExt()
public NumberEditorExt(NumberFormat format)
format - the NumberFormat to use for conversion, may be null to indicate
usage of default NumberFormat.public NumberEditorExt(boolean useStrictFormatter)
useStrictFormatter - if true, uses a StrictNumberFormatter, else uses
default NumberFormatter
public NumberEditorExt(NumberFormat format,
boolean useStrictFormatter)
format - the NumberFormat to use for conversion, may be null to indicate
usage of default NumberFormatuseStrictFormatter - if true, uses a StrictNumberFormatter, else uses
default NumberFormatter| Method Detail |
|---|
public boolean stopCellEditing()
javax.swing.DefaultCellEditorCellEditor to
the delegate.
stopCellEditing in interface CellEditorstopCellEditing in class DefaultCellEditorDefaultCellEditor.EditorDelegate.stopCellEditing()protected boolean isValid()
protected Number getNumber()
throws Exception
Exception - if creation of the expected type fails in some way.protected boolean hasStrictFormatter()
public Component getTableCellEditorComponent(JTable table,
Object value,
boolean isSelected,
int row,
int column)
getTableCellEditorComponent in interface TableCellEditorgetTableCellEditorComponent in class DefaultCellEditortable - the JTable that is asking the
editor to edit; can be nullvalue - the value of the cell to be edited; it is
up to the specific editor to interpret
and draw the value. For example, if value is
the string "true", it could be rendered as a
string or it could be rendered as a check
box that is checked. null
is a valid valueisSelected - true if the cell is to be rendered with
highlightingrow - the row of the cell being editedcolumn - the column of the cell being edited
public Number getCellEditorValue()
throws IllegalStateException
CellEditor to
the delegate. Overridden to instantiate a Number of the expected type. Note that this may throw a IllegalStateException if invoked without querying for a valid value with stopCellEditing. This should not happen during normal usage.
getCellEditorValue in interface CellEditorgetCellEditorValue in class DefaultCellEditorIllegalStateException - if current value invalidDefaultCellEditor.EditorDelegate.getCellEditorValue()public JFormattedTextField getComponent()
Convenience override with type cast.
getComponent in class DefaultCellEditorComponent
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||