From 14d41aaf33f871ac9e032dd98a8bfaa227b2ac2b Mon Sep 17 00:00:00 2001 From: Heng Sin Low Date: Sat, 29 Dec 2012 07:13:19 +0800 Subject: [PATCH] IDEMPIERE-522 Zk: Random Freeze of screen update. Fixed intermittent update issue after removal of in progress mask. --- .../adwindow/AbstractADWindowContent.java | 55 +++++++++++-------- .../webui/panel/action/ExportAction.java | 7 +-- .../webui/panel/action/FileImportAction.java | 6 +- .../webui/panel/action/ReportAction.java | 10 +++- .../adempiere/webui/process/InvoicePrint.java | 2 +- 5 files changed, 46 insertions(+), 34 deletions(-) diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/adwindow/AbstractADWindowContent.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/adwindow/AbstractADWindowContent.java index e0d5fea1ee..84192c08d8 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/adwindow/AbstractADWindowContent.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/adwindow/AbstractADWindowContent.java @@ -438,12 +438,12 @@ public abstract class AbstractADWindowContent extends AbstractUIPart implements GridTab pTab = gridWindow.getTab(entry.getKey()); Object[] value = entry.getValue(); MQuery pquery = new MQuery(pTab.getAD_Table_ID()); - pquery.addRestriction((String)value[0], "=", value[1]); + pquery.addRestriction((String)value[0], "=", value[1]); pTab.setQuery(pquery); IADTabpanel tp = adTabbox.findADTabpanel(pTab); tp.createUI(); tp.query(); - } + } MQuery targetQuery = new MQuery(gTab.getAD_Table_ID()); targetQuery.addRestriction(gTab.getLinkColumnName(), "=", parentId); @@ -866,11 +866,12 @@ public abstract class AbstractADWindowContent extends AbstractUIPart implements win.addEventListener(DialogEvents.ON_WINDOW_CLOSE, new EventListener() { @Override public void onEvent(Event event) throws Exception { - Clients.clearBusy(getComponent()); + Clients.clearBusy(getComponent().getParent()); + getComponent().invalidate(); } }); getComponent().getParent().appendChild(win); - Clients.showBusy(getComponent(), " "); + Clients.showBusy(getComponent().getParent(), " "); LayoutUtils.openOverlappedWindow(getComponent(), win, "middle_center"); } @@ -906,11 +907,12 @@ public abstract class AbstractADWindowContent extends AbstractUIPart implements public void onEvent(Event event) throws Exception { toolbar.getButton("Chat").setPressed(adTabbox.getSelectedGridTab().hasChat()); focusToActivePanel(); - Clients.clearBusy(getComponent()); + Clients.clearBusy(getComponent().getParent()); + getComponent().invalidate(); } }); getComponent().getParent().appendChild(chat); - Clients.showBusy(getComponent(), " "); + Clients.showBusy(getComponent().getParent(), " "); LayoutUtils.openOverlappedWindow(getComponent(), chat, "middle_center"); chat.showWindow(); } @@ -979,14 +981,15 @@ public abstract class AbstractADWindowContent extends AbstractUIPart implements } else if (event.getTarget() instanceof ProcessModalDialog) { - Clients.clearBusy(getComponent()); + Clients.clearBusy(getComponent().getParent()); ProcessModalDialog dialog = (ProcessModalDialog) event.getTarget(); onModalClose(dialog.getProcessInfo()); String s = breadCrumb.getStatusLine(); boolean b = breadCrumb.getStatusError(); ProcessInfoLog[] logs = breadCrumb.getPLogs(); onRefresh(true, false); - breadCrumb.setStatusLine(s, b, logs); + breadCrumb.setStatusLine(s, b, logs); + getComponent().invalidate(); } else if (ADTabpanel.ON_DYNAMIC_DISPLAY_EVENT.equals(event.getName())) { @@ -1577,7 +1580,8 @@ public abstract class AbstractADWindowContent extends AbstractUIPart implements findWindow.addEventListener(DialogEvents.ON_WINDOW_CLOSE, new EventListener() { @Override public void onEvent(Event event) throws Exception { - Clients.clearBusy(getComponent()); + Clients.clearBusy(getComponent().getParent()); + getComponent().invalidate(); if (!findWindow.isCancel()) { MQuery query = findWindow.getQuery(); @@ -1605,7 +1609,7 @@ public abstract class AbstractADWindowContent extends AbstractUIPart implements } findWindow.setTitle(null); getComponent().getParent().appendChild(findWindow); - Clients.showBusy(getComponent(), " "); + Clients.showBusy(getComponent().getParent(), " "); LayoutUtils.openOverlappedWindow(toolbar, findWindow, "after_start"); } @@ -2050,11 +2054,12 @@ public abstract class AbstractADWindowContent extends AbstractUIPart implements @Override public void onEvent(Event event) throws Exception { focusToActivePanel(); - Clients.clearBusy(getComponent()); + Clients.clearBusy(getComponent().getParent()); + getComponent().invalidate(); } }); getComponent().getParent().appendChild(messagePanel); - Clients.showBusy(getComponent(), " "); + Clients.showBusy(getComponent().getParent(), " "); LayoutUtils.openOverlappedWindow(getComponent(), messagePanel, "middle_center"); } // @@ -2086,7 +2091,7 @@ public abstract class AbstractADWindowContent extends AbstractUIPart implements if (dialog.isValid()) { dialog.setWidth("500px"); dialog.setBorder("normal"); - Clients.showBusy(getComponent(), " "); + Clients.showBusy(getComponent().getParent(), " "); getComponent().getParent().appendChild(dialog); LayoutUtils.openOverlappedWindow(getComponent(), dialog, "middle_center"); } @@ -2358,8 +2363,9 @@ public abstract class AbstractADWindowContent extends AbstractUIPart implements getComponent().getParent().appendChild(win); win.addEventListener(DialogEvents.ON_WINDOW_CLOSE, new EventListener() { public void onEvent(Event event) throws Exception { - Clients.clearBusy(getComponent()); - if (!win.isStartProcess()) { + Clients.clearBusy(getComponent().getParent()); + getComponent().invalidate(); + if (!win.isStartProcess()) { return; } boolean startWOasking = true; @@ -2367,7 +2373,7 @@ public abstract class AbstractADWindowContent extends AbstractUIPart implements executeButtonProcess(wButton, startWOasking, table_ID, recordIdParam, isProcessMandatory); } }); - Clients.showBusy(getComponent(), " "); + Clients.showBusy(getComponent().getParent(), " "); LayoutUtils.openOverlappedWindow(getComponent(), win, "middle_center"); return; } @@ -2383,7 +2389,7 @@ public abstract class AbstractADWindowContent extends AbstractUIPart implements { if(cf.isInitOK()) { - Clients.showBusy(getComponent(), " "); + Clients.showBusy(getComponent().getParent(), " "); final WCreateFromWindow window = (WCreateFromWindow) cf.getWindow(); window.setWidgetAttribute(AdempiereWebUI.WIDGET_INSTANCE_NAME, AdempiereIdGenerator.escapeId(window.getTitle())); window.addEventListener(DialogEvents.ON_WINDOW_CLOSE, new EventListener() { @@ -2392,7 +2398,8 @@ public abstract class AbstractADWindowContent extends AbstractUIPart implements if (!window.isCancel()) { onRefresh(true, false); } - Clients.clearBusy(getComponent()); + Clients.clearBusy(getComponent().getParent()); + getComponent().invalidate(); } }); getComponent().getParent().appendChild(window); @@ -2538,11 +2545,12 @@ public abstract class AbstractADWindowContent extends AbstractUIPart implements @Override public void onEvent(Event event) throws Exception { onRefresh(true, false); - Clients.clearBusy(getComponent()); + Clients.clearBusy(getComponent().getParent()); + getComponent().invalidate(); } }); getComponent().getParent().appendChild(form); - Clients.showBusy(getComponent(), " "); + Clients.showBusy(getComponent().getParent(), " "); LayoutUtils.openOverlappedWindow(getComponent(), form, "middle_center"); } else { @@ -2557,7 +2565,7 @@ public abstract class AbstractADWindowContent extends AbstractUIPart implements { dialog.setWidth("500px"); dialog.setBorder("normal"); - Clients.showBusy(getComponent(), " "); + Clients.showBusy(getComponent().getParent(), " "); getComponent().getParent().appendChild(dialog); LayoutUtils.openOverlappedWindow(getComponent(), dialog, "middle_center"); } @@ -2703,11 +2711,12 @@ public abstract class AbstractADWindowContent extends AbstractUIPart implements dialog.addEventListener(DialogEvents.ON_WINDOW_CLOSE, new EventListener() { @Override public void onEvent(Event event) throws Exception { - Clients.clearBusy(getComponent()); + Clients.clearBusy(getComponent().getParent()); + getComponent().invalidate(); } }); getComponent().getParent().appendChild(dialog); - Clients.showBusy(getComponent(), " "); + Clients.showBusy(getComponent().getParent(), " "); LayoutUtils.openOverlappedWindow(this.getComponent(),dialog,"middle_center"); } diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/panel/action/ExportAction.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/panel/action/ExportAction.java index 301fa09ed1..548aaad012 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/panel/action/ExportAction.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/panel/action/ExportAction.java @@ -42,7 +42,6 @@ import org.compiere.util.Msg; import org.zkoss.util.media.AMedia; import org.zkoss.zk.ui.event.Event; import org.zkoss.zk.ui.event.EventListener; -import org.zkoss.zk.ui.event.Events; import org.zkoss.zk.ui.util.Clients; import org.zkoss.zul.Div; import org.zkoss.zul.Filedownload; @@ -134,7 +133,7 @@ public class ExportAction implements EventListener confirmPanel.addActionListener(this); } - Clients.showBusy(panel.getComponent(), " "); + Clients.showBusy(panel.getComponent().getParent(), " "); panel.getComponent().getParent().appendChild(winExportFile); LayoutUtils.openOverlappedWindow(panel.getComponent(), winExportFile, "middle_center"); winExportFile.addEventListener(DialogEvents.ON_WINDOW_CLOSE, this); @@ -147,8 +146,8 @@ public class ExportAction implements EventListener else if(event.getTarget().getId().equals(ConfirmPanel.A_OK)) exportFile(); else if (event.getName().equals(DialogEvents.ON_WINDOW_CLOSE)) { - Clients.clearBusy(panel.getComponent()); - Events.postEvent(new Event(LayoutUtils.ON_REDRAW_EVENT, panel.getComponent())); + Clients.clearBusy(panel.getComponent().getParent()); + panel.getComponent().invalidate(); } } diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/panel/action/FileImportAction.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/panel/action/FileImportAction.java index 25825d4845..30f7ae1778 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/panel/action/FileImportAction.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/panel/action/FileImportAction.java @@ -172,7 +172,7 @@ public class FileImportAction implements EventListener confirmPanel.addActionListener(this); } - Clients.showBusy(panel.getComponent(), " "); + Clients.showBusy(panel.getComponent().getParent(), " "); panel.getComponent().getParent().appendChild(winImportFile); LayoutUtils.openOverlappedWindow(panel.getComponent(), winImportFile, "middle_center"); winImportFile.addEventListener(DialogEvents.ON_WINDOW_CLOSE, this); @@ -202,8 +202,8 @@ public class FileImportAction implements EventListener return; importFile(); } else if (event.getName().equals(DialogEvents.ON_WINDOW_CLOSE)) { - Clients.clearBusy(panel.getComponent()); - Events.postEvent(new Event(LayoutUtils.ON_REDRAW_EVENT, panel.getComponent())); + Clients.clearBusy(panel.getComponent().getParent()); + panel.getComponent().invalidate(); } } diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/panel/action/ReportAction.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/panel/action/ReportAction.java index 604d8f609d..a805ae5ad4 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/panel/action/ReportAction.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/panel/action/ReportAction.java @@ -57,6 +57,7 @@ import org.zkoss.zk.ui.util.Clients; import org.zkoss.zul.Div; import org.zkoss.zul.Filedownload; import org.zkoss.zul.Hbox; +import org.zkoss.zul.Tabpanel; import org.zkoss.zul.Vbox; /** @@ -173,7 +174,7 @@ public class ReportAction implements EventListener winReport.onClose(); else if(event.getTarget().getId().equals(ConfirmPanel.A_OK)) { winReport.setVisible(false); - Clients.showBusy(panel.getComponent(), null); + Clients.showBusy(Msg.getMsg(Env.getCtx(), "Processing")); Events.echoEvent("onValidate", winReport, null); } else if(event.getTarget() == cboPrintFormat) @@ -189,7 +190,8 @@ public class ReportAction implements EventListener cboExportType.setVisible(chkExport.isChecked()); else if (event.getName().equals("onValidate")) { validate(); - Clients.clearBusy(panel.getComponent()); + Clients.clearBusy(); + panel.getComponent().invalidate(); } } @@ -298,8 +300,10 @@ public class ReportAction implements EventListener private void print(ReportEngine re) { - winReport.onClose(); + winReport.onClose(); ReportCtl.preview(re); + Tabpanel tabPanel = (Tabpanel) panel.getComponent().getParent(); + tabPanel.getLinkedTab().setSelected(true); } private void export(ReportEngine re) diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/process/InvoicePrint.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/process/InvoicePrint.java index 8f9fd43ba3..f3a7716069 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/process/InvoicePrint.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/process/InvoicePrint.java @@ -367,7 +367,7 @@ public class InvoicePrint extends SvrProcess log.log(Level.SEVERE, e.getLocalizedMessage(), e); } } else if (pdfList.size() > 0) { - Clients.clearBusy(null); + Clients.clearBusy(); try { Window win = new SimplePDFViewer(this.getName(), new FileInputStream(pdfList.get(0))); win.setAttribute(Window.MODE_KEY, Window.MODE_HIGHLIGHTED);