Search in sources :

Example 1 with IADTab

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

the class ADWindowPanel method doCreatePart.

protected Component doCreatePart(Component parent) {
    layout = new Borderlayout();
    if (parent != null) {
        layout.setParent(parent);
        layout.setStyle("position:absolute");
        layout.setHeight("100%");
        layout.setWidth("100%");
    } else {
        layout.setPage(page);
    }
    if (!isEmbedded()) {
        North n = new North();
        n.setParent(layout);
        n.setCollapsible(false);
        n.setFlex(true);
        Vbox box = new Vbox();
        box.setWidth("100%");
        toolbar.setParent(box);
        box.setParent(n);
        toolbar.setWindowNo(getWindowNo());
        //	FR [ 588 ]
        South s = new South();
        layout.appendChild(s);
        s.setCollapsible(false);
        statusBar.setParent(s);
    } else {
        South s = new South();
        layout.appendChild(s);
        s.setCollapsible(false);
        statusBar.setParent(s);
    }
    LayoutUtils.addSclass("adwindow-status", statusBar);
    if (!isEmbedded() && adTab.isUseExternalSelection()) {
        String tabPlacement = SessionManager.getSessionApplication().getUserPreference().getProperty(UserPreference.P_WINDOW_TAB_PLACEMENT);
        if (tabPlacement == null || "left".equalsIgnoreCase(tabPlacement)) {
            west = new West();
            layout.appendChild(west);
            west.setSplittable(false);
            west.setAutoscroll(true);
            west.setFlex(true);
            LayoutUtils.addSclass("adwindow-nav adwindow-left-nav", west);
            adTab.setTabplacement(IADTab.LEFT);
            adTab.getTabSelectionComponent().setParent(west);
            if (SessionManager.getSessionApplication().getUserPreference().isPropertyBool(UserPreference.P_WINDOW_TAB_COLLAPSIBLE)) {
                west.setTitle(Msg.getElement(Env.getCtx(), "AD_Tab_ID"));
                west.setCollapsible(true);
            }
        } else {
            east = new East();
            layout.appendChild(east);
            east.setSplittable(false);
            east.setAutoscroll(true);
            east.setFlex(true);
            LayoutUtils.addSclass("adwindow-nav adwindow-right-nav", east);
            adTab.setTabplacement(IADTab.RIGHT);
            adTab.getTabSelectionComponent().setParent(east);
            if (SessionManager.getSessionApplication().getUserPreference().isPropertyBool(UserPreference.P_WINDOW_TAB_COLLAPSIBLE)) {
                east.setTitle(Msg.getElement(Env.getCtx(), "AD_Tab_ID"));
                east.setCollapsible(true);
            }
        }
        LayoutUtils.addSclass("adwindow-nav-content", (HtmlBasedComponent) adTab.getTabSelectionComponent());
    }
    contentArea = new Center();
    contentArea.setParent(layout);
    contentArea.setAutoscroll(true);
    contentArea.setFlex(true);
    adTab.createPart(contentArea);
    if (parent instanceof Tabpanel) {
        TabOnCloseHanlder handler = new TabOnCloseHanlder();
        ((Tabpanel) parent).setOnCloseHandler(handler);
    }
    if (!isEmbedded()) {
        if (keyListener != null)
            keyListener.detach();
        keyListener = new Keylistener();
        statusBar.appendChild(keyListener);
        keyListener.setCtrlKeys("#f1#f2#f3#f4#f5#f6#f7#f8#f9#f10#f11#f12^f^i^n^s^d@#left@#right@#up@#down@#pgup@#pgdn@p^p@z@x#enter");
        keyListener.addEventListener(Events.ON_CTRL_KEY, toolbar);
        keyListener.addEventListener(Events.ON_CTRL_KEY, this);
        keyListener.setAutoBlur(false);
    }
    layout.setAttribute(ITabOnSelectHandler.ATTRIBUTE_KEY, new ITabOnSelectHandler() {

        public void onSelect() {
            IADTab adTab = getADTab();
            if (adTab != null) {
                IADTabPanel iadTabpanel = adTab.getSelectedTabpanel();
                if (iadTabpanel != null && iadTabpanel instanceof ADTabPanel) {
                    ADTabPanel adTabpanel = (ADTabPanel) iadTabpanel;
                    if (adTabpanel.isGridView()) {
                        adTabpanel.getGridView().scrollToCurrentRow();
                    }
                }
            }
        }
    });
    return layout;
}
Also used : Center(org.zkoss.zkex.zul.Center) West(org.zkoss.zkex.zul.West) South(org.zkoss.zkex.zul.South) Borderlayout(org.zkoss.zkex.zul.Borderlayout) IADTab(org.adempiere.webui.component.IADTab) ITabOnSelectHandler(org.adempiere.webui.part.ITabOnSelectHandler) North(org.zkoss.zkex.zul.North) Keylistener(org.zkforge.keylistener.Keylistener) Vbox(org.zkoss.zul.Vbox) East(org.zkoss.zkex.zul.East) Tabpanel(org.adempiere.webui.component.Tabpanel)

Aggregations

IADTab (org.adempiere.webui.component.IADTab)1 Tabpanel (org.adempiere.webui.component.Tabpanel)1 ITabOnSelectHandler (org.adempiere.webui.part.ITabOnSelectHandler)1 Keylistener (org.zkforge.keylistener.Keylistener)1 Borderlayout (org.zkoss.zkex.zul.Borderlayout)1 Center (org.zkoss.zkex.zul.Center)1 East (org.zkoss.zkex.zul.East)1 North (org.zkoss.zkex.zul.North)1 South (org.zkoss.zkex.zul.South)1 West (org.zkoss.zkex.zul.West)1 Vbox (org.zkoss.zul.Vbox)1