List of usage examples for com.lowagie.text Table Table
public Table(Table t)
From source file:com.afunms.report.abstraction.ExcelReport1.java
/** * @param file//from ww w .ja v a2 s. c om * @param type * @throws DocumentException * @throws IOException */ public void createReport_weblogicDoc(String file, String type) throws DocumentException, IOException { String starttime = (String) reportHash.get("starttime"); String totime = (String) reportHash.get("totime"); String hostname = (String) reportHash.get("equipname"); String ip = (String) reportHash.get("ip"); String newip = doip(ip); // WritableSheet sheet = wb.createSheet(hostname + "", 0); Calendar colTime = (Calendar) reportHash.get("time"); Hashtable maxping = (Hashtable) reportHash.get("ping"); String weblogicnow = (String) reportHash.get("weblogicnow"); Weblogic weblogic = (Weblogic) reportHash.get("weblogic"); Hashtable hash = (Hashtable) reportHash.get("weblogicnmphash"); SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); String[] memoryItemch = { "", "", "", "" }; String[] memoryItem = { "Capability", "Utilization" }; String[] diskItem = { "AllSize", "UsedSize", "Utilization" }; String[] diskItemch = { "", "", "" }; // Document document = new Document(PageSize.A4); // (Writer)document(Writer) if ("pdf".equals(type)) { document = new Document(PageSize.B4); PdfWriter.getInstance(document, new FileOutputStream(file)); } else { RtfWriter2.getInstance(document, new FileOutputStream(file)); } document.open(); // BaseFont bfChinese = BaseFont.createFont("STSong-Light", "UniGB-UCS2-H", BaseFont.NOT_EMBEDDED); // Font titleFont = new Font(bfChinese, 12, Font.BOLD); // Font contextFont = new Font(bfChinese, 10, Font.NORMAL); Paragraph title = new Paragraph(hostname + "", titleFont); // title.setAlignment(Element.ALIGN_CENTER); // title.setFont(titleFont); document.add(title); String contextString = ":" + impReport.getTimeStamp() + " \n"// + ":" + starttime + " " + totime; Paragraph context = new Paragraph(contextString); // context.setAlignment(Element.ALIGN_LEFT); // context.setFont(contextFont); // context.setSpacingBefore(5); // context.setFirstLineIndent(5); document.add(context); Font fontChinese = new Font(bfChinese, 12, Font.NORMAL, Color.black); Table aTable = new Table(4); this.setTableFormat(aTable); // float[] widths = { 220f, 300f, 220f, 220f }; // aTable.setWidths(widths); // aTable.setWidth(100); // 90% // aTable.setAlignment(Element.ALIGN_CENTER);// // aTable.setAutoFillEmptyCells(true); // // aTable.setBorderWidth(1); // // aTable.setBorderColor(new Color(0, 125, 255)); // // aTable.setPadding(2);// // aTable.setSpacing(0);// // aTable.setBorder(2);// // aTable.endHeaders(); aTable.addCell(this.setCellFormat(new Phrase("", contextFont), true)); aTable.addCell(this.setCellFormat(new Phrase("", contextFont), true)); aTable.addCell(this.setCellFormat(new Phrase("", contextFont), true)); aTable.addCell(this.setCellFormat(new Phrase("", contextFont), true)); // aTable.addCell("3.2",Ping+"%"); aTable.addCell(""); aTable.addCell(weblogicnow + "%"); aTable.addCell((String) maxping.get("pingmax")); aTable.addCell((String) maxping.get("avgpingcon")); Image img = Image.getInstance(ResourceCenter.getInstance().getSysPath() + "/resource/image/jfreechart/" + newip + "WeblogicPing" + ".png"); // img.setAbsolutePosition(0, 0); if ("pdf".equals(type)) { img.scalePercent(75); } img.setAlignment(Image.LEFT);// document.add(aTable); document.add(img); document.add(new Paragraph("\n")); Table aTable1 = new Table(7); // float[] widths1 = { 220f, 220f, 220f, 220f, 220f, 220f, 220f }; // aTable1.setWidths(widths1); // aTable1.setWidth(100); // 90% // aTable1.setAlignment(Element.ALIGN_CENTER);// // aTable1.setAutoFillEmptyCells(true); // // aTable1.setBorderWidth(1); // // aTable1.setBorderColor(new Color(0, 125, 255)); // // aTable1.setPadding(2);// // aTable1.setSpacing(0);// // aTable1.setBorder(2);// // aTable1.endHeaders(); this.setTableFormat(aTable1); Cell cell = null; cell = new Cell(new Phrase("", contextFont)); this.setCellFormat(cell, true); aTable1.addCell(cell); cell = new Cell(new Phrase("", contextFont)); this.setCellFormat(cell, true); aTable1.addCell(cell); cell = new Cell(new Phrase("", contextFont)); this.setCellFormat(cell, true); aTable1.addCell(cell); cell = new Cell(new Phrase("", contextFont)); this.setCellFormat(cell, true); aTable1.addCell(cell); cell = new Cell(new Phrase("", contextFont)); this.setCellFormat(cell, true); aTable1.addCell(cell); cell = new Cell(new Phrase("", contextFont)); this.setCellFormat(cell, true); aTable1.addCell(cell); cell = new Cell(new Phrase("", contextFont)); this.setCellFormat(cell, true); aTable1.addCell(cell); List queuedatalist = new ArrayList(); // Hashtable hash = null; // WeblogicSnmp weblogicsnmp = null; // WeblogicConfigDao weblogicconfigdao = new WeblogicConfigDao(); // weblogicsnmp = new WeblogicSnmp(weblogic.getIpAddress(), // weblogic.getCommunity(), weblogic.getPortnum()); // hash = weblogicsnmp.collectData(); if (hash != null) { queuedatalist = (List) hash.get("queueValue"); } for (int i = 0; i < queuedatalist.size(); i++) { WeblogicQueue vo = (WeblogicQueue) queuedatalist.get(i); cell = new Cell(new Phrase("")); aTable1.addCell(cell); cell = new Cell(new Phrase(i + 1 + "", contextFont)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable1.addCell(cell); cell = new Cell(new Phrase(vo.getExecuteQueueRuntimeName(), contextFont)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable1.addCell(cell); cell = new Cell(new Phrase(vo.getThreadPoolRuntimeExecuteThreadIdleCount(), contextFont)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable1.addCell(cell); cell = new Cell(new Phrase(vo.getExecuteQueueRuntimePendingRequestOldestTime(), contextFont)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable1.addCell(cell); cell = new Cell(new Phrase(vo.getExecuteQueueRuntimePendingRequestCurrentCount(), contextFont)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable1.addCell(cell); cell = new Cell(new Phrase(vo.getExecuteQueueRuntimePendingRequestTotalCount(), contextFont)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable1.addCell(cell); } document.add(aTable1); Table aTable2 = new Table(8); this.setTableFormat(aTable2); // float[] widths2 = { 220f, 220f, 220f, 220f, 220f, 220f, 220f, 220f }; // aTable2.setWidths(widths2); // aTable2.setWidth(100); // 90% // aTable2.setAlignment(Element.ALIGN_CENTER);// // aTable2.setAutoFillEmptyCells(true); // // aTable2.setBorderWidth(1); // // aTable2.setBorderColor(new Color(0, 125, 255)); // // aTable2.setPadding(2);// // aTable2.setSpacing(0);// // aTable2.setBorder(2);// // aTable2.endHeaders(); cell = new Cell(new Phrase("JDBC", contextFont)); this.setCellFormat(cell, true); aTable2.addCell(cell); cell = new Cell(new Phrase("", contextFont)); this.setCellFormat(cell, true); aTable2.addCell(cell); cell = new Cell(new Phrase("", contextFont)); this.setCellFormat(cell, true); aTable2.addCell(cell); cell = new Cell(new Phrase("", contextFont)); this.setCellFormat(cell, true); aTable2.addCell(cell); cell = new Cell(new Phrase("", contextFont)); this.setCellFormat(cell, true); aTable2.addCell(cell); cell = new Cell(new Phrase("", contextFont)); this.setCellFormat(cell, true); aTable2.addCell(cell); cell = new Cell(new Phrase("", contextFont)); this.setCellFormat(cell, true); aTable2.addCell(cell); cell = new Cell(new Phrase("", contextFont)); this.setCellFormat(cell, true); aTable2.addCell(cell); List jdbcdatalist = new ArrayList(); // weblogicsnmp = new WeblogicSnmp(weblogic.getIpAddress(), // weblogic.getCommunity(), weblogic.getPortnum()); // hash = weblogicsnmp.collectData(); jdbcdatalist = (List) hash.get("jdbcValue"); for (int i = 0; i < jdbcdatalist.size(); i++) { WeblogicJdbc vo = (WeblogicJdbc) jdbcdatalist.get(i); cell = new Cell(new Phrase("")); aTable2.addCell(cell); cell = new Cell(new Phrase(i + 1 + "", contextFont)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable2.addCell(cell); cell = new Cell(new Phrase(vo.getJdbcConnectionPoolName(), contextFont)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable2.addCell(cell); cell = new Cell( new Phrase(vo.getJdbcConnectionPoolRuntimeActiveConnectionsCurrentCount(), contextFont)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable2.addCell(cell); cell = new Cell(new Phrase(vo.getJdbcConnectionPoolRuntimeVersionJDBCDriver(), contextFont)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable2.addCell(cell); cell = new Cell(new Phrase(vo.getJdbcConnectionPoolRuntimeMaxCapacity(), contextFont)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable2.addCell(cell); cell = new Cell( new Phrase(vo.getJdbcConnectionPoolRuntimeActiveConnectionsAverageCount(), contextFont)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable2.addCell(cell); cell = new Cell(new Phrase(vo.getJdbcConnectionPoolRuntimeHighestNumAvailable(), contextFont)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable2.addCell(cell); } document.add(aTable2); Table aTable3 = new Table(5); this.setTableFormat(aTable3); // float[] widths3 = { 220f, 220f, 220f, 220f, 220f }; // aTable3.setWidths(widths3); // aTable3.setWidth(100); // 90% // aTable3.setAlignment(Element.ALIGN_CENTER);// // aTable3.setAutoFillEmptyCells(true); // // aTable3.setBorderWidth(1); // // aTable3.setBorderColor(new Color(0, 125, 255)); // // aTable3.setPadding(2);// // aTable3.setSpacing(0);// // aTable3.setBorder(2);// // aTable3.endHeaders(); cell = new Cell(new Phrase("JVM", contextFont)); this.setCellFormat(cell, true); aTable3.addCell(cell); cell = new Cell(new Phrase("", contextFont)); this.setCellFormat(cell, true); aTable3.addCell(cell); cell = new Cell(new Phrase("", contextFont)); this.setCellFormat(cell, true); aTable3.addCell(cell); cell = new Cell(new Phrase("", contextFont)); this.setCellFormat(cell, true); aTable3.addCell(cell); cell = new Cell(new Phrase("", contextFont)); this.setCellFormat(cell, true); aTable3.addCell(cell); // weblogicsnmp = new WeblogicSnmp(weblogic.getIpAddress(), // weblogic.getCommunity(), weblogic.getPortnum()); // hash = weblogicsnmp.collectData(); List heapdatalist = new ArrayList(); heapdatalist = (List) hash.get("heapValue"); for (int i = 0; i < heapdatalist.size(); i++) { WeblogicHeap vo = (WeblogicHeap) heapdatalist.get(i); cell = new Cell(new Phrase("")); aTable3.addCell(cell); cell = new Cell(new Phrase(i + 1 + "", contextFont)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable3.addCell(cell); cell = new Cell(new Phrase(vo.getJvmRuntimeName(), contextFont)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable3.addCell(cell); cell = new Cell(new Phrase(vo.getJvmRuntimeHeapSizeCurrent(), contextFont)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable3.addCell(cell); cell = new Cell(new Phrase(vo.getJvmRuntimeHeapFreeCurrent(), contextFont)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable3.addCell(cell); } document.add(aTable3); Table aTable4 = new Table(8); // float[] widths4 = { 220f, 220f, 220f, 220f, 220f, 220f, 220f, 220f }; // aTable4.setWidths(widths4); // aTable4.setWidth(100); // 90% // aTable4.setAlignment(Element.ALIGN_CENTER);// // aTable4.setAutoFillEmptyCells(true); // // aTable4.setBorderWidth(1); // // aTable4.setBorderColor(new Color(0, 125, 255)); // // aTable4.setPadding(2);// // aTable4.setSpacing(0);// // aTable4.setBorder(2);// // aTable4.endHeaders(); this.setTableFormat(aTable4); cell = new Cell(new Phrase("", contextFont)); this.setCellFormat(cell, true); aTable4.addCell(cell); cell = new Cell(new Phrase("", contextFont)); this.setCellFormat(cell, true); aTable4.addCell(cell); cell = new Cell(new Phrase("", contextFont)); this.setCellFormat(cell, true); aTable4.addCell(cell); cell = new Cell(new Phrase("", contextFont)); this.setCellFormat(cell, true); aTable4.addCell(cell); cell = new Cell(new Phrase("", contextFont)); this.setCellFormat(cell, true); aTable4.addCell(cell); cell = new Cell(new Phrase("Socket", contextFont)); this.setCellFormat(cell, true); aTable4.addCell(cell); cell = new Cell(new Phrase("", contextFont)); this.setCellFormat(cell, true); aTable4.addCell(cell); cell = new Cell(new Phrase("IP", contextFont)); this.setCellFormat(cell, true); aTable4.addCell(cell); // weblogicsnmp = new WeblogicSnmp(weblogic.getIpAddress(), // weblogic.getCommunity(), weblogic.getPortnum()); // hash = weblogicsnmp.collectData(); List serverdatalist = new ArrayList(); serverdatalist = (List) hash.get("serverValue"); for (int i = 0; i < serverdatalist.size(); i++) { WeblogicServer vo = (WeblogicServer) serverdatalist.get(i); cell = new Cell(""); aTable4.addCell(cell); cell = new Cell(new Phrase(i + 1 + "", contextFont)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable4.addCell(cell); cell = new Cell(new Phrase(vo.getServerRuntimeName(), contextFont)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable4.addCell(cell); cell = new Cell(new Phrase(vo.getServerRuntimeListenAddress(), contextFont)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable4.addCell(cell); cell = new Cell(new Phrase(vo.getServerRuntimeListenPort(), contextFont)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable4.addCell(cell); cell = new Cell(new Phrase(vo.getServerRuntimeOpenSocketsCurrentCount(), contextFont)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable4.addCell(cell); cell = new Cell(new Phrase(vo.getServerRuntimeState(), contextFont)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable4.addCell(cell); cell = new Cell(new Phrase(weblogic.getIpAddress(), contextFont)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable4.addCell(cell); } document.add(aTable4); document.close(); }
From source file:com.afunms.report.abstraction.ExcelReport1.java
/** * @param file//from w ww. j a v a 2 s . c om * @param type * @throws DocumentException * @throws IOException */ public void createReport_weblogicNewDoc(String file, String type) throws DocumentException, IOException { Hashtable Memory = (Hashtable) reportHash.get("Memory"); // EventListDao eventListDao = new EventListDao(); Hashtable maxping = (Hashtable) reportHash.get("ping"); String starttime = (String) reportHash.get("starttime"); String totime = (String) reportHash.get("totime"); String hostname = (String) reportHash.get("equipname"); String hostnameDoc = (String) reportHash.get("equipnameDoc"); String ip = (String) reportHash.get("ip"); String typename = (String) reportHash.get("typename"); String startdate = (String) reportHash.get("startdate"); Hashtable maxjvm = (Hashtable) reportHash.get("maxjvm"); String downnum = (String) reportHash.get("downnum"); Hashtable hash = (Hashtable) reportHash.get("weblogicnmphash"); WeblogicConfig weblogicconf = (WeblogicConfig) reportHash.get("weblogicconf"); WeblogicNormal normalvalue = (WeblogicNormal) reportHash.get("normalvalue"); // time Hashtable pollingtime_ht = new Hashtable(); WeblogicManager tm = new WeblogicManager(); String lasttime; String nexttime; try { pollingtime_ht = tm.getCollecttime(weblogicconf.getIpAddress()); } catch (Exception e) { SysLogger.error("", e); } if (pollingtime_ht != null) { lasttime = (String) pollingtime_ht.get("lasttime"); nexttime = (String) pollingtime_ht.get("nexttime"); } else { lasttime = null; nexttime = null; } // end /* String type = (String)request.getAttribute("type"); */ Document document = new Document(PageSize.A4); // (Writer)document(Writer) if ("pdf".equals(type)) { PdfWriter.getInstance(document, new FileOutputStream(file)); } else { RtfWriter2.getInstance(document, new FileOutputStream(file)); } document.open(); // BaseFont bfChinese = BaseFont.createFont("STSong-Light", "UniGB-UCS2-H", BaseFont.NOT_EMBEDDED); // Font titleFont = new Font(bfChinese, 12, Font.BOLD); // Font contextFont = new Font(bfChinese, 12, Font.NORMAL); Font fontChinese = new Font(bfChinese, 12, Font.NORMAL, Color.black); Table aTable = new Table(8); // float[] widths = { 220f, 220f, 220f, 110f, 110f, 110f, 110f, 220f }; // aTable.setWidths(widths); // aTable.setWidth(100); // 90% // aTable.setAlignment(Element.ALIGN_CENTER);// // aTable.setAutoFillEmptyCells(true); // // aTable.setBorderWidth(1); // // aTable.setBorderColor(new Color(0, 125, 255)); // // aTable.setPadding(2);// // aTable.setSpacing(0);// // aTable.setBorder(2);// this.setTableFormat(aTable); aTable.endHeaders(); Cell cell = null; cell = new Cell(new Phrase("\n" + "" + hostname + "" + "\n", titleFont)); cell.setColspan(8); this.setCellFormat(cell, true); aTable.addCell(cell); cell = new Cell(new Phrase("\n" + "" + "\n", titleFont)); aTable.addCell(cell); this.setCellFormat(cell, true); cell = new Cell(new Phrase("\n" + starttime + " " + totime + "\n", contextFont)); cell.setColspan(7); aTable.addCell(cell); cell = new Cell(new Phrase("\n" + "" + "\n", titleFont)); this.setCellFormat(cell, true); aTable.addCell(cell); cell = new Cell(new Phrase(hostnameDoc, contextFont)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable.addCell(cell); cell = new Cell(new Phrase("IP", titleFont)); this.setCellFormat(cell, true); aTable.addCell(cell); cell = new Cell(new Phrase(ip, contextFont)); cell.setColspan(2); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable.addCell(cell); cell = new Cell(new Phrase("", titleFont)); cell.setColspan(2); this.setCellFormat(cell, true); aTable.addCell(cell); cell = new Cell(new Phrase(typename, contextFont)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable.addCell(cell); cell = new Cell(new Phrase("\n" + "" + "\n", titleFont)); this.setCellFormat(cell, true); aTable.addCell(cell); String grade = (String) reportHash.get("grade"); cell = new Cell(new Phrase("\n" + grade + "\n", contextFont)); cell.setColspan(7); aTable.addCell(cell); cell = new Cell(new Phrase("" + "\n" + "" + "\n" + "" + "\n" + "", titleFont)); cell.setRowspan(4); this.setCellFormat(cell, true); aTable.addCell(cell); cell = new Cell(new Phrase("\n" + "" + "\n", titleFont)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable.addCell(cell); cell = new Cell(new Phrase("\n" + "" + "\n", titleFont)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable.addCell(cell); cell = new Cell(new Phrase((String) maxping.get("pingmax"), contextFont)); cell.setColspan(2); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable.addCell(cell); cell = new Cell(new Phrase("", titleFont)); cell.setColspan(2); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable.addCell(cell); cell = new Cell(new Phrase((String) maxping.get("avgpingcon"), contextFont)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable.addCell(cell); cell = new Cell(new Phrase("\n" + "" + "\n", titleFont)); cell.setRowspan(3); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable.addCell(cell); cell = new Cell(new Phrase("\n" + "" + "\n", titleFont)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable.addCell(cell); cell = new Cell(new Phrase(normalvalue.getDomainName(), contextFont)); cell.setColspan(2); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable.addCell(cell); cell = new Cell(new Phrase("", titleFont)); cell.setColspan(2); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable.addCell(cell); cell = new Cell(new Phrase(normalvalue.getDomainAdministrationPort(), contextFont)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable.addCell(cell); cell = new Cell(new Phrase("\n" + "" + "\n", titleFont)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable.addCell(cell); cell = new Cell(new Phrase(weblogicconf.getPortnum() + "", contextFont)); cell.setColspan(2); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable.addCell(cell); cell = new Cell(new Phrase("", titleFont)); cell.setColspan(2); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable.addCell(cell); cell = new Cell(new Phrase(normalvalue.getDomainConfigurationVersion(), contextFont)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable.addCell(cell); cell = new Cell(new Phrase("\n" + ":" + "\n", titleFont)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable.addCell(cell); cell = new Cell(new Phrase(lasttime, contextFont)); cell.setColspan(2); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable.addCell(cell); cell = new Cell(new Phrase(":", titleFont)); cell.setColspan(2); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable.addCell(cell); cell = new Cell(new Phrase(nexttime, contextFont)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable.addCell(cell); cell = new Cell(new Phrase("" + "\n" + "" + "\n" + "" + "\n" + "", titleFont)); this.setCellFormat(cell, true); aTable.addCell(cell); cell = new Cell(new Phrase("\n" + "" + downnum + "" + "\n", contextFont)); cell.setColspan(7); aTable.addCell(cell); cell = new Cell(new Phrase("\n" + "" + "\n", titleFont)); this.setCellFormat(cell, true); cell.setColspan(8); aTable.addCell(cell); String strping = ""; if ("0".equals(downnum)) { strping = " 2 " + downnum + "" + "\n" + "\n"; } else { strping = " 2 " + "\n" + "\n"; } cell = new Cell(new Phrase(" 1 " + " \n" + "\n" + strping + "\n" + "\n" + "\n", contextFont) ); cell.setColspan(8); aTable.addCell(cell); // end // end } document.add(aTable); document.close(); }
From source file:com.afunms.report.abstraction.ExcelReport1.java
public void createReport_weblogicNewPDF(String file) throws DocumentException, IOException { Hashtable Memory = (Hashtable) reportHash.get("Memory"); // EventListDao eventListDao = new EventListDao(); Hashtable maxping = (Hashtable) reportHash.get("ping"); String starttime = (String) reportHash.get("starttime"); String totime = (String) reportHash.get("totime"); String hostname = (String) reportHash.get("equipname"); String hostnameDoc = (String) reportHash.get("equipnameDoc"); String ip = (String) reportHash.get("ip"); String typename = (String) reportHash.get("typename"); String startdate = (String) reportHash.get("startdate"); Hashtable maxjvm = (Hashtable) reportHash.get("maxjvm"); String downnum = (String) reportHash.get("downnum"); WeblogicConfig weblogicconf = (WeblogicConfig) reportHash.get("weblogicconf"); WeblogicNormal normalvalue = (WeblogicNormal) reportHash.get("normalvalue"); // time//from w w w. j a va 2s . c o m Hashtable pollingtime_ht = new Hashtable(); WeblogicManager tm = new WeblogicManager(); String lasttime; String nexttime; try { pollingtime_ht = tm.getCollecttime(weblogicconf.getIpAddress()); } catch (Exception e) { SysLogger.error("", e); } if (pollingtime_ht != null) { lasttime = (String) pollingtime_ht.get("lasttime"); nexttime = (String) pollingtime_ht.get("nexttime"); } else { lasttime = null; nexttime = null; } // end /* String type = (String)request.getAttribute("type"); */ Document document = new Document(PageSize.A4); // (Writer)document(Writer) PdfWriter.getInstance(document, new FileOutputStream(file)); document.open(); // BaseFont bfChinese = BaseFont.createFont("STSong-Light", "UniGB-UCS2-H", BaseFont.NOT_EMBEDDED); // Font titleFont = new Font(bfChinese, 12, Font.BOLD); // Font contextFont = new Font(bfChinese, 12, Font.NORMAL); Font contextFont1 = new Font(bfChinese, 10, Font.NORMAL); Font fontChinese = new Font(bfChinese, 12, Font.NORMAL, Color.black); Table aTable = new Table(8); float[] widths = { 220f, 220f, 220f, 110f, 110f, 110f, 110f, 220f }; aTable.setWidths(widths); aTable.setWidth(100); // 90% aTable.setAlignment(Element.ALIGN_CENTER);// aTable.setAutoFillEmptyCells(true); // aTable.setBorderWidth(1); // aTable.setBorderColor(new Color(0, 125, 255)); // aTable.setPadding(2);// aTable.setSpacing(0);// aTable.setBorder(2);// aTable.endHeaders(); Cell cell = null; cell = new Cell(new Phrase("\n" + "" + hostname + "" + "\n", titleFont)); cell.setColspan(8); cell.setHorizontalAlignment(Element.ALIGN_CENTER); cell.setVerticalAlignment(Element.ALIGN_CENTER); aTable.addCell(cell); cell = new Cell(new Phrase("\n" + "" + "\n", titleFont)); aTable.addCell(cell); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // cell = new Cell(new Phrase("\n" + starttime + " " + totime + "\n", contextFont1)); cell.setColspan(7); aTable.addCell(cell); cell = new Cell(new Phrase("\n" + "" + "\n", titleFont)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable.addCell(cell); cell = new Cell(new Phrase(hostnameDoc, contextFont)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable.addCell(cell); cell = new Cell(new Phrase("IP", titleFont)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable.addCell(cell); cell = new Cell(new Phrase(ip)); cell.setColspan(2); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable.addCell(cell); cell = new Cell(new Phrase("", titleFont)); cell.setColspan(2); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable.addCell(cell); cell = new Cell(new Phrase(typename)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable.addCell(cell); cell = new Cell(new Phrase("\n" + "" + "\n", titleFont)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable.addCell(cell); String grade = (String) reportHash.get("grade"); cell = new Cell(new Phrase("\n" + grade + "\n", contextFont)); cell.setColspan(7); aTable.addCell(cell); cell = new Cell(new Phrase("" + "\n" + "" + "\n" + "" + "\n" + "", titleFont)); cell.setRowspan(4); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable.addCell(cell); cell = new Cell(new Phrase("\n" + "" + "\n", titleFont)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable.addCell(cell); cell = new Cell(new Phrase("\n" + "" + "\n", titleFont)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable.addCell(cell); cell = new Cell(new Phrase((String) maxping.get("pingmax"))); cell.setColspan(2); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable.addCell(cell); cell = new Cell(new Phrase("", titleFont)); cell.setColspan(2); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable.addCell(cell); cell = new Cell(new Phrase((String) maxping.get("avgpingcon"), contextFont)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable.addCell(cell); cell = new Cell(new Phrase("\n" + "" + "\n", titleFont)); cell.setRowspan(3); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable.addCell(cell); cell = new Cell(new Phrase("\n" + "" + "\n", titleFont)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable.addCell(cell); cell = new Cell(new Phrase(normalvalue.getDomainName())); cell.setColspan(2); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable.addCell(cell); cell = new Cell(new Phrase("", titleFont)); cell.setColspan(2); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable.addCell(cell); cell = new Cell(new Phrase(normalvalue.getDomainAdministrationPort(), contextFont)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable.addCell(cell); cell = new Cell(new Phrase("\n" + "" + "\n", titleFont)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable.addCell(cell); cell = new Cell(new Phrase(weblogicconf.getPortnum() + "")); cell.setColspan(2); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable.addCell(cell); cell = new Cell(new Phrase("", titleFont)); cell.setColspan(2); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable.addCell(cell); cell = new Cell(new Phrase(normalvalue.getDomainConfigurationVersion(), contextFont)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable.addCell(cell); cell = new Cell(new Phrase("\n" + ":" + "\n", titleFont)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable.addCell(cell); cell = new Cell(new Phrase(lasttime)); cell.setColspan(2); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable.addCell(cell); cell = new Cell(new Phrase(":", titleFont)); cell.setColspan(2); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable.addCell(cell); cell = new Cell(new Phrase(nexttime)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable.addCell(cell); cell = new Cell(new Phrase("" + "\n" + "" + "\n" + "" + "\n" + "", titleFont)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable.addCell(cell); cell = new Cell(new Phrase("\n" + "" + downnum + "" + "\n", contextFont)); cell.setColspan(7); aTable.addCell(cell); cell = new Cell(new Phrase("\n" + "" + "\n", titleFont)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // cell.setColspan(8); aTable.addCell(cell); String strping = ""; if ("0".equals(downnum)) { strping = " 2 " + "\n" + "\n"; } else { strping = " 2 " + downnum + "" + "\n" + "\n"; } cell = new Cell(new Phrase(" 1 " + " \n" + "\n" + strping + "\n" + "\n" + "\n", contextFont) ); cell.setColspan(8); aTable.addCell(cell); // end // end } document.add(aTable); document.close(); }
From source file:com.afunms.report.abstraction.ExcelReport1.java
public void createReport_inforDoc(String filename) throws DocumentException, IOException { if (impReport.getTable() == null) { fileName = null;// ww w. jav a 2 s.c o m return; } try { // Document document = new Document(PageSize.A4); // (Writer)document(Writer) RtfWriter2.getInstance(document, new FileOutputStream(filename)); document.open(); // BaseFont bfChinese = BaseFont.createFont("Times-Roman", "", BaseFont.NOT_EMBEDDED); // Font titleFont = new Font(bfChinese, 12, Font.BOLD); // Font contextFont = new Font(bfChinese, 12, Font.NORMAL); String hostname = (String) reportHash.get("dbname"); String ip = (String) reportHash.get("ip"); String newip = doip(ip); Hashtable dbinfo = new Hashtable(); dbinfo = (Hashtable) reportHash.get("dbValue"); ArrayList dbspaces = new ArrayList(); dbspaces = (ArrayList) dbinfo.get("informixspaces");// Hashtable maxping = (Hashtable) reportHash.get("ping"); ArrayList dbsession = new ArrayList(); dbsession = (ArrayList) dbinfo.get("sessionList");// Paragraph title = new Paragraph(hostname + "", titleFont); // title.setAlignment(Element.ALIGN_CENTER); // title.setFont(titleFont); document.add(title); String Ping = (String) reportHash.get("Ping"); String starttime = (String) reportHash.get("starttime"); String totime = (String) reportHash.get("totime"); SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); String contextString = ":" + impReport.getTimeStamp() + " \n"// + ":" + starttime + " " + totime; Paragraph context = new Paragraph(contextString, contextFont); // context.setAlignment(Element.ALIGN_LEFT); // context.setFont(contextFont); // context.setSpacingBefore(5); // context.setFirstLineIndent(5); document.add(context); /* * tmpLabel = new Label(0, 1, ":" + impReport.getTimeStamp()); * sheet.addCell(tmpLabel); tmpLabel = new Label(0, 2, ": " + * starttime + " " + totime); */ Table aTable = new Table(3); float[] widths = { 220f, 220f, 220f }; aTable.setWidths(widths); aTable.setWidth(100); // 90% aTable.setAlignment(Element.ALIGN_CENTER);// aTable.setAutoFillEmptyCells(true); // aTable.setBorderWidth(1); // aTable.setBorderColor(new Color(0, 125, 255)); // aTable.setPadding(2);// aTable.setSpacing(0);// aTable.setBorder(2);// aTable.endHeaders(); Cell cell = null; cell = new Cell(new Phrase("", titleFont)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable.addCell(cell); cell = new Cell(new Phrase("", titleFont)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable.addCell(cell); cell = new Cell(new Phrase("", titleFont)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable.addCell(cell); cell = new Cell(""); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable.addCell(cell); cell = new Cell(new Phrase((String) maxping.get("pingmax"), contextFont)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable.addCell(cell); cell = new Cell(new Phrase((String) maxping.get("avgpingcon"), contextFont)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable.addCell(cell); // Image img = Image.getInstance(ResourceCenter.getInstance().getSysPath() + "/resource/image/jfreechart/" + newip + "ConnectUtilization" + ".png"); img.setAbsolutePosition(0, 0); img.setAlignment(Image.LEFT);// document.add(aTable); document.add(img); document.add(new Paragraph("\n")); // informix Table aTable1 = new Table(9); float[] width = { 220f, 220f, 220f, 220f, 220f, 220f, 220f, 220f, 220f }; aTable1.setWidths(width); aTable1.setWidth(100); // 90% aTable1.setAlignment(Element.ALIGN_CENTER);// aTable1.setAutoFillEmptyCells(true); // aTable1.setBorderWidth(1); // aTable1.setBorderColor(new Color(0, 125, 255)); // aTable1.setPadding(2);// aTable1.setSpacing(0);// aTable1.setBorder(2);// cell = new Cell(new Phrase("", titleFont)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable1.addCell(cell); cell = new Cell(new Phrase("", titleFont)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable1.addCell(cell); cell = new Cell(new Phrase("", titleFont)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable1.addCell(cell); cell = new Cell(new Phrase("", titleFont)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable1.addCell(cell); cell = new Cell(new Phrase("", titleFont)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable1.addCell(cell); cell = new Cell(new Phrase("", titleFont)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable1.addCell(cell); cell = new Cell(new Phrase("", titleFont)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable1.addCell(cell); cell = new Cell(new Phrase("", titleFont)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable1.addCell(cell); cell = new Cell(new Phrase("(%)", titleFont)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable1.addCell(cell); // aTable1.endHeaders(); // int row = 0; if (dbspaces != null && dbspaces.size() > 0) { for (int i = 0; i < dbspaces.size(); i++) { Hashtable tablesVO = (Hashtable) dbspaces.get(i); double all = 100.00; double show = all - Double.parseDouble(tablesVO.get("percent_free").toString()); String str = show + ""; if (str.length() > 5) { str = str.substring(0, 5); } aTable1.addCell(""); row = i + 1; String rowStr = "" + row; cell = new Cell(new Phrase(rowStr, contextFont)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable1.addCell(cell); cell = new Cell(new Phrase((String) tablesVO.get("dbspace"), contextFont)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable1.addCell(cell); cell = new Cell(new Phrase((String) tablesVO.get("owner"), contextFont)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable1.addCell(cell); cell = new Cell(new Phrase((String) tablesVO.get("fname"), contextFont)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable1.addCell(cell); cell = new Cell(new Phrase((String) tablesVO.get("pages_size"), contextFont)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable1.addCell(cell); cell = new Cell(new Phrase((String) tablesVO.get("pages_used"), contextFont)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable1.addCell(cell); cell = new Cell(new Phrase((String) tablesVO.get("pages_free"), contextFont)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable1.addCell(cell); cell = new Cell(new Phrase(str, contextFont)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable1.addCell(cell); } } // informix Table aTable2 = new Table(9); float[] widthss = { 220f, 220f, 220f, 220f, 220f, 220f, 220f, 220f, 220f }; aTable2.setWidths(widthss); aTable2.setWidth(100); // 90% aTable2.setAlignment(Element.ALIGN_CENTER);// aTable2.setAutoFillEmptyCells(true); // aTable2.setBorderWidth(1); // aTable2.setBorderColor(new Color(0, 125, 255)); // aTable2.setPadding(2);// aTable2.setSpacing(0);// aTable2.setBorder(2);// cell = new Cell(new Phrase("INFORMIX", titleFont)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable2.addCell(cell); cell = new Cell(new Phrase("ID", titleFont)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable2.addCell(cell); cell = new Cell(new Phrase("", titleFont)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable2.addCell(cell); cell = new Cell(new Phrase("", titleFont)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable2.addCell(cell); cell = new Cell(new Phrase("", titleFont)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable2.addCell(cell); cell = new Cell(new Phrase("", titleFont)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable2.addCell(cell); cell = new Cell(new Phrase("", titleFont)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable2.addCell(cell); cell = new Cell(new Phrase("", titleFont)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable2.addCell(cell); cell = new Cell(new Phrase("", titleFont)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable2.addCell(cell); ArrayList dblog = new ArrayList(); dblog = (ArrayList) dbinfo.get("informixlog");// if (dblog != null && dblog.size() > 0) { for (int i = 0; i < dblog.size(); i++) { Hashtable tablesVO = (Hashtable) dblog.get(i); aTable2.addCell(""); row = i + 1; String rowStr = "" + row; cell = new Cell(new Phrase(((Integer) tablesVO.get("uniqid")).intValue() + "", contextFont)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable2.addCell(cell); cell = new Cell(new Phrase(((Integer) tablesVO.get("size")).intValue() + "", contextFont)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable2.addCell(cell); cell = new Cell(new Phrase(((Integer) tablesVO.get("used")).intValue() + "", contextFont)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable2.addCell(cell); cell = new Cell(new Phrase((String) tablesVO.get("is_used"), contextFont)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable2.addCell(cell); cell = new Cell(new Phrase((String) tablesVO.get("is_current"), contextFont)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable2.addCell(cell); cell = new Cell(new Phrase((String) tablesVO.get("is_backed_up"), contextFont)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable2.addCell(cell); cell = new Cell(new Phrase((String) tablesVO.get("is_archived"), contextFont)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable2.addCell(cell); cell = new Cell(new Phrase((String) tablesVO.get("is_temp"), contextFont)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable2.addCell(cell); } } // end // -- Table aTable3 = new Table(14); float[] widths1 = { 220f, 220f, 220f, 220f, 220f, 220f, 220f, 220f, 220f, 220f, 220f, 220f, 220f, 220f }; aTable3.setWidths(widths1); aTable3.setWidth(100); // 90% aTable3.setAlignment(Element.ALIGN_CENTER);// aTable3.setAutoFillEmptyCells(true); // aTable3.setBorderWidth(1); // aTable3.setBorderColor(new Color(0, 125, 255)); // aTable3.setPadding(2);// aTable3.setSpacing(0);// aTable3.setBorder(2);// cell = new Cell(new Phrase("INFORMIX", titleFont)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable3.addCell(cell); cell = new Cell(new Phrase("", titleFont)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable3.addCell(cell); cell = new Cell(new Phrase("", titleFont)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable3.addCell(cell); cell = new Cell(new Phrase("", titleFont)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable3.addCell(cell); cell = new Cell(new Phrase("", titleFont)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable3.addCell(cell); cell = new Cell(new Phrase("", titleFont)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable3.addCell(cell); cell = new Cell(new Phrase("", titleFont)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable3.addCell(cell); cell = new Cell(new Phrase("", titleFont)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable3.addCell(cell); cell = new Cell(new Phrase("", titleFont)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable3.addCell(cell); cell = new Cell(new Phrase("", titleFont)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable3.addCell(cell); cell = new Cell(new Phrase("", titleFont)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable3.addCell(cell); cell = new Cell(new Phrase("", titleFont)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable3.addCell(cell); cell = new Cell(new Phrase("", titleFont)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable3.addCell(cell); cell = new Cell(new Phrase("", titleFont)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable3.addCell(cell); int row3 = 0; if (dbsession != null && dbsession.size() > 0) { for (int i = 0; i < dbsession.size(); i++) { Hashtable tablesVO = (Hashtable) dbsession.get(i); aTable3.addCell(""); row = i + 1; String rowStr = "" + row; cell = new Cell(new Phrase(i + 1 + "", contextFont)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable3.addCell(cell); cell = new Cell(new Phrase((String) tablesVO.get("username"), contextFont)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable3.addCell(cell); cell = new Cell(new Phrase((String) tablesVO.get("hostname"), contextFont)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable3.addCell(cell); cell = new Cell(new Phrase((String) tablesVO.get("access"), contextFont)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable3.addCell(cell); cell = new Cell(new Phrase(((Integer) tablesVO.get("lockreqs")).intValue() + "", contextFont)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable3.addCell(cell); cell = new Cell(new Phrase(((Integer) tablesVO.get("locksheld")).intValue() + "", contextFont)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable3.addCell(cell); cell = new Cell(new Phrase(((Integer) tablesVO.get("lockwts")).intValue() + "", contextFont)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable3.addCell(cell); cell = new Cell(new Phrase(((Integer) tablesVO.get("deadlks")).intValue() + "", contextFont)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable3.addCell(cell); cell = new Cell(new Phrase(((Integer) tablesVO.get("lktouts")).intValue() + "", contextFont)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable3.addCell(cell); cell = new Cell(new Phrase(((Integer) tablesVO.get("bufreads")).intValue() + "", contextFont)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable3.addCell(cell); cell = new Cell(new Phrase(((Integer) tablesVO.get("bufwrites")).intValue() + "", contextFont)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable3.addCell(cell); cell = new Cell(new Phrase(((Integer) tablesVO.get("pagreads")).intValue() + "", contextFont)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable3.addCell(cell); cell = new Cell(new Phrase(((Integer) tablesVO.get("pagwrites")).intValue() + "", contextFont)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable3.addCell(cell); } } // int row4 = row3 + row2; int row5 = 0; Table aTable4 = new Table(7); float[] widths2 = { 220f, 220f, 220f, 220f, 220f, 220f, 220f }; aTable4.setWidths(widths2); aTable4.setWidth(100); // 90% aTable4.setAlignment(Element.ALIGN_CENTER);// aTable4.setAutoFillEmptyCells(true); // aTable4.setBorderWidth(1); // aTable4.setBorderColor(new Color(0, 125, 255)); // aTable4.setPadding(2);// aTable4.setSpacing(0);// aTable4.setBorder(2);// // cell = new Cell(new Phrase("INFORMIX", titleFont)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable4.addCell(cell); cell = new Cell(new Phrase("", titleFont)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable4.addCell(cell); cell = new Cell(new Phrase("", titleFont)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable4.addCell(cell); cell = new Cell(new Phrase("", titleFont)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable4.addCell(cell); cell = new Cell(new Phrase("", titleFont)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable4.addCell(cell); cell = new Cell(new Phrase("", titleFont)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable4.addCell(cell); cell = new Cell(new Phrase("", titleFont)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable4.addCell(cell); ArrayList dblock = new ArrayList(); dblock = (ArrayList) dbinfo.get("lockList");// if (dblock != null && dblock.size() > 0) { for (int i = 0; i < dblock.size(); i++) { Hashtable tablesVO = (Hashtable) dblock.get(i); String type = (String) tablesVO.get("type"); String desc = ""; if ("B".equals(type)) { desc = ""; } else if ("IS".equals(type)) { desc = ""; } else if ("S".equals(type)) { desc = ""; } else if ("XS".equals(type)) { desc = ""; } else if ("U".equals(type)) { desc = ""; } else if ("IX".equals(type)) { desc = ""; } else if ("SIX".equals(type)) { desc = ""; } else if ("X".equals(type)) { desc = ""; } else if ("XR".equals(type)) { desc = ""; } aTable4.addCell(""); row = i + 1; String rowStr = "" + row; cell = new Cell(new Phrase(i + 1 + "", contextFont)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable4.addCell(cell); cell = new Cell(new Phrase((String) tablesVO.get("username"), contextFont)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable4.addCell(cell); cell = new Cell(new Phrase((String) tablesVO.get("hostname"), contextFont)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable4.addCell(cell); cell = new Cell(new Phrase((String) tablesVO.get("dbsname"), contextFont)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable4.addCell(cell); cell = new Cell(new Phrase((String) tablesVO.get("tabname"), contextFont)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable4.addCell(cell); cell = new Cell(new Phrase((String) tablesVO.get("desc"), contextFont)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable4.addCell(cell); } } // informix i/o Table aTable5 = new Table(10); float[] widths3 = { 220f, 220f, 220f, 220f, 220f, 220f, 220f, 220f, 220f, 220f }; aTable5.setWidths(widths3); aTable5.setWidth(100); // 90% aTable5.setAlignment(Element.ALIGN_CENTER);// aTable5.setAutoFillEmptyCells(true); // aTable5.setBorderWidth(1); // aTable5.setBorderColor(new Color(0, 125, 255)); // aTable5.setPadding(2);// aTable5.setSpacing(0);// aTable5.setBorder(2);// cell = new Cell(new Phrase("INFORMIXI/O", titleFont)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable5.addCell(cell); cell = new Cell(new Phrase("", titleFont)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable5.addCell(cell); cell = new Cell(new Phrase("", titleFont)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable5.addCell(cell); cell = new Cell(new Phrase("", titleFont)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable5.addCell(cell); cell = new Cell(new Phrase("", titleFont)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable5.addCell(cell); cell = new Cell(new Phrase("", titleFont)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable5.addCell(cell); cell = new Cell(new Phrase("", titleFont)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable5.addCell(cell); cell = new Cell(new Phrase("", titleFont)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable5.addCell(cell); cell = new Cell(new Phrase("", titleFont)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable5.addCell(cell); cell = new Cell(new Phrase("", titleFont)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable5.addCell(cell); ArrayList dbio = new ArrayList(); dbio = (ArrayList) dbinfo.get("iolist");// IO if (dbio != null && dbio.size() > 0) { for (int i = 0; i < dbio.size(); i++) { Hashtable tablesVO = (Hashtable) dbio.get(i); aTable5.addCell(""); row = i + 1; String rowStr = "" + row; cell = new Cell(new Phrase((String) tablesVO.get("chunknum"), contextFont)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable5.addCell(cell); cell = new Cell(new Phrase(((Integer) tablesVO.get("reads")).intValue() + "", contextFont)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable5.addCell(cell); cell = new Cell(new Phrase(((Integer) tablesVO.get("pagesread")).intValue() + "", contextFont)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable5.addCell(cell); cell = new Cell(new Phrase(((Integer) tablesVO.get("writes")).intValue() + "", contextFont)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable5.addCell(cell); cell = new Cell( new Phrase(((Integer) tablesVO.get("pageswritten")).intValue() + "", contextFont)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable5.addCell(cell); cell = new Cell(new Phrase(((Integer) tablesVO.get("mreads")).intValue() + "", contextFont)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable5.addCell(cell); cell = new Cell( new Phrase(((Integer) tablesVO.get("mpagesread")).intValue() + "", contextFont)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable5.addCell(cell); cell = new Cell(new Phrase(((Integer) tablesVO.get("mwrites")).intValue() + "", contextFont)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable5.addCell(cell); cell = new Cell( new Phrase(((Integer) tablesVO.get("mpageswritten")).intValue() + "", contextFont)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable5.addCell(cell); } } if (impReport.getChart() != null) { ByteArrayOutputStream baos = new ByteArrayOutputStream(); try { ChartUtilities.writeChartAsPNG(baos, impReport.getChart().getChart(), impReport.getChart().getWidth(), impReport.getChart().getHeight()); } catch (IOException ioe) { } Image img1 = Image.getInstance(baos.toByteArray()); img1.setAbsolutePosition(0, 0); img1.setAlignment(Image.MIDDLE);// document.add(img1); } document.add(aTable1); document.add(aTable2); document.add(aTable3); document.add(aTable4); document.add(aTable5); document.close(); } catch (Exception e) { // SysLogger.error("Error in ExcelReport.createReport()",e); SysLogger.error("", e); } }
From source file:com.afunms.report.abstraction.ExcelReport1.java
/** * @param filename//from ww w . ja va 2 s . co m * @param type * @throws DocumentException * @throws IOException */ public void createReport_inforNewDoc(String filename, String type) throws DocumentException, IOException { String hostname = (String) reportHash.get("dbname"); String hostnamestr = (String) reportHash.get("dbnamestr"); String ip = (String) reportHash.get("ip"); String typename = (String) reportHash.get("typename"); String Ping = (String) reportHash.get("Ping"); String starttime = (String) reportHash.get("starttime"); String totime = (String) reportHash.get("totime"); Hashtable oramem = (Hashtable) reportHash.get("memvalue"); Hashtable maxping = (Hashtable) reportHash.get("ping"); SybaseVO sysbaseVO = (SybaseVO) reportHash.get("sysbaseVO"); String runstr = (String) reportHash.get("runstr"); String[] sysItem1 = { "shared pool", "large pool", "buffer cache", "java pool" }; String downnum = (String) reportHash.get("downnum"); Hashtable dbinfo = new Hashtable(); dbinfo = (Hashtable) reportHash.get("dbValue"); ArrayList dbspaces = new ArrayList(); dbspaces = (ArrayList) dbinfo.get("informixspaces");// DBTypeDao typedao = new DBTypeDao(); DBTypeVo typevo = typedao.findByDbtype("informix"); SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); Document document = null; // (Writer)document(Writer) if ("pdf".equals(type)) { document = new Document(PageSize.B3); PdfWriter.getInstance(document, new FileOutputStream(filename)); } else { document = new Document(PageSize.A4); RtfWriter2.getInstance(document, new FileOutputStream(filename)); } document.open(); // BaseFont bfChinese = BaseFont.createFont("STSong-Light", "UniGB-UCS2-H", BaseFont.NOT_EMBEDDED); // Font titleFont = new Font(bfChinese, 12, Font.BOLD); // Font contextFont1 = new Font(bfChinese, 12, Font.NORMAL); Font fontChinese = new Font(bfChinese, 12, Font.NORMAL, Color.black); Table aTable = new Table(8); // float[] widths = { 220f, 220f, 220f, 110f, 110f, 110f, 110f, 220f }; // aTable.setWidths(widths); // aTable.setWidth(100); // 90% // aTable.setAlignment(Element.ALIGN_CENTER);// // aTable.setAutoFillEmptyCells(true); // // aTable.setBorderWidth(1); // // aTable.setBorderColor(new Color(0, 125, 255)); // // aTable.setPadding(2);// // aTable.setSpacing(0);// // aTable.setBorder(2);// this.setTableFormat(aTable); Cell cell = null; cell = new Cell(new Phrase("\n" + "" + hostname + "" + "\n", titleFont)); cell.setColspan(8); this.setCellFormat(cell, true); aTable.addCell(cell); cell = new Cell(new Phrase("\n" + "" + "\n", titleFont)); this.setCellFormat(cell, true); aTable.addCell(cell); cell = new Cell(new Phrase("\n" + "" + starttime + "" + totime + "\n", contextFont1)); cell.setColspan(7); aTable.addCell(cell); cell = new Cell(new Phrase("\n" + "" + "\n", titleFont)); this.setCellFormat(cell, true); aTable.addCell(cell); cell = new Cell(new Phrase(hostnamestr, contextFont1)); this.setCellFormat(cell, false); aTable.addCell(cell); cell = new Cell(new Phrase("IP", titleFont)); this.setCellFormat(cell, true); aTable.addCell(cell); cell = new Cell(new Phrase(ip, contextFont1)); cell.setColspan(2); this.setCellFormat(cell, false); aTable.addCell(cell); cell = new Cell(new Phrase("", titleFont)); cell.setColspan(2); this.setCellFormat(cell, true); aTable.addCell(cell); cell = new Cell(new Phrase(typename, contextFont1)); this.setCellFormat(cell, false); aTable.addCell(cell); cell = new Cell(new Phrase("", titleFont)); this.setCellFormat(cell, true); aTable.addCell(cell); cell = new Cell(new Phrase(runstr, contextFont1)); cell.setColspan(2); this.setCellFormat(cell, false); aTable.addCell(cell); cell = new Cell(new Phrase("", titleFont)); cell.setColspan(2); this.setCellFormat(cell, true); aTable.addCell(cell); String grade = (String) reportHash.get("grade"); cell = new Cell(new Phrase(grade, contextFont1)); cell.setColspan(3); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable.addCell(cell); cell = new Cell(new Phrase("" + "\n" + "" + "\n" + "" + "\n" + "", titleFont)); cell.setRowspan(5); this.setCellFormat(cell, true); aTable.addCell(cell); cell = new Cell(new Phrase("", titleFont)); cell.setRowspan(4); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable.addCell(cell); cell = new Cell(new Phrase("(MB)", titleFont)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable.addCell(cell); cell = new Cell(new Phrase("", contextFont1)); cell.setColspan(2); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable.addCell(cell); cell = new Cell(new Phrase("(MB)", titleFont)); cell.setColspan(2); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable.addCell(cell); cell = new Cell(new Phrase("", contextFont1)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable.addCell(cell); cell = new Cell(new Phrase("Metadata(MB)", titleFont)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable.addCell(cell); cell = new Cell(new Phrase("", contextFont1)); cell.setColspan(2); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable.addCell(cell); cell = new Cell(new Phrase("(MB)", titleFont)); cell.setColspan(2); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable.addCell(cell); cell = new Cell(new Phrase("", contextFont1)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable.addCell(cell); cell = new Cell(new Phrase("(MB)", titleFont)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable.addCell(cell); cell = new Cell(new Phrase("", contextFont1)); cell.setColspan(2); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable.addCell(cell); cell = new Cell(new Phrase("(%)", titleFont)); cell.setColspan(2); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable.addCell(cell); cell = new Cell(new Phrase("", contextFont1)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable.addCell(cell); cell = new Cell(new Phrase("(%)", titleFont)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable.addCell(cell); cell = new Cell(new Phrase("", contextFont1)); cell.setColspan(2); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable.addCell(cell); cell = new Cell(new Phrase("", contextFont1)); cell.setColspan(2); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable.addCell(cell); cell = new Cell(new Phrase("", contextFont1)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable.addCell(cell); cell = new Cell(new Phrase("", titleFont)); cell.setRowspan(1); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable.addCell(cell); cell = new Cell(new Phrase("", titleFont)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable.addCell(cell); cell = new Cell(new Phrase("", contextFont1)); cell.setColspan(2); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable.addCell(cell); cell = new Cell(new Phrase("", titleFont)); cell.setColspan(2); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable.addCell(cell); cell = new Cell(new Phrase("", contextFont1)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable.addCell(cell); // InformixspaceconfigDao informixspaceconfigDao = new InformixspaceconfigDao(); List list = null; try { list = informixspaceconfigDao.getByIp(ip, 1); } catch (Exception e) { SysLogger.error("", e); } finally { informixspaceconfigDao.close(); } Cell cell5 = new Cell(new Phrase("" + "\n" + "" + "\n" + "" + "\n" + "", titleFont)); this.setCellFormat(cell5, true); cell5.setRowspan(15 + list.size()); aTable.addCell(cell5); cell = new Cell(new Phrase("", titleFont)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable.addCell(cell); cell = new Cell(new Phrase("", titleFont)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable.addCell(cell); cell = new Cell(new Phrase((String) maxping.get("avgpingcon"), contextFont1)); cell.setColspan(2); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable.addCell(cell); cell = new Cell(new Phrase("", titleFont)); cell.setColspan(2); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable.addCell(cell); cell = new Cell(new Phrase((String) maxping.get("pingmax"), contextFont1)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable.addCell(cell); // io ArrayList dbabout = new ArrayList(); dbabout = (ArrayList) dbinfo.get("aboutlist");// Hashtable hashtable = new Hashtable(); if (dbabout != null && dbabout.size() > 0) { for (int i = 0; i < dbabout.size(); i++) { Hashtable tablesVO = (Hashtable) dbabout.get(i); String name = ((String) tablesVO.get("name")).trim(); String desc = ""; if ("dskreads".equals(name)) { desc = ""; hashtable.put("dskreads", tablesVO.get("value")); } else if ("bufreads".equals(name)) { desc = ""; hashtable.put("bufreads", tablesVO.get("value")); } else if ("dskwrites".equals(name)) { desc = ""; hashtable.put("dskwrites", tablesVO.get("value")); } else if ("bufwrites".equals(name)) { desc = ""; hashtable.put("bufwrites", tablesVO.get("value")); } else if ("isamtot".equals(name)) { desc = ""; hashtable.put("isamtot", tablesVO.get("value")); } else if ("isopens".equals(name)) { desc = "isopen"; hashtable.put("isopens", tablesVO.get("value")); } else if ("isstarts".equals(name)) { desc = "isstart"; hashtable.put("isstarts", tablesVO.get("value")); } else if ("isreads".equals(name)) { desc = "isread"; hashtable.put("isreads", tablesVO.get("value")); } else if ("iswrites".equals(name)) { desc = "iswirte"; hashtable.put("iswrites", tablesVO.get("value")); } else if ("isrewrites".equals(name)) { desc = "isrewrite"; hashtable.put("isrewrites", tablesVO.get("value")); } else if ("isdeletes".equals(name)) { desc = "isdelete"; hashtable.put("isdeletes", tablesVO.get("value")); } else if ("iscommits".equals(name)) { desc = "iscommit"; hashtable.put("iscommits", tablesVO.get("value")); } else if ("isrollbacks".equals(name)) { desc = "isrollback"; hashtable.put("isrollbacks", tablesVO.get("value")); } else if ("ovlock".equals(name)) { desc = ""; hashtable.put("ovlock", tablesVO.get("value")); } else if ("ovuser".equals(name)) { desc = ""; hashtable.put("ovuser", tablesVO.get("value")); } else if ("ovtrans".equals(name)) { desc = ""; hashtable.put("ovtrans", tablesVO.get("value")); } else if ("latchwts".equals(name)) { desc = ""; hashtable.put("latchwts", tablesVO.get("value")); } else if ("buffwts".equals(name)) { desc = ""; hashtable.put("buffwts", tablesVO.get("value")); } else if ("lockreqs".equals(name)) { desc = ""; hashtable.put("lockreqs", tablesVO.get("value")); } else if ("lockwts".equals(name)) { desc = ""; hashtable.put("lockwts", tablesVO.get("value")); } else if ("ckptwts".equals(name)) { desc = ""; hashtable.put("ckptwts", tablesVO.get("value")); } else if ("deadlks".equals(name)) { desc = ""; hashtable.put("deadlks", tablesVO.get("value")); } else if ("lktouts".equals(name)) { desc = ""; hashtable.put("lktouts", tablesVO.get("value")); } else if ("numckpts".equals(name)) { desc = ""; hashtable.put("numckpts", tablesVO.get("value")); } else if ("plgpagewrites".equals(name)) { desc = ""; hashtable.put("plgpagewrites", tablesVO.get("value")); } else if ("plgwrites".equals(name)) { desc = ""; hashtable.put("plgwrites", tablesVO.get("value")); } else if ("llgrecs".equals(name)) { desc = ""; hashtable.put("llgrecs", tablesVO.get("value")); } else if ("llgpagewrites".equals(name)) { desc = ""; hashtable.put("llgpagewrites", tablesVO.get("value")); } else if ("llgwrites".equals(name)) { desc = ""; hashtable.put("llgwrites", tablesVO.get("value")); } else if ("pagreads".equals(name)) { desc = ""; hashtable.put("pagreads", tablesVO.get("value")); } else if ("pagwrites".equals(name)) { desc = ""; hashtable.put("pagwrites", tablesVO.get("value")); } else if ("flushes".equals(name)) { desc = ""; hashtable.put("flushes", tablesVO.get("value")); } else if ("compress".equals(name)) { desc = ""; hashtable.put("compress", tablesVO.get("value")); } else if ("fgwrites".equals(name)) { desc = ""; hashtable.put("fgwrites", tablesVO.get("value")); } else if ("lruwrites".equals(name)) { desc = "LRU"; hashtable.put("lruwrites", tablesVO.get("value")); } else if ("chunkwrites".equals(name)) { desc = ""; hashtable.put("chunkwrites", tablesVO.get("value")); } else if ("btradata".equals(name)) { desc = ""; hashtable.put("btradata", tablesVO.get("value")); } else if ("btraidx".equals(name)) { desc = ""; hashtable.put("btraidx", tablesVO.get("value")); } else if ("dpra".equals(name)) { desc = ""; hashtable.put("dpra", tablesVO.get("value")); } else if ("rapgs_used".equals(name)) { desc = ""; hashtable.put("rapgs_used", tablesVO.get("value")); } else if ("seqscans".equals(name)) { desc = ""; hashtable.put("seqscans", tablesVO.get("value")); } else if ("totalsorts".equals(name)) { desc = ""; hashtable.put("totalsorts", tablesVO.get("value")); } else if ("memsorts".equals(name)) { desc = ""; hashtable.put("memsorts", tablesVO.get("value")); } else if ("disksorts".equals(name)) { desc = ""; hashtable.put("disksorts", tablesVO.get("value")); } else if ("maxsortspace".equals(name)) { desc = ""; hashtable.put("maxsortspace", tablesVO.get("value")); } } } cell = new Cell(new Phrase("IO", titleFont)); cell.setRowspan(4); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable.addCell(cell); cell = new Cell(new Phrase("", titleFont)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable.addCell(cell); cell = new Cell(new Phrase((String) hashtable.get("dskreads"), contextFont1)); cell.setColspan(2); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable.addCell(cell); cell = new Cell(new Phrase("", titleFont)); cell.setColspan(2); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable.addCell(cell); cell = new Cell(new Phrase((String) hashtable.get("bufreads"), contextFont1)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable.addCell(cell); cell = new Cell(new Phrase("", titleFont)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable.addCell(cell); cell = new Cell(new Phrase((String) hashtable.get("dskwrites"), contextFont1)); cell.setColspan(2); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable.addCell(cell); cell = new Cell(new Phrase("", titleFont)); cell.setColspan(2); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable.addCell(cell); cell = new Cell(new Phrase((String) hashtable.get("bufwrites"), contextFont1)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable.addCell(cell); cell = new Cell(new Phrase("(/)", titleFont)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable.addCell(cell); cell = new Cell(new Phrase("", contextFont1)); cell.setColspan(2); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable.addCell(cell); cell = new Cell(new Phrase("(/)", titleFont)); cell.setColspan(2); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable.addCell(cell); cell = new Cell(new Phrase("", contextFont1)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable.addCell(cell); cell = new Cell(new Phrase("(/)", titleFont)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable.addCell(cell); cell = new Cell(new Phrase("", contextFont1)); cell.setColspan(2); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable.addCell(cell); cell = new Cell(new Phrase("(/)", titleFont)); cell.setColspan(2); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable.addCell(cell); cell = new Cell(new Phrase("", contextFont1)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable.addCell(cell); cell = new Cell(new Phrase("", titleFont)); cell.setRowspan(5); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable.addCell(cell); cell = new Cell(new Phrase("", titleFont)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable.addCell(cell); cell = new Cell(new Phrase((String) hashtable.get("isamtot"), contextFont1)); cell.setColspan(5); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable.addCell(cell); cell = new Cell(new Phrase("isopen", titleFont)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable.addCell(cell); cell = new Cell(new Phrase((String) hashtable.get("isopens"), contextFont1)); cell.setColspan(2); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable.addCell(cell); cell = new Cell(new Phrase("isstart", titleFont)); cell.setColspan(2); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable.addCell(cell); cell = new Cell(new Phrase((String) hashtable.get("isstarts"), contextFont1)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable.addCell(cell); cell = new Cell(new Phrase("isread", titleFont)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable.addCell(cell); cell = new Cell(new Phrase((String) hashtable.get("isreads"), contextFont1)); cell.setColspan(2); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable.addCell(cell); cell = new Cell(new Phrase("iswirte", titleFont)); cell.setColspan(2); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable.addCell(cell); cell = new Cell(new Phrase((String) hashtable.get("iswrites"), contextFont1)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable.addCell(cell); cell = new Cell(new Phrase("isrewrite", titleFont)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable.addCell(cell); cell = new Cell(new Phrase((String) hashtable.get("isrewrites"), contextFont1)); cell.setColspan(2); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable.addCell(cell); cell = new Cell(new Phrase("isdelete", titleFont)); cell.setColspan(2); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable.addCell(cell); cell = new Cell(new Phrase((String) hashtable.get("isdeletes"), contextFont1)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable.addCell(cell); cell = new Cell(new Phrase("iscommit", titleFont)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable.addCell(cell); cell = new Cell(new Phrase((String) hashtable.get("iscommits"), contextFont1)); cell.setColspan(2); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable.addCell(cell); cell = new Cell(new Phrase("isrollback", titleFont)); cell.setColspan(2); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable.addCell(cell); cell = new Cell(new Phrase((String) hashtable.get("isrollbacks"), contextFont1)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable.addCell(cell); cell = new Cell(new Phrase("", titleFont)); cell.setRowspan(4); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable.addCell(cell); cell = new Cell(new Phrase("", titleFont)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable.addCell(cell); cell = new Cell(new Phrase((String) hashtable.get("latchwts"), contextFont1)); cell.setColspan(2); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable.addCell(cell); cell = new Cell(new Phrase("", titleFont)); cell.setColspan(2); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable.addCell(cell); cell = new Cell(new Phrase((String) hashtable.get("buffwts"), contextFont1)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable.addCell(cell); cell = new Cell(new Phrase("", titleFont)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable.addCell(cell); cell = new Cell(new Phrase((String) hashtable.get("lockreqs"), contextFont1)); cell.setColspan(2); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable.addCell(cell); cell = new Cell(new Phrase("", titleFont)); cell.setColspan(2); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable.addCell(cell); cell = new Cell(new Phrase((String) hashtable.get("lockwts"), contextFont1)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable.addCell(cell); cell = new Cell(new Phrase("", titleFont)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable.addCell(cell); cell = new Cell(new Phrase((String) hashtable.get("ckptwts"), contextFont1)); cell.setColspan(2); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable.addCell(cell); cell = new Cell(new Phrase("", titleFont)); cell.setColspan(2); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable.addCell(cell); cell = new Cell(new Phrase((String) hashtable.get("deadlks"), contextFont1)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable.addCell(cell); cell = new Cell(new Phrase("", titleFont)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable.addCell(cell); cell = new Cell(new Phrase((String) hashtable.get("lktouts"), contextFont1)); cell.setColspan(2); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable.addCell(cell); cell = new Cell(new Phrase("", titleFont)); cell.setColspan(2); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable.addCell(cell); cell = new Cell(new Phrase((String) hashtable.get("numckpts"), contextFont1)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable.addCell(cell); cell = new Cell(new Phrase("", titleFont)); cell.setRowspan(list.size() + 1); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable.addCell(cell); cell = new Cell(new Phrase("", titleFont)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable.addCell(cell); cell = new Cell(new Phrase("MB", titleFont)); cell.setColspan(2); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable.addCell(cell); cell = new Cell(new Phrase("MB", titleFont)); cell.setColspan(2); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable.addCell(cell); cell = new Cell(new Phrase("%", titleFont)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable.addCell(cell); // get dbspace message================== int row = 0; DecimalFormat df = new DecimalFormat("#.###"); if (dbspaces != null && dbspaces.size() > 0) { for (int i = 0; i < dbspaces.size(); i++) { Hashtable tablesVO = (Hashtable) dbspaces.get(i); double all = 100.00; double show = all - Double.parseDouble(tablesVO.get("percent_free").toString()); String str = df.format(show) + ""; String spacenameString = (String) tablesVO.get("dbspace"); for (int j = 0; j < list.size(); j++) { Informixspaceconfig vo = (Informixspaceconfig) list.get(j); DBDao dbdao = new DBDao(); // dbdao = new DBDao(); List shareList = null; try { shareList = dbdao.getDbByTypeAndIpaddress(typevo.getId(), vo.getIpaddress()); } catch (Exception e) { } finally { dbdao.close(); } if (shareList == null || shareList.size() == 0) continue; DBVo dbvo = (DBVo) shareList.get(0); if (spacenameString.equals(vo.getSpacename())) { cell = new Cell(new Phrase(spacenameString, contextFont1)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable.addCell(cell); cell = new Cell(new Phrase((String) tablesVO.get("pages_size"), contextFont1)); cell.setColspan(2); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable.addCell(cell); cell = new Cell(new Phrase(df.format(Float.parseFloat(tablesVO.get("pages_used") + "")), contextFont1)); cell.setColspan(2); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable.addCell(cell); cell = new Cell(new Phrase(str, contextFont1)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable.addCell(cell); } } } } String count = (String) reportHash.get("count"); cell = new Cell(new Phrase("" + "\n" + "" + "\n" + "" + "\n" + "", titleFont)); cell.setRowspan(2); this.setCellFormat(cell, true); aTable.addCell(cell); cell = new Cell(new Phrase("\n" + "" + downnum + "" + "\n", contextFont1)); cell.setColspan(7); aTable.addCell(cell); cell = new Cell(new Phrase("\n" + "" + count + "" + "\n", contextFont1)); cell.setColspan(7); aTable.addCell(cell); cell = new Cell(new Phrase("\n" + "" + "\n", titleFont)); cell.setColspan(8); this.setCellFormat(cell, true); aTable.addCell(cell); String pinglog = ""; if ("0".equals(downnum)) { pinglog = " " + "2 "; } else { pinglog = " " + "2 " + downnum + ""; } String spacelog = ""; if ("0".equals(count)) { spacelog = " " + "3 " + count + "" + " "; } else { spacelog = " " + "3 "; } cell = new Cell(new Phrase(" 1 " + "\n" + "\n" + pinglog + "\n" + "\n" + spacelog + "\n" + "\n" + "\n" + "\n" + "\n" + "\n", contextFont1)); cell.setColspan(8); aTable.addCell(cell); document.add(aTable); document.close(); }
From source file:com.afunms.report.abstraction.ExcelReport1.java
public void createReport_inforNewPDF(String filename) throws DocumentException, IOException { String hostname = (String) reportHash.get("dbname"); String hostnamestr = (String) reportHash.get("dbnamestr"); String ip = (String) reportHash.get("ip"); String typename = (String) reportHash.get("typename"); String Ping = (String) reportHash.get("Ping"); String starttime = (String) reportHash.get("starttime"); String totime = (String) reportHash.get("totime"); Hashtable oramem = (Hashtable) reportHash.get("memvalue"); Hashtable maxping = (Hashtable) reportHash.get("ping"); SybaseVO sysbaseVO = (SybaseVO) reportHash.get("sysbaseVO"); String runstr = (String) reportHash.get("runstr"); String[] sysItem1 = { "shared pool", "large pool", "buffer cache", "java pool" }; String downnum = (String) reportHash.get("downnum"); Hashtable dbinfo = new Hashtable(); dbinfo = (Hashtable) reportHash.get("dbValue"); ArrayList dbspaces = new ArrayList(); dbspaces = (ArrayList) dbinfo.get("informixspaces");// DBTypeDao typedao = new DBTypeDao(); DBTypeVo typevo = typedao.findByDbtype("informix"); SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); Document document = new Document(PageSize.A4); // (Writer)document(Writer) PdfWriter.getInstance(document, new FileOutputStream(filename)); document.open();/*from w w w . j ava 2 s. c o m*/ // BaseFont bfChinese = BaseFont.createFont("STSong-Light", "UniGB-UCS2-H", BaseFont.NOT_EMBEDDED); // Font titleFont = new Font(bfChinese, 12, Font.BOLD); // Font contextFont1 = new Font(bfChinese, 12, Font.NORMAL); Font contextFont2 = new Font(bfChinese, 11, Font.NORMAL); Font fontChinese = new Font(bfChinese, 12, Font.NORMAL, Color.black); Table aTable = new Table(8); float[] widths = { 220f, 220f, 220f, 110f, 110f, 110f, 110f, 220f }; aTable.setWidths(widths); aTable.setWidth(100); // 90% aTable.setAlignment(Element.ALIGN_CENTER);// aTable.setAutoFillEmptyCells(true); // aTable.setBorderWidth(1); // aTable.setBorderColor(new Color(0, 125, 255)); // aTable.setPadding(2);// aTable.setSpacing(0);// aTable.setBorder(2);// Cell cell = null; cell = new Cell(new Phrase("\n" + "" + hostname + "" + "\n", titleFont)); cell.setColspan(8); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable.addCell(cell); cell = new Cell(new Phrase("\n" + "" + "\n", titleFont)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable.addCell(cell); cell = new Cell(new Phrase("\n" + "" + starttime + "" + totime + "\n", contextFont2)); cell.setColspan(7); aTable.addCell(cell); cell = new Cell(new Phrase("\n" + "" + "\n", titleFont)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable.addCell(cell); cell = new Cell(new Phrase(hostnamestr)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable.addCell(cell); cell = new Cell(new Phrase("IP", titleFont)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable.addCell(cell); cell = new Cell(new Phrase(ip)); cell.setColspan(2); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable.addCell(cell); cell = new Cell(new Phrase("", titleFont)); cell.setColspan(2); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable.addCell(cell); cell = new Cell(new Phrase(typename)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable.addCell(cell); cell = new Cell(new Phrase("", titleFont)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable.addCell(cell); cell = new Cell(new Phrase(runstr, contextFont1)); cell.setColspan(2); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable.addCell(cell); cell = new Cell(new Phrase("", titleFont)); cell.setColspan(2); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable.addCell(cell); String grade = (String) reportHash.get("grade"); cell = new Cell(new Phrase(grade, contextFont1)); cell.setColspan(3); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable.addCell(cell); cell = new Cell(new Phrase("" + "\n" + "" + "\n" + "" + "\n" + "", titleFont)); cell.setRowspan(5); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable.addCell(cell); cell = new Cell(new Phrase("", titleFont)); cell.setRowspan(4); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable.addCell(cell); cell = new Cell(new Phrase("(MB)", titleFont)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable.addCell(cell); cell = new Cell(new Phrase("", contextFont1)); cell.setColspan(2); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable.addCell(cell); cell = new Cell(new Phrase("(MB)", titleFont)); cell.setColspan(2); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable.addCell(cell); cell = new Cell(new Phrase("", contextFont1)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable.addCell(cell); cell = new Cell(new Phrase("Metadata(MB)", titleFont)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable.addCell(cell); cell = new Cell(new Phrase("", contextFont1)); cell.setColspan(2); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable.addCell(cell); cell = new Cell(new Phrase("(MB)", titleFont)); cell.setColspan(2); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable.addCell(cell); cell = new Cell(new Phrase("", contextFont1)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable.addCell(cell); cell = new Cell(new Phrase("(MB)", titleFont)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable.addCell(cell); cell = new Cell(new Phrase("", contextFont1)); cell.setColspan(2); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable.addCell(cell); cell = new Cell(new Phrase("(%)", titleFont)); cell.setColspan(2); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable.addCell(cell); cell = new Cell(new Phrase("", contextFont1)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable.addCell(cell); cell = new Cell(new Phrase("(%)", titleFont)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable.addCell(cell); cell = new Cell(new Phrase("", contextFont1)); cell.setColspan(2); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable.addCell(cell); cell = new Cell(new Phrase("", contextFont1)); cell.setColspan(2); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable.addCell(cell); cell = new Cell(new Phrase("", contextFont1)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable.addCell(cell); cell = new Cell(new Phrase("", titleFont)); cell.setRowspan(1); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable.addCell(cell); cell = new Cell(new Phrase("", titleFont)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable.addCell(cell); cell = new Cell(new Phrase("", contextFont1)); cell.setColspan(2); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable.addCell(cell); cell = new Cell(new Phrase("", titleFont)); cell.setColspan(2); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable.addCell(cell); cell = new Cell(new Phrase("", contextFont1)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable.addCell(cell); // InformixspaceconfigDao informixspaceconfigDao = new InformixspaceconfigDao(); List list = null; try { list = informixspaceconfigDao.getByIp(ip, 1); } catch (Exception e) { SysLogger.error("", e); } finally { informixspaceconfigDao.close(); } Cell cell5 = new Cell(new Phrase("" + "\n" + "" + "\n" + "" + "\n" + "", titleFont)); cell5.setRowspan(15 + list.size()); cell5.setHorizontalAlignment(Element.ALIGN_CENTER); // cell5.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable.addCell(cell5); cell = new Cell(new Phrase("", titleFont)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable.addCell(cell); cell = new Cell(new Phrase("", titleFont)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable.addCell(cell); cell = new Cell(new Phrase((String) maxping.get("avgpingcon"))); cell.setColspan(2); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable.addCell(cell); cell = new Cell(new Phrase("", titleFont)); cell.setColspan(2); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable.addCell(cell); cell = new Cell(new Phrase((String) maxping.get("pingmax"))); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable.addCell(cell); // io ArrayList dbabout = new ArrayList(); dbabout = (ArrayList) dbinfo.get("aboutlist");// Hashtable hashtable = new Hashtable(); if (dbabout != null && dbabout.size() > 0) { for (int i = 0; i < dbabout.size(); i++) { Hashtable tablesVO = (Hashtable) dbabout.get(i); String name = ((String) tablesVO.get("name")).trim(); String desc = ""; if ("dskreads".equals(name)) { desc = ""; hashtable.put("dskreads", tablesVO.get("value")); } else if ("bufreads".equals(name)) { desc = ""; hashtable.put("bufreads", tablesVO.get("value")); } else if ("dskwrites".equals(name)) { desc = ""; hashtable.put("dskwrites", tablesVO.get("value")); } else if ("bufwrites".equals(name)) { desc = ""; hashtable.put("bufwrites", tablesVO.get("value")); } else if ("isamtot".equals(name)) { desc = ""; hashtable.put("isamtot", tablesVO.get("value")); } else if ("isopens".equals(name)) { desc = "isopen"; hashtable.put("isopens", tablesVO.get("value")); } else if ("isstarts".equals(name)) { desc = "isstart"; hashtable.put("isstarts", tablesVO.get("value")); } else if ("isreads".equals(name)) { desc = "isread"; hashtable.put("isreads", tablesVO.get("value")); } else if ("iswrites".equals(name)) { desc = "iswirte"; hashtable.put("iswrites", tablesVO.get("value")); } else if ("isrewrites".equals(name)) { desc = "isrewrite"; hashtable.put("isrewrites", tablesVO.get("value")); } else if ("isdeletes".equals(name)) { desc = "isdelete"; hashtable.put("isdeletes", tablesVO.get("value")); } else if ("iscommits".equals(name)) { desc = "iscommit"; hashtable.put("iscommits", tablesVO.get("value")); } else if ("isrollbacks".equals(name)) { desc = "isrollback"; hashtable.put("isrollbacks", tablesVO.get("value")); } else if ("ovlock".equals(name)) { desc = ""; hashtable.put("ovlock", tablesVO.get("value")); } else if ("ovuser".equals(name)) { desc = ""; hashtable.put("ovuser", tablesVO.get("value")); } else if ("ovtrans".equals(name)) { desc = ""; hashtable.put("ovtrans", tablesVO.get("value")); } else if ("latchwts".equals(name)) { desc = ""; hashtable.put("latchwts", tablesVO.get("value")); } else if ("buffwts".equals(name)) { desc = ""; hashtable.put("buffwts", tablesVO.get("value")); } else if ("lockreqs".equals(name)) { desc = ""; hashtable.put("lockreqs", tablesVO.get("value")); } else if ("lockwts".equals(name)) { desc = ""; hashtable.put("lockwts", tablesVO.get("value")); } else if ("ckptwts".equals(name)) { desc = ""; hashtable.put("ckptwts", tablesVO.get("value")); } else if ("deadlks".equals(name)) { desc = ""; hashtable.put("deadlks", tablesVO.get("value")); } else if ("lktouts".equals(name)) { desc = ""; hashtable.put("lktouts", tablesVO.get("value")); } else if ("numckpts".equals(name)) { desc = ""; hashtable.put("numckpts", tablesVO.get("value")); } else if ("plgpagewrites".equals(name)) { desc = ""; hashtable.put("plgpagewrites", tablesVO.get("value")); } else if ("plgwrites".equals(name)) { desc = ""; hashtable.put("plgwrites", tablesVO.get("value")); } else if ("llgrecs".equals(name)) { desc = ""; hashtable.put("llgrecs", tablesVO.get("value")); } else if ("llgpagewrites".equals(name)) { desc = ""; hashtable.put("llgpagewrites", tablesVO.get("value")); } else if ("llgwrites".equals(name)) { desc = ""; hashtable.put("llgwrites", tablesVO.get("value")); } else if ("pagreads".equals(name)) { desc = ""; hashtable.put("pagreads", tablesVO.get("value")); } else if ("pagwrites".equals(name)) { desc = ""; hashtable.put("pagwrites", tablesVO.get("value")); } else if ("flushes".equals(name)) { desc = ""; hashtable.put("flushes", tablesVO.get("value")); } else if ("compress".equals(name)) { desc = ""; hashtable.put("compress", tablesVO.get("value")); } else if ("fgwrites".equals(name)) { desc = ""; hashtable.put("fgwrites", tablesVO.get("value")); } else if ("lruwrites".equals(name)) { desc = "LRU"; hashtable.put("lruwrites", tablesVO.get("value")); } else if ("chunkwrites".equals(name)) { desc = ""; hashtable.put("chunkwrites", tablesVO.get("value")); } else if ("btradata".equals(name)) { desc = ""; hashtable.put("btradata", tablesVO.get("value")); } else if ("btraidx".equals(name)) { desc = ""; hashtable.put("btraidx", tablesVO.get("value")); } else if ("dpra".equals(name)) { desc = ""; hashtable.put("dpra", tablesVO.get("value")); } else if ("rapgs_used".equals(name)) { desc = ""; hashtable.put("rapgs_used", tablesVO.get("value")); } else if ("seqscans".equals(name)) { desc = ""; hashtable.put("seqscans", tablesVO.get("value")); } else if ("totalsorts".equals(name)) { desc = ""; hashtable.put("totalsorts", tablesVO.get("value")); } else if ("memsorts".equals(name)) { desc = ""; hashtable.put("memsorts", tablesVO.get("value")); } else if ("disksorts".equals(name)) { desc = ""; hashtable.put("disksorts", tablesVO.get("value")); } else if ("maxsortspace".equals(name)) { desc = ""; hashtable.put("maxsortspace", tablesVO.get("value")); } } } cell = new Cell(new Phrase("IO", titleFont)); cell.setRowspan(4); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable.addCell(cell); cell = new Cell(new Phrase("", titleFont)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable.addCell(cell); cell = new Cell(new Phrase((String) hashtable.get("dskreads"))); cell.setColspan(2); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable.addCell(cell); cell = new Cell(new Phrase("", titleFont)); cell.setColspan(2); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable.addCell(cell); cell = new Cell(new Phrase((String) hashtable.get("bufreads"))); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable.addCell(cell); cell = new Cell(new Phrase("", titleFont)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable.addCell(cell); cell = new Cell(new Phrase((String) hashtable.get("dskwrites"))); cell.setColspan(2); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable.addCell(cell); cell = new Cell(new Phrase("", titleFont)); cell.setColspan(2); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable.addCell(cell); cell = new Cell(new Phrase((String) hashtable.get("bufwrites"))); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable.addCell(cell); cell = new Cell(new Phrase("(/)", titleFont)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable.addCell(cell); cell = new Cell(new Phrase("", contextFont1)); cell.setColspan(2); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable.addCell(cell); cell = new Cell(new Phrase("(/)", titleFont)); cell.setColspan(2); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable.addCell(cell); cell = new Cell(new Phrase("", contextFont1)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable.addCell(cell); cell = new Cell(new Phrase("(/)", titleFont)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable.addCell(cell); cell = new Cell(new Phrase("", contextFont1)); cell.setColspan(2); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable.addCell(cell); cell = new Cell(new Phrase("(/)", titleFont)); cell.setColspan(2); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable.addCell(cell); cell = new Cell(new Phrase("", contextFont1)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable.addCell(cell); cell = new Cell(new Phrase("", titleFont)); cell.setRowspan(5); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable.addCell(cell); cell = new Cell(new Phrase("", titleFont)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable.addCell(cell); cell = new Cell(new Phrase((String) hashtable.get("isamtot"), contextFont1)); cell.setColspan(5); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable.addCell(cell); cell = new Cell(new Phrase("isopen")); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable.addCell(cell); cell = new Cell(new Phrase((String) hashtable.get("isopens"))); cell.setColspan(2); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable.addCell(cell); cell = new Cell(new Phrase("isstart")); cell.setColspan(2); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable.addCell(cell); cell = new Cell(new Phrase((String) hashtable.get("isstarts"))); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable.addCell(cell); cell = new Cell(new Phrase("isread")); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable.addCell(cell); cell = new Cell(new Phrase((String) hashtable.get("isreads"))); cell.setColspan(2); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable.addCell(cell); cell = new Cell(new Phrase("iswirte")); cell.setColspan(2); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable.addCell(cell); cell = new Cell(new Phrase((String) hashtable.get("iswrites"))); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable.addCell(cell); cell = new Cell(new Phrase("isrewrite")); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable.addCell(cell); cell = new Cell(new Phrase((String) hashtable.get("isrewrites"))); cell.setColspan(2); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable.addCell(cell); cell = new Cell(new Phrase("isdelete")); cell.setColspan(2); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable.addCell(cell); cell = new Cell(new Phrase((String) hashtable.get("isdeletes"))); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable.addCell(cell); cell = new Cell(new Phrase("iscommit")); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable.addCell(cell); cell = new Cell(new Phrase((String) hashtable.get("iscommits"))); cell.setColspan(2); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable.addCell(cell); cell = new Cell(new Phrase("isrollback")); cell.setColspan(2); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable.addCell(cell); cell = new Cell(new Phrase((String) hashtable.get("isrollbacks"))); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable.addCell(cell); cell = new Cell(new Phrase("", titleFont)); cell.setRowspan(4); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable.addCell(cell); cell = new Cell(new Phrase("", titleFont)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable.addCell(cell); cell = new Cell(new Phrase((String) hashtable.get("latchwts"))); cell.setColspan(2); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable.addCell(cell); cell = new Cell(new Phrase("", titleFont)); cell.setColspan(2); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable.addCell(cell); cell = new Cell(new Phrase((String) hashtable.get("buffwts"))); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable.addCell(cell); cell = new Cell(new Phrase("", titleFont)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable.addCell(cell); cell = new Cell(new Phrase((String) hashtable.get("lockreqs"))); cell.setColspan(2); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable.addCell(cell); cell = new Cell(new Phrase("", titleFont)); cell.setColspan(2); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable.addCell(cell); cell = new Cell(new Phrase((String) hashtable.get("lockwts"))); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable.addCell(cell); cell = new Cell(new Phrase("", titleFont)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable.addCell(cell); cell = new Cell(new Phrase((String) hashtable.get("ckptwts"))); cell.setColspan(2); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable.addCell(cell); cell = new Cell(new Phrase("", titleFont)); cell.setColspan(2); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable.addCell(cell); cell = new Cell(new Phrase((String) hashtable.get("deadlks"))); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable.addCell(cell); cell = new Cell(new Phrase("", titleFont)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable.addCell(cell); cell = new Cell(new Phrase((String) hashtable.get("lktouts"))); cell.setColspan(2); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable.addCell(cell); cell = new Cell(new Phrase("", titleFont)); cell.setColspan(2); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable.addCell(cell); cell = new Cell(new Phrase((String) hashtable.get("numckpts"))); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable.addCell(cell); cell = new Cell(new Phrase("", titleFont)); cell.setRowspan(list.size() + 1); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable.addCell(cell); cell = new Cell(new Phrase("", titleFont)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable.addCell(cell); cell = new Cell(new Phrase("MB", titleFont)); cell.setColspan(2); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable.addCell(cell); cell = new Cell(new Phrase("MB", titleFont)); cell.setColspan(2); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable.addCell(cell); cell = new Cell(new Phrase("%", titleFont)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable.addCell(cell); // get dbspace message================== int row = 0; DecimalFormat df = new DecimalFormat("#.###"); if (dbspaces != null && dbspaces.size() > 0) { for (int i = 0; i < dbspaces.size(); i++) { Hashtable tablesVO = (Hashtable) dbspaces.get(i); double all = 100.00; double show = all - Double.parseDouble(tablesVO.get("percent_free").toString()); String str = df.format(show) + ""; String spacenameString = (String) tablesVO.get("dbspace"); for (int j = 0; j < list.size(); j++) { Informixspaceconfig vo = (Informixspaceconfig) list.get(j); DBDao dbdao = new DBDao(); // dbdao = new DBDao(); List shareList = null; try { shareList = dbdao.getDbByTypeAndIpaddress(typevo.getId(), vo.getIpaddress()); } catch (Exception e) { } finally { dbdao.close(); } if (shareList == null || shareList.size() == 0) continue; DBVo dbvo = (DBVo) shareList.get(0); if (spacenameString.equals(vo.getSpacename())) { cell = new Cell(new Phrase(spacenameString)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable.addCell(cell); cell = new Cell(new Phrase((String) tablesVO.get("pages_size"))); cell.setColspan(2); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable.addCell(cell); cell = new Cell(new Phrase(df.format(Float.parseFloat(tablesVO.get("pages_used") + "")))); cell.setColspan(2); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable.addCell(cell); cell = new Cell(new Phrase(str)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable.addCell(cell); } } } } String count = (String) reportHash.get("count"); cell = new Cell(new Phrase("" + "\n" + "" + "\n" + "" + "\n" + "", titleFont)); cell.setRowspan(2); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable.addCell(cell); cell = new Cell(new Phrase("\n" + "" + downnum + "" + "\n", contextFont1)); cell.setColspan(7); aTable.addCell(cell); cell = new Cell(new Phrase("\n" + "" + count + "" + "\n", contextFont1)); cell.setColspan(7); aTable.addCell(cell); cell = new Cell(new Phrase("\n" + "" + "\n", titleFont)); cell.setColspan(8); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable.addCell(cell); String pinglog = ""; if ("0".equals(downnum)) { pinglog = " " + "2 "; } else { pinglog = " " + "2 " + downnum + ""; } String spacelog = ""; if ("0".equals(count)) { spacelog = " " + "3 " + count + "" + " "; } else { spacelog = " " + "3 "; } cell = new Cell(new Phrase(" 1 " + "\n" + "\n" + pinglog + "\n" + "\n" + spacelog + "\n" + "\n" + "\n" + "\n" + "\n" + "\n", contextFont1)); cell.setColspan(8); aTable.addCell(cell); document.add(aTable); document.close(); }
From source file:com.afunms.report.abstraction.ExcelReport1.java
public void createReport_faworklistdoc(String filename, User user) throws DocumentException, IOException { // //from w w w . j a v a 2 s. c o m Document document = new Document(PageSize.A4); // (Writer)document(Writer) RtfWriter2.getInstance(document, new FileOutputStream(filename)); document.open(); // BaseFont bfChinese = BaseFont.createFont("Times-Roman", "", BaseFont.NOT_EMBEDDED); // Font titleFont = new Font(bfChinese, 12, Font.BOLD); // Font contextFont = new Font(bfChinese, 12, Font.NORMAL); Paragraph title = new Paragraph("", titleFont); // title.setAlignment(Element.ALIGN_CENTER); // title.setFont(titleFont); document.add(title); // document.add(new Paragraph("\n")); Table aTable = new Table(13); float[] widths = { 220f, 220f, 220f, 220f, 220f, 220f, 220f, 220f, 220f, 220f, 220f, 220f, 220f }; aTable.setWidths(widths); aTable.setWidth(100); // 90% aTable.setAlignment(Element.ALIGN_CENTER);// aTable.setAutoFillEmptyCells(true); // aTable.setBorderWidth(1); // aTable.setBorderColor(new Color(0, 125, 255)); // aTable.setPadding(2);// aTable.setSpacing(0);// aTable.setBorder(2);// aTable.endHeaders(); Cell cell = null; NodeMonitorDao nmdao = new NodeMonitorDao(); List moidlist = new ArrayList(); try { moidlist = nmdao.loadByBID(user.getBusinessids()); } catch (Exception e) { } finally { nmdao.close(); } cell = new Cell(new Phrase("", titleFont)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable.addCell(cell); cell = new Cell(new Phrase("IP", titleFont)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable.addCell(cell); cell = new Cell(new Phrase("", titleFont)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable.addCell(cell); cell = new Cell(new Phrase("", titleFont)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable.addCell(cell); cell = new Cell(new Phrase("()", titleFont)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable.addCell(cell); cell = new Cell(new Phrase("", titleFont)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable.addCell(cell); cell = new Cell(new Phrase("", titleFont)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable.addCell(cell); cell = new Cell(new Phrase("()", titleFont)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable.addCell(cell); cell = new Cell(new Phrase("", titleFont)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable.addCell(cell); cell = new Cell(new Phrase("", titleFont)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable.addCell(cell); cell = new Cell(new Phrase("()", titleFont)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable.addCell(cell); cell = new Cell(new Phrase("", titleFont)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable.addCell(cell); cell = new Cell(new Phrase("", titleFont)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable.addCell(cell); if (moidlist != null) { for (int i = 0; i < moidlist.size(); i++) { NodeMonitor nm = (NodeMonitor) moidlist.get(i); HostNode vo = new HostNode(); HostNodeDao dao = new HostNodeDao(); try { vo = dao.loadHost(nm.getNodeID()); } catch (Exception e) { } finally { dao.close(); } String enable = ""; if (!nm.isEnabled()) enable = ""; if (vo == null) continue; String sms0 = ""; if (nm.getSms0() == 0) sms0 = ""; String sms1 = ""; if (nm.getSms1() == 0) sms1 = ""; String sms2 = ""; if (nm.getSms2() == 0) sms2 = ""; cell = new Cell(new Phrase(i + 1 + "", titleFont)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable.addCell(cell); cell = new Cell(new Phrase(vo.getAlias() + "(" + nm.getIp() + ")", titleFont)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable.addCell(cell); cell = new Cell(new Phrase(nm.getDescr(), titleFont)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable.addCell(cell); cell = new Cell(new Phrase(enable, titleFont)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable.addCell(cell); cell = new Cell(new Phrase(nm.getLimenvalue0() + nm.getUnit(), titleFont)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable.addCell(cell); cell = new Cell(new Phrase(nm.getTime0() + "", titleFont)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable.addCell(cell); cell = new Cell(new Phrase(sms0, titleFont)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable.addCell(cell); cell = new Cell(new Phrase(nm.getLimenvalue1() + nm.getUnit(), titleFont)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable.addCell(cell); cell = new Cell(new Phrase(nm.getTime1() + "", titleFont)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable.addCell(cell); cell = new Cell(new Phrase(sms1, titleFont)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable.addCell(cell); cell = new Cell(new Phrase(nm.getLimenvalue2() + nm.getUnit(), titleFont)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable.addCell(cell); cell = new Cell(new Phrase(nm.getTime1() + "", titleFont)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable.addCell(cell); cell = new Cell(new Phrase(sms2, titleFont)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable.addCell(cell); } } document.add(aTable); document.close(); }
From source file:com.afunms.report.abstraction.ExcelReport1.java
public void createReport_faworklistsearchdoc(String filename) throws DocumentException, IOException { // // www .jav a2s. c om Document document = new Document(PageSize.A4); // (Writer)document(Writer) RtfWriter2.getInstance(document, new FileOutputStream(filename)); document.open(); // BaseFont bfChinese = BaseFont.createFont("Times-Roman", "", BaseFont.NOT_EMBEDDED); // Font titleFont = new Font(bfChinese, 12, Font.BOLD); // Font contextFont = new Font(bfChinese, 12, Font.NORMAL); Paragraph title = new Paragraph("", titleFont); // title.setAlignment(Element.ALIGN_CENTER); // title.setFont(titleFont); document.add(title); // document.add(new Paragraph("\n")); Table aTable = new Table(13); float[] widths = { 220f, 220f, 220f, 220f, 220f, 220f, 220f, 220f, 220f, 220f, 220f, 220f, 220f }; aTable.setWidths(widths); aTable.setWidth(100); // 90% aTable.setAlignment(Element.ALIGN_CENTER);// aTable.setAutoFillEmptyCells(true); // aTable.setBorderWidth(1); // aTable.setBorderColor(new Color(0, 125, 255)); // aTable.setPadding(2);// aTable.setSpacing(0);// aTable.setBorder(2);// aTable.endHeaders(); Cell cell = null; List moidlist = (List) reportHash.get("list"); cell = new Cell(new Phrase("", titleFont)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable.addCell(cell); cell = new Cell(new Phrase("IP", titleFont)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable.addCell(cell); cell = new Cell(new Phrase("", titleFont)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable.addCell(cell); cell = new Cell(new Phrase("", titleFont)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable.addCell(cell); cell = new Cell(new Phrase("()", titleFont)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable.addCell(cell); cell = new Cell(new Phrase("", titleFont)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable.addCell(cell); cell = new Cell(new Phrase("", titleFont)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable.addCell(cell); cell = new Cell(new Phrase("()", titleFont)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable.addCell(cell); cell = new Cell(new Phrase("", titleFont)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable.addCell(cell); cell = new Cell(new Phrase("", titleFont)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable.addCell(cell); cell = new Cell(new Phrase("()", titleFont)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable.addCell(cell); cell = new Cell(new Phrase("", titleFont)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable.addCell(cell); cell = new Cell(new Phrase("", titleFont)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable.addCell(cell); if (moidlist != null) { for (int i = 0; i < moidlist.size(); i++) { NodeMonitor nm = (NodeMonitor) moidlist.get(i); HostNode vo = new HostNode(); HostNodeDao dao = new HostNodeDao(); vo = dao.loadHost(nm.getNodeID()); String enable = ""; if (!nm.isEnabled()) enable = ""; if (vo == null) continue; dao.close(); String sms0 = ""; if (nm.getSms0() == 0) sms0 = ""; String sms1 = ""; if (nm.getSms1() == 0) sms1 = ""; String sms2 = ""; if (nm.getSms2() == 0) sms2 = ""; cell = new Cell(new Phrase(i + 1 + "", titleFont)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable.addCell(cell); cell = new Cell(new Phrase(vo.getAlias() + "(" + nm.getIp() + ")", titleFont)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable.addCell(cell); cell = new Cell(new Phrase(nm.getDescr(), titleFont)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable.addCell(cell); cell = new Cell(new Phrase(enable, titleFont)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable.addCell(cell); cell = new Cell(new Phrase(nm.getLimenvalue0() + nm.getUnit(), titleFont)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable.addCell(cell); cell = new Cell(new Phrase(nm.getTime0() + "", titleFont)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable.addCell(cell); cell = new Cell(new Phrase(sms0, titleFont)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable.addCell(cell); cell = new Cell(new Phrase(nm.getLimenvalue1() + nm.getUnit(), titleFont)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable.addCell(cell); cell = new Cell(new Phrase(nm.getTime1() + "", titleFont)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable.addCell(cell); cell = new Cell(new Phrase(sms1, titleFont)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable.addCell(cell); cell = new Cell(new Phrase(nm.getLimenvalue2() + nm.getUnit(), titleFont)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable.addCell(cell); cell = new Cell(new Phrase(nm.getTime1() + "", titleFont)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable.addCell(cell); cell = new Cell(new Phrase(sms2, titleFont)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable.addCell(cell); } } document.add(aTable); document.close(); }
From source file:com.afunms.report.abstraction.ExcelReport1.java
/** * @author HONGLI sqlserverword/*from w ww. j a v a 2 s. c o m*/ * @param filename * @throws DocumentException * @throws IOException */ public void createReport_SqlServerCldDoc(String filename, String type) throws IOException { if (impReport.getTable() == null) { fileName = null; return; } try { // Document document = new Document(PageSize.A4); // (Writer)document(Writer) if ("pdf".equals(type)) { PdfWriter.getInstance(document, new FileOutputStream(filename)); } else { RtfWriter2.getInstance(document, new FileOutputStream(filename)); } document.open(); // BaseFont bfChinese = BaseFont.createFont("STSong-Light", "UniGB-UCS2-H", BaseFont.NOT_EMBEDDED); // Font titleFont = new Font(bfChinese, 12, Font.BOLD); // Font contextFont = new Font(bfChinese, 12, Font.NORMAL); String hostname = (String) reportHash.get("dbname"); String ip = (String) reportHash.get("ip"); String typename = (String) reportHash.get("typename"); String runstr = (String) reportHash.get("runstr"); String grade = (String) reportHash.get("grade"); String pingnow = (String) reportHash.get("pingnow"); String pingmin = (String) reportHash.get("pingmin"); String pingconavg = (String) reportHash.get("pingconavg"); DBVo vo = (DBVo) reportHash.get("vo"); String newip = doip(ip); Paragraph title = new Paragraph(hostname + "", titleFont); // title.setAlignment(Element.ALIGN_CENTER); // title.setFont(titleFont); document.add(title); String Ping = (String) reportHash.get("Ping"); String starttime = (String) reportHash.get("starttime"); String totime = (String) reportHash.get("totime"); Hashtable maxping = (Hashtable) reportHash.get("ping"); SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); String contextString = ":" + impReport.getTimeStamp() + " \n"// + ":" + starttime + " " + totime; Paragraph context = new Paragraph(contextString, contextFont); // context.setAlignment(Element.ALIGN_LEFT); // context.setFont(contextFont); // context.setSpacingBefore(5); // context.setFirstLineIndent(5); document.add(context); /* * tmpLabel = new Label(0, 1, ":" + impReport.getTimeStamp()); * sheet.addCell(tmpLabel); tmpLabel = new Label(0, 2, ": " + * starttime + " " + totime); */ // Table dbTable = new Table(5); this.setTableFormat(dbTable); // float[] cellWidths = { 220f, 220f, 220f, 220f, 220f }; // dbTable.setWidths(cellWidths); // dbTable.setWidth(100); // 90% // dbTable.setAlignment(Element.ALIGN_CENTER);// // dbTable.setAutoFillEmptyCells(true); // // dbTable.setBorderWidth(1); // // dbTable.setBorderColor(new Color(0, 125, 255)); // // dbTable.setPadding(2);// // dbTable.setSpacing(0);// // dbTable.setBorder(2);// // dbTable.endHeaders(); Cell dbCell = null; dbCell = new Cell(new Phrase("", titleFont)); dbCell.setColspan(5); this.setCellFormat(dbCell, true); dbTable.addCell(dbCell); dbCell = new Cell(new Phrase("", titleFont)); this.setCellFormat(dbCell, true); dbTable.addCell(dbCell); dbCell = new Cell(new Phrase("IP", titleFont)); this.setCellFormat(dbCell, true); dbTable.addCell(dbCell); dbCell = new Cell(new Phrase("", titleFont)); this.setCellFormat(dbCell, true); dbTable.addCell(dbCell); dbCell = new Cell(new Phrase("", titleFont)); this.setCellFormat(dbCell, true); dbTable.addCell(dbCell); dbCell = new Cell(new Phrase("", titleFont)); this.setCellFormat(dbCell, true); dbTable.addCell(dbCell); dbCell = new Cell(new Phrase(vo.getDbName(), contextFont)); this.setCellFormat(dbCell, false); dbTable.addCell(dbCell); dbCell = new Cell(new Phrase(ip, contextFont)); this.setCellFormat(dbCell, false); dbTable.addCell(dbCell); dbCell = new Cell(new Phrase(typename, contextFont)); this.setCellFormat(dbCell, false); dbTable.addCell(dbCell); dbCell = new Cell(new Phrase(runstr, contextFont)); this.setCellFormat(dbCell, false); dbTable.addCell(dbCell); dbCell = new Cell(new Phrase(grade, contextFont)); this.setCellFormat(dbCell, false); dbTable.addCell(dbCell); Table aTable = new Table(3); this.setTableFormat(aTable); // float[] widths = { 220f, 220f, 220f }; // aTable.setWidths(widths); // aTable.setWidth(100); // 90% // aTable.setAlignment(Element.ALIGN_CENTER);// // aTable.setAutoFillEmptyCells(true); // // aTable.setBorderWidth(1); // // aTable.setBorderColor(new Color(0, 125, 255)); // // aTable.setPadding(2);// // aTable.setSpacing(0);// // aTable.setBorder(2);// // aTable.endHeaders(); Cell cell = null; cell = new Cell(new Phrase("", titleFont)); this.setCellFormat(cell, true); aTable.addCell(cell); cell = new Cell(new Phrase("", titleFont)); this.setCellFormat(cell, true); aTable.addCell(cell); cell = new Cell(new Phrase("", titleFont)); this.setCellFormat(cell, true); aTable.addCell(cell); cell = new Cell(new Phrase(pingnow + "%", contextFont)); this.setCellFormat(cell, false); aTable.addCell(cell); cell = new Cell(new Phrase(pingmin + "%", contextFont)); this.setCellFormat(cell, false); aTable.addCell(cell); cell = new Cell(new Phrase(pingconavg + "%", contextFont)); this.setCellFormat(cell, false); aTable.addCell(cell); // Image img = Image.getInstance(ResourceCenter.getInstance().getSysPath() + "/resource/image/jfreechart/" + newip + "ConnectUtilization" + ".png"); // img.setAbsolutePosition(0, 0); img.scalePercent(75); img.setAlignment(Image.LEFT);// document.add(dbTable); document.add(aTable); document.add(img); document.add(new Paragraph("\n")); // Table dbInfoTable = new Table(5); this.setTableFormat(dbInfoTable); // float[] dbInfoWidths = { 220f, 220f, 220f, 220f, 220f }; // dbInfoTable.setWidths(dbInfoWidths); // dbInfoTable.setWidth(100); // 90% // dbInfoTable.setAlignment(Element.ALIGN_CENTER);// // dbInfoTable.setAutoFillEmptyCells(true); // // dbInfoTable.setBorderWidth(1); // // dbInfoTable.setBorderColor(new Color(0, 125, 255)); // // dbInfoTable.setPadding(2);// // dbInfoTable.setSpacing(0);// // dbInfoTable.setBorder(2);// Hashtable mems = (Hashtable) reportHash.get("mems");// cell = new Cell(new Phrase("(KB)", titleFont)); cell.setColspan(5); this.setCellFormat(cell, true); dbInfoTable.addCell(cell); cell = new Cell(new Phrase("", titleFont)); this.setCellFormat(cell, true); dbInfoTable.addCell(cell); cell = new Cell(new Phrase("", titleFont)); this.setCellFormat(cell, true); dbInfoTable.addCell(cell); cell = new Cell(new Phrase("", titleFont)); this.setCellFormat(cell, true); dbInfoTable.addCell(cell); cell = new Cell(new Phrase("SQL", titleFont)); this.setCellFormat(cell, true); dbInfoTable.addCell(cell); cell = new Cell(new Phrase("", titleFont)); this.setCellFormat(cell, true); dbInfoTable.addCell(cell); cell = new Cell(new Phrase((String) mems.get("totalMemory"), contextFont)); this.setCellFormat(cell, false); dbInfoTable.addCell(cell); cell = new Cell(new Phrase((String) mems.get("optMemory"), contextFont)); this.setCellFormat(cell, false); dbInfoTable.addCell(cell); cell = new Cell(new Phrase((String) mems.get("conMemory"), contextFont)); this.setCellFormat(cell, false); dbInfoTable.addCell(cell); cell = new Cell(new Phrase((String) mems.get("sqlMem"), contextFont)); this.setCellFormat(cell, false); dbInfoTable.addCell(cell); cell = new Cell(new Phrase((String) mems.get("lockMem"), contextFont)); this.setCellFormat(cell, false); dbInfoTable.addCell(cell); document.add(dbInfoTable); // Table sysInfoTable = new Table(4); this.setTableFormat(sysInfoTable); // float[] sysInfoWidths = { 220f, 220f, 220f, 220f }; // dbInfoTable.setWidths(dbInfoWidths); // sysInfoTable.setWidth(100); // 90% // sysInfoTable.setAlignment(Element.ALIGN_CENTER);// // sysInfoTable.setAutoFillEmptyCells(true); // // sysInfoTable.setBorderWidth(1); // // sysInfoTable.setBorderColor(new Color(0, 125, 255)); // // sysInfoTable.setPadding(2);// // sysInfoTable.setSpacing(0);// // sysInfoTable.setBorder(2);// Hashtable sysValue = (Hashtable) reportHash.get("sysValue");// cell = new Cell(new Phrase("(KB)", titleFont)); cell.setColspan(4); this.setCellFormat(cell, true); sysInfoTable.addCell(cell); cell = new Cell(new Phrase("", titleFont)); this.setCellFormat(cell, true); sysInfoTable.addCell(cell); cell = new Cell(new Phrase("", titleFont)); this.setCellFormat(cell, true); sysInfoTable.addCell(cell); cell = new Cell(new Phrase("", titleFont)); this.setCellFormat(cell, true); sysInfoTable.addCell(cell); cell = new Cell(new Phrase(" ", titleFont)); this.setCellFormat(cell, true); sysInfoTable.addCell(cell); cell = new Cell(new Phrase((String) sysValue.get("productlevel"), contextFont)); this.setCellFormat(cell, false); sysInfoTable.addCell(cell); cell = new Cell(new Phrase((String) sysValue.get("IsIntegratedSecurityOnly"), contextFont)); this.setCellFormat(cell, false); sysInfoTable.addCell(cell); cell = new Cell(new Phrase((String) sysValue.get("IsSingleUser"), contextFont)); this.setCellFormat(cell, false); sysInfoTable.addCell(cell); cell = new Cell(new Phrase((String) sysValue.get("IsClustered"), contextFont)); this.setCellFormat(cell, false); sysInfoTable.addCell(cell); document.add(sysInfoTable); Table aTable1 = new Table(6); this.setTableFormat(aTable1); float[] width = { 220f, 220f, 330f, 220f, 220f, 220f }; aTable1.setWidths(width); // aTable1.setWidth(100); // 90% // aTable1.setAlignment(Element.ALIGN_CENTER);// // aTable1.setAutoFillEmptyCells(true); // // aTable1.setBorderWidth(1); // // aTable1.setBorderColor(new Color(0, 125, 255)); // // aTable1.setPadding(2);// // aTable1.setSpacing(0);// // aTable1.setBorder(2);// cell = new Cell(new Phrase("", titleFont)); cell.setColspan(6); this.setCellFormat(cell, true); aTable1.addCell(cell); cell = new Cell(new Phrase("", titleFont)); this.setCellFormat(cell, true); aTable1.addCell(cell); cell = new Cell(new Phrase("", titleFont)); this.setCellFormat(cell, true); aTable1.addCell(cell); cell = new Cell(new Phrase("", titleFont)); this.setCellFormat(cell, true); aTable1.addCell(cell); cell = new Cell(new Phrase("MB", titleFont)); this.setCellFormat(cell, true); aTable1.addCell(cell); cell = new Cell(new Phrase("MB", titleFont)); this.setCellFormat(cell, true); aTable1.addCell(cell); cell = new Cell(new Phrase("(%)", titleFont)); this.setCellFormat(cell, true); aTable1.addCell(cell); // aTable1.endHeaders(); // Hashtable dbValue = (Hashtable) reportHash.get("tableinfo_v"); Hashtable alldatabase = new Hashtable(); if (dbValue.get("database") != null) alldatabase = (Hashtable) dbValue.get("database"); Vector names = new Vector(); if (dbValue.get("names") != null) names = (Vector) dbValue.get("names"); if (alldatabase != null && alldatabase.size() > 0) { if (names == null) names = new Vector(); int row = 1; for (int i = 0; i < names.size(); i++) { String key = (String) names.get(i); if (alldatabase.get(key) == null) continue; Hashtable data = (Hashtable) alldatabase.get(key); String dbname = data.get("dbname").toString(); String size = data.get("size").toString(); String usedsize = ""; if (data.get("usedsize") != null) { usedsize = data.get("usedsize").toString(); } String usedperc = ""; if (data.get("usedperc") != null) usedperc = data.get("usedperc").toString(); cell = new Cell(new Phrase("")); this.setCellFormat(cell, false); aTable1.addCell(cell); cell = new Cell(new Phrase(row + "", titleFont)); this.setCellFormat(cell, false); aTable1.addCell(cell); cell = new Cell(new Phrase(dbname, titleFont)); this.setCellFormat(cell, false); aTable1.addCell(cell); cell = new Cell(new Phrase(size, titleFont)); this.setCellFormat(cell, false); aTable1.addCell(cell); cell = new Cell(new Phrase(usedsize, titleFont)); this.setCellFormat(cell, false); aTable1.addCell(cell); cell = new Cell(new Phrase(usedperc, titleFont)); this.setCellFormat(cell, false); aTable1.addCell(cell); row++; } } if (impReport.getChart() != null) { ByteArrayOutputStream baos = new ByteArrayOutputStream(); try { ChartUtilities.writeChartAsPNG(baos, impReport.getChart().getChart(), impReport.getChart().getWidth(), impReport.getChart().getHeight()); } catch (IOException ioe) { } Image img1 = Image.getInstance(baos.toByteArray()); img1.setAbsolutePosition(0, 0); img1.setAlignment(Image.MIDDLE);// document.add(img1); } document.add(aTable1); // Table evenInfoTable = new Table(2); this.setTableFormat(evenInfoTable); // float[] evenInfoWidths = { 220f, 220f }; // evenInfoTable.setWidths(evenInfoWidths); // evenInfoTable.setWidth(100); // 90% // evenInfoTable.setAlignment(Element.ALIGN_CENTER);// // evenInfoTable.setAutoFillEmptyCells(true); // // evenInfoTable.setBorderWidth(1); // // evenInfoTable.setBorderColor(new Color(0, 125, 255)); // // evenInfoTable.setPadding(2);// // evenInfoTable.setSpacing(0);// // evenInfoTable.setBorder(2);// String downnum = (String) reportHash.get("downnum"); String count = (Integer) reportHash.get("count") + ""; cell = new Cell(new Phrase("", titleFont)); cell.setColspan(2); this.setCellFormat(cell, true); evenInfoTable.addCell(cell); cell = new Cell(new Phrase("", titleFont)); this.setCellFormat(cell, true); evenInfoTable.addCell(cell); cell = new Cell(new Phrase("", titleFont)); this.setCellFormat(cell, true); evenInfoTable.addCell(cell); cell = new Cell(new Phrase(downnum, contextFont)); this.setCellFormat(cell, false); evenInfoTable.addCell(cell); cell = new Cell(new Phrase(count, contextFont)); this.setCellFormat(cell, false); evenInfoTable.addCell(cell); document.add(evenInfoTable); // addEventListToDoc(document, titleFont, contextFont); document.close(); } catch (Exception e) { SysLogger.error("", e); } }
From source file:com.afunms.report.abstraction.ExcelReport1.java
/** * @author HONGLI DB2 doc/*from w w w . jav a 2 s . c o m*/ * @param filename * @throws DocumentException * @throws IOException */ public void createReportDB2SelfDoc(String filename) throws DocumentException, IOException { if (impReport.getTable() == null) { fileName = null; return; } try { // Document document = new Document(PageSize.A4); // (Writer)document(Writer) RtfWriter2.getInstance(document, new FileOutputStream(filename)); document.open(); // BaseFont bfChinese = BaseFont.createFont("Times-Roman", "", BaseFont.NOT_EMBEDDED); // Font titleFont = new Font(bfChinese, 12, Font.BOLD); // Font contextFont = new Font(bfChinese, 12, Font.NORMAL); String hostname = (String) reportHash.get("dbname"); String ip = (String) reportHash.get("ip"); String newip = doip(ip); Paragraph title = new Paragraph(hostname + "", titleFont); // title.setAlignment(Element.ALIGN_CENTER); // title.setFont(titleFont); document.add(title); String Ping = (String) reportHash.get("Ping"); String starttime = (String) reportHash.get("starttime"); String totime = (String) reportHash.get("totime"); Hashtable maxping = (Hashtable) reportHash.get("ping"); SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); String contextString = ":" + impReport.getTimeStamp() + " \n"// + ":" + starttime + " " + totime; Paragraph context = new Paragraph(contextString, contextFont); // context.setAlignment(Element.ALIGN_LEFT); // context.setFont(contextFont); // context.setSpacingBefore(5); // context.setFirstLineIndent(5); document.add(context); /* * tmpLabel = new Label(0, 1, ":" + impReport.getTimeStamp()); * sheet.addCell(tmpLabel); tmpLabel = new Label(0, 2, ": " + * starttime + " " + totime); */ Table aTable = new Table(3); float[] widths = { 220f, 220f, 220f }; aTable.setWidths(widths); aTable.setWidth(100); // 90% aTable.setAlignment(Element.ALIGN_CENTER);// aTable.setAutoFillEmptyCells(true); // aTable.setBorderWidth(1); // aTable.setBorderColor(new Color(0, 125, 255)); // aTable.setPadding(2);// aTable.setSpacing(0);// aTable.setBorder(2);// aTable.endHeaders(); Cell cell = null; cell = new Cell(new Phrase("", titleFont)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable.addCell(cell); cell = new Cell(new Phrase("", titleFont)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable.addCell(cell); cell = new Cell(new Phrase("", titleFont)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable.addCell(cell); cell = new Cell(new Phrase((String) maxping.get("pingnow"), contextFont)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable.addCell(cell); cell = new Cell(new Phrase((String) maxping.get("pingmax"), contextFont)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable.addCell(cell); cell = new Cell(new Phrase((String) maxping.get("avgpingcon"), contextFont)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable.addCell(cell); // document.add(aTable); Image img = Image.getInstance(ResourceCenter.getInstance().getSysPath() + "/resource/image/jfreechart/" + newip + "ConnectUtilization" + ".png"); img.setAlignment(Image.LEFT);// document.add(img); document.add(new Paragraph("\n")); Table aTable1 = new Table(5); float[] width = { 220f, 220f, 220f, 220f, 220f }; aTable1.setWidths(width); aTable1.setWidth(100); // 90% aTable1.setAlignment(Element.ALIGN_CENTER);// aTable1.setAutoFillEmptyCells(true); // aTable1.setBorderWidth(1); // aTable1.setBorderColor(new Color(0, 125, 255)); // aTable1.setPadding(2);// aTable1.setSpacing(0);// aTable1.setBorder(2);// cell = new Cell(new Phrase("", titleFont)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable1.addCell(cell); cell = new Cell(new Phrase("", titleFont)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable1.addCell(cell); cell = new Cell(new Phrase("(MB)", titleFont)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable1.addCell(cell); cell = new Cell(new Phrase("(MB)", titleFont)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable1.addCell(cell); cell = new Cell(new Phrase("(%)", titleFont)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable1.addCell(cell); // aTable1.endHeaders(); // Hashtable spaceInfo = (Hashtable) reportHash.get("spaceInfo"); if (spaceInfo.get("toolsdb") != null) { List toolsdb = (ArrayList) spaceInfo.get("toolsdb");// if (toolsdb != null && toolsdb.size() > 0) { for (int i = 0; i < toolsdb.size(); i++) { Hashtable tempSpace = (Hashtable) toolsdb.get(i); String SYSCATSPACE = tempSpace.get("tablespace_name") + ""; String totalspac = tempSpace.get("totalspac") + ""; String usablespac = tempSpace.get("usablespac") + ""; String usableper = (String) tempSpace.get("usableper"); if (usableper == null || usableper.trim().equals("")) { usableper = "0"; } cell = new Cell(new Phrase((i + 1) + "", titleFont)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable1.addCell(cell); cell = new Cell(new Phrase(SYSCATSPACE, titleFont)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable1.addCell(cell); cell = new Cell(new Phrase(totalspac, titleFont)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable1.addCell(cell); cell = new Cell(new Phrase(usablespac, titleFont)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable1.addCell(cell); cell = new Cell(new Phrase(usableper, titleFont)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable1.addCell(cell); } } if (impReport.getChart() != null) { ByteArrayOutputStream baos = new ByteArrayOutputStream(); try { ChartUtilities.writeChartAsPNG(baos, impReport.getChart().getChart(), impReport.getChart().getWidth(), impReport.getChart().getHeight()); } catch (IOException ioe) { } Image img1 = Image.getInstance(baos.toByteArray()); img1.setAbsolutePosition(0, 0); img1.setAlignment(Image.MIDDLE);// document.add(img1); } } document.add(aTable1); document.close(); } catch (Exception e) { SysLogger.error("", e); } }