public abstract class ObservableValueEditingSupport extends EditingSupport
EditingSupport
using the JFace Data Binding concepts to handle the
updating of an element from a CellEditor
.Constructor and Description |
---|
ObservableValueEditingSupport(ColumnViewer viewer,
DataBindingContext dbc)
Constructs a new instance with the provided
viewer and
dbc . |
Modifier and Type | Method and Description |
---|---|
protected boolean |
canEdit(Object element)
Default implementation always returns
true . |
static EditingSupport |
create(ColumnViewer viewer,
DataBindingContext dbc,
CellEditor cellEditor,
IValueProperty cellEditorProperty,
IValueProperty elementProperty)
Returns an ObservableValueEditingSupport instance which binds the given
cell editor property to the given element property.
|
protected Binding |
createBinding(IObservableValue target,
IObservableValue model)
Creates a new binding for the provided
target and
model . |
protected abstract IObservableValue |
doCreateCellEditorObservable(CellEditor cellEditor)
Creates the observable value for the CellEditor.
|
protected abstract IObservableValue |
doCreateElementObservable(Object element,
ViewerCell cell)
Creates the observable value for the element.
|
protected Object |
getValue(Object element)
Default implementation always returns
null as this will be
handled by the Binding. |
protected void |
initializeCellEditorValue(CellEditor cellEditor,
ViewerCell cell)
Creates a
Binding between the editor and the element to be
edited. |
protected void |
saveCellEditorValue(CellEditor cellEditor,
ViewerCell cell)
Updates the model from the target.
|
protected void |
setValue(Object element,
Object value)
Default implementation does nothing as this will be handled by the
Binding.
|
getCellEditor, getViewer
public ObservableValueEditingSupport(ColumnViewer viewer, DataBindingContext dbc)
viewer
and
dbc
.viewer
- viewer to editdbc
- dbc to create Bindings
public static EditingSupport create(ColumnViewer viewer, DataBindingContext dbc, CellEditor cellEditor, IValueProperty cellEditorProperty, IValueProperty elementProperty)
viewer
- the column viewerdbc
- the DataBindingContext used for binding between the cell
editor and the viewer element.cellEditor
- the cell editorcellEditorProperty
- the cell editor property to be bound to the element.elementProperty
- the element property to be bound to the cell editor.protected boolean canEdit(Object element)
true
.canEdit
in class EditingSupport
element
- the model elementEditingSupport.canEdit(java.lang.Object)
protected Object getValue(Object element)
null
as this will be
handled by the Binding.getValue
in class EditingSupport
element
- the model elementEditingSupport.getValue(java.lang.Object)
protected void setValue(Object element, Object value)
setValue
in class EditingSupport
element
- the model elementvalue
- the new valueEditingSupport.setValue(java.lang.Object,
java.lang.Object)
protected final void initializeCellEditorValue(CellEditor cellEditor, ViewerCell cell)
Binding
between the editor and the element to be
edited. Invokes doCreateCellEditorObservable(CellEditor)
,
doCreateElementObservable(Object, ViewerCell)
, and then
createBinding(IObservableValue, IObservableValue)
.initializeCellEditorValue
in class EditingSupport
cellEditor
- the cell editorcell
- the cell the editor is working forprotected abstract IObservableValue doCreateCellEditorObservable(CellEditor cellEditor)
cellEditor
- protected abstract IObservableValue doCreateElementObservable(Object element, ViewerCell cell)
element
- cell
- protected Binding createBinding(IObservableValue target, IObservableValue model)
target
and
model
. Default value update
strategies
are used with the target to model updating on
UpdateValueStrategy.POLICY_CONVERT
.target
- model
- protected final void saveCellEditorValue(CellEditor cellEditor, ViewerCell cell)
saveCellEditorValue
in class EditingSupport
cellEditor
- the cell-editorcell
- the cell the editor is working for
Copyright (c) 2000, 2015 Eclipse Contributors and others. All rights reserved.Guidelines for using Eclipse APIs.