E
- the type of elements returned by the underlying column viewer.V
- the type of values returned, and accepted, by the underlying cell
editors.public abstract class TypedEditingSupportConstantEditor<E,V> extends TypedEditingSupport<E,V>
An Editing Support with support for generic types (see
TypedEditingSupport
) and a single underlying cell editor. Objects of
this type also permit to set a validator to restrict the values that the
underlying cell editor will accept.
This object accepts two validators, a “first-level” validator and a
(unqualified) validator. The effective validator is a composition of those
two validators: if the first-level validator reports an error, the effective
validator reports that error (the unqualified validator is not invoked); and
otherwise, the unqualified validator is invoked. If a validator is set to
null
, it considers everything acceptable (but the other
validator still operates). Both validators are null
by default
(subclasses may change this).
The user must go through this object to change the validator behavior of the underlying cell editor. The user may not set or remove the validator directly on the underlying cell editor.
The user must call setCellEditor(CellEditor)
; override
#getValueTyped(E)
to provide values
corresponding to elements; and #setValueTyped(E, V)
to set the values sent by the cell editor back to the
model. The user may also override #canEditTyped(E)
(true
by default).
Constructor and Description |
---|
TypedEditingSupportConstantEditor(ColumnViewer viewer,
Class<E> classOfElements,
Class<V> classOfValues) |
Modifier and Type | Method and Description |
---|---|
CellEditor |
getCellEditor()
Returns the cell editor underlying this object.
|
CellEditor |
getCellEditorTyped(E element)
The editor to be shown
This method is simply a better typed version of
TypedEditingSupport.getCellEditor(Object) . |
void |
setCellEditor(CellEditor editor)
Sets the cell editor underlying this object.
|
protected void |
setFirstLevelValidator(Function<V,String> valueToErrorMessage)
Sets the first-level input validator for this cell editor.
|
void |
setValidator(Function<V,String> valueToErrorMessage)
Sets the input validator for this cell editor.
|
canEdit, canEditTyped, getCellEditor, getTypedElement, getTypedValue, getValue, getValueTyped, setValue, setValueTyped
getViewer, initializeCellEditorValue, saveCellEditorValue
public TypedEditingSupportConstantEditor(ColumnViewer viewer, Class<E> classOfElements, Class<V> classOfValues)
public CellEditor getCellEditor()
null
iff has never been set.public CellEditor getCellEditorTyped(E element)
TypedEditingSupport
The editor to be shown
This method is simply a better typed version of
TypedEditingSupport.getCellEditor(Object)
.
getCellEditorTyped
in class TypedEditingSupport<E,V>
element
- the model elementpublic void setCellEditor(CellEditor editor)
editor
- not null
.public void setValidator(Function<V,String> valueToErrorMessage)
Sets the input validator for this cell editor.
The validator is given the value to be validated, and must return a
string indicating whether the given value is valid; null
means valid, and non-null
means invalid, with the result
being the error message to display to the end user.
valueToErrorMessage
- the input validator, or null
if noneprotected void setFirstLevelValidator(Function<V,String> valueToErrorMessage)
Sets the first-level input validator for this cell editor.
The validator is given the value to be validated, and must return a
string indicating whether the given value is valid; null
means valid, and non-null
means invalid, with the result
being the error message to display to the end user.
valueToErrorMessage
- the input validator, or null
if noneCopyright © 2017. All rights reserved.