Search in sources :

Example 1 with Accordion

use of org.adempiere.webui.component.Accordion in project adempiere by adempiere.

the class NavBarDesktop method doCreatePart.

protected Component doCreatePart(Component parent) {
    SidePanel pnlSide = new SidePanel();
    HeaderPanel pnlHead = new HeaderPanel();
    pnlSide.getMenuPanel().addMenuListener(this);
    layout = new Borderlayout();
    if (parent != null) {
        layout.setParent(parent);
        layout.setWidth("100%");
        layout.setHeight("100%");
        layout.setStyle("position: absolute");
    } else
        layout.setPage(page);
    dashboardRunnable = new DashboardRunnable(layout.getDesktop(), this);
    North n = new North();
    n.setSplittable(true);
    n.setCollapsible(false);
    layout.appendChild(n);
    pnlHead.setParent(n);
    leftRegion = new West();
    layout.appendChild(leftRegion);
    leftRegion.setWidth("300px");
    leftRegion.setCollapsible(true);
    leftRegion.setSplittable(true);
    leftRegion.setTitle("Navigation");
    //leftRegion.setHflex("true");
    leftRegion.setVflex("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);
    navigationPanel.setWidth("100%");
    navigationPanel.setHeight("100%");
    navigationPanel.add(pnlSide, "Application Menu");
    Div div = new Div();
    favPanel = (DPFavourites) Executions.createComponents(FAVOURITES_PATH, div, null);
    navigationPanel.add(div, "Favourites");
    //setup drag and drop for favourites
    div = navigationPanel.getHeader(1);
    div.setDroppable(DPFavourites.FAVOURITE_DROPPABLE);
    div.addEventListener(Events.ON_DROP, this);
    div = new Div();
    Component component = Executions.createComponents(ACTIVITIES_PATH, div, null);
    if (component instanceof DashboardPanel) {
        DashboardPanel dashboardPanel = (DashboardPanel) component;
        dashboardRunnable.add(dashboardPanel);
    }
    navigationPanel.add(div, "Activities");
    div = new Div();
    Executions.createComponents(VIEWS_PATH, div, null);
    navigationPanel.add(div, Msg.getMsg(Env.getCtx(), "View").replaceAll("&", ""));
    navigationPanel.setSelectedIndex(0);
    windowArea = new Center();
    windowArea.setParent(layout);
    windowArea.setHflex("true");
    windowArea.setVflex("true");
    windowContainer.createPart(windowArea);
    createHomeTab();
    return layout;
}
Also used : Center(org.zkoss.zul.Center) SidePanel(org.adempiere.webui.panel.SidePanel) West(org.zkoss.zul.West) Borderlayout(org.zkoss.zul.Borderlayout) DashboardRunnable(org.adempiere.webui.dashboard.DashboardRunnable) IOException(java.io.IOException) Div(org.zkoss.zul.Div) DashboardPanel(org.adempiere.webui.dashboard.DashboardPanel) Accordion(org.adempiere.webui.component.Accordion) HeaderPanel(org.adempiere.webui.panel.HeaderPanel) Event(org.zkoss.zk.ui.event.Event) OpenEvent(org.zkoss.zk.ui.event.OpenEvent) DropEvent(org.zkoss.zk.ui.event.DropEvent) North(org.zkoss.zul.North) UserPreference(org.adempiere.webui.util.UserPreference) EventListener(org.zkoss.zk.ui.event.EventListener) Component(org.zkoss.zk.ui.Component) OpenEvent(org.zkoss.zk.ui.event.OpenEvent)

Example 2 with Accordion

use of org.adempiere.webui.component.Accordion in project adempiere by adempiere.

the class NavBar2Desktop method doCreatePart.

protected Component doCreatePart(Component parent) {
    SidePanel pnlSide = new SidePanel();
    HeaderPanel pnlHead = new HeaderPanel();
    pnlSide.getMenuPanel().addMenuListener(this);
    layout = new Borderlayout();
    if (parent != null) {
        layout.setParent(parent);
        layout.setWidth("100%");
        layout.setHeight("100%");
        layout.setStyle("position: absolute");
    } else
        layout.setPage(page);
    dashboardRunnable = new DashboardRunnable(layout.getDesktop(), this);
    North n = new North();
    n.setSplittable(true);
    n.setCollapsible(false);
    layout.appendChild(n);
    pnlHead.setParent(n);
    West w = new West();
    layout.appendChild(w);
    w.setWidth("300px");
    w.setCollapsible(true);
    w.setSplittable(true);
    w.setTitle(Util.cleanAmp(Msg.getMsg(Env.getCtx(), "Menu")));
    //w.setHflex("true");
    w.setVflex("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);
    Center center = new Center();
    center.setParent(layout);
    center.setHflex("true");
    center.setVflex("true");
    Borderlayout innerLayout = new Borderlayout();
    innerLayout.setHeight("100%");
    innerLayout.setWidth("100%");
    innerLayout.setParent(center);
    West innerW = new West();
    innerW.setWidth("200px");
    innerW.setCollapsible(true);
    innerW.setTitle("Navigation");
    innerW.setSplittable(true);
    innerW.setCollapsible(true);
    innerW.setParent(innerLayout);
    shortcutPanel = new Accordion();
    shortcutPanel.setWidth("100%");
    shortcutPanel.setHeight("100%");
    innerW.appendChild(shortcutPanel);
    Div div = new Div();
    Executions.createComponents(FAVOURITES_PATH, div, null);
    shortcutPanel.add(div, "Favourites");
    div = new Div();
    Component component = Executions.createComponents(ACTIVITIES_PATH, div, null);
    if (component instanceof DashboardPanel) {
        DashboardPanel dashboardPanel = (DashboardPanel) component;
        dashboardRunnable.add(dashboardPanel);
    }
    shortcutPanel.add(div, "Activities");
    shortcutPanel.setSelectedIndex(0);
    windowArea = new Center();
    windowArea.setParent(innerLayout);
    windowArea.setHflex("true");
    windowArea.setVflex("true");
    windowContainer.createPart(windowArea);
    createHomeTab();
    return layout;
}
Also used : Center(org.zkoss.zul.Center) SidePanel(org.adempiere.webui.panel.SidePanel) West(org.zkoss.zul.West) Borderlayout(org.zkoss.zul.Borderlayout) DashboardRunnable(org.adempiere.webui.dashboard.DashboardRunnable) IOException(java.io.IOException) Div(org.zkoss.zul.Div) DashboardPanel(org.adempiere.webui.dashboard.DashboardPanel) Accordion(org.adempiere.webui.component.Accordion) HeaderPanel(org.adempiere.webui.panel.HeaderPanel) Event(org.zkoss.zk.ui.event.Event) OpenEvent(org.zkoss.zk.ui.event.OpenEvent) North(org.zkoss.zul.North) UserPreference(org.adempiere.webui.util.UserPreference) EventListener(org.zkoss.zk.ui.event.EventListener) Component(org.zkoss.zk.ui.Component) OpenEvent(org.zkoss.zk.ui.event.OpenEvent)

Aggregations

IOException (java.io.IOException)2 Accordion (org.adempiere.webui.component.Accordion)2 DashboardPanel (org.adempiere.webui.dashboard.DashboardPanel)2 DashboardRunnable (org.adempiere.webui.dashboard.DashboardRunnable)2 HeaderPanel (org.adempiere.webui.panel.HeaderPanel)2 SidePanel (org.adempiere.webui.panel.SidePanel)2 UserPreference (org.adempiere.webui.util.UserPreference)2 Component (org.zkoss.zk.ui.Component)2 Event (org.zkoss.zk.ui.event.Event)2 EventListener (org.zkoss.zk.ui.event.EventListener)2 OpenEvent (org.zkoss.zk.ui.event.OpenEvent)2 Borderlayout (org.zkoss.zul.Borderlayout)2 Center (org.zkoss.zul.Center)2 Div (org.zkoss.zul.Div)2 North (org.zkoss.zul.North)2 West (org.zkoss.zul.West)2 DropEvent (org.zkoss.zk.ui.event.DropEvent)1