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 415291b012..2d450478f3 100644 --- a/zkwebui/WEB-INF/src/org/adempiere/webui/desktop/DefaultDesktop.java +++ b/zkwebui/WEB-INF/src/org/adempiere/webui/desktop/DefaultDesktop.java @@ -38,8 +38,10 @@ 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; @@ -56,6 +58,7 @@ import org.zkoss.zk.ui.Page; import org.zkoss.zk.ui.event.Event; import org.zkoss.zk.ui.event.EventListener; import org.zkoss.zk.ui.event.Events; +import org.zkoss.zk.ui.event.OpenEvent; import org.zkoss.zk.ui.util.Clients; import org.zkoss.zkex.zul.Borderlayout; import org.zkoss.zkex.zul.Center; @@ -134,6 +137,18 @@ public class DefaultDesktop extends TabbedDesktop implements MenuListener, Seria w.setSplittable(true); w.setTitle("Menu"); w.setFlex(true); + w.addEventListener(Events.ON_OPEN, new EventListener() { + @Override + public void onEvent(Event event) throws Exception { + OpenEvent oe = (OpenEvent) event; + UserPreference pref = SessionManager.getSessionApplication().getUserPreference(); + pref.setProperty(UserPreference.P_MENU_COLLAPSED, !oe.isOpen()); + pref.savePreference(); + } + }); + UserPreference pref = SessionManager.getSessionApplication().getUserPreference(); + boolean menuCollapsed= pref.isPropertyBool(UserPreference.P_MENU_COLLAPSED); + w.setOpen(!menuCollapsed); pnlSide.setParent(w); windowArea = new Center(); diff --git a/zkwebui/WEB-INF/src/org/adempiere/webui/desktop/NavBar2Desktop.java b/zkwebui/WEB-INF/src/org/adempiere/webui/desktop/NavBar2Desktop.java index b3facceec2..b8cc0a8ede 100644 --- a/zkwebui/WEB-INF/src/org/adempiere/webui/desktop/NavBar2Desktop.java +++ b/zkwebui/WEB-INF/src/org/adempiere/webui/desktop/NavBar2Desktop.java @@ -34,8 +34,10 @@ 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; @@ -52,6 +54,7 @@ import org.zkoss.zk.ui.Page; import org.zkoss.zk.ui.event.Event; import org.zkoss.zk.ui.event.EventListener; import org.zkoss.zk.ui.event.Events; +import org.zkoss.zk.ui.event.OpenEvent; import org.zkoss.zk.ui.util.Clients; import org.zkoss.zkex.zul.Borderlayout; import org.zkoss.zkex.zul.Center; @@ -131,8 +134,19 @@ public class NavBar2Desktop extends TabbedDesktop implements MenuListener, Seria w.setSplittable(true); w.setTitle("Menu"); w.setFlex(true); - pnlSide.setParent(w); - w.setOpen(false); + w.addEventListener(Events.ON_OPEN, new EventListener() { + @Override + public void onEvent(Event event) throws Exception { + OpenEvent oe = (OpenEvent) event; + UserPreference pref = SessionManager.getSessionApplication().getUserPreference(); + pref.setProperty(UserPreference.P_MENU_COLLAPSED, !oe.isOpen()); + pref.savePreference(); + } + }); + UserPreference pref = SessionManager.getSessionApplication().getUserPreference(); + boolean menuCollapsed= pref.isPropertyBool(UserPreference.P_MENU_COLLAPSED); + w.setOpen(!menuCollapsed); + pnlSide.setParent(w); Center center = new Center(); center.setParent(layout); diff --git a/zkwebui/WEB-INF/src/org/adempiere/webui/desktop/NavBarDesktop.java b/zkwebui/WEB-INF/src/org/adempiere/webui/desktop/NavBarDesktop.java index e455f83cb1..93c7bd307b 100644 --- a/zkwebui/WEB-INF/src/org/adempiere/webui/desktop/NavBarDesktop.java +++ b/zkwebui/WEB-INF/src/org/adempiere/webui/desktop/NavBarDesktop.java @@ -35,8 +35,10 @@ 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; @@ -54,6 +56,7 @@ import org.zkoss.zk.ui.event.DropEvent; import org.zkoss.zk.ui.event.Event; import org.zkoss.zk.ui.event.EventListener; import org.zkoss.zk.ui.event.Events; +import org.zkoss.zk.ui.event.OpenEvent; import org.zkoss.zk.ui.util.Clients; import org.zkoss.zkex.zul.Borderlayout; import org.zkoss.zkex.zul.Center; @@ -141,9 +144,20 @@ public class NavBarDesktop extends TabbedDesktop implements MenuListener, Serial leftRegion.setSplittable(true); leftRegion.setTitle("Navigation"); leftRegion.setFlex(true); + leftRegion.addEventListener(Events.ON_OPEN, new EventListener() { + @Override + public void onEvent(Event event) throws Exception { + OpenEvent oe = (OpenEvent) event; + UserPreference pref = SessionManager.getSessionApplication().getUserPreference(); + pref.setProperty(UserPreference.P_MENU_COLLAPSED, !oe.isOpen()); + pref.savePreference(); + } + }); + UserPreference pref = SessionManager.getSessionApplication().getUserPreference(); + boolean menuCollapsed= pref.isPropertyBool(UserPreference.P_MENU_COLLAPSED); + leftRegion.setOpen(!menuCollapsed); navigationPanel = new Accordion(); navigationPanel.setParent(leftRegion); - leftRegion.setOpen(true); navigationPanel.setWidth("100%"); navigationPanel.setHeight("100%");