From 79bc88e332e5dbb3172876e34c34e531defae70b Mon Sep 17 00:00:00 2001 From: Heng Sin Low Date: Mon, 14 Jan 2013 17:40:47 +0800 Subject: [PATCH] IDEMPIERE-547 Zk: Shouldn't open embedded window as overlapped window. Fixed for document action dialog. --- .../src/org/adempiere/webui/LayoutUtils.java | 2 ++ .../adwindow/AbstractADWindowContent.java | 30 +++++++++++++++---- .../webui/panel/WDocActionPanel.java | 2 ++ .../theme/default/css/theme.css.dsp | 11 ++++++- 4 files changed, 39 insertions(+), 6 deletions(-) diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/LayoutUtils.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/LayoutUtils.java index a6a0ca197b..7bddda90e3 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/LayoutUtils.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/LayoutUtils.java @@ -25,6 +25,7 @@ import org.zkoss.zk.ui.util.Clients; import org.zkoss.zul.Borderlayout; import org.zkoss.zul.Div; import org.zkoss.zul.Window; +import org.zkoss.zul.Window.Mode; /** * @@ -148,6 +149,7 @@ public final class LayoutUtils { .append(position) .append("');"); window.setVisible(true); + window.setMode(Mode.EMBEDDED); Clients.response("_openPopupWindow_", new AuScript(window, script.toString())); } 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 98e4890561..a24a9d9be4 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 @@ -802,6 +802,8 @@ public abstract class AbstractADWindowContent extends AbstractUIPart implements private FindWindow findWindow; + private Div maskDiv; + /** * @see ToolbarListener#onLock() */ @@ -2375,11 +2377,10 @@ public abstract class AbstractADWindowContent extends AbstractUIPart implements } else { - final int recordIdParam = record_ID; - getComponent().getParent().appendChild(win); + final int recordIdParam = record_ID; win.addEventListener(DialogEvents.ON_WINDOW_CLOSE, new EventListener() { public void onEvent(Event event) throws Exception { - Clients.clearBusy(getComponent().getParent()); + hideMaskDiv(); getComponent().invalidate(); if (!win.isStartProcess()) { return; @@ -2389,8 +2390,12 @@ public abstract class AbstractADWindowContent extends AbstractUIPart implements executeButtonProcess(wButton, startWOasking, table_ID, recordIdParam, isProcessMandatory); } }); - Clients.showBusy(getComponent().getParent(), " "); - LayoutUtils.openOverlappedWindow(getComponent(), win, "middle_center"); + getComponent().getParent().appendChild(getMaskDiv()); + getComponent().getParent().appendChild(win); + win.setContentStyle("background-color: #fff;"); + LayoutUtils.openEmbeddedWindow(getComponent(), win, "middle_center"); + win.setSclass("embedded-dialog"); + win.focus(); return; } } // DocAction @@ -2500,6 +2505,21 @@ public abstract class AbstractADWindowContent extends AbstractUIPart implements isProcessMandatory); } // actionButton + private Div getMaskDiv() { + if (maskDiv == null) { + maskDiv = new Div(); + maskDiv.setStyle("position: absolute; width: 100%; height: 100%; border: none; margin: 0; background-color: #e4e4e4; " + + "padding: 0; z-index:999; opacity:0.6; top: 0px; left: 0px;"); + } + return maskDiv; + } + + private void hideMaskDiv() { + if (maskDiv != null && maskDiv.getParent() != null) { + maskDiv.detach(); + } + } + private void executeButtonProcess(final IProcessButton wButton, final boolean startWOasking, final int table_ID, final int record_ID, boolean isProcessMandatory) { diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/panel/WDocActionPanel.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/panel/WDocActionPanel.java index 145cfacaf4..df08b1c4ac 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/panel/WDocActionPanel.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/panel/WDocActionPanel.java @@ -273,6 +273,8 @@ public class WDocActionPanel extends Window implements EventListener, Dia this.setTitle(Msg.translate(Env.getCtx(), "DocAction")); this.setWidth("410px"); this.setBorder("normal"); + this.setStyle("position: absolute"); + this.setZindex(1000); this.appendChild(grid); } diff --git a/org.adempiere.ui.zk/theme/default/css/theme.css.dsp b/org.adempiere.ui.zk/theme/default/css/theme.css.dsp index a20b88176b..2880774d75 100644 --- a/org.adempiere.ui.zk/theme/default/css/theme.css.dsp +++ b/org.adempiere.ui.zk/theme/default/css/theme.css.dsp @@ -1023,4 +1023,13 @@ tbody.z-grid-empty-body td { overflow: hidden !important; border-bottom: 1px solid #CFCFCF !important; border-top: 1px solid #CFCFCF !important; -} \ No newline at end of file +} + +.embedded-dialog { + background-color: #666; +} + +.embedded-dialog .z-window-embedded-header { + color: #fff; + font-weight: bold; +}