[EMF-Databinding] Observe addition/removal changes in multi-value feature of a multi-value feature [message #902114] |
Wed, 15 August 2012 22:38 ![Go to next message Go to next message](theme/Solstice/images/down.png) |
Paco Blanco![Friend of Eclipse Friend](/donate/web-api/friends_decorator.php?email=fcojavibr%40gmail.com) Messages: 28 Registered: June 2012 |
Junior Member |
|
|
Me again... :S
We want to observe element additions/removals from a list of a list of objects (like a double-nested multi-value feature)
We have a Model instance, this one has a multi-value feature, the objects from this feature was shown in a table. They have another multi-value feature inside that I want to observe.
Wrong code:
WritableValue writable = new WritableValue();
writable.setValue(model);
IObservableList observableSubElementList = EMFProperties.list(ModelPackage.Literals.MODEL__SUBELEMENTS).observeDetail(writable);
ObservableListContentProvider ocp = new ObservableListContentProvider();
tableViewer.setContentProvider(ocp);
table.setInput(observableSubElementList);
//One wrong possibility to observe changes in the SubList:
IObservableList observableSubSubElementList = EMFProperties.value(ModelPackage.Literals.SUBELEMENT__SUBSUBELEMENTS).observeDetail(observableSubElementList);
observableSubSubElementList.addListChangeListener(new IListChangeListener() {
@Override
public void handleListChange(ListChangeEvent event) {
//Do something
}
});
//Another wrong possibility to observe changes in the SubList:
IObservableList observableSubSubElementMap = EMFProperties.value(ModelPackage.Literals.SUBELEMENT__SUBSUBELEMENTS).observeDetail(ocp.getKnownElements());
observablePermissionList.addMapChangeListener(new IMapChangeListener() {
@Override
public void handleListChange(ListChangeEvent event) {
//Do something
}
});
The wrong code only observe changes if one list is replaced by other list (other Java object). It does not observe to the subelement additions or removals in any list.
I think we have to use not ObservableList/Map.value but ObservableList/Map.list:
IObservableList observableSubSubElementList = EMFProperties.list(ModelPackage.Literals.SUBELEMENT__SUBSUBELEMENTS) -> xxxxx -> observableSubElementList
xxxxx can be a method or a group of methods that I cannot find.
Any idea? Or maybe is it not possible?
[Updated on: Wed, 15 August 2012 22:41] Report message to a moderator
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.02651 seconds