IDEMPIERE-1021 Processing status box from Generate Invoices displays on other windows.

This commit is contained in:
Heng Sin Low 2013-06-14 16:32:01 +08:00
parent 91971e5bd3
commit 9c78dd7956
5 changed files with 61 additions and 4 deletions

View File

@ -25,6 +25,7 @@ import org.adempiere.webui.AdempiereWebUI;
import org.adempiere.webui.LayoutUtils;
import org.adempiere.webui.component.Button;
import org.adempiere.webui.component.ConfirmPanel;
import org.adempiere.webui.component.Mask;
import org.adempiere.webui.component.Panel;
import org.adempiere.webui.component.Window;
import org.adempiere.webui.desktop.IDesktop;
@ -53,6 +54,7 @@ import org.zkoss.zhtml.Td;
import org.zkoss.zhtml.Text;
import org.zkoss.zhtml.Tr;
import org.zkoss.zk.au.out.AuEcho;
import org.zkoss.zk.au.out.AuScript;
import org.zkoss.zk.ui.Component;
import org.zkoss.zk.ui.Desktop;
import org.zkoss.zk.ui.Executions;
@ -224,6 +226,7 @@ public class ProcessDialog extends Window implements EventListener<Event>, IProc
private BusyDialog progressWindow;
private Future<?> future;
private ProcessDialogRunnable processDialogRunnable;
private Mask mask;
private static final String ON_STATUS_UPDATE = "onStatusUpdate";
private static final String ON_COMPLETE = "onComplete";
@ -437,12 +440,32 @@ public class ProcessDialog extends Window implements EventListener<Event>, IProc
}
private void showBusyDialog() {
Clients.showBusy(this, " ");
progressWindow = new BusyDialog();
progressWindow.setStyle("position: absolute;");
this.appendChild(progressWindow);
showBusyMask(progressWindow);
LayoutUtils.openOverlappedWindow(this, progressWindow, "middle_center");
}
private Div getMask() {
if (mask == null) {
mask = new Mask();
}
return mask;
}
public void showBusyMask(Window window) {
getParent().appendChild(getMask());
StringBuilder script = new StringBuilder("var w=zk.Widget.$('#");
script.append(getParent().getUuid()).append("');");
if (window != null) {
script.append("var d=zk.Widget.$('#").append(window.getUuid()).append("');w.busy=d;");
} else {
script.append("w.busy=true;");
}
Clients.response(new AuScript(script.toString()));
}
public void unlockUI(ProcessInfo pi) {
if (!m_isLocked || Executions.getCurrent() == null) return;
@ -451,8 +474,17 @@ public class ProcessDialog extends Window implements EventListener<Event>, IProc
updateUI(pi);
}
public void hideBusyMask() {
if (mask != null && mask.getParent() != null) {
mask.detach();
StringBuilder script = new StringBuilder("var w=zk.Widget.$('#");
script.append(getParent().getUuid()).append("');w.busy=false;");
Clients.response(new AuScript(script.toString()));
}
}
private void hideBusyDialog() {
Clients.clearBusy(this);
hideBusyMask();
if (progressWindow != null) {
progressWindow.dispose();
progressWindow = null;

View File

@ -283,6 +283,9 @@ public abstract class TabbedDesktop extends AbstractDesktop {
{
Tabpanel tabPanel = new Tabpanel();
window.setParent(tabPanel);
Object defer = window.getAttribute(WindowContainer.DEFER_SET_SELECTED_TAB);
if ( defer != null)
tabPanel.setAttribute(WindowContainer.DEFER_SET_SELECTED_TAB, defer);
String title = window.getTitle();
window.setTitle(null);
preOpenNewTab();

View File

@ -34,8 +34,12 @@ import org.zkoss.zk.ui.event.SwipeEvent;
*/
public class WindowContainer extends AbstractUIPart
{
private static final String ON_DEFER_SET_SELECTED_TAB = "onDeferSetSelectedTab";
public static final String ON_WINDOW_CONTAINER_SELECTION_CHANGED_EVENT = "onWindowContainerSelectionChanged";
public static final String DEFER_SET_SELECTED_TAB = "deferSetSelectedTab";
private static final int MAX_TITLE_LENGTH = 30;
private Tabbox tabbox;
@ -62,6 +66,14 @@ public class WindowContainer extends AbstractUIPart
tabbox = new Tabbox();
tabbox.setSclass("desktop-tabbox");
tabbox.setId("desktop_tabbox");
tabbox.addEventListener(ON_DEFER_SET_SELECTED_TAB, new EventListener<Event>() {
@Override
public void onEvent(Event event) throws Exception {
Tab tab = (Tab) event.getData();
if (tab != null)
setSelectedTab(tab);
}
});
Tabpanels tabpanels = new Tabpanels();
tabpanels.setVflex("1");
@ -179,7 +191,13 @@ public class WindowContainer extends AbstractUIPart
}
if (enable)
{
Boolean b = (Boolean) comp.getAttribute(DEFER_SET_SELECTED_TAB);
if (b != null && b.booleanValue())
Events.echoEvent(ON_DEFER_SET_SELECTED_TAB, tabbox, tab);
else
setSelectedTab(tab);
}
return tab;
}

View File

@ -5,6 +5,7 @@ import net.sf.jasperreports.engine.JasperPrint;
import org.adempiere.webui.apps.AEnv;
import org.adempiere.webui.component.Window;
import org.adempiere.webui.part.WindowContainer;
import org.adempiere.webui.session.SessionManager;
import org.compiere.report.JRViewerProvider;
@ -20,6 +21,7 @@ public class ZkJRViewerProvider implements JRViewerProvider {
viewer.setAttribute(Window.MODE_KEY, Window.MODE_EMBEDDED);
viewer.setAttribute(Window.INSERT_POSITION_KEY, Window.INSERT_NEXT);
viewer.setAttribute(WindowContainer.DEFER_SET_SELECTED_TAB, Boolean.TRUE);
SessionManager.getAppDesktop().showWindow(viewer);
}
};

View File

@ -18,6 +18,7 @@ package org.adempiere.webui.window;
import org.adempiere.webui.apps.AEnv;
import org.adempiere.webui.component.Window;
import org.adempiere.webui.part.WindowContainer;
import org.adempiere.webui.session.SessionManager;
import org.compiere.print.ReportEngine;
import org.compiere.print.ReportViewerProvider;
@ -37,6 +38,7 @@ public class ZkReportViewerProvider implements ReportViewerProvider {
viewer.setAttribute(Window.MODE_KEY, Window.MODE_EMBEDDED);
viewer.setAttribute(Window.INSERT_POSITION_KEY, Window.INSERT_NEXT);
viewer.setAttribute(WindowContainer.DEFER_SET_SELECTED_TAB, Boolean.TRUE);
SessionManager.getAppDesktop().showWindow(viewer);
}
};