org.springframework.richclient.widget.table
Class ValueModelTableCellEditor
java.lang.Object
javax.swing.AbstractCellEditor
org.springframework.richclient.widget.table.ValueModelTableCellEditor
- All Implemented Interfaces:
- Serializable, CellEditor, TableCellEditor
public class ValueModelTableCellEditor
- extends AbstractCellEditor
- implements TableCellEditor
TableCellEditor
that uses a backing FormModel
to determine the editing capabilities and
committing of the value.
NOTE: the CellEditor will get the first event, only afterwards the row selection changes. This has the
effect that editing a cell will switch values upon entering. Additionally the cell should always be marked
editable and the binding that acts as the editor should disable itself if needed. If we were to rely on
FieldMetadata.isReadOnly()
, the previous value would determine if the cell is editable because
the underlying form object isn't changed yet.
- Author:
- Jan Hoskens
- See Also:
- Serialized Form
Constructor Summary |
ValueModelTableCellEditor(AbstractForm form,
String propertyName)
|
ValueModelTableCellEditor(FormModel formModel,
FieldMetadata fieldMetadata,
ValueModel valueModel,
JComponent editor)
|
ValueModelTableCellEditor(FormModel formModel,
FieldMetadata fieldMetadata,
ValueModel valueModel,
JComponent editor,
ActionCommand commitCommand)
Creates a TableCellEditor. |
ValueModelTableCellEditor(FormModel formModel,
String propertyName,
JComponent editor)
Creates a TableCellEditor. |
ValueModelTableCellEditor(FormModel formModel,
String propertyName,
JComponent editor,
ActionCommand commitCommand)
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
ValueModelTableCellEditor
public ValueModelTableCellEditor(FormModel formModel,
String propertyName,
JComponent editor)
- Creates a TableCellEditor. The property will be used to retrieve the
ValueModel
and
FieldMetadata
. The first is used while getting the initial value, the latter is used to
determine if the cell is editable. Note that the given editor should be bound already.
- Parameters:
formModel
- model to use when committing/reverting.propertyName
- name of the property.editor
- JComponent bound to that property used in the editable state.
ValueModelTableCellEditor
public ValueModelTableCellEditor(AbstractForm form,
String propertyName)
ValueModelTableCellEditor
public ValueModelTableCellEditor(FormModel formModel,
String propertyName,
JComponent editor,
ActionCommand commitCommand)
ValueModelTableCellEditor
public ValueModelTableCellEditor(FormModel formModel,
FieldMetadata fieldMetadata,
ValueModel valueModel,
JComponent editor)
ValueModelTableCellEditor
public ValueModelTableCellEditor(FormModel formModel,
FieldMetadata fieldMetadata,
ValueModel valueModel,
JComponent editor,
ActionCommand commitCommand)
- Creates a TableCellEditor. The
ValueModel
is used while getting the initial value, the
FieldMetadata
is used to determine if the cell is editable. Note that the given editor should
be bound already.
- Parameters:
formModel
- model to use when committing/reverting.valueModel
- valueModel to retrieve the initial value.fieldMetadata
- metaData to determine if the cell is editable.editor
- JComponent bound to that property used in the editable state.
getTableCellEditorComponent
public Component getTableCellEditorComponent(JTable table,
Object value,
boolean isSelected,
int row,
int column)
- Specified by:
getTableCellEditorComponent
in interface TableCellEditor
cancelCellEditing
public void cancelCellEditing()
- Specified by:
cancelCellEditing
in interface CellEditor
- Overrides:
cancelCellEditing
in class AbstractCellEditor
getCellEditorValue
public Object getCellEditorValue()
- Specified by:
getCellEditorValue
in interface CellEditor
isCellEditable
public boolean isCellEditable(EventObject anEvent)
- We cannot rely on the
FieldMetadata
because the form object is replaced AFTER this method
is queried. We would be returning the previous value instead of the current one.
Instead rely on the binding's component to set the editor read-only.
- Specified by:
isCellEditable
in interface CellEditor
- Overrides:
isCellEditable
in class AbstractCellEditor
stopCellEditing
public boolean stopCellEditing()
- Specified by:
stopCellEditing
in interface CellEditor
- Overrides:
stopCellEditing
in class AbstractCellEditor
Copyright © 2004-2009 The Spring Framework. All Rights Reserved.