Search in sources :

Example 66 with Component

use of org.zkoss.zk.ui.Component 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)

Example 67 with Component

use of org.zkoss.zk.ui.Component in project adempiere by adempiere.

the class TabbedDesktop method closeWindow.

/**
	 *
	 * @param windowNo
	 * @return boolean
	 */
public boolean closeWindow(int windowNo) {
    Tabbox tabbox = windowContainer.getComponent();
    Tabpanels panels = tabbox.getTabpanels();
    List<?> childrens = panels.getChildren();
    for (Object child : childrens) {
        Tabpanel panel = (Tabpanel) child;
        Component component = panel.getFirstChild();
        Object att = component.getAttribute(WINDOWNO_ATTRIBUTE);
        if (att != null && (att instanceof Integer)) {
            if (windowNo == (Integer) att) {
                Tab tab = panel.getLinkedTab();
                panel.getLinkedTab().onClose();
                if (tab.getParent() == null) {
                    unregisterWindow(windowNo);
                    return true;
                } else {
                    return false;
                }
            }
        }
    }
    return false;
}
Also used : Tab(org.zkoss.zul.Tab) Tabpanels(org.zkoss.zul.Tabpanels) Tabbox(org.adempiere.webui.component.Tabbox) Component(org.zkoss.zk.ui.Component) Tabpanel(org.adempiere.webui.component.Tabpanel) DesktopTabpanel(org.adempiere.webui.component.DesktopTabpanel)

Example 68 with Component

use of org.zkoss.zk.ui.Component in project adempiere by adempiere.

the class DPActivities method onEvent.

public void onEvent(Event event) {
    Component comp = event.getTarget();
    String eventName = event.getName();
    if (eventName.equals(Events.ON_CLICK)) {
        if (comp instanceof Button) {
            Button btn = (Button) comp;
            int menuId = 0;
            try {
                menuId = Integer.valueOf(btn.getName());
            } catch (Exception e) {
            }
            if (menuId > 0)
                SessionManager.getAppDesktop().onMenuSelected(menuId);
        }
    }
}
Also used : Button(org.adempiere.webui.component.Button) Component(org.zkoss.zk.ui.Component)

Example 69 with Component

use of org.zkoss.zk.ui.Component in project adempiere by adempiere.

the class WindowContainer method insertBefore.

/**
     * 
     * @param refTab
     * @param comp
     * @param title
     * @param closeable
     * @param enable
     */
public void insertBefore(Tab refTab, Component comp, String title, boolean closeable, boolean enable) {
    Tab tab = new Tab();
    title = title.replaceAll("[&]", "");
    if (title.length() <= MAX_TITLE_LENGTH) {
        tab.setLabel(title);
    } else {
        tab.setTooltiptext(title);
        title = title.substring(0, 27) + "...";
        tab.setLabel(title);
    }
    tab.setClosable(closeable);
    // fix scroll position lost coming back into a grid view tab
    tab.addEventListener(Events.ON_SELECT, new EventListener<Event>() {

        public void onEvent(Event event) throws Exception {
            Tab tab = (Tab) event.getTarget();
            org.zkoss.zul.Tabpanel panel = tab.getLinkedPanel();
            Component component = panel.getFirstChild();
            if (component != null && component.getAttribute(ITabOnSelectHandler.ATTRIBUTE_KEY) instanceof ITabOnSelectHandler) {
                ITabOnSelectHandler handler = (ITabOnSelectHandler) component.getAttribute(ITabOnSelectHandler.ATTRIBUTE_KEY);
                handler.onSelect();
            }
        }
    });
    Tabpanel tabpanel = null;
    if (comp instanceof Tabpanel) {
        tabpanel = (Tabpanel) comp;
    } else {
        tabpanel = new Tabpanel();
        tabpanel.appendChild(comp);
    }
    tabpanel.setZclass("desktop-tabpanel");
    tabpanel.setHeight("100%");
    tabpanel.setWidth("100%");
    tabpanel.setStyle("position: relative;");
    if (refTab == null) {
        tabbox.getTabs().appendChild(tab);
        tabbox.getTabpanels().appendChild(tabpanel);
    } else {
        org.zkoss.zul.Tabpanel refpanel = refTab.getLinkedPanel();
        tabbox.getTabs().insertBefore(tab, refTab);
        tabbox.getTabpanels().insertBefore(tabpanel, refpanel);
    }
    if (enable)
        setSelectedTab(tab);
}
Also used : Tab(org.adempiere.webui.component.Tab) Event(org.zkoss.zk.ui.event.Event) Component(org.zkoss.zk.ui.Component) Tabpanel(org.adempiere.webui.component.Tabpanel)

Example 70 with Component

use of org.zkoss.zk.ui.Component in project adempiere by adempiere.

the class MenuPanel method onEvent.

public void onEvent(Event event) {
    Component comp = event.getTarget();
    String eventName = event.getName();
    if (eventName.equals(Events.ON_CLICK)) {
        if (comp instanceof Treerow) {
            Treeitem selectedItem = (Treeitem) comp.getParent();
            if (selectedItem.getValue() != null) {
                fireMenuSelectedEvent(selectedItem);
            } else {
                selectedItem.setOpen(!selectedItem.isOpen());
            }
        }
    } else // Elaine 2009/02/27 - expand tree
    if (eventName.equals(Events.ON_CHECK) && event.getTarget() == chkExpand) {
        expandOnCheck();
    }
//
}
Also used : Treeitem(org.zkoss.zul.Treeitem) Component(org.zkoss.zk.ui.Component) Treerow(org.zkoss.zul.Treerow)

Aggregations

Component (org.zkoss.zk.ui.Component)70 IOException (java.io.IOException)8 HtmlBasedComponent (org.zkoss.zk.ui.HtmlBasedComponent)8 Checkbox (org.adempiere.webui.component.Checkbox)7 ToolBarButton (org.adempiere.webui.component.ToolBarButton)7 Div (org.zkoss.zul.Div)7 Listitem (org.zkoss.zul.Listitem)7 MapLayer (au.org.emii.portal.menu.MapLayer)6 Button (org.adempiere.webui.component.Button)6 Tabpanel (org.adempiere.webui.component.Tabpanel)6 WEditor (org.adempiere.webui.editor.WEditor)6 ParseException (org.json.simple.parser.ParseException)6 Event (org.zkoss.zk.ui.event.Event)6 MapComposer (au.org.emii.portal.composer.MapComposer)5 PreparedStatement (java.sql.PreparedStatement)5 ResultSet (java.sql.ResultSet)5 DashboardPanel (org.adempiere.webui.dashboard.DashboardPanel)5 HeaderPanel (org.adempiere.webui.panel.HeaderPanel)5 SidePanel (org.adempiere.webui.panel.SidePanel)5 UiException (org.zkoss.zk.ui.UiException)5