List of usage examples for com.lowagie.text Table setWidths
public void setWidths(int[] widths) throws DocumentException
From source file:com.afunms.report.abstraction.ExcelReport1.java
public void createReport_sybaseNewPDF(String filename) throws DocumentException, IOException { String hostname = (String) reportHash.get("dbname"); String hostnamestr = (String) reportHash.get("hostnamestr"); 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"); 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();/*w w w.j a v a 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 contextFont = 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", 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); // aTable.addCell(cell); cell = new Cell(new Phrase(hostnamestr, contextFont1)); 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(sysbaseVO.getTotal_physicalMemory(), 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(sysbaseVO.getTotal_dataCache())); 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(sysbaseVO.getMetadata_cache())); 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(sysbaseVO.getProcedure_cache())); 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(sysbaseVO.getTotal_logicalMemory(), 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(sysbaseVO.getData_hitrate())); 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(sysbaseVO.getProcedure_hitrate(), 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(sysbaseVO.getServerName())); 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(sysbaseVO.getVersion())); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable.addCell(cell); // SybspaceconfigDao sybspaceconfigDao = new SybspaceconfigDao(); List list = null; try { list = sybspaceconfigDao.getByIp(ip, 1); } catch (Exception e) { SysLogger.error("", e); } finally { sybspaceconfigDao.close(); } Cell cell5 = new Cell(new Phrase("" + "\n" + "" + "\n" + "" + "\n" + "", titleFont)); cell5.setRowspan(8 + 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((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.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); cell = new Cell(new Phrase(sysbaseVO.getIdle())); cell.setColspan(2); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable.addCell(cell); cell = new Cell(new Phrase("cpu()", titleFont)); cell.setColspan(2); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable.addCell(cell); cell = new Cell(new Phrase(sysbaseVO.getCpu_busy())); cell.setColspan(2); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable.addCell(cell); cell = new Cell(new Phrase("I/O()", titleFont)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable.addCell(cell); cell = new Cell(new Phrase(sysbaseVO.getIo_busy())); cell.setColspan(2); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable.addCell(cell); cell = new Cell(new Phrase("IO(%)", titleFont)); cell.setColspan(2); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable.addCell(cell); cell = new Cell(new Phrase(sysbaseVO.getIo_busy_rate())); 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); cell = new Cell(new Phrase(sysbaseVO.getSent_rate())); 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(sysbaseVO.getReceived_rate())); 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); cell = new Cell(new Phrase(sysbaseVO.getWrite_rate())); 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(sysbaseVO.getRead_rate())); 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); cell = new Cell(new Phrase(sysbaseVO.getDisk_count())); 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(sysbaseVO.getLocks_count())); 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); cell = new Cell(new Phrase(sysbaseVO.getXact_count())); cell.setColspan(6); 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.setColspan(2); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable.addCell(cell); // get dbspace message================== 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(); for (int j = 0; j < list.size(); j++) { Sybspaceconfig vo = (Sybspaceconfig) list.get(j); if (vo.getSpacename().equals(dbname)) { String dbsize = tablesVO.getDb_size(); String freesize = tablesVO.getDb_freesize(); String userdperc = tablesVO.getDb_usedperc(); cell = new Cell(new Phrase(dbname)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable.addCell(cell); cell = new Cell(new Phrase(dbsize)); cell.setColspan(2); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable.addCell(cell); cell = new Cell(new Phrase(freesize)); cell.setColspan(2); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable.addCell(cell); cell = new Cell(new Phrase(userdperc)); cell.setColspan(2); 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 " + downnum + ""; } else { pinglog = " " + "2 "; } 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
/** * mysql pdf/*w ww .j a v a 2s .c om*/ * * @author HONGLI * @param filename * @throws DocumentException * @throws IOException */ public void createReport_mysqlNewPDF(String filename) throws DocumentException, IOException { String hostname = (String) reportHash.get("dbname"); String hostnamestr = (String) reportHash.get("hostnamestr"); 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"); DBVo vo = (DBVo) reportHash.get("vo"); String runstr = (String) reportHash.get("runstr"); String[] sysItem1 = { "shared pool", "large pool", "buffer cache", "java pool" }; String downnum = (String) reportHash.get("downnum"); 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(); // 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 contextFont = 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", 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); // aTable.addCell(cell); cell = new Cell(new Phrase(hostnamestr, contextFont1)); 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(8); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable.addCell(cell); cell = new Cell(new Phrase("", titleFont)); cell.setRowspan(5); Vector val = (Vector) reportHash.get("Val"); String Max_used_connections = ""; String Table_locks_immediate = ""; String Table_locks_waited = ""; String Key_read_requests = ""; String Key_reads = ""; String log_slow_queries = ""; String Threads_connected = ""; String Open_tables = ""; String Opened_tables = ""; if (val != null && val.size() > 0) { for (int i = 0; i < val.size(); i++) { Hashtable return_value = (Hashtable) val.get(i); if (return_value != null && return_value.size() > 0) { String name = return_value.get("variable_name").toString(); String value = return_value.get("value").toString(); if (name.equalsIgnoreCase("Max_used_connections")) { // name=""; Max_used_connections = value; } if (name.equalsIgnoreCase("Table_locks_immediate")) { // name=""; Table_locks_immediate = value; } if (name.equalsIgnoreCase("Table_locks_waited")) { // name=""; Table_locks_waited = value; } if (name.equalsIgnoreCase("Key_read_requests")) { // name=""; Key_read_requests = value; } if (name.equalsIgnoreCase("Key_reads")) { // name=""; Key_reads = value; } if (name.equalsIgnoreCase("log_slow_queries")) { // name=""; log_slow_queries = value; } if (name.equalsIgnoreCase("Threads_connected")) { // name=""; Threads_connected = value; } if (name.equalsIgnoreCase("Open_tables")) { // name=""; Open_tables = value; } if (name.equalsIgnoreCase("Opened_tables")) { // name=""; Opened_tables = value; } } } } 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(Max_used_connections, 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(Table_locks_immediate, 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(Table_locks_waited, 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(Key_read_requests, 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(Key_reads, 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(log_slow_queries, 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(Threads_connected, 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(Open_tables, 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(Opened_tables, 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(2); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable.addCell(cell); Vector tableinfo_v = (Vector) reportHash.get("tableinfo_v"); String Threads_cached = ""; String Innodb_buffer_pool_pages_total = ""; String Threads_created = ""; String Uptime = ""; if (tableinfo_v != null) { for (int i = 0; i < tableinfo_v.size(); i++) { Hashtable ht = (Hashtable) tableinfo_v.get(i); String size = ht.get("variable_name").toString(); String free = ht.get("value").toString(); if (size.equalsIgnoreCase("Threads_cached")) { // size=""; Threads_cached = free; } if (size.equalsIgnoreCase("Innodb_buffer_pool_pages_total")) { // size=""; Innodb_buffer_pool_pages_total = free; } if (size.equalsIgnoreCase("Threads_created")) { // size=""; Threads_created = free; } if (size.equalsIgnoreCase("Uptime")) { // size=":"; Uptime = free; } } } cell = new Cell(new Phrase("", titleFont)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable.addCell(cell); cell = new Cell(new Phrase(Threads_cached)); 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(Threads_cached)); 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(Threads_cached)); 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(Uptime)); 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("")); 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("")); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable.addCell(cell); // // // // SybspaceconfigDao sybspaceconfigDao = new SybspaceconfigDao(); // // List list = null; // try { // list = sybspaceconfigDao.getByIp(ip, 1); // } catch (Exception e) { // SysLogger.error("", e); // } finally { // sybspaceconfigDao.close(); // } // Cell cell5 = new Cell(new Phrase("" + "\n" + "" + "\n" + "" + "\n" + "", titleFont)); cell5.setRowspan(1); 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((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.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); // cell = new Cell(new Phrase(sysbaseVO.getIdle())); // cell.setColspan(2); // cell.setHorizontalAlignment(Element.ALIGN_CENTER); // // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // // aTable.addCell(cell); // cell = new Cell(new Phrase("cpu()", titleFont)); // cell.setColspan(2); // cell.setHorizontalAlignment(Element.ALIGN_CENTER); // // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // // aTable.addCell(cell); // cell = new Cell(new Phrase(sysbaseVO.getCpu_busy())); // cell.setColspan(2); // cell.setHorizontalAlignment(Element.ALIGN_CENTER); // // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // // aTable.addCell(cell); // // cell = new Cell(new Phrase("I/O()", titleFont)); // cell.setHorizontalAlignment(Element.ALIGN_CENTER); // // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // // aTable.addCell(cell); // cell = new Cell(new Phrase(sysbaseVO.getIo_busy())); // cell.setColspan(2); // cell.setHorizontalAlignment(Element.ALIGN_CENTER); // // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // // aTable.addCell(cell); // cell = new Cell(new Phrase("IO(%)", titleFont)); // cell.setColspan(2); // cell.setHorizontalAlignment(Element.ALIGN_CENTER); // // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // // aTable.addCell(cell); // cell = new Cell(new Phrase(sysbaseVO.getIo_busy_rate())); // 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); // cell = new Cell(new Phrase(sysbaseVO.getSent_rate())); // 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(sysbaseVO.getReceived_rate())); // 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); // cell = new Cell(new Phrase(sysbaseVO.getWrite_rate())); // 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(sysbaseVO.getRead_rate())); // 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); // cell = new Cell(new Phrase(sysbaseVO.getDisk_count())); // 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(sysbaseVO.getLocks_count())); // 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); // cell = new Cell(new Phrase(sysbaseVO.getXact_count())); // cell.setColspan(6); // 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.setColspan(2); // cell.setHorizontalAlignment(Element.ALIGN_CENTER); // // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // // aTable.addCell(cell); // // get dbspace message================== // 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(); // for (int j = 0; j < list.size(); j++) { // Sybspaceconfig vo = (Sybspaceconfig) list.get(j); // if (vo.getSpacename().equals(dbname)) { // // String dbsize = tablesVO.getDb_size(); // String freesize = tablesVO.getDb_freesize(); // String userdperc = tablesVO.getDb_usedperc(); // // cell = new Cell(new Phrase(dbname)); // cell.setHorizontalAlignment(Element.ALIGN_CENTER); // // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // // aTable.addCell(cell); // cell = new Cell(new Phrase(dbsize)); // cell.setColspan(2); // cell.setHorizontalAlignment(Element.ALIGN_CENTER); // // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // // aTable.addCell(cell); // cell = new Cell(new Phrase(freesize)); // cell.setColspan(2); // cell.setHorizontalAlignment(Element.ALIGN_CENTER); // // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // // aTable.addCell(cell); // cell = new Cell(new Phrase(userdperc)); // cell.setColspan(2); // 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 " + downnum + ""; } else { pinglog = " " + "2 "; } 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_db2Doc(String filename) throws DocumentException, IOException { if (impReport.getTable() == null) { fileName = null;// w w w . jav a 2 s. com 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_db2NewPDF(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"); String runstr = (String) reportHash.get("runstr"); String[] sysItem1 = { "shared pool", "large pool", "buffer cache", "java pool" }; String downnum = (String) reportHash.get("downnum"); Hashtable returnhash = null;/* ww w .ja v a2s. c o m*/ returnhash = (Hashtable) reportHash.get("returnhash"); Hashtable db2sys = (Hashtable) reportHash.get("sqlsys"); List retList = new ArrayList(); Enumeration dbs = returnhash.keys(); 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(); // 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 contextFont = 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", 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); // 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("\n" + "" + "\n", 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); while (dbs.hasMoreElements()) { String obj = (String) dbs.nextElement(); returnhash = (Hashtable) db2sys.get(obj); cell = new Cell(new Phrase("\n" + "DB2:" + obj + "" + "\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" + "" + "\n" + "", titleFont)); cell.setRowspan(4); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable.addCell(cell); cell = new Cell(new Phrase("", titleFont)); cell.setRowspan(3); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable.addCell(cell); // jingcheng message if (db2sys == null) db2sys = new Hashtable(); // Enumeration dbs = db2sys.keys(); // Hashtable<String,Object> returnhash = new Hashtable(); String rows_read = "---"; String rows_selected = "---"; String lock_waits = "---"; String lock_wait_time = "---"; String deadlocks = "---"; String lock_escals = "---"; String host_name = "---"; String prod_release = ""; if (returnhash != null) { rows_read = (String) returnhash.get("rows_read"); rows_selected = (String) returnhash.get("rows_selected"); lock_waits = (String) returnhash.get("lock_waits"); lock_wait_time = (String) returnhash.get("lock_wait_time"); deadlocks = (String) returnhash.get("deadlocks"); lock_escals = (String) returnhash.get("lock_escals"); host_name = (String) returnhash.get("host_name"); prod_release = (String) returnhash.get("prod_release"); } // end message cell = new Cell(new Phrase("", titleFont)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable.addCell(cell); cell = new Cell(new Phrase(rows_read)); 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(rows_selected)); 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(lock_waits)); 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(lock_wait_time)); 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(deadlocks)); 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(lock_escals)); 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(host_name)); cell.setColspan(2); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable.addCell(cell); cell = new Cell(new Phrase("DB2", titleFont)); cell.setColspan(2); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable.addCell(cell); cell = new Cell(new Phrase(prod_release)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable.addCell(cell); // Db2spaceconfigDao db2spaceconfigDao = new Db2spaceconfigDao(); List list = null; try { list = db2spaceconfigDao.getByIp(ip, 1); } catch (Exception e) { SysLogger.error("", e); } finally { db2spaceconfigDao.close(); } Cell cell5 = new Cell(new Phrase("" + "\n" + "" + "\n" + "" + "\n" + "", titleFont)); int row = 0; for (int j = 0; j < list.size(); j++) { Db2spaceconfig vo1 = (Db2spaceconfig) list.get(j); if (vo1.getDbname().equals(obj)) { row++; } } // cell5.setRowspan(2+list.size()); cell5.setRowspan(2 + row); 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((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.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); 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.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); // ==== returnhash = (Hashtable) reportHash.get("returnhash"); retList = (List) returnhash.get(obj); int tie = 0; for (int i = 0; i < retList.size(); i++) { Hashtable ht = (Hashtable) retList.get(i); String tablespace = ht.get("tablespace_name").toString(); for (int j = 0; j < list.size(); j++) { Db2spaceconfig vo1 = (Db2spaceconfig) list.get(j); if (vo1.getSpacename().equals(tablespace)) { if (vo1.getDbname().equals(obj)) { 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(tablespace)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable.addCell(cell); cell = new Cell(new Phrase(size)); cell.setColspan(2); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable.addCell(cell); cell = new Cell(new Phrase(free)); cell.setColspan(2); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable.addCell(cell); cell = new Cell(new Phrase(percent)); cell.setColspan(2); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable.addCell(cell); tie++; } } } } } // ===============end 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_serviceworkchoce(String starttime, String totime, String file, String username, String positionname) throws DocumentException, IOException { Hashtable allreporthash = new Hashtable(); allreporthash = reportHash;/*from w w w . j ava 2s .c om*/ /* * 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(file)); document.open(); // BaseFont bfChinese = BaseFont.createFont("Times-Roman", "", BaseFont.NOT_EMBEDDED); // Font titleFont1 = new Font(bfChinese, 14, Font.BOLD); Font titleFont = new Font(bfChinese, 14, Font.BOLD); // Font contextFont = new Font(bfChinese, 14, Font.NORMAL); Font fontChinese = new Font(bfChinese, 12, Font.NORMAL, Color.black); try { fileName = ResourceCenter.getInstance().getSysPath() + file; Table aTable = new Table(13); float[] widths = { 40f, 100f, 40f, 40f, 40f, 40f, 40f, 40f, 40f, 40f, 40f, 40f, 40f }; 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("", titleFont1)); cell.setColspan(13); 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 = new Cell(new Phrase("" + starttime + "" + totime, contextFont)); cell.setColspan(12); 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(username, contextFont)); cell.setColspan(4); 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(positionname, contextFont)); cell.setColspan(5); 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("", contextFont)); cell.setColspan(11); 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("", contextFont)); cell.setColspan(11); aTable.addCell(cell); cell = new Cell(new Phrase("", titleFont)); cell.setColspan(13); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable.addCell(cell); int netsize = 0; Hashtable netreporthash = (Hashtable) allreporthash.get("netreporthash"); if (netreporthash != null) { netsize = netreporthash.size(); } cell = new Cell(new Phrase("" + "\n" + "", titleFont)); cell.setRowspan(3 + netsize); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable.addCell(cell); cell = new Cell(new Phrase("IP", titleFont)); cell.setRowspan(3); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable.addCell(cell); cell = new Cell(new Phrase("" + "\n" + "(%)", titleFont)); cell.setColspan(2); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable.addCell(cell); cell = new Cell(new Phrase("CPU(%)", titleFont)); 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("KB/S", titleFont)); cell.setColspan(4); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable.addCell(cell); cell = new Cell(new Phrase("", titleFont)); cell.setRowspan(3); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable.addCell(cell); cell = new Cell(new Phrase("" + "\n" + "", titleFont)); cell.setRowspan(2); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable.addCell(cell); cell = new Cell(new Phrase("" + "\n" + "", titleFont)); cell.setRowspan(2); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable.addCell(cell); cell = new Cell(new Phrase("" + "\n" + "", titleFont)); cell.setRowspan(2); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable.addCell(cell); cell = new Cell(new Phrase("" + "\n" + "", titleFont)); cell.setRowspan(2); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable.addCell(cell); cell = new Cell(new Phrase("" + "\n" + "", titleFont)); cell.setRowspan(2); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable.addCell(cell); cell = new Cell(new Phrase("" + "\n" + "", titleFont)); cell.setRowspan(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("", titleFont)); cell.setColspan(2); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable.addCell(cell); cell = new Cell(new Phrase("" + "\n" + "", titleFont)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable.addCell(cell); cell = new Cell(new Phrase("" + "\n" + "", titleFont)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable.addCell(cell); cell = new Cell(new Phrase("" + "\n" + "", titleFont)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable.addCell(cell); cell = new Cell(new Phrase("" + "\n" + "", titleFont)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable.addCell(cell); java.text.NumberFormat formatenet = java.text.NumberFormat.getNumberInstance(); formatenet.setMaximumFractionDigits(0);// if (netreporthash != null && netreporthash.size() > 0) { Iterator keys = netreporthash.keySet().iterator(); HostNode node = null; while (keys.hasNext()) { node = (HostNode) keys.next(); Hashtable report_has = (Hashtable) netreporthash.get(node); String hostname = (String) report_has.get("equipname"); // WritableSheet sheet = wb.createSheet(hostname+"", // sheetNum); Hashtable CPU = (Hashtable) report_has.get("CPU"); String Ping = (String) report_has.get("Ping"); String ip = (String) report_has.get("ip"); Calendar colTime = Calendar.getInstance(); Date cc = colTime.getTime(); Vector netifVector = (Vector) report_has.get("netifVector"); Hashtable portconfigHash = (Hashtable) report_has.get("portconfigHash"); List reportports = (List) report_has.get("reportports"); Vector iprouterVector = (Vector) report_has.get("iprouterVector"); Hashtable memMaxHash = (Hashtable) report_has.get("memmaxhash"); Hashtable maxping = (Hashtable) report_has.get("ping"); SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); String[] netIfItemch = { "", "", "", "(M)", "", "", "" }; String[] ipRouterItemch = { "", "", "", "", "", "" }; String[] memoryItem = { "Capability", "Utilization" }; String[] diskItem = { "AllSize", "UsedSize", "Utilization", "INodeUsedSize", "INodeUtilization" }; String[] diskItemch = { "", "", "", "i-node", "i-node" }; String[] iproutertype = { "", "", "", "direct(3)", "indirect(4)" }; String[] iprouterproto = { "", "other(1)", "local(2)", "netmgmt(3)", "icmp(4)", "egp(5)", "ggp(6)", "hello(7)", "rip(8)", "is-is(9)", "es-is(10)", "ciscoIgrp(11)", "bbnSpfIgp(12)", "ospf(13)", "bgp(14)" }; String avginput = (String) report_has.get("avginput"); String avgoutput = (String) report_has.get("avgoutput"); String maxinput = (String) report_has.get("maxinput"); String maxoutput = (String) report_has.get("maxoutput"); String level4 = (String) report_has.get("level4"); cell = new Cell(new Phrase(ip, contextFont)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable.addCell(cell); String string1 = ((String) maxping.get("pingmax")).replace("%", ""); String string2 = ((String) maxping.get("avgpingcon")).replace("%", ""); cell = new Cell(new Phrase(formatenet.format(Double.valueOf(string2)), contextFont)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable.addCell(cell); cell = new Cell(new Phrase(formatenet.format(Double.valueOf(string1)), contextFont)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable.addCell(cell); String cpu = ""; if (CPU.get("cpu") != null) cpu = (String) CPU.get("cpu"); String cpumax = ""; if (CPU.get("cpumax") != null) cpumax = (String) CPU.get("cpumax"); String avgcpu = ""; if (CPU.get("avgcpu") != null) avgcpu = (String) CPU.get("avgcpu"); String string3 = avgcpu.replace("%", ""); String string4 = cpumax.replace("%", ""); cell = new Cell(new Phrase(formatenet.format(Double.valueOf(string3)), contextFont)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable.addCell(cell); cell = new Cell(new Phrase(formatenet.format(Double.valueOf(string4)), contextFont)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable.addCell(cell); cell = new Cell(""); aTable.addCell(cell); cell = new Cell(""); aTable.addCell(cell); cell = new Cell(new Phrase(avgoutput.replace(".0", ""), contextFont)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable.addCell(cell); cell = new Cell(new Phrase(maxoutput.replace(".0", ""), contextFont)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable.addCell(cell); cell = new Cell(new Phrase(avginput.replace(".0", ""), contextFont)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable.addCell(cell); cell = new Cell(new Phrase(maxinput.replace(".0", ""), contextFont)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable.addCell(cell); cell = new Cell(new Phrase(level4, contextFont)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable.addCell(cell); } } // ===================================================================== Hashtable hostreporthash = (Hashtable) allreporthash.get("hostreporthash"); int hostsize = 0; if (hostreporthash != null) { hostsize = hostreporthash.size(); } cell = new Cell(new Phrase("" + "\n" + "" + "\n" + "", titleFont)); cell.setRowspan(2 + hostsize); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable.addCell(cell); cell = new Cell(new Phrase("IP", titleFont)); cell.setRowspan(2); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable.addCell(cell); cell = new Cell(new Phrase("" + "\n" + "(%)", titleFont)); cell.setColspan(2); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable.addCell(cell); cell = new Cell(new Phrase("CPU(%)", titleFont)); 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("KB/S", titleFont)); cell.setColspan(4); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable.addCell(cell); cell = new Cell(new Phrase("", titleFont)); cell.setRowspan(2); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable.addCell(cell); cell = new Cell(new Phrase("" + "\n" + "", titleFont)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable.addCell(cell); cell = new Cell(new Phrase("" + "\n" + "", titleFont)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable.addCell(cell); cell = new Cell(new Phrase("" + "\n" + "", titleFont)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable.addCell(cell); cell = new Cell(new Phrase("" + "\n" + "", titleFont)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable.addCell(cell); cell = new Cell(new Phrase("" + "\n" + "", titleFont)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable.addCell(cell); cell = new Cell(new Phrase("" + "\n" + "", titleFont)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable.addCell(cell); cell = new Cell(new Phrase("" + "\n" + "", titleFont)); cell.setColspan(2); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable.addCell(cell); cell = new Cell(new Phrase("" + "\n" + "", titleFont)); cell.setColspan(2); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable.addCell(cell); java.text.NumberFormat formatehost = java.text.NumberFormat.getNumberInstance(); formatehost.setMaximumFractionDigits(0);// if (hostreporthash != null && hostreporthash.size() > 0) { Iterator keys = hostreporthash.keySet().iterator(); HostNode node = null; while (keys.hasNext()) { node = (HostNode) keys.next(); // String newip = doip(ip); Hashtable report_has = (Hashtable) hostreporthash.get(node); String hostname = (String) report_has.get("equipname"); Hashtable CPU = (Hashtable) report_has.get("CPU"); String Ping = (String) report_has.get("Ping"); Calendar colTime = (Calendar) report_has.get("time"); Date cc = colTime.getTime(); Hashtable Memory = (Hashtable) report_has.get("Memory"); Hashtable Disk = (Hashtable) report_has.get("Disk"); Hashtable memMaxHash = (Hashtable) report_has.get("memmaxhash"); Hashtable memAvgHash = (Hashtable) report_has.get("memavghash"); Hashtable maxping = (Hashtable) report_has.get("ping"); String ip = (String) report_has.get("ip"); SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); String[] memoryItemch = { "", "", "", "" }; String[] memoryItem = { "Capability", "c" }; String[] diskItem = { "AllSize", "UsedSize", "Utilization", "Utilizationvalue" }; String[] diskItemch = { "", "", "" }; String level4 = (String) report_has.get("level4"); cell = new Cell(new Phrase(ip, contextFont)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable.addCell(cell); // ======= String string7 = ((String) maxping.get("pingmax")).replace("%", ""); String string8 = ((String) maxping.get("avgpingcon")).replace("%", ""); // formate.format(Double.valueOf(string1)); // System.out.println(formate.format(Double.valueOf(string))+"@@@@@@@0000000000"); cell = new Cell(new Phrase(formatehost.format(Double.valueOf(string8)), contextFont)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable.addCell(cell); cell = new Cell(new Phrase(formatehost.format(Double.valueOf(string7)), contextFont)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable.addCell(cell); String cpu = ""; if (CPU.get("cpu") != null) cpu = (String) CPU.get("cpu"); String cpumax = ""; if (CPU.get("cpumax") != null) cpumax = (String) CPU.get("cpumax"); String avgcpu = ""; if (CPU.get("avgcpu") != null) avgcpu = (String) CPU.get("avgcpu"); String string3 = avgcpu.replace("%", ""); String string4 = cpumax.replace("%", ""); cell = new Cell(new Phrase(formatehost.format(Double.valueOf(string3)), contextFont)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable.addCell(cell); cell = new Cell(new Phrase(formatehost.format(Double.valueOf(string4)), contextFont)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable.addCell(cell); String avgvalue = "0.0%"; if (memAvgHash.get("PhysicalMemory") != null) { avgvalue = (String) memAvgHash.get("PhysicalMemory"); String string5 = avgvalue.replace("%", ""); cell = new Cell(new Phrase(formatehost.format(Double.valueOf(string5)), contextFont)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable.addCell(cell); } else { String string5 = avgvalue.replace("%", ""); cell = new Cell(new Phrase(formatehost.format(Double.valueOf(string5)), contextFont)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable.addCell(cell); } String value = "0.0%"; if (memMaxHash.get("PhysicalMemory") != null) { value = (String) memMaxHash.get("PhysicalMemory"); String string6 = value.replace("%", ""); cell = new Cell(new Phrase(formatehost.format(Double.valueOf(string6)), contextFont)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable.addCell(cell); } else { String string6 = value.replace("%", ""); cell = new Cell(new Phrase(formatehost.format(Double.valueOf(string6)), contextFont)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable.addCell(cell); } String value1 = "0"; String value2 = "100"; String name = ""; String name1 = ""; String Utilization = ""; String Utilization1 = ""; if (Disk != null && Disk.size() > 0) { for (int i = 0; i < Disk.size(); i++) { Hashtable diskhash = (Hashtable) (Disk.get(new Integer(i))); if (diskhash.get(diskItem[3]) != null) { if (value1.compareTo((String) diskhash.get(diskItem[3])) < 0) { value1 = (String) diskhash.get(diskItem[3]); name = (String) diskhash.get("name"); Utilization = (String) diskhash.get(diskItem[2]); } } if (diskhash.get(diskItem[3]) != null) { if (value2.compareTo((String) diskhash.get(diskItem[3])) >= 0) { value2 = (String) diskhash.get(diskItem[3]); name1 = (String) diskhash.get("name"); Utilization1 = (String) diskhash.get(diskItem[2]); } } } cell = new Cell(name + " " + Utilization); cell.setColspan(2); aTable.addCell(cell); cell = new Cell(name1 + " " + Utilization1); cell.setColspan(2); aTable.addCell(cell); } else { cell = new Cell("---"); cell.setColspan(2); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable.addCell(cell); cell = new Cell("---"); cell.setColspan(2); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable.addCell(cell); } cell = new Cell(new Phrase(level4, contextFont)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable.addCell(cell); } } // =========================================================================== Hashtable dbreporthash = (Hashtable) allreporthash.get("dbreporthash"); int dbsize = 0; if (dbreporthash != null) { dbsize = dbreporthash.size(); } cell = new Cell(new Phrase("" + "\n" + "" + "\n" + "", titleFont)); cell.setRowspan(2 + dbsize); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable.addCell(cell); cell = new Cell(new Phrase("IP", titleFont)); cell.setRowspan(2); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable.addCell(cell); cell = new Cell(new Phrase("", titleFont)); cell.setRowspan(2); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable.addCell(cell); cell = new Cell(new Phrase("" + "\n" + "(%)", titleFont)); cell.setColspan(2); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable.addCell(cell); cell = new Cell(new Phrase("" + "\n" + "(%)", titleFont)); cell.setColspan(2); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable.addCell(cell); for (int i = 0; i < 6; i++) { cell = new Cell(new Phrase("", contextFont)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable.addCell(cell); } cell = new Cell(new Phrase("" + "\n" + "", titleFont)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable.addCell(cell); cell = new Cell(new Phrase("" + "\n" + "", titleFont)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable.addCell(cell); cell = new Cell(new Phrase("" + "\n" + "", titleFont)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable.addCell(cell); cell = new Cell(new Phrase("" + "\n" + "", titleFont)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable.addCell(cell); for (int i = 0; i < 6; i++) { cell = new Cell(new Phrase("", contextFont)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable.addCell(cell); } java.text.NumberFormat formatedb = java.text.NumberFormat.getNumberInstance(); formatedb.setMaximumFractionDigits(0);// if (dbreporthash != null && dbreporthash.size() > 0) { Iterator keys = dbreporthash.keySet().iterator(); DBVo node = null; while (keys.hasNext()) { // String newip = doip(ip); node = (DBVo) keys.next(); Hashtable report_has = (Hashtable) dbreporthash.get(node); Hashtable maxping = (Hashtable) report_has.get("maxping"); String string1 = ((String) maxping.get("pingmax")).replace("%", ""); String string2 = ((String) maxping.get("avgpingcon")).replace("%", ""); String ip = (String) report_has.get("ip"); cell = new Cell(new Phrase(ip, contextFont)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable.addCell(cell); String dbtype = (String) report_has.get("dbtype"); cell = new Cell(new Phrase(dbtype, contextFont)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable.addCell(cell); // ======= cell = new Cell(new Phrase(formatedb.format(Double.valueOf(string2)), contextFont)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable.addCell(cell); cell = new Cell(new Phrase(formatedb.format(Double.valueOf(string1)), contextFont)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable.addCell(cell); String maxspace = ""; String minspace = ""; if ((Integer) report_has.get("maxspace") != 0) { maxspace = (Integer) report_has.get("maxspace") + ""; } if ((Integer) report_has.get("mixspace") != 0) { minspace = (Integer) report_has.get("mixspace") + ""; } if (dbtype.equals("SQLServer") || dbtype.equals("Sybase") || dbtype.equals("Informix")) { maxspace = "---"; minspace = "---"; } cell = new Cell(new Phrase(maxspace, contextFont)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable.addCell(cell); cell = new Cell(new Phrase(minspace, contextFont)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable.addCell(cell); for (int i = 0; i < 6; i++) { cell = new Cell(new Phrase("", contextFont)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable.addCell(cell); } } } // =================================================================== Hashtable tomcatreporthash = (Hashtable) allreporthash.get("tomcatreporthash"); Hashtable iisreporthash = (Hashtable) allreporthash.get("iisreporthash"); Hashtable weblogicreporthash = (Hashtable) allreporthash.get("weblogicreporthash"); int tomcatsize = 0; if (tomcatreporthash != null) { tomcatsize = tomcatreporthash.size(); } int iissize = 0; if (iisreporthash != null) { iissize = iisreporthash.size(); } int weblogicsize = 0; if (weblogicreporthash != null) { weblogicsize = weblogicreporthash.size(); } cell = new Cell(new Phrase("" + "\n" + "" + "\n" + "", titleFont)); cell.setRowspan(2 + tomcatsize + iissize + weblogicsize); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable.addCell(cell); cell = new Cell(new Phrase("IP", titleFont)); cell.setRowspan(2); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable.addCell(cell); cell = new Cell(new Phrase("", titleFont)); cell.setRowspan(2); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable.addCell(cell); cell = new Cell(new Phrase("" + "\n" + "(%)", titleFont)); cell.setColspan(2); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable.addCell(cell); for (int i = 0; i < 8; i++) { cell = new Cell(new Phrase("", contextFont)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable.addCell(cell); } cell = new Cell(new Phrase("" + "\n" + "", titleFont)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable.addCell(cell); cell = new Cell(new Phrase("" + "\n" + "", titleFont)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable.addCell(cell); for (int i = 0; i < 8; i++) { cell = new Cell(new Phrase("", titleFont)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable.addCell(cell); } // tomcat============================================================ java.text.NumberFormat formatetomcat = java.text.NumberFormat.getNumberInstance(); formatetomcat.setMaximumFractionDigits(0);// if (tomcatreporthash != null && tomcatreporthash.size() > 0) { Iterator keys = tomcatreporthash.keySet().iterator(); Node node = null; while (keys.hasNext()) { node = (Node) keys.next(); Hashtable report_has = (Hashtable) tomcatreporthash.get(node); Hashtable maxping = (Hashtable) report_has.get("maxping"); String string1 = ((String) maxping.get("pingmax")).replace("%", ""); String string2 = ((String) maxping.get("avgpingcon")).replace("%", ""); String ip = (String) report_has.get("ip"); cell = new Cell(new Phrase(ip, contextFont)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable.addCell(cell); String tomcattype = (String) report_has.get("TOMCAT"); cell = new Cell(new Phrase(tomcattype, contextFont)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable.addCell(cell); // ======= cell = new Cell(new Phrase(formatetomcat.format(Double.valueOf(string2)), contextFont)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable.addCell(cell); cell = new Cell(new Phrase(formatetomcat.format(Double.valueOf(string1)), contextFont)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable.addCell(cell); for (int i = 0; i < 8; i++) { cell = new Cell(new Phrase("", contextFont)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable.addCell(cell); } } } // IIS============================================================================ java.text.NumberFormat formateiis = java.text.NumberFormat.getNumberInstance(); formateiis.setMaximumFractionDigits(0);// if (iisreporthash != null && iisreporthash.size() > 0) { Iterator keys = iisreporthash.keySet().iterator(); Node node = null; while (keys.hasNext()) { node = (Node) keys.next(); Hashtable report_has = (Hashtable) iisreporthash.get(node); Hashtable maxping = (Hashtable) report_has.get("maxping"); String string1 = ((String) maxping.get("pingmax")).replace("%", ""); String string2 = ((String) maxping.get("avgpingcon")).replace("%", ""); String ip = (String) report_has.get("ip"); cell = new Cell(new Phrase(ip, contextFont)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable.addCell(cell); String tomcattype = (String) report_has.get("IIS"); cell = new Cell(new Phrase(tomcattype, contextFont)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable.addCell(cell); // ======= cell = new Cell(new Phrase(formateiis.format(Double.valueOf(string2)), contextFont)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable.addCell(cell); cell = new Cell(new Phrase(formateiis.format(Double.valueOf(string1)), contextFont)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable.addCell(cell); for (int i = 0; i < 8; i++) { cell = new Cell(new Phrase("", contextFont)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable.addCell(cell); } } } // weblogic================================================================ java.text.NumberFormat formateweblogic = java.text.NumberFormat.getNumberInstance(); formateweblogic.setMaximumFractionDigits(0);// if (weblogicreporthash != null && weblogicreporthash.size() > 0) { Iterator keys = weblogicreporthash.keySet().iterator(); Node node = null; while (keys.hasNext()) { node = (Node) keys.next(); Hashtable report_has = (Hashtable) weblogicreporthash.get(node); Hashtable maxping = (Hashtable) report_has.get("maxping"); String string1 = ((String) maxping.get("pingmax")).replace("%", ""); String string2 = ((String) maxping.get("avgpingcon")).replace("%", ""); String ip = (String) report_has.get("ip"); cell = new Cell(new Phrase(ip, contextFont)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable.addCell(cell); String tomcattype = (String) report_has.get("WEBLOGIC"); cell = new Cell(new Phrase(tomcattype, contextFont)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable.addCell(cell); // ======= cell = new Cell(new Phrase(formateweblogic.format(Double.valueOf(string2)), contextFont)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable.addCell(cell); cell = new Cell(new Phrase(formateweblogic.format(Double.valueOf(string1)), contextFont)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable.addCell(cell); for (int i = 0; i < 8; i++) { cell = new Cell(new Phrase("", contextFont)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable.addCell(cell); } } } // ============================================================= cell = new Cell(new Phrase("" + "\n" + "" + "\n" + "" + "\n" + "" + "\n" + "" + "\n" + "", titleFont)); cell.setRowspan(6); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable.addCell(cell); cell = new Cell(new Phrase("", titleFont)); cell.setRowspan(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("(%)", titleFont)); cell.setColspan(2); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable.addCell(cell); cell = new Cell(new Phrase("", contextFont)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable.addCell(cell); cell = new Cell(new Phrase("", contextFont)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable.addCell(cell); cell = new Cell(new Phrase("", contextFont)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable.addCell(cell); cell = new Cell(new Phrase("", contextFont)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable.addCell(cell); cell = new Cell(new Phrase("", contextFont)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable.addCell(cell); cell = new Cell(new Phrase("", contextFont)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable.addCell(cell); cell = new Cell(new Phrase("()", titleFont)); cell.setRowspan(2); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable.addCell(cell); cell = new Cell(new Phrase("" + "\n" + "", titleFont)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable.addCell(cell); cell = new Cell(new Phrase("" + "\n" + "", titleFont)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable.addCell(cell); cell = new Cell(new Phrase("" + "\n" + "", titleFont)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable.addCell(cell); cell = new Cell(new Phrase("" + "\n" + "", titleFont)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable.addCell(cell); for (int i = 0; i < 6; i++) { cell = new Cell(new Phrase("", contextFont)); 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("", contextFont)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable.addCell(cell); cell = new Cell(new Phrase("", contextFont)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable.addCell(cell); cell = new Cell(new Phrase("", contextFont)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable.addCell(cell); cell = new Cell(new Phrase("", contextFont)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable.addCell(cell); for (int i = 0; i < 6; i++) { cell = new Cell(new Phrase("", contextFont)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable.addCell(cell); } cell = new Cell(new Phrase("0", contextFont)); 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("", contextFont)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable.addCell(cell); cell = new Cell(new Phrase("", contextFont)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable.addCell(cell); cell = new Cell(new Phrase("", contextFont)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable.addCell(cell); cell = new Cell(new Phrase("", contextFont)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable.addCell(cell); for (int i = 0; i < 6; i++) { cell = new Cell(new Phrase("", contextFont)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable.addCell(cell); } cell = new Cell(new Phrase("0", contextFont)); 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("", contextFont)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable.addCell(cell); cell = new Cell(new Phrase("", contextFont)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable.addCell(cell); cell = new Cell(new Phrase("", contextFont)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable.addCell(cell); cell = new Cell(new Phrase("", contextFont)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable.addCell(cell); for (int i = 0; i < 6; i++) { cell = new Cell(new Phrase("", contextFont)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable.addCell(cell); } cell = new Cell(new Phrase("0", contextFont)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable.addCell(cell); cell = new Cell(new Phrase("SSO", titleFont)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable.addCell(cell); cell = new Cell(new Phrase("", contextFont)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable.addCell(cell); cell = new Cell(new Phrase("", contextFont)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable.addCell(cell); cell = new Cell(new Phrase("", contextFont)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable.addCell(cell); cell = new Cell(new Phrase("", contextFont)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable.addCell(cell); for (int i = 0; i < 6; i++) { cell = new Cell(new Phrase("", contextFont)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable.addCell(cell); } cell = new Cell(new Phrase("0", contextFont)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable.addCell(cell); document.add(aTable); document.close(); } catch (Exception e) { // TODO: handle exception } }
From source file:com.afunms.report.abstraction.ExcelReport1.java
public void createReport_tomcatNewPDF(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"); String downnum = (String) reportHash.get("downnum"); Tomcat tomcat = (Tomcat) reportHash.get("tomcat"); /* String type = (String)request.getAttribute("type"); */ Document document = new Document(PageSize.A4); // (Writer)document(Writer) PdfWriter.getInstance(document, new FileOutputStream(file)); document.open();// ww w. jav a 2s . com // 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")); 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"))); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable.addCell(cell); cell = new Cell(new Phrase("\n" + "JVM" + "\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"))); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable.addCell(cell); cell = new Cell(new Phrase("\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" + "TOMCAT" + "\n", titleFont)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable.addCell(cell); cell = new Cell(new Phrase(tomcat.getVersion())); cell.setColspan(2); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable.addCell(cell); cell = new Cell(new Phrase("JVM", titleFont)); cell.setColspan(2); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable.addCell(cell); cell = new Cell(new Phrase(tomcat.getJvmversion())); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable.addCell(cell); cell = new Cell(new Phrase("\n" + "JVM" + "\n", titleFont)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable.addCell(cell); cell = new Cell(new Phrase(tomcat.getJvmvender())); 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(tomcat.getOs())); 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 " + 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_iisNewPDF(String file) throws DocumentException, IOException { 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"); Tomcat tomcat = (Tomcat) reportHash.get("tomcat"); Hashtable maxjvm = (Hashtable) reportHash.get("maxjvm"); String downnum = (String) reportHash.get("downnum"); IIS iis = (IIS) reportHash.get("iis"); // time//from w ww.j a v a 2 s . c om Hashtable pollingtime_ht = new Hashtable(); IISManager tm = new IISManager(); String lasttime; String nexttime; try { pollingtime_ht = tm.getCollecttime(iis.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; } // List data_list = new ArrayList(); Hashtable iisvalues = ShareData.getIisdata(); if (iisvalues != null && iisvalues.size() > 0) { data_list = (List) iisvalues.get(ip); } System.out.println(data_list + "----------------------------===================="); String totalBytesSentHighWord = ""; String totalBytesSentLowWord = ""; String totalBytesReceivedHighWord = ""; String totalBytesReceivedLowWord = ""; String totalFilesSent = ""; String totalFilesReceived = ""; String currentAnonymousUsers = ""; String totalAnonymousUsers = ""; String maxAnonymousUsers = ""; String currentConnections = ""; String maxConnections = ""; String connectionAttempts = ""; String logonAttempts = ""; String totalGets = ""; String totalPosts = ""; String totalNotFoundErrors = ""; if (data_list != null && data_list.size() > 0) { IISVo iisvo = (IISVo) data_list.get(0); totalBytesSentHighWord = iisvo.getTotalBytesSentHighWord(); totalBytesSentLowWord = iisvo.getTotalBytesSentLowWord(); totalBytesReceivedHighWord = iisvo.getTotalBytesReceivedHighWord(); totalBytesReceivedLowWord = iisvo.getTotalBytesReceivedLowWord(); totalFilesSent = iisvo.getTotalFilesSent(); totalFilesReceived = iisvo.getTotalFilesReceived(); currentAnonymousUsers = iisvo.getCurrentAnonymousUsers(); totalAnonymousUsers = iisvo.getTotalAnonymousUsers(); maxAnonymousUsers = iisvo.getMaxAnonymousUsers(); currentConnections = iisvo.getCurrentConnections(); maxConnections = iisvo.getMaxConnections(); connectionAttempts = iisvo.getConnectionAttempts(); logonAttempts = iisvo.getLogonAttempts(); totalGets = iisvo.getTotalGets(); totalPosts = iisvo.getTotalPosts(); totalNotFoundErrors = iisvo.getTotalNotFoundErrors(); } // 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(10); 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"))); 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(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", titleFont)); cell.setRowspan(8); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable.addCell(cell); cell = new Cell(new Phrase("\n" + "32 :" + "\n", titleFont)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable.addCell(cell); cell = new Cell(new Phrase(totalBytesSentHighWord)); cell.setColspan(2); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable.addCell(cell); cell = new Cell(new Phrase("32 :", titleFont)); cell.setColspan(2); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable.addCell(cell); cell = new Cell(new Phrase(totalBytesSentLowWord)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable.addCell(cell); cell = new Cell(new Phrase("\n" + "32 :" + "\n", titleFont)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable.addCell(cell); cell = new Cell(new Phrase(totalBytesReceivedHighWord)); cell.setColspan(2); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable.addCell(cell); cell = new Cell(new Phrase("32 :", titleFont)); cell.setColspan(2); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable.addCell(cell); cell = new Cell(new Phrase(totalBytesReceivedLowWord)); 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(totalFilesSent)); 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(totalFilesReceived)); 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(currentAnonymousUsers)); 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(totalAnonymousUsers)); 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(maxAnonymousUsers)); 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(currentConnections)); 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(maxConnections)); 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(connectionAttempts)); 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(logonAttempts)); cell.setColspan(2); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable.addCell(cell); cell = new Cell(new Phrase("GET:", titleFont)); cell.setColspan(2); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable.addCell(cell); cell = new Cell(new Phrase(totalGets)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable.addCell(cell); cell = new Cell(new Phrase("\n" + "POST:" + "\n", titleFont)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // aTable.addCell(cell); cell = new Cell(new Phrase(totalPosts)); 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(totalNotFoundErrors)); 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 " + 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 ww 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;//from ww w . java2s . com 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
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 ww w. ja v a 2 s. c om // 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(); }