Search in sources :

Example 1 with Borderlayout

use of org.zkoss.zkex.zul.Borderlayout in project adempiere by adempiere.

the class ADTabPanel method includedAutoResize.

public int includedAutoResize(HorizontalEmbeddedPanel embeddedPanel) {
    if (embeddedPanel.windowPanel != null) {
        if (embeddedPanel.windowPanel.isEmbedded()) {
            Borderlayout window = embeddedPanel.windowPanel.getComponent();
            try {
                int size = 0;
                int addSize = 0;
                if (!embeddedPanel.tabPanel.getGridTab().isSingleRow()) {
                    size = MSysConfig.getIntValue("TAB_INCLUDING_HEIGHT", 400);
                } else {
                    for (Object o : embeddedPanel.tabPanel.getGrid().getRows().getChildren()) {
                        if (o instanceof Row) {
                            if (((Row) o).isVisible()) {
                                size += getComponentSize((Row) o);
                            }
                        } else if (o instanceof org.zkoss.zul.Div) {
                            // Group
                            size += 20;
                        }
                    }
                    // 25 = statusbar
                    size += 25;
                    size += addSize;
                    List<HorizontalEmbeddedPanel> included = embeddedPanel.tabPanel.getHorizontalIncludedPanel();
                    if (included.size() > 0) {
                        for (HorizontalEmbeddedPanel panel : included) {
                            size += includedAutoResize(panel);
                        }
                    }
                }
                window.setHeight(size + "px");
                window.resize();
                return size;
            } catch (Exception e) {
                e.printStackTrace();
            }
            return 0;
        }
    }
    return 0;
}
Also used : org.zkoss.zul(org.zkoss.zul) Borderlayout(org.zkoss.zkex.zul.Borderlayout) Row(org.zkoss.zul.Row) PropertyVetoException(java.beans.PropertyVetoException)

Example 2 with Borderlayout

use of org.zkoss.zkex.zul.Borderlayout in project adempiere by adempiere.

the class ADTabPanel method init.

/**
     *
     * @param winPanel
     * @param windowNo
     * @param gridTab
     * @param gridWindow
     */
public void init(AbstractADWindowPanel winPanel, int windowNo, GridTab gridTab, GridWindow gridWindow) {
    this.windowNo = windowNo;
    this.gridWindow = gridWindow;
    this.gridTab = gridTab;
    this.windowPanel = winPanel;
    gridTab.addDataStatusListener(this);
    this.dataBinder = new GridTabDataBinder(gridTab);
    this.getChildren().clear();
    int AD_Tree_ID = 0;
    if (gridTab.isTreeTab())
        AD_Tree_ID = MTree.getDefaultAD_Tree_ID(Env.getAD_Client_ID(Env.getCtx()), gridTab.getKeyColumnName());
    if (gridTab.isTreeTab() && AD_Tree_ID != 0) {
        Borderlayout layout = new Borderlayout();
        layout.setParent(this);
        layout.setStyle("width: 100%; height: 100%; position: absolute;");
        treePanel = new ADTreePanel();
        West west = new West();
        west.appendChild(treePanel);
        west.setWidth("300px");
        west.setCollapsible(true);
        west.setSplittable(true);
        west.setAutoscroll(true);
        layout.appendChild(west);
        Center center = new Center();
        center.setFlex(true);
        center.appendChild(grid);
        layout.appendChild(center);
        formComponent = layout;
        treePanel.getTree().addEventListener(Events.ON_SELECT, this);
    } else {
        this.appendChild(grid);
        formComponent = grid;
    }
    this.appendChild(listPanel);
    listPanel.setVisible(false);
    listPanel.setWindowNo(windowNo);
    listPanel.setADWindowPanel(winPanel);
    gridTab.getTableModel().addVetoableChangeListener(this);
}
Also used : Center(org.zkoss.zkex.zul.Center) West(org.zkoss.zkex.zul.West) Borderlayout(org.zkoss.zkex.zul.Borderlayout) GridTabDataBinder(org.adempiere.webui.util.GridTabDataBinder)

Example 3 with Borderlayout

use of org.zkoss.zkex.zul.Borderlayout in project adempiere by adempiere.

the class ADTabPanel method autoResize.

public void autoResize() {
    if (windowPanel != null) {
        if (windowPanel.isEmbedded()) {
            Borderlayout window = ((ADWindowPanel) windowPanel).getComponent();
            if (isGridView()) {
                int size = MSysConfig.getIntValue("TAB_INCLUDING_HEIGHT", 400);
                window.setHeight(size + "px");
                listPanel.resize();
                window.resize();
            } else {
                try {
                    int addSize = 0;
                    int size = 0;
                    if (grid.getRows() != null) {
                        for (Object o : grid.getRows().getChildren()) {
                            if (o instanceof Row) {
                                if (((Row) o).isVisible()) {
                                    size += getComponentSize((Row) o);
                                }
                            } else if (o instanceof org.zkoss.zul.Group) {
                                size += 20;
                            }
                        }
                    }
                    // 25 = statusbar
                    size += 25;
                    size += addSize;
                    size += doAutoSize();
                    window.setHeight(size + "px");
                    window.resize();
                } catch (Exception e) {
                    e.printStackTrace();
                    //nothing to do, just ignore
                    window.setHeight("61px");
                    window.resize();
                }
            }
        }
    }
}
Also used : org.zkoss.zul(org.zkoss.zul) Borderlayout(org.zkoss.zkex.zul.Borderlayout) Row(org.zkoss.zul.Row) PropertyVetoException(java.beans.PropertyVetoException)

Example 4 with Borderlayout

use of org.zkoss.zkex.zul.Borderlayout in project adempiere by adempiere.

the class ADTabPanel method includedAutoResize.

public int includedAutoResize(EmbeddedPanel embeddedpanel) {
    if (embeddedpanel.windowPanel != null) {
        if (embeddedpanel.windowPanel.isEmbedded()) {
            Borderlayout window = embeddedpanel.windowPanel.getComponent();
            try {
                int size = 0;
                int addSize = 0;
                if (!embeddedpanel.tabPanel.getGridTab().isSingleRow()) {
                    size = MSysConfig.getIntValue("TAB_INCLUDING_HEIGHT", 400);
                } else {
                    for (Object o : embeddedpanel.tabPanel.getGrid().getRows().getChildren()) {
                        if (o instanceof Row) {
                            if (((Row) o).isVisible()) {
                                size += getComponentSize((Row) o);
                            }
                        } else if (o instanceof org.zkoss.zul.Group) {
                            // Group
                            size += 20;
                        }
                    }
                    // 25 = statusbar
                    size += 25;
                    size += addSize;
                    List<EmbeddedPanel> included = embeddedpanel.tabPanel.getIncludedPanel();
                    if (included.size() > 0) {
                        for (EmbeddedPanel panel : included) {
                            size += includedAutoResize(panel);
                        }
                    }
                }
                window.setHeight(size + "px");
                window.resize();
                return size;
            } catch (Exception e) {
                e.printStackTrace();
            }
            return 0;
        }
    }
    return 0;
}
Also used : org.zkoss.zul(org.zkoss.zul) Borderlayout(org.zkoss.zkex.zul.Borderlayout) Row(org.zkoss.zul.Row) PropertyVetoException(java.beans.PropertyVetoException)

Example 5 with Borderlayout

use of org.zkoss.zkex.zul.Borderlayout 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

Borderlayout (org.zkoss.zkex.zul.Borderlayout)16 Center (org.zkoss.zkex.zul.Center)13 North (org.zkoss.zkex.zul.North)11 South (org.zkoss.zkex.zul.South)10 ConfirmPanel (org.adempiere.webui.component.ConfirmPanel)8 Panel (org.adempiere.webui.component.Panel)7 Separator (org.zkoss.zul.Separator)4 PropertyVetoException (java.beans.PropertyVetoException)3 Button (org.adempiere.webui.component.Button)3 Label (org.adempiere.webui.component.Label)3 WAppsAction (org.adempiere.webui.component.WAppsAction)3 West (org.zkoss.zkex.zul.West)3 org.zkoss.zul (org.zkoss.zul)3 Row (org.zkoss.zul.Row)3 IOException (java.io.IOException)2 Listbox (org.adempiere.webui.component.Listbox)2 ToolBarButton (org.adempiere.webui.component.ToolBarButton)2 Pre (org.zkoss.zhtml.Pre)2 Text (org.zkoss.zhtml.Text)2 Div (org.zkoss.zul.Div)2