Search in sources :

Example 21 with Tabpanel

use of org.adempiere.webui.component.Tabpanel 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 22 with Tabpanel

use of org.adempiere.webui.component.Tabpanel 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 23 with Tabpanel

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

the class MultiTabPart method addTab.

public void addTab(Component comp, String title, boolean closeable, boolean enable) {
    Tab tab = new Tab();
    tab.setLabel(title);
    tab.setClosable(closeable);
    Tabpanel tabpanel = null;
    if (comp instanceof Tabpanel) {
        tabpanel = (Tabpanel) comp;
    } else {
        tabpanel = new Tabpanel();
        tabpanel.appendChild(comp);
    }
    tabbox.getTabs().appendChild(tab);
    tabbox.getTabpanels().appendChild(tabpanel);
    if (enable)
        setSelectedTab(tab);
}
Also used : Tab(org.adempiere.webui.component.Tab) Tabpanel(org.adempiere.webui.component.Tabpanel)

Aggregations

Tabpanel (org.adempiere.webui.component.Tabpanel)23 Tab (org.adempiere.webui.component.Tab)10 ToolBarButton (org.adempiere.webui.component.ToolBarButton)7 Vbox (org.zkoss.zul.Vbox)7 Tabpanels (org.adempiere.webui.component.Tabpanels)6 Tabs (org.adempiere.webui.component.Tabs)6 Component (org.zkoss.zk.ui.Component)6 Div (org.zkoss.zul.Div)6 Tabbox (org.adempiere.webui.component.Tabbox)5 Hbox (org.zkoss.zul.Hbox)5 IOException (java.io.IOException)4 DesktopTabpanel (org.adempiere.webui.component.DesktopTabpanel)4 Row (org.adempiere.webui.component.Row)4 Rows (org.adempiere.webui.component.Rows)4 Event (org.zkoss.zk.ui.event.Event)4 Html (org.zkoss.zul.Html)4 BufferedReader (java.io.BufferedReader)3 InputStreamReader (java.io.InputStreamReader)3 URL (java.net.URL)3 PreparedStatement (java.sql.PreparedStatement)3