From bf05050818fde129488dbda47125a3a25548b1c9 Mon Sep 17 00:00:00 2001 From: Carlos Ruiz Date: Sat, 24 Apr 2010 05:40:40 +0000 Subject: [PATCH] Fix [2990258] Request toolbar button calls up search form on zkwebui Link to SF Tracker: http://sourceforge.net/support/tracker.php?aid=2990258 --- .../src/org/adempiere/webui/WRequest.java | 10 +++++++++- .../webui/desktop/DefaultDesktop.java | 12 ++++++++++-- .../org/adempiere/webui/desktop/IDesktop.java | 8 ++++++++ .../webui/desktop/TabbedDesktop.java | 19 +++++++++++++++++++ 4 files changed, 46 insertions(+), 3 deletions(-) diff --git a/zkwebui/WEB-INF/src/org/adempiere/webui/WRequest.java b/zkwebui/WEB-INF/src/org/adempiere/webui/WRequest.java index eac7731408..e84c8fefaa 100644 --- a/zkwebui/WEB-INF/src/org/adempiere/webui/WRequest.java +++ b/zkwebui/WEB-INF/src/org/adempiere/webui/WRequest.java @@ -189,15 +189,23 @@ public class WRequest implements EventListener query = new MQuery(""); String where = "(" + m_where + ") AND Processed='N'"; query.addRestriction(where); + query.setRecordCount(0); } else if (e.getTarget() == m_all) { query = new MQuery(""); query.addRestriction(m_where.toString()); + query.setRecordCount(0); + } + else if (e.getTarget() == m_new) + { + query = new MQuery(""); + query.addRestriction("1=2"); + query.setRecordCount(0); } int AD_Window_ID = 232; // 232=all - 201=my - ADWindow frame = SessionManager.getAppDesktop().openWindow(AD_Window_ID); + ADWindow frame = SessionManager.getAppDesktop().openWindow(AD_Window_ID, query); if(frame == null) return; // New - set Table/Record diff --git a/zkwebui/WEB-INF/src/org/adempiere/webui/desktop/DefaultDesktop.java b/zkwebui/WEB-INF/src/org/adempiere/webui/desktop/DefaultDesktop.java index 9ca7fba771..10a136a729 100644 --- a/zkwebui/WEB-INF/src/org/adempiere/webui/desktop/DefaultDesktop.java +++ b/zkwebui/WEB-INF/src/org/adempiere/webui/desktop/DefaultDesktop.java @@ -82,8 +82,10 @@ import org.zkoss.zul.Toolbarbutton; */ public class DefaultDesktop extends TabbedDesktop implements MenuListener, Serializable, EventListener, IServerPushCallback { - - private static final long serialVersionUID = 6320678631023300467L; + /** + * + */ + private static final long serialVersionUID = 2899600212295462854L; private static final CLogger logger = CLogger.getCLogger(DefaultDesktop.class); @@ -455,6 +457,12 @@ public class DefaultDesktop extends TabbedDesktop implements MenuListener, Seria return super.openWindow(windowId); } + @Override + public ADWindow openWindow(int windowId, MQuery query) { + autoHideMenu(); + return super.openWindow(windowId, query); + } + @Override public ADForm openForm(int formId) { autoHideMenu(); diff --git a/zkwebui/WEB-INF/src/org/adempiere/webui/desktop/IDesktop.java b/zkwebui/WEB-INF/src/org/adempiere/webui/desktop/IDesktop.java index 410f5c6ee0..309c2d26a5 100644 --- a/zkwebui/WEB-INF/src/org/adempiere/webui/desktop/IDesktop.java +++ b/zkwebui/WEB-INF/src/org/adempiere/webui/desktop/IDesktop.java @@ -144,6 +144,14 @@ public interface IDesktop extends UIPart { */ public ADWindow openWindow(int windowId); + /** + * + * @param windowId + * @param query + * @return ADWindow + */ + public ADWindow openWindow(int windowId, MQuery query); + /** * Open operating system task window * @param task_ID diff --git a/zkwebui/WEB-INF/src/org/adempiere/webui/desktop/TabbedDesktop.java b/zkwebui/WEB-INF/src/org/adempiere/webui/desktop/TabbedDesktop.java index 699ab01ba3..f11dc23254 100644 --- a/zkwebui/WEB-INF/src/org/adempiere/webui/desktop/TabbedDesktop.java +++ b/zkwebui/WEB-INF/src/org/adempiere/webui/desktop/TabbedDesktop.java @@ -116,6 +116,25 @@ public abstract class TabbedDesktop extends AbstractDesktop { } } + /** + * + * @param windowId + * @param query + * @return ADWindow + */ + public ADWindow openWindow(int windowId, MQuery query) { + ADWindow adWindow = new ADWindow(Env.getCtx(), windowId, query); + + DesktopTabpanel tabPanel = new DesktopTabpanel(); + if (adWindow.createPart(tabPanel) != null) { + windowContainer.addWindow(tabPanel, adWindow.getTitle(), true); + return adWindow; + } else { + //user cancel + return null; + } + } + /** * * @param taskId