List of usage examples for com.lowagie.text Image LEFT
int LEFT
To view the source code for com.lowagie.text Image LEFT.
Click Source Link
From source file:com.afunms.report.abstraction.ExcelReport1.java
public void createReport_sybPDF(String filename) throws DocumentException, IOException { if (impReport.getTable() == null) { fileName = null;//from w w w. ja v a 2 s .c o m return; } try { // Document document = new Document(PageSize.A4); // (Writer)document(Writer) PdfWriter.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 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); document.add(new Paragraph("\n")); /* * tmpLabel = new Label(0, 1, ":" + impReport.getTimeStamp()); * sheet.addCell(tmpLabel); tmpLabel = new Label(0, 2, ": " + * starttime + " " + totime); */ PdfPTable aTable = new PdfPTable(3); float[] widths = { 220f, 220f, 220f }; aTable.setWidths(widths); aTable.setWidthPercentage(100); PdfPCell cell = null; cell = new PdfPCell(new Phrase("", titleFont)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable.addCell(cell); cell = new PdfPCell(new Phrase("", titleFont)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable.addCell(cell); cell = new PdfPCell(new Phrase("", titleFont)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable.addCell(cell); cell = new PdfPCell(new Phrase("")); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable.addCell(cell); cell = new PdfPCell(new Phrase((String) maxping.get("pingmax"))); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable.addCell(cell); cell = new PdfPCell(new Phrase((String) maxping.get("avgpingcon"))); 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.setAlignment(Image.LEFT);// img.scalePercent(76); document.add(aTable); document.add(img); document.add(new Paragraph("\n")); PdfPTable aTable1 = new PdfPTable(6); float[] width = { 220f, 220f, 220f, 220f, 220f, 220f }; aTable1.setWidths(width); aTable1.setWidthPercentage(100); cell = new PdfPCell(new Phrase("", titleFont)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable1.addCell(cell); cell = new PdfPCell(new Phrase("", titleFont)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable1.addCell(cell); cell = new PdfPCell(new Phrase("", titleFont)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable1.addCell(cell); cell = new PdfPCell(new Phrase("MB", titleFont)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable1.addCell(cell); cell = new PdfPCell(new Phrase("MB", titleFont)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable1.addCell(cell); cell = new PdfPCell(new Phrase("(%)", titleFont)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable1.addCell(cell); // aTable1.endHeaders(); // SybaseVO sysbaseVO = (SybaseVO) reportHash.get("sysbaseVO"); if (sysbaseVO == null) sysbaseVO = new SybaseVO(); List dbsizelist = (List) sysbaseVO.getDbInfo(); int row = 1; if (dbsizelist != null && dbsizelist.size() > 0) { for (int i = 0; i < dbsizelist.size(); i++) { TablesVO tablesVO = (TablesVO) dbsizelist.get(i); String dbname = tablesVO.getDb_name(); String dbsize = tablesVO.getDb_size(); String freesize = tablesVO.getDb_freesize(); String userdperc = tablesVO.getDb_usedperc(); cell = new PdfPCell(new Phrase("")); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable1.addCell(cell); cell = new PdfPCell(new Phrase(row + "")); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable1.addCell(cell); cell = new PdfPCell(new Phrase(dbname)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable1.addCell(cell); cell = new PdfPCell(new Phrase(dbsize)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable1.addCell(cell); cell = new PdfPCell(new Phrase(freesize)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable1.addCell(cell); cell = new PdfPCell(new Phrase(userdperc)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 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); document.close(); } catch (Exception e) { // TODO: handle exception } }
From source file:com.afunms.report.abstraction.ExcelReport1.java
public void createReport_db2Doc(String filename) throws DocumentException, IOException { if (impReport.getTable() == null) { fileName = null;//from ww w . j a v 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 servername = (String) reportHash.get("servername"); String ip = (String) reportHash.get("ip"); String newip = doip(ip); String Ping = (String) reportHash.get("Ping"); String starttime = (String) reportHash.get("starttime"); String totime = (String) reportHash.get("totime"); Hashtable maxping = (Hashtable) reportHash.get("ping"); Hashtable returnhash = (Hashtable) reportHash.get("returnhash"); Paragraph title = new Paragraph(hostname + "", titleFont); // title.setAlignment(Element.ALIGN_CENTER); // title.setFont(titleFont); document.add(title); 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(aTable); document.add(img); document.add(new Paragraph("\n")); Enumeration dbs = returnhash.keys(); // List retList = new ArrayList(); List retList = new ArrayList(); Paragraph context1 = null; Table aTable1 = null; while (dbs.hasMoreElements()) { aTable1 = new Table(6); float[] width = { 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);// String obj = (String) dbs.nextElement(); retList = (List) returnhash.get(obj); String contextString1 = "DB2:" + obj + "(" + "IP:" + ip + ")"; context1 = new Paragraph(contextString1, contextFont); // context1.setAlignment(Element.ALIGN_LEFT); // context.setFont(contextFont); // context1.setSpacingBefore(5); // context1.setFirstLineIndent(5); 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("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 tableinfo_v = (Hashtable) * reportHash.get("tableinfo_v"); * * String[] dbs1 = servername.split(","); for (int i = 0; i < * tableinfo_v.size(); i++) { List list = (List) * tableinfo_v.get(dbs1[i]); for (int k = 0; k < list.size(); * k++) { * * row = row + 1; Hashtable ht = (Hashtable) list.get(k); if (ht == * null) continue; String spacename = ""; if * (ht.get("tablespace_name") != null) spacename = * ht.get("tablespace_name").toString(); String size = ""; if * (ht.get("totalspac") != null) size = * ht.get("totalspac").toString(); String free = ""; if * (ht.get("usablespac") != null) free = * ht.get("usablespac").toString(); String percent = "---"; if * (ht.get("usableper") != null) percent = * ht.get("usableper").toString(); */ for (int i = 0; i < retList.size(); i++) { Hashtable ht = (Hashtable) retList.get(i); if (ht == null) continue; String spacename = ""; if (ht.get("tablespace_name") != null) spacename = ht.get("tablespace_name").toString(); String size = ""; if (ht.get("totalspac") != null) size = ht.get("totalspac").toString(); String free = ""; if (ht.get("usablespac") != null) free = ht.get("usablespac").toString(); String percent = ""; if (ht.get("usableper") != null) percent = ht.get("usableper").toString(); cell = new Cell(new Phrase("")); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable1.addCell(cell); 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(spacename, titleFont)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable1.addCell(cell); cell = new Cell(new Phrase(size, titleFont)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable1.addCell(cell); cell = new Cell(new Phrase(free, titleFont)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable1.addCell(cell); cell = new Cell(new Phrase(percent, titleFont)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable1.addCell(cell); } document.add(context1); document.add(aTable1); } 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.close(); } catch (Exception e) { // TODO: handle exception } }
From source file:com.afunms.report.abstraction.ExcelReport1.java
public void createReport_db2PDF(String filename) throws DocumentException, IOException { if (impReport.getTable() == null) { fileName = null;/*from w w w. j ava 2 s.com*/ return; } try { // Document document = new Document(PageSize.A4); // (Writer)document(Writer) PdfWriter.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); Font contextFont1 = new Font(bfChinese, 11, Font.NORMAL); String hostname = (String) reportHash.get("dbname"); String servername = (String) reportHash.get("servername"); String ip = (String) reportHash.get("ip"); String newip = doip(ip); String Ping = (String) reportHash.get("Ping"); String starttime = (String) reportHash.get("starttime"); String totime = (String) reportHash.get("totime"); Hashtable returnhash = (Hashtable) reportHash.get("returnhash"); Hashtable maxping = (Hashtable) reportHash.get("ping"); Paragraph title = new Paragraph(hostname + "", titleFont); // title.setAlignment(Element.ALIGN_CENTER); // title.setFont(titleFont); document.add(title); SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); String contextString = ":" + impReport.getTimeStamp() + " \n"// + ":" + starttime + " " + totime; Paragraph context = new Paragraph(contextString, contextFont1); // context.setAlignment(Element.ALIGN_LEFT); // context.setFont(contextFont); // context.setSpacingBefore(5); // context.setFirstLineIndent(5); document.add(context); document.add(new Paragraph("\n")); /* * tmpLabel = new Label(0, 1, ":" + impReport.getTimeStamp()); * sheet.addCell(tmpLabel); tmpLabel = new Label(0, 2, ": " + * starttime + " " + totime); */ PdfPTable aTable = new PdfPTable(3); float[] widths = { 220f, 220f, 220f }; aTable.setWidths(widths); aTable.setWidthPercentage(100); PdfPCell cell = null; cell = new PdfPCell(new Phrase("", titleFont)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable.addCell(cell); cell = new PdfPCell(new Phrase("", titleFont)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable.addCell(cell); cell = new PdfPCell(new Phrase("", titleFont)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable.addCell(cell); cell = new PdfPCell(new Phrase("")); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable.addCell(cell); cell = new PdfPCell(new Phrase((String) maxping.get("pingmax"))); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable.addCell(cell); cell = new PdfPCell(new Phrase((String) maxping.get("avgpingcon"))); 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.setAlignment(Image.LEFT);// img.scalePercent(76); document.add(aTable); document.add(img); document.add(new Paragraph("\n")); Enumeration dbs = returnhash.keys(); List retList = new ArrayList(); Paragraph context1 = null; PdfPTable aTable1 = null; while (dbs.hasMoreElements()) { aTable1 = new PdfPTable(6); float[] width = { 220f, 220f, 220f, 220f, 220f, 220f }; aTable1.setWidths(width); aTable1.setWidthPercentage(100); cell = new PdfPCell(new Phrase("", titleFont)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable1.addCell(cell); cell = new PdfPCell(new Phrase("", titleFont)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable1.addCell(cell); cell = new PdfPCell(new Phrase("", titleFont)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable1.addCell(cell); cell = new PdfPCell(new Phrase("MB", titleFont)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable1.addCell(cell); cell = new PdfPCell(new Phrase("MB", titleFont)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable1.addCell(cell); cell = new PdfPCell(new Phrase("(%)", titleFont)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable1.addCell(cell); // aTable1.endHeaders(); // String obj = (String) dbs.nextElement(); retList = (List) returnhash.get(obj); String contextString1 = "DB2:" + obj + "(" + "IP:" + ip + ")"; context1 = new Paragraph(contextString1, contextFont); // context1.setAlignment(Element.ALIGN_LEFT); // context.setFont(contextFont); // context1.setSpacingBefore(5); // context1.setFirstLineIndent(5); int row = 1; for (int i = 0; i < retList.size(); i++) { Hashtable ht = (Hashtable) retList.get(i); if (ht == null) continue; String spacename = ""; if (ht.get("tablespace_name") != null) spacename = ht.get("tablespace_name").toString(); String size = ""; if (ht.get("totalspac") != null) size = ht.get("totalspac").toString(); String free = ""; if (ht.get("usablespac") != null) free = ht.get("usablespac").toString(); String percent = ""; if (ht.get("usableper") != null) percent = ht.get("usableper").toString(); cell = new PdfPCell(new Phrase("")); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable1.addCell(cell); cell = new PdfPCell(new Phrase(i + 1 + "")); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable1.addCell(cell); cell = new PdfPCell(new Phrase(spacename)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable1.addCell(cell); cell = new PdfPCell(new Phrase(size)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable1.addCell(cell); cell = new PdfPCell(new Phrase(free)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable1.addCell(cell); cell = new PdfPCell(new Phrase(percent)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable1.addCell(cell); } document.add(context1); document.add(new Paragraph("\n")); document.add(aTable1); } 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.close(); } catch (Exception e) { // TODO: handle exception } }
From source file:com.afunms.report.abstraction.ExcelReport1.java
/** * IISLog IP word/*from www . java 2 s . co m*/ * * @param filename * @throws DocumentException * @throws IOException */ public void createReport_iislogipword(String filename) throws DocumentException, IOException { String starttime = (String) reportHash.get("starttime"); String totime = (String) reportHash.get("totime"); // 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 contextFont = new Font(bfChinese, 12, Font.NORMAL); 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); // Image img = Image .getInstance(ResourceCenter.getInstance().getSysPath() + "/resource/image/jfreechart/IISLogIP.png"); img.setAbsolutePosition(0, 0); img.setAlignment(Image.LEFT);// document.add(img); document.close(); }
From source file:com.afunms.report.abstraction.ExcelReport1.java
/** * IISLog word//from w w w .ja va 2s . c o m * * @param filename * @throws DocumentException * @throws IOException */ public void createReport_iislogstateword(String filename) throws DocumentException, IOException { String starttime = (String) reportHash.get("starttime"); String totime = (String) reportHash.get("totime"); // 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 contextFont = new Font(bfChinese, 12, Font.NORMAL); 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); // // Image img = Image.getInstance( ResourceCenter.getInstance().getSysPath() + "/resource/image/jfreechart/IISLogState.png"); img.setAbsolutePosition(0, 0); img.setAlignment(Image.LEFT);// document.add(img); document.close(); }
From source file:com.afunms.report.abstraction.ExcelReport1.java
public void createReport_tomcatDoc(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);/*from w ww. j a v a2 s . c om*/ // WritableSheet sheet = wb.createSheet(hostname + "", 0); Hashtable CPU = (Hashtable) reportHash.get("CPU"); if (CPU == null) CPU = new Hashtable(); String Ping = (String) reportHash.get("Ping"); Hashtable Memory = (Hashtable) reportHash.get("Memory"); Hashtable Disk = (Hashtable) reportHash.get("Disk"); Hashtable memMaxHash = (Hashtable) reportHash.get("memmaxhash"); Hashtable memAvgHash = (Hashtable) reportHash.get("memavghash"); Hashtable maxping = (Hashtable) reportHash.get("ping"); Hashtable maxjvm = (Hashtable) reportHash.get("maxjvm"); String jvmnow = (String) reportHash.get("jvmnow"); 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)) { 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, titleFont); // 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(this.setCellFormat(new Phrase("", contextFont), false)); aTable.addCell(this.setCellFormat(new Phrase(Ping + "%", contextFont), false)); aTable.addCell(this.setCellFormat(new Phrase((String) maxping.get("pingmax"), contextFont), false)); aTable.addCell(this.setCellFormat(new Phrase((String) maxping.get("avgpingcon"), contextFont), false)); Image img = Image.getInstance(ResourceCenter.getInstance().getSysPath() + "/resource/image/jfreechart/" + newip + "TomcatPing" + ".png"); // img.setAbsolutePosition(0, 0); img.setAlignment(Image.LEFT);// document.add(aTable); document.add(img); Table aTable1 = new Table(4); this.setTableFormat(aTable1); // float[] widths1 = { 220f, 300f, 220f, 220f }; // aTable.setWidths(widths1); // 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(); aTable1.addCell(this.setCellFormat(new Phrase("JVM", contextFont), true)); aTable1.addCell(this.setCellFormat(new Phrase("", contextFont), true)); aTable1.addCell(this.setCellFormat(new Phrase("", contextFont), true)); aTable1.addCell(this.setCellFormat(new Phrase("", contextFont), true)); aTable1.addCell(this.setCellFormat(new Phrase("", contextFont), false)); aTable1.addCell(this.setCellFormat(new Phrase(jvmnow + "%", contextFont), false)); aTable1.addCell(this.setCellFormat(new Phrase((String) maxjvm.get("max_tomcat_jvm"), contextFont), false)); aTable1.addCell(this.setCellFormat(new Phrase((String) maxjvm.get("avg_tomcat_jvm"), contextFont), false)); Image img1 = Image.getInstance(ResourceCenter.getInstance().getSysPath() + "/resource/image/jfreechart/" + newip + "tomcat_jvm" + ".png"); // img1.setAbsolutePosition(0, 0); img1.setAlignment(Image.LEFT);// document.add(aTable1); document.add(img1); document.close(); }
From source file:com.afunms.report.abstraction.ExcelReport1.java
public void createReport_tomcatPDF(String file) 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);/*from w w w . ja va 2 s.co m*/ // WritableSheet sheet = wb.createSheet(hostname + "", 0); Hashtable CPU = (Hashtable) reportHash.get("CPU"); if (CPU == null) CPU = new Hashtable(); String Ping = (String) reportHash.get("Ping"); Calendar colTime = (Calendar) reportHash.get("time"); Hashtable maxping = (Hashtable) reportHash.get("ping"); String jvmnow = (String) reportHash.get("jvmnow"); Hashtable maxjvm = (Hashtable) reportHash.get("maxjvm"); SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); 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, 10, Font.NORMAL); Paragraph title = new Paragraph(hostname + "", contextFont); // title.setAlignment(Element.ALIGN_CENTER); // title.setFont(titleFont); document.add(title); 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); document.add(new Paragraph("\n")); Font fontChinese = new Font(bfChinese, 12, Font.NORMAL, Color.black); PdfPTable aTable = new PdfPTable(4); float[] widths = { 220f, 300f, 220f, 220f }; aTable.setWidths(widths); aTable.setWidthPercentage(100); aTable.addCell(new Phrase("", contextFont)); aTable.addCell(new Phrase("", contextFont)); aTable.addCell(new Phrase("", contextFont)); aTable.addCell(new Phrase("", contextFont)); // aTable.addCell("3.2",Ping+"%"); aTable.addCell(""); aTable.addCell(Ping + "%"); aTable.addCell((String) maxping.get("pingmax")); aTable.addCell((String) maxping.get("avgpingcon")); Image img = Image.getInstance(ResourceCenter.getInstance().getSysPath() + "/resource/image/jfreechart/" + newip + "TomcatPing" + ".png"); img.setAlignment(Image.LEFT);// img.scalePercent(75); document.add(aTable); document.add(img); PdfPTable aTable1 = new PdfPTable(4); float[] widths1 = { 220f, 300f, 220f, 220f }; aTable1.setWidths(widths1); aTable1.setWidthPercentage(100); aTable1.addCell(new Phrase("JVM", contextFont)); aTable1.addCell(new Phrase("", contextFont)); aTable1.addCell(new Phrase("", contextFont)); aTable1.addCell(new Phrase("", contextFont)); // aTable.addCell("3.2",Ping+"%"); aTable1.addCell(""); aTable1.addCell(jvmnow + "%"); aTable1.addCell((String) maxjvm.get("max_tomcat_jvm")); aTable1.addCell((String) maxjvm.get("avg_tomcat_jvm")); Image img1 = Image.getInstance(ResourceCenter.getInstance().getSysPath() + "/resource/image/jfreechart/" + newip + "tomcat_jvm" + ".png"); img1.setAlignment(Image.LEFT);// img1.scalePercent(75); document.add(aTable1); document.add(img1); document.close(); }
From source file:com.afunms.report.abstraction.ExcelReport1.java
public void createReport_iisDoc(String file) 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);//from w w w .j a v a 2 s.co m // WritableSheet sheet = wb.createSheet(hostname + "", 0); Calendar colTime = (Calendar) reportHash.get("time"); Hashtable maxping = (Hashtable) reportHash.get("ping"); String iisnow = (String) reportHash.get("iisnow"); 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) RtfWriter2.getInstance(document, new FileOutputStream(file)); document.open(); // BaseFont bfChinese = BaseFont.createFont("Times-Roman", "", 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, contextFont); // 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(iisnow + "%"); aTable.addCell((String) maxping.get("pingmax")); aTable.addCell((String) maxping.get("avgpingcon")); Image img = Image.getInstance(ResourceCenter.getInstance().getSysPath() + "/resource/image/jfreechart/" + newip + "iisPing" + ".png"); img.setAbsolutePosition(0, 0); img.setAlignment(Image.LEFT);// document.add(aTable); document.add(img); document.close(); }
From source file:com.afunms.report.abstraction.ExcelReport1.java
public void createReport_iisPDF(String file) 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);//from w w w . j av a 2s .c o m // WritableSheet sheet = wb.createSheet(hostname + "", 0); Calendar colTime = (Calendar) reportHash.get("time"); Hashtable maxping = (Hashtable) reportHash.get("ping"); String iisnow = (String) reportHash.get("iisnow"); SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); // 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, 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, contextFont); // context.setAlignment(Element.ALIGN_LEFT); // context.setFont(contextFont); // context.setSpacingBefore(5); // context.setFirstLineIndent(5); document.add(context); document.add(new Paragraph("\n")); 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.setWidthPercentage(100); 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(iisnow + "%"); aTable.addCell((String) maxping.get("pingmax")); aTable.addCell((String) maxping.get("avgpingcon")); Image img = Image.getInstance(ResourceCenter.getInstance().getSysPath() + "/resource/image/jfreechart/" + newip + "iisPing" + ".png"); img.setAlignment(Image.LEFT);// img.scalePercent(75); document.add(aTable); document.add(img); PdfPTable aTable1 = new PdfPTable(4); float[] widths1 = { 220f, 300f, 220f, 220f }; aTable1.setWidths(widths1); aTable1.setWidthPercentage(100); document.close(); }
From source file:com.afunms.report.abstraction.ExcelReport1.java
/** * @param file/*from w ww . j a va 2s. co m*/ * @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(); }