JIDE 3.5.15

com.jidesoft.grid
Class FormattedTextFieldCellEditor

java.lang.Object
  extended by javax.swing.AbstractCellEditor
      extended by com.jidesoft.grid.AbstractJideCellEditor
          extended by com.jidesoft.grid.ContextSensitiveCellEditor
              extended by com.jidesoft.grid.FormattedTextFieldCellEditor
All Implemented Interfaces:
ConverterContextSupport, EditorContextSupport, EditorStyleSupport, JideCellEditor, FocusListener, Serializable, EventListener, CellEditor, TableCellEditor

public class FormattedTextFieldCellEditor
extends ContextSensitiveCellEditor
implements FocusListener

This is a CellEditor which will assume userObject of a converter context as JFormattedTextField.AbstractFormatter and use it on a FormattedTextField.

See Also:
Serialized Form

Field Summary
protected  JFormattedTextField _textField
           
 
Fields inherited from class com.jidesoft.grid.ContextSensitiveCellEditor
DEFAULT_CELL_EDITOR_BORDER
 
Fields inherited from class com.jidesoft.grid.AbstractJideCellEditor
_clickCountToStart
 
Fields inherited from class javax.swing.AbstractCellEditor
changeEvent, listenerList
 
Constructor Summary
FormattedTextFieldCellEditor()
          Creates a FormattedTextFieldCellEditor with no format and String as default class.
FormattedTextFieldCellEditor(Class<?> clazz)
          Creates a FormattedTextFieldCellEditor with no format and specified class.
FormattedTextFieldCellEditor(Class<?> clazz, Format format)
          Creates a FormattedTextFieldCellEditor with specified class and format.
FormattedTextFieldCellEditor(Class<?> clazz, JFormattedTextField.AbstractFormatter formatter)
          Creates a FormattedTextFieldCellEditor with specified class and formatter.
 
Method Summary
protected  JFormattedTextField createFormattedTextField(Format format)
          Creates the formatted text field used by this cell editor.
protected  JFormattedTextField createFormattedTextField(JFormattedTextField.AbstractFormatter formatter)
          Creates the formatted text field used by this cell editor.
protected  void customizeTextField()
           
 void focusGained(FocusEvent e)
           
 void focusLost(FocusEvent e)
           
 Object getCellEditorValue()
           
protected  JFormattedTextField.AbstractFormatterFactory getFormatFactory()
           
 Component getTableCellEditorComponent(JTable table, Object value, boolean isSelected, int row, int column)
           
 boolean isEditorStyleSupported(int editorStyle)
          Checks if the editor style is supported by the cell editor.
 void setCellEditorValue(Object value)
           
 void setConverterContext(ConverterContext context)
          Set the converter context for the cell editor.
protected  void setupTextField()
           
 
Methods inherited from class com.jidesoft.grid.ContextSensitiveCellEditor
getConverter, getConverterContext, getEditorContext, getEditorStyle, getType, isUseConverterContext, setConverter, setEditorContext, setEditorStyle, setType, setUseConverterContext
 
Methods inherited from class com.jidesoft.grid.AbstractJideCellEditor
addValidationListener, getClickCountToStart, getDefaultErrorBehavior, getValidationListeners, isAutoStopCellEditing, isCellEditable, isPassEnterKeyToTable, removeValidationListener, setAutoStopCellEditing, setClickCountToStart, setDefaultErrorBehavior, setPassEnterKeyToTable, validate
 
Methods inherited from class javax.swing.AbstractCellEditor
addCellEditorListener, cancelCellEditing, fireEditingCanceled, fireEditingStopped, getCellEditorListeners, removeCellEditorListener, shouldSelectCell, stopCellEditing
 
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, cancelCellEditing, isCellEditable, removeCellEditorListener, shouldSelectCell, stopCellEditing
 

Field Detail

_textField

protected JFormattedTextField _textField
Constructor Detail

FormattedTextFieldCellEditor

public FormattedTextFieldCellEditor()
Creates a FormattedTextFieldCellEditor with no format and String as default class. The format can be set by following setConverterContext().


FormattedTextFieldCellEditor

public FormattedTextFieldCellEditor(Class<?> clazz)
Creates a FormattedTextFieldCellEditor with no format and specified class. The format can be set by following setConverterContext().

Parameters:
clazz - the type.

FormattedTextFieldCellEditor

public FormattedTextFieldCellEditor(Class<?> clazz,
                                    Format format)
Creates a FormattedTextFieldCellEditor with specified class and format.

Parameters:
clazz - the type.
format - Format used to look up an AbstractFormatter

FormattedTextFieldCellEditor

public FormattedTextFieldCellEditor(Class<?> clazz,
                                    JFormattedTextField.AbstractFormatter formatter)
Creates a FormattedTextFieldCellEditor with specified class and formatter.

Parameters:
clazz - the type.
formatter - AbstractFormatter to use for formatting.
Method Detail

createFormattedTextField

protected JFormattedTextField createFormattedTextField(Format format)
Creates the formatted text field used by this cell editor.

Parameters:
format - Format used to look up an AbstractFormatter
Returns:
a JFormattedTextField.

createFormattedTextField

protected JFormattedTextField createFormattedTextField(JFormattedTextField.AbstractFormatter formatter)
Creates the formatted text field used by this cell editor.

Parameters:
formatter - AbstractFormatter to use for formatting.
Returns:
a JFormattedTextField.

customizeTextField

protected void customizeTextField()

setupTextField

protected void setupTextField()

setConverterContext

public void setConverterContext(ConverterContext context)
Description copied from class: ContextSensitiveCellEditor
Set the converter context for the cell editor.

By default, this context is null so that the converter context of the cell editor will be the same as the converter context of the cell in the ContextSensitiveTable. You could set this context to a non-null value so that the editor could have different converter context with the cell itself.

While getting converter context, it will first check this method then check ContextSensitiveCellEditor.isUseConverterContext() to decide if the editor should use the cell's converter context or use null always.

Specified by:
setConverterContext in interface ConverterContextSupport
Overrides:
setConverterContext in class ContextSensitiveCellEditor
Parameters:
context - the converter context
See Also:
ContextSensitiveCellEditor.getConverterContext()

getCellEditorValue

public Object getCellEditorValue()
Specified by:
getCellEditorValue in interface CellEditor

setCellEditorValue

public void setCellEditorValue(Object value)

getTableCellEditorComponent

public Component getTableCellEditorComponent(JTable table,
                                             Object value,
                                             boolean isSelected,
                                             int row,
                                             int column)
Specified by:
getTableCellEditorComponent in interface TableCellEditor

focusLost

public void focusLost(FocusEvent e)
Specified by:
focusLost in interface FocusListener

focusGained

public void focusGained(FocusEvent e)
Specified by:
focusGained in interface FocusListener

getFormatFactory

protected JFormattedTextField.AbstractFormatterFactory getFormatFactory()

isEditorStyleSupported

public boolean isEditorStyleSupported(int editorStyle)
Description copied from interface: EditorStyleSupport
Checks if the editor style is supported by the cell editor.

Specified by:
isEditorStyleSupported in interface EditorStyleSupport
Overrides:
isEditorStyleSupported in class ContextSensitiveCellEditor
Parameters:
editorStyle - the editor style
Returns:
true if it is supported. Otherwise false.

JIDE 3.5.15