();
- }
-
- protected Component doCreatePart(Component parent)
- {
- SidePanel pnlSide = new SidePanel();
- HeaderPanel pnlHead = new HeaderPanel();
-
- pnlSide.getMenuPanel().addMenuListener(this);
-
- layout = new Borderlayout();
- if (parent != null)
- {
- layout.setParent(parent);
- layout.setWidth("100%");
- layout.setHeight("100%");
- layout.setStyle("position: absolute");
- }
- else
- layout.setPage(page);
-
- North n = new North();
- layout.appendChild(n);
- n.setCollapsible(false);
- pnlHead.setParent(n);
-
- West w = new West();
- layout.appendChild(w);
- w.setWidth("300px");
- w.setCollapsible(true);
- w.setSplittable(true);
- w.setTitle("Menu");
- w.setTooltiptext("Application Menu");
- w.setFlex(true);
-// w.setAutoscroll(true);
- pnlSide.setParent(w);
-
- windowArea = new Center();
- windowArea.setParent(layout);
- windowArea.setFlex(true);
-// windowArea.setAutoscroll(true);
- windowContainer = new WindowContainer();
- windowContainer.createPart(windowArea);
-
- createHomeTab();
-
- return layout;
- }
-
- private void createHomeTab()
- {
- Tabpanel homeTab = new Tabpanel();
- windowContainer.addWindow(homeTab, Msg.getMsg(Env.getCtx(), "Home").replaceAll("&", ""), false);
-
- Portallayout layout = new Portallayout();
- layout.setWidth("100%");
- homeTab.appendChild(layout);
-
- // Dashboard content
- Portalchildren portalchildren = 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' "
- + "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()));
- rs = pstmt.executeQuery();
-
- while (rs.next())
- {
- int columnNo = rs.getInt(X_PA_DashboardContent.COLUMNNAME_ColumnNo);
- if(portalchildren == null || currentColumnNo != columnNo)
- {
- portalchildren = new Portalchildren();
- layout.appendChild(portalchildren);
- portalchildren.setWidth(width + "%");
- portalchildren.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");
- portalchildren.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("");
-
- 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("\n");
-
-// if(description != null)
-// result.append("
" + description + "
\n");
- result.append(stripHtml(htmlContent, false) + "
\n");
- result.append("\n\n\n