AdapterFactoryObservableList not responsive to changes in the underlying model ? [message #1696186] |
Fri, 22 May 2015 11:46  |
Eclipse User |
|
|
|
Hello,
I was trying to populate a ListView using a AdapterFactoryObservableList when I noticed the ListView is not updated when the underlying model changes.
One very simple example to illustrate this (using EMF Transaction but when reverting back to plain EMF.Edit the behaviour turns out to be the same)
ListView<IEmployer> myListView = new ListView<>();
domain = (AdapterFactoryEditingDomain) TransactionalEditingDomain.Registry.INSTANCE.getEditingDomain("my_id") ;
TransactionalCommandStack stack = (TransactionalCommandStack) domain.getCommandStack() ;
Resource mainResource = new ResourceImpl(URI.createFileURI("path_to_xmi") );
domain.getResourceSet().getResources().add(mainResource) ;
List<IEmployer> employers = fetchSomeData();
try
{
stack.execute(new RecordingCommand((TransactionalEditingDomain)domain)
{
@Override
protected void doExecute()
{
mainResource.getContents().addAll(employers.subList(0, 10)) ;
}
}, Collections.emptyMap());
}
catch(...)
myListView.setItems(new AdapterFactoryObservableList<IEmployer>(adapterFactory, mainResource)) ;
try {
stack.execute(new RecordingCommand((TransactionalEditingDomain)domain)
{
@Override
protected void doExecute()
{
mainResource.getContents().addAll(employers.subList(11, employers.size())) ;
}
}, Collections.emptyMap()) ;
}
catch(...)
The result of this code is that the first ten elements appear are displayed in the ListView, while the remainder is not.
Is there anything I can do to change this behaviour ?
Thomas Elskens
|
|
|
|
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.25550 seconds