Class ObservableValueEditingSupport<E,M,T>
java.lang.Object
org.eclipse.jface.viewers.EditingSupport
org.eclipse.jface.databinding.viewers.ObservableValueEditingSupport<E,M,T>
- Type Parameters:
E- type of the model element with a property that is being editedM- type of the value in the model that is being edited, the value of the property on the model elementT- type of the target value that actually is being edited by the user
EditingSupport using the JFace Data Binding concepts to handle the
updating of an element from a CellEditor.
If M and T are different then they must be converted to each
other.
- Since:
- 1.2
-
Constructor Summary
ConstructorsConstructorDescriptionObservableValueEditingSupport(ColumnViewer viewer, DataBindingContext dataBindingContext) Constructs a new instance with the providedviewerand dataBindingContext -
Method Summary
Modifier and TypeMethodDescriptionprotected booleanDefault implementation always returnstrue.static <E,M, T> EditingSupport create(ColumnViewer viewer, DataBindingContext dataBindingContext, CellEditor cellEditor, IValueProperty<? super CellEditor, T> cellEditorProperty, IValueProperty<E, M> elementProperty) Returns an ObservableValueEditingSupport instance which binds the given cell editor property to the given element property.protected BindingcreateBinding(IObservableValue<T> target, IObservableValue<M> model) Creates a new binding for the providedtargetandmodel.protected abstract IObservableValue<T> doCreateCellEditorObservable(CellEditor cellEditor) Creates the observable value for the CellEditor.protected abstract IObservableValue<M> doCreateElementObservable(E element, ViewerCell cell) Creates the observable value for the element.protected final DataBindingContextprotected ObjectDefault implementation always returnsnullas this will be handled by the Binding.protected final voidinitializeCellEditorValue(CellEditor cellEditor, ViewerCell cell) Creates aBindingbetween the editor and the element to be edited.protected final voidsaveCellEditorValue(CellEditor cellEditor, ViewerCell cell) Updates the model from the target.protected voidDefault implementation does nothing as this will be handled by the Binding.Methods inherited from class org.eclipse.jface.viewers.EditingSupport
getCellEditor, getViewer
-
Constructor Details
-
ObservableValueEditingSupport
Constructs a new instance with the providedviewerand dataBindingContext- Parameters:
viewer- viewer to editdataBindingContext- used to createBindings
-
-
Method Details
-
create
public static <E,M, EditingSupport createT> (ColumnViewer viewer, DataBindingContext dataBindingContext, CellEditor cellEditor, IValueProperty<? super CellEditor, T> cellEditorProperty, IValueProperty<E, M> elementProperty) Returns an ObservableValueEditingSupport instance which binds the given cell editor property to the given element property.- Parameters:
viewer- the column viewerdataBindingContext- 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.- Returns:
- an ObservableValueEditingSupport instance using the given arguments.
- Since:
- 1.3
-
canEdit
Default implementation always returnstrue.- Specified by:
canEditin classEditingSupport- Parameters:
element- the model element- Returns:
- true if editable
- See Also:
-
getValue
Default implementation always returnsnullas this will be handled by the Binding.- Specified by:
getValuein classEditingSupport- Parameters:
element- the model element- Returns:
- the value shown
- See Also:
-
setValue
Default implementation does nothing as this will be handled by the Binding.- Specified by:
setValuein classEditingSupport- Parameters:
element- the model elementvalue- the new value- See Also:
-
initializeCellEditorValue
Creates aBindingbetween the editor and the element to be edited. InvokesdoCreateCellEditorObservable(CellEditor),doCreateElementObservable(Object, ViewerCell), and thencreateBinding(IObservableValue, IObservableValue).- Overrides:
initializeCellEditorValuein classEditingSupport- Parameters:
cellEditor- the cell editorcell- the cell the editor is working for
-
doCreateCellEditorObservable
Creates the observable value for the CellEditor.- Parameters:
cellEditor- editor to create observable for- Returns:
- observable value
-
doCreateElementObservable
Creates the observable value for the element.- Parameters:
element- element to create observable forcell- elements viewer cell- Returns:
- observable value
-
getDataBindingContext
- Returns:
- the
DataBindingContextthat was used when creating this object. - Since:
- 1.11
-
createBinding
Creates a new binding for the providedtargetandmodel. Defaultvalue update strategiesare used with the target to model updating onUpdateValueStrategy.POLICY_CONVERT.- Parameters:
target- the targetmodel- the model- Returns:
- binding created binding
-
saveCellEditorValue
Updates the model from the target.- Overrides:
saveCellEditorValuein classEditingSupport- Parameters:
cellEditor- the cell-editorcell- the cell the editor is working for
-