[NEON] Refresh Ui Component instantly [message #1746653] |
Wed, 02 November 2016 09:45  |
Eclipse User |
|
|
|
Hi,
I implemented a menu to load data asynchronously as following:
public abstract class AbstractLoadingMenu extends AbstractMenu {
@Override
protected String getConfiguredText() {
return TEXTS.get("AbstractLoadingMenu");
}
@Override
protected Set<? extends IMenuType> getConfiguredMenuTypes() {
return CollectionUtility.hashSet(TableMenuType.EmptySpace);
}
@Override
protected void execAction() {
setEnabled(false);
Jobs.schedule(new IRunnable() {
@Override
public void run() throws Exception {
try {
setText(getConfiguredLoadingMessage());
load();
} catch (Throwable t) {
t.printStackTrace();
setText(getConfiguredErrorMessage());
} finally {
setText(getConfiguredText());
setEnabled(true);
}
}
}, Jobs.newInput().withName(getConfiguredText()).withRunContext(ClientRunContexts.copyCurrent()));
}
protected abstract void load();
}
Sometimes it takes rather long until the menu becomes enabled again despite setEnabled(true); being called almost instantly. I suspect it maybe has something todo with it being called out of a job. Is there a method to force the ui to refresh instantly after setEnabled(true); has been called?
Other than that I am generally interested in any feedback about this implementation.
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.24813 seconds