IDEMPIERE-5527 Implement asynchronous rendering of dashboard gadget panel (#1644)

* IDEMPIERE-5527 Implement asynchronous rendering of dashboard gadget panel

- implement the same when pushing the Refresh button

* - change to Async
This commit is contained in:
Carlos Ruiz 2023-01-18 15:47:51 +01:00 committed by GitHub
parent 0aec0cf450
commit 89cd0be188
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 18 additions and 3 deletions

View File

@ -29,10 +29,13 @@
package org.adempiere.webui.dashboard;
import org.adempiere.util.ContextRunnable;
import org.adempiere.webui.apps.BusyDialog;
import org.adempiere.webui.apps.graph.WDocumentStatusPanel;
import org.adempiere.webui.component.ToolBarButton;
import org.adempiere.webui.theme.ThemeManager;
import org.adempiere.webui.util.ServerPushTemplate;
import org.compiere.Adempiere;
import org.compiere.util.Env;
import org.compiere.util.Msg;
import org.compiere.util.Util;
@ -95,8 +98,20 @@ public class DPDocumentStatus extends DashboardPanel implements EventListener<Ev
String eventName = event.getName();
if (eventName.equals(Events.ON_CLICK)) {
statusPanel.refresh();
statusPanel.updateUI();
BusyDialog busyDialog = new BusyDialog();
busyDialog.setShadow(false);
getParent().insertBefore(busyDialog, getParent().getFirstChild());
ServerPushTemplate template = new ServerPushTemplate(getDesktop());
ContextRunnable cr = new ContextRunnable() {
@Override
protected void doRun() {
refresh(template);
template.executeAsync(() -> {
busyDialog.detach();
});
}
};
Adempiere.getThreadPoolExecutor().submit(cr);
}
}

View File

@ -143,7 +143,7 @@ public class DashboardRunnable implements Runnable, Serializable
@Override
protected void doRun() {
dpanel.refresh(template);
template.execute(() -> {
template.executeAsync(() -> {
busyDialog.detach();
});
}