Search in sources :

Example 1 with Tabpanel

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

the class ADTabPanel method setTabPanels.

private Tabbox setTabPanels(HorizontalEmbeddedPanel ep, Panel panel) {
    // For One Tab We created only one TabBox
    if (null == tabBox && null == tabPanels) {
        tabBox = new Tabbox();
        tabBox.setHeight("100%");
        //tabBox.setStyle("height: 100%; width: 100%; position: relative;");
        tabPanels = new Tabpanels();
        tabPanels.setHeight("600px");
        tabBox.appendChild(tabPanels);
        tabs = new Tabs();
        tabBox.appendChild(tabs);
    }
    // Setting Name For Tab
    Tab tab = new Tab(ep.gridWindow.getTab(ep.tabIndex).getName());
    tab.addEventListener(Events.ON_CLICK, this);
    tab.addEventListener(Events.ON_FOCUS, this);
    // Appending Tab to Tabs
    tabs.appendChild(tab);
    //Creating a TabPanel For every Tab
    Tabpanel tabPanel = new Tabpanel();
    embeddedTabPanel.put(ep.adTabId, tabPanel);
    tabPanel.setStyle("margin:0; padding:0; border: none; height:600px;");
    //Setting Embedded Panel to tabPanel
    tabPanel.appendChild(panel);
    //Appending Tab Panel To TabPanels
    tabPanels.appendChild(tabPanel);
    //By Default first Tab should populated
    tabBox.setSelectedIndex(0);
    // Returning the tabbox
    return tabBox;
}
Also used : Tab(org.adempiere.webui.component.Tab) Tabpanels(org.adempiere.webui.component.Tabpanels) Tabs(org.adempiere.webui.component.Tabs) Tabbox(org.adempiere.webui.component.Tabbox) Tabpanel(org.adempiere.webui.component.Tabpanel)

Example 2 with Tabpanel

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

Example 3 with Tabpanel

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

the class FindWindow method initPanel.

// initAdvanced
/**
     * initialise Main Window
     *
    **/
private void initPanel() {
    winMain = new MultiTabPart();
    winMain.createPart(this);
    winMain.getComponent().setStyle("height: 100%; width: 100%; position: relative;");
    winAdvanced = new Window();
    winLookupRecord = new Window();
    Tabpanel tabPanel = new Tabpanel();
    tabPanel.setStyle("height: 100%; width: 100%");
    tabPanel.appendChild(winLookupRecord);
    winMain.addTab(tabPanel, Msg.getMsg(Env.getCtx(), "Find").replaceAll("&", ""), false, true);
    tabPanel = new Tabpanel();
    tabPanel.setStyle("height: 100%; width: 100%");
    tabPanel.appendChild(winAdvanced);
    winMain.addTab(tabPanel, Msg.getMsg(Env.getCtx(), "Advanced").replaceAll("&", ""), false, false);
    m_sTipText = "<".concat(Msg.getMsg(Env.getCtx(), "SelectOrEnterQueryName")).concat(">");
    m_sToolTipText = Msg.getMsg(Env.getCtx(), "SelectOrEnterQueryNameToolTip");
    try {
        initSimple();
        initAdvanced();
    } catch (Exception e) {
        log.warning("Init failed " + e.getLocalizedMessage());
    }
}
Also used : Window(org.adempiere.webui.component.Window) MultiTabPart(org.adempiere.webui.part.MultiTabPart) Tabpanel(org.adempiere.webui.component.Tabpanel) SQLException(java.sql.SQLException) IOException(java.io.IOException)

Example 4 with Tabpanel

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

the class AboutWindow method createCredit.

private Tabpanel createCredit() {
    Tabpanel tabPanel = new Tabpanel();
    Vbox vbox = new Vbox();
    vbox.setParent(tabPanel);
    vbox.setWidth("100%");
    Hbox hbox = new Hbox();
    hbox.setParent(vbox);
    ToolBarButton link = new ToolBarButton();
    link.setImage("images/Posterita.jpg");
    link.setParent(hbox);
    link.setHref("http://www.posterita.org");
    link.setTarget("_blank");
    Label label = new Label("Contributed the initial Zk Web Client code.");
    label.setParent(hbox);
    Separator separator = new Separator();
    separator.setParent(vbox);
    Div div = new Div();
    div.setParent(vbox);
    div.setWidth("100%");
    Label caption = new Label("Sponsors");
    caption.setStyle("font-weight: bold;");
    div.appendChild(caption);
    separator = new Separator();
    separator.setBar(true);
    separator.setParent(div);
    Vbox content = new Vbox();
    content.setWidth("100%");
    content.setParent(div);
    link = new ToolBarButton();
    link = new ToolBarButton();
    link.setLabel("eEvolution");
    link.setHref("http://www.eevolution.com/");
    link.setTarget("_blank");
    link.setParent(content);
    link = new ToolBarButton();
    link.setLabel("Adaxa");
    link.setHref("http://www.adaxa.com/");
    link.setTarget("_blank");
    link.setParent(content);
    link = new ToolBarButton();
    link.setLabel("Westfalia IT");
    link.setHref("http://www.westfalia-it.com");
    link.setTarget("_blank");
    link.setParent(content);
    link = new ToolBarButton();
    link.setLabel("Walkingtree ");
    link.setHref("http://www.walkingtree.in");
    link.setTarget("_blank");
    link.setParent(content);
    link.setLabel("Sysnova");
    link.setHref("http://www.sysnova.com/");
    link.setTarget("_blank");
    link.setParent(content);
    link = new ToolBarButton();
    link.setLabel("Idalica");
    link.setHref("http://www.idalica.com/");
    link.setTarget("_blank");
    link.setParent(content);
    link = new ToolBarButton();
    link.setLabel("ERPCyA");
    link.setHref("http://www.erpcya.com/");
    link.setTarget("_blank");
    link.setParent(content);
    separator = new Separator();
    separator.setParent(vbox);
    div = new Div();
    div.setParent(vbox);
    div.setWidth("100%");
    caption = new Label("Contributors");
    caption.setStyle("font-weight: bold;");
    div.appendChild(caption);
    separator = new Separator();
    separator.setBar(true);
    separator.setParent(div);
    content = new Vbox();
    content.setWidth("100%");
    content.setParent(div);
    link = new ToolBarButton();
    link.setLabel("Victor PĂ©rez");
    link.setHref("http://wiki.adempiere.net/User:vpj-cd");
    link.setTarget("_blank");
    link.setParent(content);
    link = new ToolBarButton();
    link.setLabel("Paul Bowden");
    link.setHref("http://wiki.adempiere.net/User:Phib");
    link.setTarget("_blank");
    link.setParent(content);
    link = new ToolBarButton();
    link.setLabel("Michael McKay");
    link.setHref("http://wiki.adempiere.net/User:MJMcKay");
    link.setTarget("_blank");
    link.setParent(content);
    link = new ToolBarButton();
    link.setLabel("Mario Calderon");
    link.setHref("http://wiki.adempiere.net/User:mar_cal_westf");
    link.setTarget("_blank");
    link.setParent(content);
    link = new ToolBarButton();
    link.setLabel("Ashley G Ramdass");
    link.setHref("http://wiki.adempiere.net/User:Agramdass");
    link.setTarget("_blank");
    link.setParent(content);
    link = new ToolBarButton();
    link.setLabel("Low Heng Sin");
    link.setHref("http://wiki.adempiere.net/User:Hengsin");
    link.setTarget("_blank");
    link.setParent(content);
    link = new ToolBarButton();
    link.setLabel("Carlos Ruiz");
    link.setHref("http://wiki.adempiere.net/User:CarlosRuiz");
    link.setTarget("_blank");
    link.setParent(content);
    link = new ToolBarButton();
    link.setLabel("Teo Sarca");
    link.setHref("http://wiki.adempiere.net/User:Teo_sarca");
    link.setTarget("_blank");
    link.setParent(content);
    link = new ToolBarButton();
    link.setLabel("Trifon Trifonov");
    link.setHref("http://wiki.adempiere.net/User:Trifonnt");
    link.setTarget("_blank");
    link.setParent(content);
    link = new ToolBarButton();
    link.setLabel("Yamel Senih");
    link.setHref("http://wiki.adempiere.net/User:Yamel_Senih");
    link.setTarget("_blank");
    link.setParent(content);
    return tabPanel;
}
Also used : Div(org.zkoss.zul.Div) Hbox(org.zkoss.zul.Hbox) ToolBarButton(org.adempiere.webui.component.ToolBarButton) Label(org.adempiere.webui.component.Label) Tabpanel(org.adempiere.webui.component.Tabpanel) Vbox(org.zkoss.zul.Vbox) Separator(org.zkoss.zul.Separator)

Example 5 with Tabpanel

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

the class NavBarDesktop method createHomeTab.

private void createHomeTab() {
    Tabpanel homeTab = new Tabpanel();
    windowContainer.addWindow(homeTab, Msg.getMsg(Env.getCtx(), "Home").replaceAll("&", ""), false);
    Anchorlayout anchorLayout = new Anchorlayout();
    homeTab.appendChild(anchorLayout);
    // Dashboard content
    Anchorchildren anchorchildren = null;
    int currentColumnNo = 0;
    String sql = "SELECT COUNT(DISTINCT COLUMNNO) " + "FROM PA_DASHBOARDCONTENT " + "WHERE (AD_CLIENT_ID=0 OR AD_CLIENT_ID=?) AND ISACTIVE='Y'";
    int noOfCols = DB.getSQLValue(null, sql, Env.getAD_Client_ID(Env.getCtx()));
    int width = noOfCols <= 0 ? 100 : 100 / noOfCols;
    sql = "SELECT x.*, m.AD_MENU_ID " + "FROM PA_DASHBOARDCONTENT x " + "LEFT OUTER JOIN AD_MENU m ON x.AD_WINDOW_ID=m.AD_WINDOW_ID " + "WHERE (x.AD_CLIENT_ID=0 OR x.AD_CLIENT_ID=?) AND x.ISACTIVE='Y' " + "AND x.zulfilepath not in (?, ?, ?) " + "ORDER BY x.COLUMNNO, x.AD_CLIENT_ID, x.LINE ";
    PreparedStatement pstmt = null;
    ResultSet rs = null;
    try {
        pstmt = DB.prepareStatement(sql, null);
        pstmt.setInt(1, Env.getAD_Client_ID(Env.getCtx()));
        pstmt.setString(2, ACTIVITIES_PATH);
        pstmt.setString(3, FAVOURITES_PATH);
        pstmt.setString(4, VIEWS_PATH);
        rs = pstmt.executeQuery();
        while (rs.next()) {
            int columnNo = rs.getInt(X_PA_DashboardContent.COLUMNNAME_ColumnNo);
            if (anchorchildren == null || currentColumnNo != columnNo) {
                anchorchildren = new Anchorchildren();
                anchorLayout.appendChild(anchorchildren);
                anchorchildren.setWidth(width + "%");
                anchorchildren.setStyle("padding: 5px");
                currentColumnNo = columnNo;
            }
            Panel panel = new Panel();
            panel.setStyle("margin-bottom:10px");
            panel.setTitle(rs.getString(X_PA_DashboardContent.COLUMNNAME_Name));
            String description = rs.getString(X_PA_DashboardContent.COLUMNNAME_Description);
            if (description != null)
                panel.setTooltiptext(description);
            String collapsible = rs.getString(X_PA_DashboardContent.COLUMNNAME_IsCollapsible);
            panel.setCollapsible(collapsible.equals("Y"));
            panel.setBorder("normal");
            anchorchildren.appendChild(panel);
            Panelchildren content = new Panelchildren();
            panel.appendChild(content);
            boolean panelEmpty = true;
            // HTML content
            String htmlContent = rs.getString(X_PA_DashboardContent.COLUMNNAME_HTML);
            if (htmlContent != null) {
                StringBuffer result = new StringBuffer("<html><head>");
                URL url = getClass().getClassLoader().getResource("org/compiere/images/PAPanel.css");
                InputStreamReader ins;
                try {
                    ins = new InputStreamReader(url.openStream());
                    BufferedReader bufferedReader = new BufferedReader(ins);
                    String cssLine;
                    while ((cssLine = bufferedReader.readLine()) != null) result.append(cssLine + "\n");
                } catch (IOException e1) {
                    logger.log(Level.SEVERE, e1.getLocalizedMessage(), e1);
                }
                result.append("</head><body><div class=\"content\">\n");
                //	            	if(description != null)
                //	            		result.append("<h2>" + description + "</h2>\n");
                result.append(stripHtml(htmlContent, false) + "<br>\n");
                result.append("</div>\n</body>\n</html>\n</html>");
                Html html = new Html();
                html.setContent(result.toString());
                content.appendChild(html);
                panelEmpty = false;
            }
            // Window
            int AD_Window_ID = rs.getInt(X_PA_DashboardContent.COLUMNNAME_AD_Window_ID);
            if (AD_Window_ID > 0) {
                int AD_Menu_ID = rs.getInt(X_AD_Menu.COLUMNNAME_AD_Menu_ID);
                ToolBarButton btn = new ToolBarButton(String.valueOf(AD_Menu_ID));
                MMenu menu = new MMenu(Env.getCtx(), AD_Menu_ID, null);
                btn.setLabel(menu.getName());
                btn.addEventListener(Events.ON_CLICK, this);
                content.appendChild(btn);
                panelEmpty = false;
            }
            // Goal
            int PA_Goal_ID = rs.getInt(X_PA_DashboardContent.COLUMNNAME_PA_Goal_ID);
            if (PA_Goal_ID > 0) {
                String goalDisplay = rs.getString(X_PA_DashboardContent.COLUMNNAME_GoalDisplay);
                MGoal goal = new MGoal(Env.getCtx(), PA_Goal_ID, null);
                WGraph graph = new WGraph(goal, 55, false, true, !(X_PA_DashboardContent.GOALDISPLAY_Chart.equals(goalDisplay)), X_PA_DashboardContent.GOALDISPLAY_Chart.equals(goalDisplay));
                content.appendChild(graph);
                panelEmpty = false;
            }
            // ZUL file url
            String url = rs.getString(X_PA_DashboardContent.COLUMNNAME_ZulFilePath);
            if (url != null) {
                try {
                    Component component = Executions.createComponents(url, content, null);
                    if (component != null) {
                        if (component instanceof DashboardPanel) {
                            DashboardPanel dashboardPanel = (DashboardPanel) component;
                            if (!dashboardPanel.getChildren().isEmpty()) {
                                content.appendChild(dashboardPanel);
                                dashboardRunnable.add(dashboardPanel);
                                panelEmpty = false;
                            }
                        } else {
                            content.appendChild(component);
                            panelEmpty = false;
                        }
                    }
                } catch (Exception e) {
                    logger.log(Level.WARNING, "Failed to create components. zul=" + url, e);
                }
            }
            if (panelEmpty)
                panel.detach();
        }
    } catch (Exception e) {
        logger.log(Level.WARNING, "Failed to create dashboard content", e);
    } finally {
        DB.close(rs, pstmt);
    }
    //
    //register as 0
    registerWindow(homeTab);
    if (!anchorLayout.getDesktop().isServerPushEnabled())
        anchorLayout.getDesktop().enableServerPush(true);
    dashboardRunnable.refreshDashboard();
    dashboardThread = new Thread(dashboardRunnable, "UpdateInfo");
    dashboardThread.setDaemon(true);
    dashboardThread.start();
}
Also used : Anchorchildren(org.zkoss.zul.Anchorchildren) ToolBarButton(org.adempiere.webui.component.ToolBarButton) InputStreamReader(java.io.InputStreamReader) WGraph(org.adempiere.webui.apps.graph.WGraph) Anchorlayout(org.zkoss.zul.Anchorlayout) Html(org.zkoss.zul.Html) PreparedStatement(java.sql.PreparedStatement) Panelchildren(org.zkoss.zul.Panelchildren) IOException(java.io.IOException) MMenu(org.compiere.model.MMenu) URL(java.net.URL) IOException(java.io.IOException) DashboardPanel(org.adempiere.webui.dashboard.DashboardPanel) SidePanel(org.adempiere.webui.panel.SidePanel) HeaderPanel(org.adempiere.webui.panel.HeaderPanel) DashboardPanel(org.adempiere.webui.dashboard.DashboardPanel) Panel(org.zkoss.zul.Panel) ResultSet(java.sql.ResultSet) BufferedReader(java.io.BufferedReader) Component(org.zkoss.zk.ui.Component) Tabpanel(org.adempiere.webui.component.Tabpanel) MGoal(org.compiere.model.MGoal)

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