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 10a136a729..87873d9169 100644 --- a/zkwebui/WEB-INF/src/org/adempiere/webui/desktop/DefaultDesktop.java +++ b/zkwebui/WEB-INF/src/org/adempiere/webui/desktop/DefaultDesktop.java @@ -26,7 +26,6 @@ import java.sql.PreparedStatement; import java.sql.ResultSet; import java.util.logging.Level; -import org.adempiere.webui.apps.ProcessDialog; import org.adempiere.webui.apps.graph.WGraph; import org.adempiere.webui.apps.graph.WPerformanceDetail; import org.adempiere.webui.component.Tabpanel; @@ -35,17 +34,14 @@ import org.adempiere.webui.dashboard.DPActivities; import org.adempiere.webui.dashboard.DashboardPanel; import org.adempiere.webui.dashboard.DashboardRunnable; import org.adempiere.webui.event.MenuListener; -import org.adempiere.webui.panel.ADForm; import org.adempiere.webui.panel.HeaderPanel; import org.adempiere.webui.panel.SidePanel; import org.adempiere.webui.session.SessionManager; import org.adempiere.webui.util.IServerPushCallback; import org.adempiere.webui.util.ServerPushTemplate; import org.adempiere.webui.util.UserPreference; -import org.adempiere.webui.window.ADWindow; import org.compiere.model.MGoal; import org.compiere.model.MMenu; -import org.compiere.model.MQuery; import org.compiere.model.X_AD_Menu; import org.compiere.model.X_PA_DashboardContent; import org.compiere.util.CLogger; @@ -83,9 +79,9 @@ import org.zkoss.zul.Toolbarbutton; public class DefaultDesktop extends TabbedDesktop implements MenuListener, Serializable, EventListener, IServerPushCallback { /** - * + * generated serial version ID */ - private static final long serialVersionUID = 2899600212295462854L; + private static final long serialVersionUID = -8203958978173990301L; private static final CLogger logger = CLogger.getCLogger(DefaultDesktop.class); @@ -452,44 +448,8 @@ public class DefaultDesktop extends TabbedDesktop implements MenuListener, Seria } @Override - public ADWindow openWindow(int windowId) { + protected void preOpenNewTab() + { autoHideMenu(); - 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(); - return super.openForm(formId); - } - - @Override - public ProcessDialog openProcessDialog(int processId, boolean soTrx) { - autoHideMenu(); - return super.openProcessDialog(processId, soTrx); - } - - @Override - public void openTask(int taskId) { - autoHideMenu(); - super.openTask(taskId); - } - - @Override - public void openWorkflow(int workflowID) { - autoHideMenu(); - super.openWorkflow(workflowID); - } - - @Override - public void showWindow(int AD_Window_ID, MQuery query) { - autoHideMenu(); - super.showWindow(AD_Window_ID, query); - } + } } 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 309c2d26a5..7239806a7c 100644 --- a/zkwebui/WEB-INF/src/org/adempiere/webui/desktop/IDesktop.java +++ b/zkwebui/WEB-INF/src/org/adempiere/webui/desktop/IDesktop.java @@ -113,6 +113,7 @@ public interface IDesktop extends UIPart { * * @param window_ID * @param query + * @deprecated */ public void showWindow(int window_ID, MQuery query); 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 f11dc23254..34f293d519 100644 --- a/zkwebui/WEB-INF/src/org/adempiere/webui/desktop/TabbedDesktop.java +++ b/zkwebui/WEB-INF/src/org/adempiere/webui/desktop/TabbedDesktop.java @@ -63,6 +63,7 @@ public abstract class TabbedDesktop extends AbstractDesktop { pd.setParent(tabPanel); String title = pd.getTitle(); pd.setTitle(null); + preOpenNewTab(); windowContainer.addWindow(tabPanel, title, true); } return pd; @@ -80,6 +81,7 @@ public abstract class TabbedDesktop extends AbstractDesktop { form.setParent(tabPanel); //do not show window title when open as tab form.setTitle(null); + preOpenNewTab(); windowContainer.addWindow(tabPanel, form.getFormName(), true); return form; @@ -95,6 +97,7 @@ public abstract class TabbedDesktop extends AbstractDesktop { DesktopTabpanel tabPanel = new DesktopTabpanel(); p.setParent(tabPanel); + preOpenNewTab(); windowContainer.addWindow(tabPanel, p.getWorkflow().get_Translation(MWorkflow.COLUMNNAME_Name), true); } @@ -108,6 +111,7 @@ public abstract class TabbedDesktop extends AbstractDesktop { DesktopTabpanel tabPanel = new DesktopTabpanel(); if (adWindow.createPart(tabPanel) != null) { + preOpenNewTab(); windowContainer.addWindow(tabPanel, adWindow.getTitle(), true); return adWindow; } else { @@ -127,6 +131,7 @@ public abstract class TabbedDesktop extends AbstractDesktop { DesktopTabpanel tabPanel = new DesktopTabpanel(); if (adWindow.createPart(tabPanel) != null) { + preOpenNewTab(); windowContainer.addWindow(tabPanel, adWindow.getTitle(), true); return adWindow; } else { @@ -199,6 +204,7 @@ public abstract class TabbedDesktop extends AbstractDesktop { Tabpanel tabPanel = new Tabpanel(); window.setParent(tabPanel); + preOpenNewTab(); windowContainer.addWindow(tabPanel, title, closeable); } @@ -213,6 +219,7 @@ public abstract class TabbedDesktop extends AbstractDesktop { DesktopTabpanel tabPanel = new DesktopTabpanel(); if (wnd.createPart(tabPanel) != null) { + preOpenNewTab(); windowContainer.insertAfter(windowContainer.getSelectedTab(), tabPanel, wnd.getTitle(), true, true); } } @@ -220,16 +227,11 @@ public abstract class TabbedDesktop extends AbstractDesktop { /** * @param AD_Window_ID * @param query + * @deprecated */ public void showWindow(int AD_Window_ID, MQuery query) { - ADWindow wnd = new ADWindow(Env.getCtx(), AD_Window_ID, query); - - DesktopTabpanel tabPanel = new DesktopTabpanel(); - if (wnd.createPart(tabPanel) != null) - { - windowContainer.addWindow(tabPanel, wnd.getTitle(), true); - } + openWindow(AD_Window_ID, query); } /** @@ -242,6 +244,7 @@ public abstract class TabbedDesktop extends AbstractDesktop { window.setParent(tabPanel); String title = window.getTitle(); window.setTitle(null); + preOpenNewTab(); if (Window.INSERT_NEXT.equals(window.getAttribute(Window.INSERT_POSITION_KEY))) windowContainer.insertAfter(windowContainer.getSelectedTab(), tabPanel, title, true, true); else @@ -319,4 +322,11 @@ public abstract class TabbedDesktop extends AbstractDesktop { } return false; } + + /** + * invoke before a new tab is added to the desktop + */ + protected void preOpenNewTab() + { + } }