use of org.adempiere.webui.util.ServerPushTemplate in project adempiere by adempiere.
the class DashboardRunnable method refreshDashboard.
/**
* Refresh dashboard content
*/
public void refreshDashboard() {
ServerPushTemplate template = new ServerPushTemplate(desktop);
for (int i = 0; i < dashboardPanels.size(); i++) {
//make sure context is correct
Properties ctx = (Properties) template.getDesktop().getSession().getAttribute(SessionContextListener.SESSION_CTX);
if (ctx != null) {
ServerContext serverContext = ServerContext.getCurrentInstance();
if (serverContext == null) {
serverContext = ServerContext.newInstance();
serverContext.putAll(ctx);
} else {
String id = ctx.getProperty(SessionContextListener.SERVLET_SESSION_ID);
if (id == null || !id.equals(serverContext.getProperty(SessionContextListener.SERVLET_SESSION_ID))) {
serverContext.clear();
serverContext.putAll(ctx);
}
}
}
dashboardPanels.get(i).refresh(template);
}
//make sure context is correct
Properties ctx = (Properties) template.getDesktop().getSession().getAttribute(SessionContextListener.SESSION_CTX);
if (ctx != null) {
ServerContext serverContext = ServerContext.getCurrentInstance();
if (serverContext == null) {
serverContext = ServerContext.newInstance();
serverContext.putAll(ctx);
} else {
String id = ctx.getProperty(SessionContextListener.SERVLET_SESSION_ID);
if (id == null || !id.equals(serverContext.getProperty(SessionContextListener.SERVLET_SESSION_ID))) {
serverContext.clear();
serverContext.putAll(ctx);
}
}
}
appDesktop.onServerPush(template);
}
Aggregations