Observe Lists and ObservableMapProvider [message #504597] |
Mon, 21 December 2009 17:26 |
Tim Messages: 12 Registered: December 2009 |
Junior Member |
|
|
Hello,
i want to build a tableviewer and fill it with my data. Changes in the model btw the ui should synchronize automatically the other side.
I have solved it for POJOs without Lists. Now, i have a List in my domain model and dont know, how i can automatically synchronize the view, if properties in the list changes.
My domain model looks for example like this:
public class DomainModel
{
prvate String options;
prvate String label;
prvate Integer number;
prvate Integer physNumber;
prvate List<CallAttr> callAttr = new ArrayList<CallAttr>;
// the setter contains the propertyChange events
}
Now i build my the content- and labelprovider for the tableviewer, here's the code:
ObservableListContentProvider contentProvider = new ObservableListContentProvider();
// the wList get a list with some Object from the type //DomainModel
wList = new WritableList(ViewModel().getmodelList(), DomainModell.class);
// now come the binding with the viewer an the model with a //ObservableMapCellLabelProvider
String[] modelElements = {"options", "label", "number", "physNumber"};
IObservableMap[] observableMap = BeansObservables.observeMaps(contentProvider.getKnownElements(), DomainModel.class, modelElements);
// set providers
viewer.setContentProvider(contentProvider);
viewer.setLabelProvider(new ObservableMapCellLabelProvider(observableMap));
viewer.setInput(wList);
So far, this work very nice.
But now i want two more attributes in the viewer from the arraylist "callAttr":
public class CallAttr
{
private String name;
private String age;
}
The presentation of this properties in the viewer ist not the problem, but the automatically synchronization. If i change the name in the model, i must manuel refresh the viewer and this is not so nice! I want the automatically synchronization!
How i could solve this problem?
Can someone help me?
|
|
|
Re: Observe Lists and ObservableMapProvider [message #509649 is a reply to message #504597] |
Sat, 23 January 2010 23:50 |
Boris Bokowski Messages: 272 Registered: July 2009 |
Senior Member |
|
|
Hi Tim,
I sounds like this enhancement request is what you are looking for:
https://bugs.eclipse.org/bugs/show_bug.cgi?id=300043
Boris
"Tim" <konkretman@gmx.de> wrote in message
news:hgob4j$9le$1@build.eclipse.org...
> Hello,
>
> i want to build a tableviewer and fill it with my data. Changes in the
> model btw the ui should synchronize automatically the other side.
> I have solved it for POJOs without Lists. Now, i have a List in my domain
> model and dont know, how i can automatically synchronize the view, if
> properties in the list changes.
> My domain model looks for example like this:
> public class DomainModel
> {
> prvate String options;
> prvate String label;
> prvate Integer number;
> prvate Integer physNumber;
> prvate List<CallAttr> callAttr = new ArrayList<CallAttr>;
> // the setter contains the propertyChange events
> }
>
>
> Now i build my the content- and labelprovider for the tableviewer, here's
> the code:
>
> ObservableListContentProvider contentProvider = new
> ObservableListContentProvider();
> // the wList get a list with some Object from the type //DomainModel
> wList = new WritableList(ViewModel().getmodelList(), DomainModell.class);
> // now come the binding with the viewer an the model with a
> //ObservableMapCellLabelProvider
> String[] modelElements = {"options", "label", "number", "physNumber"};
> IObservableMap[] observableMap =
> BeansObservables.observeMaps(contentProvider.getKnownElement s(),
> DomainModel.class, modelElements);
>
> // set providers
> viewer.setContentProvider(contentProvider);
> viewer.setLabelProvider(new
> ObservableMapCellLabelProvider(observableMap));
>
> viewer.setInput(wList);
>
>
> So far, this work very nice. But now i want two more attributes in the
> viewer from the arraylist "callAttr":
>
> public class CallAttr
> {
> private String name;
> private String age;
> }
>
>
> The presentation of this properties in the viewer ist not the problem, but
> the automatically synchronization. If i change the name in the model, i
> must manuel refresh the viewer and this is not so nice! I want the
> automatically synchronization!
>
> How i could solve this problem?
> Can someone help me?
|
|
|
Powered by
FUDForum. Page generated in 0.03665 seconds