Skip to main content


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 15:13 Go to next message
Simon Scholz is currently offline Simon ScholzFriend
Messages: 73
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
Re: Databing with viewer input [message #897380 is a reply to message #897320] Mon, 23 July 2012 20:45 Go to previous messageGo to next message
Jan Krakora is currently offline Jan KrakoraFriend
Messages: 477
Registered: December 2009
Location: Prague
Senior Member
Hi Simon,

what about the ObservableListContentProvider?
http://www.vogella.com/articles/EclipseDataBinding/article.html#jfacedb
Re: Databing with viewer input [message #897384 is a reply to message #897380] Mon, 23 July 2012 21:49 Go to previous messageGo to next message
Simon Scholz is currently offline Simon ScholzFriend
Messages: 73
Registered: April 2012
Location: Germany
Member
Thanks for the reply Jan Krakora,

I am already using the ObservableListContentProvider for the TableViewer.
It updates the TableRowItems, which are passed as input via the binding, but not the model of the input binding is not updated.
So I got 2 different kinds of bindings:

1. Model, which is converted to a List of TableRowItems(by the UpdateStrategys Converter) in order to be shown as input of the TableViewer via ViewerProperties.input().observe(tableViewer)

2. TableRowItems, which internally contain the different columns of the TableViewer, which can be edited by an org.eclipse.jface.databinding.viewers.ObservableValueEditingSupport. So the CellEditor in the ObservableValueEditingSupport updates the TableRowItems correctly, but the model in the first binding is not informed, when an TableRowItem is changed.

So what I want is to trigger an update on the input model of the first binding, when a TableRowItem of the second binding is modified.
I'd like to update from target to model with the ViewerProperties.input().observe(tableViewer) binding.

I hope my needs are clear, otherwise I can offer more information.

Thanks in advance.

Best regards,

Simon
Re: Databing with viewer input [message #1835656 is a reply to message #897384] Wed, 09 December 2020 15:11 Go to previous message
Priya Abi is currently offline Priya AbiFriend
Messages: 1
Registered: December 2020
Junior Member
Hi Simon,

I am facing the same issue as you. Model value is being set to the viewer but viewer input is not being updated to the model.
Were you able to find a solution to your problem??
Previous Topic:Horizontal toolbar on custom DPI settings
Next Topic:Jface EOL versions?
Goto Forum:
  


Current Time: Tue Mar 19 03:34:07 GMT 2024

Powered by FUDForum. Page generated in 0.02745 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top