From 68f7100ac009a83c85397b89f6e41643bb5f764f Mon Sep 17 00:00:00 2001 From: Heng Sin Low Date: Mon, 20 Nov 2017 10:28:31 +0800 Subject: [PATCH] IDEMPIERE-3563 Improvement to Process/COG toolbar button popup. --- .../adwindow/AbstractADWindowContent.java | 8 +- .../adempiere/webui/adwindow/DetailPane.java | 6 +- .../webui/adwindow/ProcessButtonPopup.java | 101 +++++++++++++++--- .../adempiere/webui/editor/WButtonEditor.java | 5 +- .../webui/panel/WDocActionPanel.java | 95 ++++++++++------ .../css/fragment/application-menu.css.dsp | 10 ++ 6 files changed, 169 insertions(+), 56 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 b582207c43..97eb3ba4f0 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 @@ -2974,7 +2974,7 @@ public abstract class AbstractADWindowContent extends AbstractUIPart implements Clients.response(new AuScript(script.toString())); } - private void executeButtonProcess(final IProcessButton wButton, + public void executeButtonProcess(final IProcessButton wButton, final boolean startWOasking, final int table_ID, final int record_ID, boolean isProcessMandatory) { /** @@ -3271,8 +3271,10 @@ public abstract class AbstractADWindowContent extends AbstractUIPart implements popup.setWidgetAttribute(AdempiereWebUI.WIDGET_INSTANCE_NAME, "processButtonPopup"); ADTabpanel adtab = (ADTabpanel) adTabbox.getSelectedTabpanel(); popup.render(adtab.getToolbarButtons()); - - LayoutUtils.openPopupWindow(toolbar.getButton("Process"), popup, "after_start"); + if (popup.getChildren().size() > 0) { + popup.setPage(this.getComponent().getPage()); + popup.open(getToolbar().getButton("Process"), "after_start"); + } } @Override diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/adwindow/DetailPane.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/adwindow/DetailPane.java index 78c95f99ed..a8a3b55f17 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/adwindow/DetailPane.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/adwindow/DetailPane.java @@ -434,8 +434,10 @@ public class DetailPane extends Panel implements EventListener, IdSpace { ProcessButtonPopup popup = new ProcessButtonPopup(); ADTabpanel adtab = (ADTabpanel) getSelectedADTabpanel(); popup.render(adtab.getToolbarButtons()); - - LayoutUtils.openPopupWindow(button, popup, "after_start"); + if (popup.getChildren().size() > 0) { + popup.setPage(button.getPage()); + popup.open(button, "after_start"); + } } /** diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/adwindow/ProcessButtonPopup.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/adwindow/ProcessButtonPopup.java index af244390e7..6889813ab4 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/adwindow/ProcessButtonPopup.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/adwindow/ProcessButtonPopup.java @@ -5,41 +5,108 @@ package org.adempiere.webui.adwindow; import java.util.List; -import org.adempiere.webui.component.Window; -import org.adempiere.webui.util.ZKUpdateUtil; +import org.adempiere.util.Callback; +import org.adempiere.webui.component.Menupopup; +import org.adempiere.webui.editor.IProcessButton; +import org.adempiere.webui.editor.WButtonEditor; +import org.adempiere.webui.panel.WDocActionPanel; +import org.compiere.model.GridTab; +import org.compiere.util.Env; +import org.compiere.util.Msg; +import org.zkoss.zk.ui.event.Event; +import org.zkoss.zk.ui.event.EventListener; +import org.zkoss.zk.ui.event.Events; import org.zkoss.zul.Button; -import org.zkoss.zul.Vbox; +import org.zkoss.zul.Listitem; +import org.zkoss.zul.Menu; +import org.zkoss.zul.Menuitem; +import org.zkoss.zul.Menuseparator; /** * @author hengsin * */ -public class ProcessButtonPopup extends Window { +public class ProcessButtonPopup extends Menupopup implements EventListener { + private static final String DOCUMENT_ACTION_MENUITEM_ATTRIBUTE = "document-action-menuitem"; + private static final String DOC_ACTION_PANEL_ATTRIBUTE = "doc-action-panel"; + private static final String BUTTON_ATTRIBUTE = "button"; /** * generated serial id */ private static final long serialVersionUID = 304878472233552113L; public void render(List