- remember the last collapsed state of menu
This commit is contained in:
parent
a8fa8b00a7
commit
e628941eb5
|
@ -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();
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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%");
|
||||
|
|
Loading…
Reference in New Issue