Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » JFace » Databing with viewer input (ViewerProperties.input().observe(tableViewer);)
Databing with viewer input [message #897320] Mon, 23 July 2012 11:13 Go to previous message
Simon SSC is currently offline Simon SSC
Messages: 56
Registered: April 2012
Location: Germany
Member
Hello,

I am binding an TableViewer to my model, which contains a List of Objects.
The List is converted, by a Converter in the UpdateStrategy to a List of TableRowItem Objects, so that my model can be shown in the viewer.

IObservableValue observableViewerValue = ViewerProperties.input()       .observe(tableViewer);
IObservableValue observableModelValue = ...IObservableValue form model...

...creation of the targetToModel and modelToTarget UpdateStrategies...

this.dataBindingContext.bindValue(observableViewerValue ,observableModelValue, targetToModel, modelToTarget);



With that code the input of the TableViewer is correctly filled by the converted model.

My Question is how to update the TableViewers input, when the input is changed with the org.eclipse.jface.databinding.viewers.ObservableValueEditingSupport.

In the ObservableValueEditingSupport itself you have to return an IObservableValue in the doCreateElementObservable method.

I added an IValueChangeListener to that IObservableValue and realized that the Values are updated in the TableRowItem, which I mentioned before.

But it seems that the input of the viewer is only affected internally inside the TableRowItem, so that the model(observableModelValue in the sample code), which is bound to the input of the TableViewer, is not updated.

How do I trigger an update to the model which is bound to the input of the TableViewer?

Using...
Object input = viewer.getInput();
viewer.setInput(input);

... does not update the model, which is bound to the input of the viewer Sad

Best regards,

Simon
 
Read Message
Read Message
Read Message
Previous Topic:Data Binding Exception when closing.
Next Topic:Getting IValueProperty of a certain value in a MAP
Goto Forum:
  


Current Time: Sat May 25 23:43:54 EDT 2013

Powered by FUDForum. Page generated in 0.01762 seconds