Search in sources :

Example 1 with ToolBarButton

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

the class FindWindow method onEvent.

// addSelectionColumn
public void onEvent(Event event) throws Exception {
    if (Events.ON_SELECT.equals(event.getName())) {
        if (event.getTarget() instanceof Listbox) {
            ListItem row = (ListItem) (event.getTarget().getParent().getParent());
            Listbox listbox = (Listbox) event.getTarget();
            advancedPanel.setSelectedItem(row);
            Listbox listColumn = (Listbox) row.getFellow("listColumn" + row.getId());
            Listbox listOperator = (Listbox) row.getFellow("listOperator" + row.getId());
            if (listbox.getId().equals(listColumn.getId()) || listbox.getId().equals(listOperator.getId())) {
                if (listbox.getId().equals(listColumn.getId())) {
                    ListItem column = listColumn.getSelectedItem();
                    if (column != null) {
                        addOperators(column, listOperator);
                    }
                }
                Component componentFrom = getEditorCompQueryFrom(row);
                Component componentTo = getEditorCompQueryTo(row);
                addRowEditor(componentFrom, (ListCell) row.getFellow("cellQueryFrom" + row.getId()));
                addRowEditor(componentTo, (ListCell) row.getFellow("cellQueryTo" + row.getId()));
            }
        } else if (event.getTarget() == fQueryName) {
            int index = fQueryName.getSelectedIndex();
            if (index < 0) {
                if (fQueryName.getSelectedItem() == null || fQueryName.getSelectedItem().equals(m_sTipText)) {
                    return;
                }
            } else if (index == 0) {
                // no query - wipe and start over.
                List<?> rowList = advancedPanel.getChildren();
                for (int rowIndex = rowList.size() - 1; rowIndex >= 1; rowIndex--) rowList.remove(rowIndex);
                createFields();
                fQueryName.setSelectedIndex(-1);
                fQueryName.setText(m_sTipText);
            } else
                parseUserQuery(userQueries[index - 1]);
        }
    } else //
    if (Events.ON_CLICK.equals(event.getName())) {
        //  Toolbar Buttons actions
        if (event.getTarget() instanceof ToolBarButton) {
            ToolBarButton button = (ToolBarButton) event.getTarget();
            if ("btnNewAdv".equals(button.getAttribute("name").toString())) {
                createFields();
            } else if ("btnDeleteAdv".equals(button.getAttribute("name").toString())) {
                int index = advancedPanel.getSelectedIndex();
                if (index >= 0) {
                    cmd_delete();
                }
            } else if ("btnSaveAdv".equals(button.getAttribute("name").toString())) {
                // Save the query but don't overwrite the Last query
                cmd_save(false);
            }
        } else //  Confirm panel actions
        if (event.getTarget() instanceof Button) {
            Button btn = (Button) event.getTarget();
            if ("btnOkSimple".equals(btn.getName())) {
                cmd_ok_Simple();
                dispose();
            } else if ("btnOkAdv".equals(btn.getName())) {
                cmd_ok_Advanced();
                dispose();
            } else if ("btnCancel".equals(btn.getName())) {
                m_isCancel = true;
                dispose();
            } else if ("btnNew".equals(btn.getName())) {
                m_query = MQuery.getNoRecordQuery(m_tableName, true);
                m_total = 0;
                m_createNew = true;
                dispose();
            }
        }
    } else if (Events.ON_OK.equals(event.getName())) {
        if (winLookupRecord.equals(event.getTarget())) {
            cmd_ok_Simple();
            dispose();
        } else if (winAdvanced.equals(event.getTarget())) {
            cmd_ok_Advanced();
            dispose();
        }
        // Check simple panel fields
        for (WEditor editor : m_sEditors) {
            if (editor.getComponent() == event.getTarget()) {
                cmd_ok_Simple();
                dispose();
            }
        }
        // Check simple panel fields
        for (WEditor editor : m_sEditors2) {
            if (editor != null && editor.getComponent() == event.getTarget()) {
                cmd_ok_Simple();
                dispose();
            }
        }
    } else if (Events.ON_FOCUS.equals(event.getName())) {
        if (event.getTarget() == fQueryName) {
            // fQueryName received the focus - delete the tip text so the user can type without 
            // having to delete the tip.
            int index = fQueryName.getSelectedIndex();
            if (index < 0) {
                if (fQueryName.getSelectedItem() == null || fQueryName.getSelectedItem().equals(m_sTipText)) {
                    fQueryName.setSelectedIndex(-1);
                    fQueryName.setText("");
                }
            }
        }
    } else if (Events.ON_BLUR.equals(event.getName())) {
        if (event.getTarget() == fQueryName) {
            // fQueryName lost the focus. If the field is blank, replace the tip text.
            if (fQueryName.getSelectedItem() != null && fQueryName.getSelectedItem().equals("")) {
                fQueryName.setText(m_sTipText);
            }
        }
    }
}
Also used : ToolBarButton(org.adempiere.webui.component.ToolBarButton) Button(org.adempiere.webui.component.Button) ToolBarButton(org.adempiere.webui.component.ToolBarButton) ListItem(org.adempiere.webui.component.ListItem) WEditor(org.adempiere.webui.editor.WEditor) Listbox(org.adempiere.webui.component.Listbox) Component(org.zkoss.zk.ui.Component)

Example 2 with ToolBarButton

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

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

the class DefaultDesktop method onEvent.

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

Example 4 with ToolBarButton

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

Example 5 with ToolBarButton

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

the class NavBar2Desktop method createHomeTab.

private void createHomeTab() {
    Tabpanel homeTab = new Tabpanel();
    windowContainer.addWindow(homeTab, Util.cleanAmp(Msg.getMsg(Env.getCtx(), "Home")), false);
    Anchorlayout anchorLayout = new Anchorlayout();
    anchorLayout.setVflex("1");
    anchorLayout.setHflex("1");
    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);
        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 + "%");
                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

ToolBarButton (org.adempiere.webui.component.ToolBarButton)12 Component (org.zkoss.zk.ui.Component)7 IOException (java.io.IOException)6 Tabpanel (org.adempiere.webui.component.Tabpanel)5 BufferedReader (java.io.BufferedReader)3 InputStreamReader (java.io.InputStreamReader)3 URL (java.net.URL)3 PreparedStatement (java.sql.PreparedStatement)3 ResultSet (java.sql.ResultSet)3 WGraph (org.adempiere.webui.apps.graph.WGraph)3 DashboardPanel (org.adempiere.webui.dashboard.DashboardPanel)3 HeaderPanel (org.adempiere.webui.panel.HeaderPanel)3 SidePanel (org.adempiere.webui.panel.SidePanel)3 MGoal (org.compiere.model.MGoal)3 Separator (org.zkoss.zul.Separator)3 Button (org.adempiere.webui.component.Button)2 Combobox (org.adempiere.webui.component.Combobox)2 Label (org.adempiere.webui.component.Label)2 Listbox (org.adempiere.webui.component.Listbox)2 ToolBar (org.adempiere.webui.component.ToolBar)2