Example usage for com.lowagie.text.pdf PdfPTable addCell

List of usage examples for com.lowagie.text.pdf PdfPTable addCell

Introduction

In this page you can find the example usage for com.lowagie.text.pdf PdfPTable addCell.

Prototype

public void addCell(Phrase phrase) 

Source Link

Document

Adds a cell element.

Usage

From source file:com.afunms.report.abstraction.ExcelReport1.java

public void createReport_capacityPDF(String file) throws DocumentException, IOException {
    String starttime = (String) reportHash.get("starttime");
    String totime = (String) reportHash.get("totime");

    String hostname = (String) reportHash.get("equipname");
    String ip = (String) reportHash.get("ip");
    String newip = doip(ip);//from ww w  .  ja  v a2  s. c o  m
    // WritableSheet sheet = wb.createSheet(hostname + "", 0);
    Hashtable CPU = (Hashtable) reportHash.get("CPU");
    if (CPU == null)
        CPU = new Hashtable();
    String Ping = (String) reportHash.get("Ping");
    Calendar colTime = (Calendar) reportHash.get("time");
    Date cc = colTime.getTime();
    Hashtable Memory = (Hashtable) reportHash.get("Memory");
    Hashtable Disk = (Hashtable) reportHash.get("Disk");

    Hashtable memMaxHash = (Hashtable) reportHash.get("memmaxhash");
    Hashtable memAvgHash = (Hashtable) reportHash.get("memavghash");
    Hashtable maxping = (Hashtable) reportHash.get("ping");

    SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");

    String[] memoryItemch = { "", "", "", "" };
    String[] memoryItem = { "Capability", "Utilization" };
    String[] diskItem = { "AllSize", "UsedSize", "Utilization" };
    String[] diskItemch = { "", "", "" };
    // 
    Document document = new Document(PageSize.A4);
    // (Writer)document(Writer)
    PdfWriter.getInstance(document, new FileOutputStream(file));
    document.open();
    // 
    BaseFont bfChinese = BaseFont.createFont("STSong-Light", "UniGB-UCS2-H", BaseFont.NOT_EMBEDDED);
    // 
    Font titleFont = new Font(bfChinese, 12, Font.BOLD);
    // 
    Font contextFont = new Font(bfChinese, 10, Font.NORMAL);
    Paragraph title = new Paragraph(hostname + "", titleFont);
    // 
    title.setAlignment(Element.ALIGN_CENTER);
    // title.setFont(titleFont);
    document.add(title);

    String contextString = ":" + impReport.getTimeStamp() + " \n"// 
            + ":" + starttime + "  " + totime;
    Paragraph context = new Paragraph(contextString, contextFont);
    // 
    context.setAlignment(Element.ALIGN_LEFT);
    // context.setFont(contextFont);
    // 
    context.setSpacingBefore(5);
    // 
    context.setFirstLineIndent(5);
    document.add(context);
    document.add(new Phrase("\n"));
    Font fontChinese = new Font(bfChinese, 12, Font.NORMAL, Color.black);

    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");
    PdfPTable aTable1 = new PdfPTable(4);
    float[] width = { 220f, 300f, 220f, 220f };
    aTable1.setWidths(width);
    aTable1.setWidthPercentage(100);

    aTable1.addCell(new Phrase("CPU", contextFont));
    aTable1.addCell(new Phrase("", contextFont));
    aTable1.addCell(new Phrase("", contextFont));
    aTable1.addCell(new Phrase("", contextFont));
    // aTable.addCell("3.2",Ping+"%");
    aTable1.addCell("");

    aTable1.addCell(cpu + "%");
    aTable1.addCell(cpumax);
    aTable1.addCell(avgcpu);

    Image img1 = Image.getInstance(
            ResourceCenter.getInstance().getSysPath() + "/resource/image/jfreechart/" + newip + "cpu" + ".png");
    // img.setAlignment(Image.MIDDLE);// 
    img1.scalePercent(75);
    document.add(aTable1);
    document.add(img1);

    if (Memory != null && Memory.size() > 0) {
        PdfPTable aTable2 = new PdfPTable(6);
        float[] widthss = { 220f, 300f, 220f, 220f, 220f, 220f };
        aTable2.setWidths(widthss);
        aTable2.setWidthPercentage(100);
        aTable2.addCell(new Phrase("", contextFont));
        aTable2.addCell(new Phrase("", contextFont));
        // 

        for (int i = 0; i < memoryItemch.length; i++) {
            PdfPCell cell = new PdfPCell(new Phrase(memoryItemch[i], contextFont));
            aTable2.addCell(cell);
        }
        // 
        for (int i = 0; i < Memory.size(); i++) {
            aTable2.addCell("");
            Hashtable mhash = (Hashtable) (Memory.get(new Integer(i)));
            String name = (String) mhash.get("name");
            PdfPCell cell1 = new PdfPCell(new Phrase(name));
            aTable2.addCell(cell1);
            for (int j = 0; j < memoryItem.length; j++) {
                String value = "";
                if (mhash.get(memoryItem[j]) != null) {
                    value = (String) mhash.get(memoryItem[j]);
                }
                PdfPCell cell2 = new PdfPCell(new Phrase(value));
                aTable2.addCell(cell2);
            }
            String value = "";
            if (memMaxHash.get(name) != null) {
                value = (String) memMaxHash.get(name);
                PdfPCell cell3 = new PdfPCell(new Phrase(value));
                aTable2.addCell(cell3);
            }
            String avgvalue = "";
            if (memAvgHash.get(name) != null) {
                avgvalue = (String) memAvgHash.get(name);
                aTable2.addCell(new Phrase(avgvalue));
            }

        } // end 
          // 
        Image img2 = Image.getInstance(ResourceCenter.getInstance().getSysPath() + "/resource/image/jfreechart/"
                + newip + "memory" + ".png");
        // img.setAlignment(Image.MIDDLE);// 
        img2.scalePercent(75);
        document.add(aTable2);
        document.add(img2);
    } else {
        PdfPTable aTable2 = new PdfPTable(6);

        float[] widthss = { 220f, 300f, 220f, 220f, 220f, 220f };
        aTable2.setWidths(widthss);
        aTable2.setWidthPercentage(100);
        /*
         * aTable2.setWidth(100); //  90%
         * aTable2.setAlignment(Element.ALIGN_CENTER);// 
         * aTable2.setAutoFillEmptyCells(true); // 
         * aTable2.setBorderWidth(1); //  aTable2.setBorderColor(new
         * Color(0, 125, 255)); //  aTable2.setPadding(2);//
         *  aTable2.setSpacing(0);// 
         * aTable2.setBorder(2);//  aTable2.endHeaders();
         */
        aTable2.addCell(new Phrase("", contextFont));
        aTable2.addCell(new Phrase("", contextFont));
        // 

        for (int i = 0; i < memoryItemch.length; i++) {
            PdfPCell cell = new PdfPCell(new Phrase(memoryItemch[i], contextFont));
            aTable2.addCell(cell);
        }
        // 
        String[] names = null;
        HostNodeDao dao = new HostNodeDao();
        HostNode node = (HostNode) dao.findByCondition("ip_address", ip).get(0);
        // Monitoriplist monitor = monitorManager.getByIpaddress(ip);
        if (node.getSysOid().startsWith("1.3.6.1.4.1.311")) {
            names = new String[] { "PhysicalMemory", "VirtualMemory" };
        } else {
            names = new String[] { "PhysicalMemory", "SwapMemory" };
        }
        for (int i = 0; i < names.length; i++) {
            String name = names[i];
            aTable2.addCell("");
            PdfPCell cell = new PdfPCell(new Phrase(names[i]));
            aTable2.addCell(cell);

            for (int j = 0; j < memoryItem.length; j++) {
                // 
                String value = "";
                PdfPCell cell1 = new PdfPCell(new Phrase(value));
                aTable2.addCell(cell1);
            }
            String value = "";
            if (memMaxHash.get(name) != null) {
                value = (String) memMaxHash.get(name);
                PdfPCell cell2 = new PdfPCell(new Phrase(value));
                aTable2.addCell(cell2);
            } else {
                PdfPCell cell3 = new PdfPCell(new Phrase(value));
                aTable2.addCell(cell3);
            }
            String avgvalue = "";
            if (memAvgHash.get(name) != null) {
                avgvalue = (String) memAvgHash.get(name);
                PdfPCell cell4 = new PdfPCell(new Phrase(avgvalue));
                aTable2.addCell(cell4);
            } else {
                PdfPCell cell5 = new PdfPCell(new Phrase(avgvalue));
                aTable2.addCell(cell5);
            }

        } // end 
          // 
        Image img2 = Image.getInstance(ResourceCenter.getInstance().getSysPath() + "/resource/image/jfreechart/"
                + newip + "memory" + ".png");
        // img.setAlignment(Image.MIDDLE);// 
        img2.scalePercent(75);
        document.add(aTable2);
        document.add(img2);

    }
    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 img3 = Image.getInstance(baos.toByteArray());
        img3.setAlignment(Image.MIDDLE);// 
        img3.scalePercent(76);
        document.add(new Paragraph("\n"));
        // document.add(aTable3);
        document.add(img3);
    }
    document.close();
}

From source file:com.afunms.report.abstraction.ExcelReport1.java

public void createReport_diskPDF(String file) throws DocumentException, IOException {
    String starttime = (String) reportHash.get("starttime");
    String totime = (String) reportHash.get("totime");

    String hostname = (String) reportHash.get("equipname");
    String ip = (String) reportHash.get("ip");
    String newip = doip(ip);//from w  ww .j av a  2  s . co m
    // WritableSheet sheet = wb.createSheet(hostname + "", 0);
    Hashtable CPU = (Hashtable) reportHash.get("CPU");
    if (CPU == null)
        CPU = new Hashtable();
    String Ping = (String) reportHash.get("Ping");
    // Calendar colTime = (Calendar) reportHash.get("time");
    // Date cc = colTime.getTime();
    Hashtable Memory = (Hashtable) reportHash.get("Memory");
    Hashtable Disk = (Hashtable) reportHash.get("Disk");

    Hashtable memMaxHash = (Hashtable) reportHash.get("memmaxhash");
    Hashtable memAvgHash = (Hashtable) reportHash.get("memavghash");
    Hashtable maxping = (Hashtable) reportHash.get("ping");

    SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");

    String[] memoryItemch = { "", "", "", "" };
    String[] memoryItem = { "Capability", "Utilization" };
    String[] diskItem = { "AllSize", "UsedSize", "Utilization" };
    String[] diskItemch = { "", "", "" };
    // 
    Document document = new Document(PageSize.A4);
    // (Writer)document(Writer)
    PdfWriter.getInstance(document, new FileOutputStream(file));
    document.open();
    // 
    BaseFont bfChinese = BaseFont.createFont("STSong-Light", "UniGB-UCS2-H", BaseFont.NOT_EMBEDDED);
    // 
    Font titleFont = new Font(bfChinese, 12, Font.BOLD);
    // 
    Font contextFont = new Font(bfChinese, 10, Font.NORMAL);
    Paragraph title = new Paragraph(hostname + "", titleFont);
    // 
    title.setAlignment(Element.ALIGN_CENTER);
    // title.setFont(titleFont);
    document.add(title);

    String contextString = ":" + impReport.getTimeStamp() + " \n"// 
            + ":" + starttime + "  " + totime;
    Paragraph context = new Paragraph(contextString, contextFont);
    // 
    context.setAlignment(Element.ALIGN_LEFT);
    // context.setFont(contextFont);
    // 
    context.setSpacingBefore(5);
    // 
    context.setFirstLineIndent(5);
    document.add(context);
    document.add(new Phrase("\n"));
    Font fontChinese = new Font(bfChinese, 12, Font.NORMAL, Color.black);
    PdfPTable aTable = new PdfPTable(4);
    float[] widths = { 220f, 300f, 220f, 220f };

    PdfPTable aTable3 = new PdfPTable(5);
    float[] widthss1 = { 220f, 440f, 150f, 150f, 220f };
    aTable3.setWidths(widthss1);
    aTable3.setWidthPercentage(100);
    if (Disk != null && Disk.size() > 0) {
        aTable3.addCell(new Phrase("", contextFont));
        aTable3.addCell(new Phrase("", contextFont));

        for (int i = 0; i < diskItemch.length; i++) {
            PdfPCell cell = new PdfPCell(new Phrase(diskItemch[i], contextFont));
            aTable3.addCell(cell);
        }
        // 

        for (int i = 0; i < Disk.size(); i++) {
            aTable3.addCell("");
            Hashtable diskhash = (Hashtable) (Disk.get(new Integer(i)));
            String name = (String) diskhash.get("name");
            PdfPCell cell = new PdfPCell(new Phrase(name));
            aTable3.addCell(cell);
            for (int j = 0; j < diskItem.length; j++) {
                String value = "";
                if (diskhash.get(diskItem[j]) != null) {
                    value = (String) diskhash.get(diskItem[j]);
                }
                PdfPCell cell1 = new PdfPCell(new Phrase(value));
                aTable3.addCell(cell1);
            }
        } // end 
          // 

        Image img3 = Image.getInstance(ResourceCenter.getInstance().getSysPath() + "/resource/image/jfreechart/"
                + newip + "disk" + ".png");
        img3.setAlignment(Image.MIDDLE);// 
        img3.scalePercent(78);
        document.add(aTable3);
        // document.add(new Paragraph("\n"));
        document.add(img3);

    }
    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 img3 = Image.getInstance(baos.toByteArray());
        img3.setAlignment(Image.MIDDLE);// 
        img3.scalePercent(76);
        document.add(new Paragraph("\n"));
        // document.add(aTable3);
        document.add(img3);
    }
    document.close();
}

From source file:com.afunms.report.abstraction.ExcelReport1.java

public void createReport_networkPDF(String file) throws DocumentException, IOException {
    String runmodel = PollingEngine.getCollectwebflag();
    Hashtable CPU = (Hashtable) reportHash.get("CPU");
    String Ping = (String) reportHash.get("Ping");
    String ip = (String) reportHash.get("ip");
    String newip = doip(ip);/*from  w  w w  .  j  a v a 2  s.  c om*/
    Calendar colTime = (Calendar) reportHash.get("time");
    Date cc = colTime.getTime();
    Vector netifVector = (Vector) reportHash.get("netifVector");
    Hashtable portconfigHash = (Hashtable) reportHash.get("portconfigHash");
    List reportports = (List) reportHash.get("reportports");
    Vector iprouterVector = (Vector) reportHash.get("iprouterVector");

    Hashtable Memory = (Hashtable) reportHash.get("Memory");
    Hashtable Disk = (Hashtable) reportHash.get("Disk");
    String hostname = (String) reportHash.get("equipname");
    Hashtable memMaxHash = (Hashtable) reportHash.get("memmaxhash");
    Hashtable maxping = (Hashtable) reportHash.get("ping");

    SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");

    String[] netIfItemch = { "", "", "", "(M)(KB/S)", "", "(KB/S)",
            "(KB/S)" };
    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)" };
    // 
    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);
    BaseFont bfChinese1 = BaseFont.createFont("Times-Roman", "", BaseFont.NOT_EMBEDDED);
    // 
    Font titleFont = new Font(bfChinese, 12, Font.BOLD);
    // 
    Font contextFont = new Font(bfChinese, 10, Font.NORMAL);

    Paragraph title = new Paragraph(hostname + "", titleFont);
    // 
    title.setAlignment(Element.ALIGN_CENTER);
    // title.setFont(titleFont);
    document.add(title);
    String contextString = ":" + impReport.getTimeStamp() + " \n"// 
            + ":" + sdf.format(cc);

    Paragraph context = new Paragraph(new Phrase(contextString, titleFont));
    // 
    context.setAlignment(Element.ALIGN_CENTER);
    // context.setFont(contextFont);
    // 
    context.setSpacingBefore(5);
    // 
    context.setFirstLineIndent(5);
    document.add(context);
    document.add(new Paragraph("\n"));
    //  Table 
    Font fontChinese = new Font(bfChinese, 12, Font.NORMAL, Color.black);
    Table aTable = new Table(4);
    // PdfPTable pdfPTable = new PdfPTable(aTable);
    // float[] widths = { 220f, 300f, 220f, 220f };
    // aTable.setWidths(widths);
    // aTable.setWidthPercentage(100);
    aTable.setWidth(100);
    // 
    aTable.setPadding(5);
    aTable.setAutoFillEmptyCells(true);
    Cell pc1 = new Cell(new Phrase("", contextFont));
    // pc1.setRowspan(2);
    Cell pc2 = new Cell(new Phrase("", contextFont));
    Cell pc3 = new Cell(new Phrase("", contextFont));
    Cell pc4 = new Cell(new Phrase("", contextFont));
    pc1.setBackgroundColor(Color.LIGHT_GRAY);
    pc2.setBackgroundColor(Color.LIGHT_GRAY);
    pc3.setBackgroundColor(Color.LIGHT_GRAY);
    pc4.setBackgroundColor(Color.LIGHT_GRAY);
    aTable.addCell(pc1);
    aTable.addCell(pc2);
    aTable.addCell(pc3);
    aTable.addCell(pc4);
    // aTable.addCell("3.2",Ping+"%");
    aTable.addCell("");
    aTable.addCell(Ping + "%");
    aTable.addCell((String) maxping.get("pingmax"));
    aTable.addCell((String) maxping.get("avgpingcon"));
    Image img = Image.getInstance(ResourceCenter.getInstance().getSysPath() + "/resource/image/jfreechart/"
            + newip + "ConnectUtilization" + ".png");
    // img.setAbsolutePosition(0, 0);
    img.setAlignment(Image.LEFT);// 
    img.scalePercent(76);
    document.add(aTable);
    document.add(img);
    document.add(new Paragraph("\n"));

    // document.add(new Paragraph("\n"));
    // document.close();
    Table aTable1 = new Table(4);
    aTable1.setWidth(100);
    // 
    aTable1.setPadding(5);
    aTable1.setAutoFillEmptyCells(true);
    // float[] width = { 220f, 300f, 220f, 220f };
    // aTable1.setWidths(width);
    // aTable1.setWidthPercentage(100);
    // aTable.addCell("3.2",Ping+"%");
    pc1 = new Cell(new Phrase("CPU", contextFont));
    // pc1.setRowspan(2);
    pc2 = new Cell(new Phrase("", contextFont));
    pc3 = new Cell(new Phrase("", contextFont));
    pc4 = new Cell(new Phrase("", contextFont));
    pc1.setBackgroundColor(Color.LIGHT_GRAY);
    pc2.setBackgroundColor(Color.LIGHT_GRAY);
    pc3.setBackgroundColor(Color.LIGHT_GRAY);
    pc4.setBackgroundColor(Color.LIGHT_GRAY);
    aTable1.addCell(pc1);
    aTable1.addCell(pc2);
    aTable1.addCell(pc3);
    aTable1.addCell(pc4);
    aTable1.addCell("");
    aTable1.addCell((String) CPU.get("cpu") + "%");
    aTable1.addCell((String) CPU.get("cpumax"));
    aTable1.addCell((String) CPU.get("avgcpu"));

    Image img1 = Image.getInstance(
            ResourceCenter.getInstance().getSysPath() + "/resource/image/jfreechart/" + newip + "cpu" + ".png");
    // img.setAbsolutePosition(0, 0);
    img1.setAlignment(Image.MIDDLE);// 
    img1.scalePercent(76);
    document.add(aTable1);
    document.add(img1);
    document.add(new Paragraph("\n"));
    if (netifVector != null && netifVector.size() > 0) {
        Table aTable2 = new Table(8);
        aTable2.setWidth(100);
        // 
        aTable2.setPadding(5);
        aTable2.setAutoFillEmptyCells(true);
        // float[] width2 = { 300f, 220f, 220f, 180f, 300f, 180f, 220f, 220f
        // };
        // aTable2.setWidths(width2);
        // aTable2.setWidthPercentage(100);
        // aTable2.setHeaderRows(1);
        Cell ct = new Cell(new Phrase("", contextFont));
        // ct.setRowspan(netifVector.size() + 1);
        ct.setBackgroundColor(Color.lightGray);
        ct.setHorizontalAlignment(Element.ALIGN_CENTER);
        ct.setVerticalAlignment(Element.ALIGN_MIDDLE);
        aTable2.addCell(ct);
        // 
        // allRow = allRow;
        Color color = new Color(204, 204, 255);
        for (int i = 0; i < netIfItemch.length; i++) {
            Cell cell = new Cell(new Paragraph(netIfItemch[i], contextFont));
            cell.setBackgroundColor(Color.LIGHT_GRAY);
            aTable2.addCell(cell);
        }
        // 
        for (int i = 0; i < netifVector.size(); i++) {
            aTable2.addCell("");
            String[] strs = (String[]) netifVector.get(i);
            String ifname = strs[1];
            String index = strs[0];
            for (int j = 0; j < strs.length; j++) {
                if (j == 1) {
                    String linkuse = "";
                    if (portconfigHash != null && portconfigHash.size() > 0) {
                        if (portconfigHash.get(ip + ":" + index) != null)
                            linkuse = (String) portconfigHash.get(ip + ":" + index);
                    }
                    Cell cell1 = new Cell(new Phrase(strs[j], contextFont));
                    Cell cell2 = new Cell(new Phrase(linkuse, contextFont));
                    cell1.setLeading(6);
                    cell2.setLeading(6);
                    if (i % 2 != 0) {
                        cell1.setBackgroundColor(color);
                        cell2.setBackgroundColor(color);
                    }
                    aTable2.addCell(cell1);
                    aTable2.addCell(cell2);

                } else if (j > 1) {
                    Cell cell3 = new Cell(new Phrase(strs[j].replace("KB/", ""), contextFont));
                    cell3.setLeading(6);
                    if (i % 2 != 0) {
                        cell3.setBackgroundColor(color);
                    }
                    aTable2.addCell(cell3);

                } else {
                    Cell cell4 = new Cell(new Phrase(strs[j].replace("KB/", ""), contextFont));
                    cell4.setLeading(6);
                    if (i % 2 != 0) {
                        cell4.setBackgroundColor(color);
                    }
                    aTable2.addCell(cell4);
                }
            } // end 

        }
        document.add(aTable2);
        document.add(new Paragraph("\n"));
    }
    if ("0".equals(runmodel)) {
        // 
        if (iprouterVector != null && iprouterVector.size() > 0) {
            PdfPTable aTable3 = new PdfPTable(7);
            float[] width2 = { 240f, 170f, 310f, 300f, 220f, 180f, 330f };
            aTable3.setWidths(width2);
            aTable3.setWidthPercentage(100);
            aTable3.setHeaderRows(1);
            aTable3.addCell(new Phrase("", contextFont));
            // 
            // allRow = allRow+1;
            for (int i = 0; i < ipRouterItemch.length; i++) {
                aTable3.addCell(new Phrase(ipRouterItemch[i], contextFont));

            }

            // 

            for (int i = 0; i < iprouterVector.size(); i++) {
                aTable3.addCell("         ");

                IpRouter iprouter = (IpRouter) iprouterVector.get(i);
                aTable3.addCell(iprouter.getIfindex());
                aTable3.addCell(iprouter.getDest());
                aTable3.addCell(iprouter.getNexthop());
                aTable3.addCell(iproutertype[Integer.parseInt(iprouter.getType().longValue() + "")]);
                aTable3.addCell(iprouterproto[Integer.parseInt(iprouter.getProto().longValue() + "")]);
                aTable3.addCell(iprouter.getMask());
            }
            document.add(aTable3);
            document.add(new Paragraph("\n"));
        }
    } else {
        // 
        List routerList = (ArrayList) reportHash.get("routerList");
        if (routerList != null) {
            PdfPTable aTable3 = new PdfPTable(7);
            float[] width2 = { 240f, 170f, 310f, 300f, 220f, 180f, 330f };
            aTable3.setWidths(width2);
            aTable3.setWidthPercentage(100);
            aTable3.setHeaderRows(1);
            aTable3.addCell(new Phrase("", contextFont));
            // 
            // allRow = allRow+1;
            for (int i = 0; i < ipRouterItemch.length; i++) {
                aTable3.addCell(new Phrase(ipRouterItemch[i], contextFont));
            }
            for (int i = 0; i < routerList.size(); i++) {
                RouterNodeTemp iprouter = (RouterNodeTemp) routerList.get(i);
                aTable3.addCell("         ");
                aTable3.addCell(iprouter.getIfindex());
                aTable3.addCell(iprouter.getDest());
                aTable3.addCell(iprouter.getNexthop());
                aTable3.addCell(iprouter.getType());
                aTable3.addCell(iprouter.getProto());
                aTable3.addCell(iprouter.getMask());
            }
            document.add(aTable3);
            document.add(new Paragraph("\n"));
        }
    }
    // doc

    if (reportports != null && reportports.size() > 0) {
        // 

        // aTable4.addCell("");
        for (int i = 0; i < reportports.size(); i++) {
            PdfPTable aTable4 = new PdfPTable(2);
            float[] width2 = { 600f, 300f };
            aTable4.setWidths(width2);
            aTable4.setWidthPercentage(100);
            com.afunms.config.model.Portconfig portconfig = (com.afunms.config.model.Portconfig) reportports
                    .get(i);

            Phrase phrase = new Phrase("", contextFont);
            Phrase phrase1 = new Phrase(portconfig.getPortindex() + "(" + portconfig.getName() + ")");
            Phrase phrase2 = new Phrase("", contextFont);
            aTable4.addCell(new Phrase("" + portconfig.getPortindex() + "(" + portconfig.getName() + ")",
                    contextFont));
            // aTable4.addCell(new Phrase(phrase++ portconfig.getPortindex()
            // + "("+ portconfig.getName() +phrase2));
            if (portconfig.getLinkuse() == null)
                portconfig.setLinkuse("");
            /*
             * Cell cell1 = new Cell(new Phrase(":"+
             * portconfig.getLinkuse(),contextFont));
             */
            aTable4.addCell(new Phrase(":" + portconfig.getLinkuse(), contextFont));
            document.add(aTable4);
            // 
            Image img2 = Image.getInstance(ResourceCenter.getInstance().getSysPath()
                    + "/resource/image/jfreechart/" + newip + portconfig.getPortindex() + "ifspeed_day.png");
            // img2.setAbsolutePosition(0, 0);
            img2.setAlignment(Image.LEFT);// 
            // sheet,0,0,5,1,,,
            img2.scalePercent(67);
            document.add(img2);

        }
    } // 
    if (impReport.getChart() != null) {
        ByteArrayOutputStream baos = new ByteArrayOutputStream();
        try {
            ChartUtilities.writeChartAsPNG(baos, impReport.getChart().getChart(),
                    impReport.getChart().getWidth(), impReport.getChart().getHeight());
        } catch (IOException ioe) {
        }
        WritableImage wi = new WritableImage(2, 10000 + 5, 8, 12, baos.toByteArray());
        Image img2 = Image.getInstance(baos.toByteArray());
        // img.setAbsolutePosition(0, 0);
        img2.setAlignment(Image.LEFT);// 
        img2.scalePercent(67);
        document.add(img2);
    }

    document.close();
}

From source file:com.afunms.report.abstraction.ExcelReport1.java

/**
 * MODIFY HONGLI 2010-10-27//from   w  ww  .j  a v  a  2  s.c o  m
 */
public void createReport_oraPDF(String filename) throws DocumentException, IOException {
    if (impReport.getTable() == null) {
        fileName = null;
        return;
    }
    try {
        // 
        Document document = new Document(PageSize.A4);
        // (Writer)document(Writer)
        PdfWriter.getInstance(document, new FileOutputStream(filename));
        document.open();
        // 
        BaseFont bfChinese = BaseFont.createFont("STSong-Light", "UniGB-UCS2-H", BaseFont.NOT_EMBEDDED);

        // 
        Font titleFont = new Font(bfChinese, 12, Font.BOLD);
        // 
        Font contextFont = new Font(bfChinese, 12, Font.NORMAL);
        Font contextFont1 = new Font(bfChinese, 11, Font.NORMAL);
        String hostname = (String) reportHash.get("dbname");
        String ip = (String) reportHash.get("ip");
        String newip = doip(ip);
        Paragraph title = new Paragraph(hostname + "", titleFont);
        // 
        title.setAlignment(Element.ALIGN_CENTER);
        // title.setFont(titleFont);
        document.add(title);
        String Ping = (String) reportHash.get("Ping");
        String starttime = (String) reportHash.get("starttime");
        String totime = (String) reportHash.get("totime");

        Hashtable maxping = (Hashtable) reportHash.get("ping");

        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");

        String contextString = ":" + impReport.getTimeStamp() + " \n"// 
                + ":" + starttime + "  " + totime;

        Paragraph context = new Paragraph(contextString, contextFont1);
        // 
        context.setAlignment(Element.ALIGN_LEFT);
        // context.setFont(contextFont);
        // 
        context.setSpacingBefore(5);
        // 
        context.setFirstLineIndent(5);
        document.add(context);
        document.add(new Paragraph("\n"));
        /*
         * tmpLabel = new Label(0, 1, ":" + impReport.getTimeStamp());
         * sheet.addCell(tmpLabel); tmpLabel = new Label(0, 2, ": " +
         * starttime + "  " + totime);
         */
        PdfPTable aTable = new PdfPTable(3);
        float[] widths = { 220f, 220f, 220f };
        aTable.setWidths(widths);
        aTable.setWidthPercentage(100);
        PdfPCell cell = null;
        cell = new PdfPCell(new Phrase("", titleFont));
        this.setCellFormat(cell, true);
        aTable.addCell(cell);
        cell = new PdfPCell(new Phrase("", titleFont));
        this.setCellFormat(cell, true);
        aTable.addCell(cell);
        cell = new PdfPCell(new Phrase("", titleFont));
        this.setCellFormat(cell, true);
        aTable.addCell(cell);
        cell = new PdfPCell(new Phrase((String) maxping.get("pingnow")));
        this.setCellFormat(cell, false);
        aTable.addCell(cell);
        cell = new PdfPCell(new Phrase((String) maxping.get("pingmax")));
        this.setCellFormat(cell, false);
        aTable.addCell(cell);
        cell = new PdfPCell(new Phrase((String) maxping.get("avgpingcon")));
        this.setCellFormat(cell, false);
        aTable.addCell(cell);

        // 
        Image img = Image.getInstance(ResourceCenter.getInstance().getSysPath() + "/resource/image/jfreechart/"
                + newip + "ConnectUtilization" + ".png");
        img.setAlignment(Image.MIDDLE);// 
        img.scalePercent(76);
        document.add(aTable);
        document.add(img);
        document.add(new Paragraph("\n"));
        // HONGLI MODIFY START1
        PdfPTable aTable1 = new PdfPTable(12);
        float[] width = { 220f, 220f, 220f, 220f, 220f, 220f, 220f, 220f, 220f, 220f, 220f, 220f };
        // HONGLI MODIFY END1
        aTable1.setWidths(width);
        aTable1.setWidthPercentage(100);
        aTable1.setHeaderRows(1);
        cell = new PdfPCell(new Phrase("", titleFont));
        this.setCellFormat(cell, true);
        aTable1.addCell(cell);
        cell = new PdfPCell(new Phrase("", titleFont));
        this.setCellFormat(cell, true);
        aTable1.addCell(cell);
        cell = new PdfPCell(new Phrase("", titleFont));
        this.setCellFormat(cell, true);
        aTable1.addCell(cell);
        cell = new PdfPCell(new Phrase("", titleFont));
        this.setCellFormat(cell, true);
        aTable1.addCell(cell);
        cell = new PdfPCell(new Phrase("MB", titleFont));
        this.setCellFormat(cell, true);
        aTable1.addCell(cell);
        cell = new PdfPCell(new Phrase("MB", titleFont));
        this.setCellFormat(cell, true);
        aTable1.addCell(cell);
        cell = new PdfPCell(new Phrase("", titleFont));
        this.setCellFormat(cell, true);
        aTable1.addCell(cell);
        // HONGLI ADD START1
        cell = new PdfPCell(new Phrase("", titleFont));
        this.setCellFormat(cell, true);
        aTable1.addCell(cell);
        cell = new PdfPCell(new Phrase("", titleFont));
        this.setCellFormat(cell, true);
        aTable1.addCell(cell);
        cell = new PdfPCell(new Phrase("", titleFont));
        this.setCellFormat(cell, true);
        aTable1.addCell(cell);
        cell = new PdfPCell(new Phrase("", titleFont));
        this.setCellFormat(cell, true);
        aTable1.addCell(cell);
        // HONGLI ADD END1
        cell = new PdfPCell(new Phrase("", titleFont));
        this.setCellFormat(cell, true);
        aTable1.addCell(cell);
        // aTable1.endHeaders();

        // 
        Vector tableinfo_v = (Vector) reportHash.get("tableinfo_v");

        // HONGLI ADD START2
        Hashtable dbio = (Hashtable) reportHash.get("dbio");
        // HONGLI ADD END2

        int row = 0;
        for (int i = 0; i < tableinfo_v.size(); i++) {
            Hashtable ht = (Hashtable) tableinfo_v.get(i);
            String _filename = ht.get("file_name").toString();
            String tablespace = ht.get("tablespace").toString();
            String size = ht.get("size_mb").toString();
            String free = ht.get("free_mb").toString();
            String percent = ht.get("percent_free").toString();
            String status = ht.get("status").toString();

            // HONGLI ADD START3
            String pyr = "";
            String pbr = "";
            String pyw = "";
            String pbw = "";
            if (dbio.containsKey(_filename)) {
                Hashtable iodetail = (Hashtable) dbio.get(_filename);
                if (iodetail != null && iodetail.size() > 0) {
                    pyr = (String) iodetail.get("pyr");
                    pbr = (String) iodetail.get("pbr");
                    pyw = (String) iodetail.get("pyw");
                    pbw = (String) iodetail.get("pbw");
                }
            }
            // HONGLI ADD END3

            aTable1.addCell(new Phrase(""));
            row = i + 1;
            String rowStr = "" + row;
            cell = new PdfPCell(new Phrase(rowStr));
            cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
            cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
            aTable1.addCell(cell);
            cell = new PdfPCell(new Phrase(_filename));
            cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
            cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
            aTable1.addCell(cell);
            cell = new PdfPCell(new Phrase(tablespace));
            cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
            cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
            aTable1.addCell(cell);
            cell = new PdfPCell(new Phrase(size));
            cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
            cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
            aTable1.addCell(cell);
            cell = new PdfPCell(new Phrase(free));
            cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
            cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
            aTable1.addCell(cell);
            cell = new PdfPCell(new Phrase(percent));
            cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
            cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
            aTable1.addCell(cell);
            // HONGLI ADD START4
            cell = new PdfPCell(new Phrase(pyr));
            cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
            cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
            aTable1.addCell(cell);
            cell = new PdfPCell(new Phrase(pbr));
            cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
            cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
            aTable1.addCell(cell);
            cell = new PdfPCell(new Phrase(pyw));
            cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
            cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
            aTable1.addCell(cell);
            cell = new PdfPCell(new Phrase(pbw));
            cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
            cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
            aTable1.addCell(cell);
            // HONGLI ADD END4
            cell = new PdfPCell(new Phrase(status));
            cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
            cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
            aTable1.addCell(cell);

        }

        if (impReport.getChart() != null) {
            ByteArrayOutputStream baos = new ByteArrayOutputStream();
            try {
                ChartUtilities.writeChartAsPNG(baos, impReport.getChart().getChart(),
                        impReport.getChart().getWidth(), impReport.getChart().getHeight());
            } catch (IOException ioe) {
            }
            Image img1 = Image.getInstance(baos.toByteArray());
            img1.setAbsolutePosition(0, 0);
            img1.setAlignment(Image.MIDDLE);// 

            document.add(img1);
        }

        document.add(aTable1);
        document.close();
    } catch (Exception e) {
        // SysLogger.error("Error in ExcelReport.createReport()",e);
        SysLogger.error("", e);
    }

}

From source file:com.afunms.report.abstraction.ExcelReport1.java

public void createReport_sqlPDF(String filename) throws DocumentException, IOException {
    if (impReport.getTable() == null) {
        fileName = null;//from  www . j a  va  2s. c  o  m
        return;
    }
    try {
        // 
        Document document = new Document(PageSize.A4);
        // (Writer)document(Writer)
        PdfWriter.getInstance(document, new FileOutputStream(filename));
        document.open();
        // 
        BaseFont bfChinese = BaseFont.createFont("STSong-Light", "UniGB-UCS2-H", BaseFont.NOT_EMBEDDED);
        // 
        Font titleFont = new Font(bfChinese, 12, Font.BOLD);
        // 
        Font contextFont = new Font(bfChinese, 12, Font.NORMAL);
        String hostname = (String) reportHash.get("dbname");
        String ip = (String) reportHash.get("ip");
        String newip = doip(ip);
        Paragraph title = new Paragraph(hostname + "", titleFont);
        // 
        title.setAlignment(Element.ALIGN_CENTER);
        // title.setFont(titleFont);
        document.add(title);
        String Ping = (String) reportHash.get("Ping");
        String starttime = (String) reportHash.get("starttime");
        String totime = (String) reportHash.get("totime");

        Hashtable maxping = (Hashtable) reportHash.get("ping");

        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");

        String contextString = ":" + impReport.getTimeStamp() + " \n"// 
                + ":" + starttime + "  " + totime;

        Paragraph context = new Paragraph(contextString, contextFont);
        // 
        context.setAlignment(Element.ALIGN_LEFT);
        // context.setFont(contextFont);
        // 
        context.setSpacingBefore(5);
        // 
        context.setFirstLineIndent(5);
        document.add(context);
        document.add(new Paragraph("\n"));
        /*
         * tmpLabel = new Label(0, 1, ":" + impReport.getTimeStamp());
         * sheet.addCell(tmpLabel); tmpLabel = new Label(0, 2, ": " +
         * starttime + "  " + totime);
         */
        PdfPTable aTable = new PdfPTable(3);
        float[] widths = { 220f, 220f, 220f };
        aTable.setWidths(widths);
        aTable.setWidthPercentage(100);
        PdfPCell cell = null;
        cell = new PdfPCell(new Phrase("", titleFont));
        cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
        cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
        aTable.addCell(cell);
        cell = new PdfPCell(new Phrase("", titleFont));
        cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
        cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
        aTable.addCell(cell);
        cell = new PdfPCell(new Phrase("", titleFont));
        cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
        cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
        aTable.addCell(cell);
        cell = new PdfPCell(new Phrase((String) maxping.get("pingnow")));
        cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
        cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
        aTable.addCell(cell);
        cell = new PdfPCell(new Phrase((String) maxping.get("pingmax")));
        cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
        cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
        aTable.addCell(cell);
        cell = new PdfPCell(new Phrase((String) maxping.get("avgpingcon")));
        cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
        cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
        aTable.addCell(cell);

        Image img = Image.getInstance(ResourceCenter.getInstance().getSysPath() + "/resource/image/jfreechart/"
                + newip + "ConnectUtilization" + ".png");
        img.setAlignment(Image.LEFT);//
        //  document.add(aTable);
        img.scalePercent(76);
        document.add(aTable);
        document.add(img);

        document.add(new Paragraph("\n"));
        PdfPTable aTable1 = new PdfPTable(6);
        float[] width = { 220f, 220f, 220f, 220f, 220f, 220f };
        aTable1.setWidths(width);
        aTable1.setWidthPercentage(100);
        cell = new PdfPCell(new Phrase("", titleFont));
        cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
        cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
        aTable1.addCell(cell);
        cell = new PdfPCell(new Phrase("", titleFont));
        cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
        cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
        aTable1.addCell(cell);
        cell = new PdfPCell(new Phrase("", titleFont));
        cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
        cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
        aTable1.addCell(cell);
        cell = new PdfPCell(new Phrase("MB", titleFont));
        cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
        cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
        aTable1.addCell(cell);
        cell = new PdfPCell(new Phrase("MB", titleFont));
        cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
        cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
        aTable1.addCell(cell);
        cell = new PdfPCell(new Phrase("(%)", titleFont));
        cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
        cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
        aTable1.addCell(cell);
        // aTable1.endHeaders();

        // 
        Hashtable dbValue = (Hashtable) reportHash.get("tableinfo_v");
        Hashtable alldatabase = new Hashtable();
        if (dbValue.get("database") != null)
            alldatabase = (Hashtable) dbValue.get("database");
        Vector names = new Vector();
        if (dbValue.get("names") != null)
            names = (Vector) dbValue.get("names");

        if (alldatabase != null && alldatabase.size() > 0) {
            if (names == null)
                names = new Vector();
            int row = 1;
            for (int i = 0; i < names.size(); i++) {
                String key = (String) names.get(i);
                if (alldatabase.get(key) == null)
                    continue;
                Hashtable data = (Hashtable) alldatabase.get(key);
                String dbname = data.get("dbname").toString();
                String size = data.get("size").toString();
                String usedsize = "";
                if (data.get("usedsize") != null) {
                    usedsize = data.get("usedsize").toString();
                }
                String usedperc = "";
                if (data.get("usedperc") != null)
                    usedperc = data.get("usedperc").toString();
                cell = new PdfPCell(new Phrase(""));
                cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
                cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
                aTable1.addCell(cell);
                cell = new PdfPCell(new Phrase(row + ""));
                cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
                cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
                aTable1.addCell(cell);
                cell = new PdfPCell(new Phrase(dbname));
                cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
                cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
                aTable1.addCell(cell);
                cell = new PdfPCell(new Phrase(size));
                cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
                cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
                aTable1.addCell(cell);
                cell = new PdfPCell(new Phrase(usedsize));
                cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
                cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
                aTable1.addCell(cell);
                cell = new PdfPCell(new Phrase(usedperc));
                cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
                cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
                aTable1.addCell(cell);
                row++;

            }
        }

        if (impReport.getChart() != null) {
            ByteArrayOutputStream baos = new ByteArrayOutputStream();
            try {
                ChartUtilities.writeChartAsPNG(baos, impReport.getChart().getChart(),
                        impReport.getChart().getWidth(), impReport.getChart().getHeight());
            } catch (IOException ioe) {
            }
            Image img1 = Image.getInstance(baos.toByteArray());
            img1.setAbsolutePosition(0, 0);
            img1.setAlignment(Image.MIDDLE);// 

            document.add(img1);
        }

        document.add(aTable1);
        document.close();
    } catch (Exception e) {
        // TODO: handle exception
    }
}

From source file:com.afunms.report.abstraction.ExcelReport1.java

public void createReport_sybPDF(String filename) throws DocumentException, IOException {
    if (impReport.getTable() == null) {
        fileName = null;/*  w w w.j  av  a2s .co m*/
        return;
    }
    try {
        // 
        Document document = new Document(PageSize.A4);
        // (Writer)document(Writer)
        PdfWriter.getInstance(document, new FileOutputStream(filename));
        document.open();
        // 
        BaseFont bfChinese = BaseFont.createFont("STSong-Light", "UniGB-UCS2-H", BaseFont.NOT_EMBEDDED);
        // 
        Font titleFont = new Font(bfChinese, 12, Font.BOLD);
        // 
        Font contextFont = new Font(bfChinese, 12, Font.NORMAL);
        String hostname = (String) reportHash.get("dbname");
        String ip = (String) reportHash.get("ip");
        String newip = doip(ip);
        Paragraph title = new Paragraph(hostname + "", titleFont);
        // 
        title.setAlignment(Element.ALIGN_CENTER);
        // title.setFont(titleFont);
        document.add(title);
        String Ping = (String) reportHash.get("Ping");
        String starttime = (String) reportHash.get("starttime");
        String totime = (String) reportHash.get("totime");

        Hashtable maxping = (Hashtable) reportHash.get("ping");

        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");

        String contextString = ":" + impReport.getTimeStamp() + " \n"// 
                + ":" + starttime + "  " + totime;

        Paragraph context = new Paragraph(contextString, contextFont);
        // 
        context.setAlignment(Element.ALIGN_LEFT);
        // context.setFont(contextFont);
        // 
        context.setSpacingBefore(5);
        // 
        context.setFirstLineIndent(5);
        document.add(context);
        document.add(new Paragraph("\n"));
        /*
         * tmpLabel = new Label(0, 1, ":" + impReport.getTimeStamp());
         * sheet.addCell(tmpLabel); tmpLabel = new Label(0, 2, ": " +
         * starttime + "  " + totime);
         */
        PdfPTable aTable = new PdfPTable(3);
        float[] widths = { 220f, 220f, 220f };
        aTable.setWidths(widths);
        aTable.setWidthPercentage(100);
        PdfPCell cell = null;
        cell = new PdfPCell(new Phrase("", titleFont));
        cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
        cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
        aTable.addCell(cell);
        cell = new PdfPCell(new Phrase("", titleFont));
        cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
        cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
        aTable.addCell(cell);
        cell = new PdfPCell(new Phrase("", titleFont));
        cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
        cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
        aTable.addCell(cell);
        cell = new PdfPCell(new Phrase(""));
        cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
        cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
        aTable.addCell(cell);
        cell = new PdfPCell(new Phrase((String) maxping.get("pingmax")));
        cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
        cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
        aTable.addCell(cell);
        cell = new PdfPCell(new Phrase((String) maxping.get("avgpingcon")));
        cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
        cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
        aTable.addCell(cell);
        // 
        Image img = Image.getInstance(ResourceCenter.getInstance().getSysPath() + "/resource/image/jfreechart/"
                + newip + "ConnectUtilization" + ".png");
        img.setAlignment(Image.LEFT);// 
        img.scalePercent(76);
        document.add(aTable);
        document.add(img);
        document.add(new Paragraph("\n"));
        PdfPTable aTable1 = new PdfPTable(6);
        float[] width = { 220f, 220f, 220f, 220f, 220f, 220f };
        aTable1.setWidths(width);
        aTable1.setWidthPercentage(100);
        cell = new PdfPCell(new Phrase("", titleFont));
        cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
        cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
        aTable1.addCell(cell);
        cell = new PdfPCell(new Phrase("", titleFont));
        cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
        cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
        aTable1.addCell(cell);
        cell = new PdfPCell(new Phrase("", titleFont));
        cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
        cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
        aTable1.addCell(cell);
        cell = new PdfPCell(new Phrase("MB", titleFont));
        cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
        cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
        aTable1.addCell(cell);
        cell = new PdfPCell(new Phrase("MB", titleFont));
        cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
        cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
        aTable1.addCell(cell);
        cell = new PdfPCell(new Phrase("(%)", titleFont));
        cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
        cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
        aTable1.addCell(cell);
        // aTable1.endHeaders();

        // 
        SybaseVO sysbaseVO = (SybaseVO) reportHash.get("sysbaseVO");
        if (sysbaseVO == null)
            sysbaseVO = new SybaseVO();
        List dbsizelist = (List) sysbaseVO.getDbInfo();
        int row = 1;
        if (dbsizelist != null && dbsizelist.size() > 0) {
            for (int i = 0; i < dbsizelist.size(); i++) {

                TablesVO tablesVO = (TablesVO) dbsizelist.get(i);
                String dbname = tablesVO.getDb_name();
                String dbsize = tablesVO.getDb_size();
                String freesize = tablesVO.getDb_freesize();
                String userdperc = tablesVO.getDb_usedperc();
                cell = new PdfPCell(new Phrase(""));
                cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
                cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
                aTable1.addCell(cell);
                cell = new PdfPCell(new Phrase(row + ""));
                cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
                cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
                aTable1.addCell(cell);
                cell = new PdfPCell(new Phrase(dbname));
                cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
                cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
                aTable1.addCell(cell);
                cell = new PdfPCell(new Phrase(dbsize));
                cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
                cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
                aTable1.addCell(cell);
                cell = new PdfPCell(new Phrase(freesize));
                cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
                cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
                aTable1.addCell(cell);
                cell = new PdfPCell(new Phrase(userdperc));
                cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
                cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
                aTable1.addCell(cell);
                row++;

            }
        }

        if (impReport.getChart() != null) {
            ByteArrayOutputStream baos = new ByteArrayOutputStream();
            try {
                ChartUtilities.writeChartAsPNG(baos, impReport.getChart().getChart(),
                        impReport.getChart().getWidth(), impReport.getChart().getHeight());
            } catch (IOException ioe) {
            }
            Image img1 = Image.getInstance(baos.toByteArray());
            img1.setAbsolutePosition(0, 0);
            img1.setAlignment(Image.MIDDLE);// 

            document.add(img1);
        }

        document.add(aTable1);
        document.close();
    } catch (Exception e) {
        // TODO: handle exception
    }
}

From source file:com.afunms.report.abstraction.ExcelReport1.java

public void createReport_db2PDF(String filename) throws DocumentException, IOException {
    if (impReport.getTable() == null) {
        fileName = null;/*from  w  ww .  j a  v  a 2  s. c  o  m*/
        return;
    }
    try {
        // 
        Document document = new Document(PageSize.A4);
        // (Writer)document(Writer)
        PdfWriter.getInstance(document, new FileOutputStream(filename));
        document.open();
        // 
        BaseFont bfChinese = BaseFont.createFont("STSong-Light", "UniGB-UCS2-H", BaseFont.NOT_EMBEDDED);
        // 
        Font titleFont = new Font(bfChinese, 12, Font.BOLD);
        // 
        Font contextFont = new Font(bfChinese, 12, Font.NORMAL);
        Font contextFont1 = new Font(bfChinese, 11, Font.NORMAL);
        String hostname = (String) reportHash.get("dbname");
        String servername = (String) reportHash.get("servername");
        String ip = (String) reportHash.get("ip");
        String newip = doip(ip);
        String Ping = (String) reportHash.get("Ping");
        String starttime = (String) reportHash.get("starttime");
        String totime = (String) reportHash.get("totime");
        Hashtable returnhash = (Hashtable) reportHash.get("returnhash");
        Hashtable maxping = (Hashtable) reportHash.get("ping");

        Paragraph title = new Paragraph(hostname + "", titleFont);
        // 
        title.setAlignment(Element.ALIGN_CENTER);
        // title.setFont(titleFont);
        document.add(title);

        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");

        String contextString = ":" + impReport.getTimeStamp() + " \n"// 
                + ":" + starttime + "  " + totime;

        Paragraph context = new Paragraph(contextString, contextFont1);
        // 
        context.setAlignment(Element.ALIGN_LEFT);
        // context.setFont(contextFont);
        // 
        context.setSpacingBefore(5);
        // 
        context.setFirstLineIndent(5);
        document.add(context);
        document.add(new Paragraph("\n"));
        /*
         * tmpLabel = new Label(0, 1, ":" + impReport.getTimeStamp());
         * sheet.addCell(tmpLabel); tmpLabel = new Label(0, 2, ": " +
         * starttime + "  " + totime);
         */

        PdfPTable aTable = new PdfPTable(3);
        float[] widths = { 220f, 220f, 220f };
        aTable.setWidths(widths);
        aTable.setWidthPercentage(100);
        PdfPCell cell = null;
        cell = new PdfPCell(new Phrase("", titleFont));
        cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
        cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
        aTable.addCell(cell);
        cell = new PdfPCell(new Phrase("", titleFont));
        cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
        cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
        aTable.addCell(cell);
        cell = new PdfPCell(new Phrase("", titleFont));
        cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
        cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
        aTable.addCell(cell);
        cell = new PdfPCell(new Phrase(""));
        cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
        cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
        aTable.addCell(cell);
        cell = new PdfPCell(new Phrase((String) maxping.get("pingmax")));
        cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
        cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
        aTable.addCell(cell);
        cell = new PdfPCell(new Phrase((String) maxping.get("avgpingcon")));
        cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
        cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
        aTable.addCell(cell);
        // 
        Image img = Image.getInstance(ResourceCenter.getInstance().getSysPath() + "/resource/image/jfreechart/"
                + newip + "ConnectUtilization" + ".png");
        img.setAlignment(Image.LEFT);// 
        img.scalePercent(76);
        document.add(aTable);
        document.add(img);
        document.add(new Paragraph("\n"));
        Enumeration dbs = returnhash.keys();
        List retList = new ArrayList();
        Paragraph context1 = null;
        PdfPTable aTable1 = null;

        while (dbs.hasMoreElements()) {

            aTable1 = new PdfPTable(6);
            float[] width = { 220f, 220f, 220f, 220f, 220f, 220f };
            aTable1.setWidths(width);
            aTable1.setWidthPercentage(100);
            cell = new PdfPCell(new Phrase("", titleFont));
            cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
            cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
            aTable1.addCell(cell);
            cell = new PdfPCell(new Phrase("", titleFont));
            cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
            cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
            aTable1.addCell(cell);
            cell = new PdfPCell(new Phrase("", titleFont));
            cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
            cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
            aTable1.addCell(cell);
            cell = new PdfPCell(new Phrase("MB", titleFont));
            cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
            cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
            aTable1.addCell(cell);
            cell = new PdfPCell(new Phrase("MB", titleFont));
            cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
            cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
            aTable1.addCell(cell);
            cell = new PdfPCell(new Phrase("(%)", titleFont));
            cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
            cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
            aTable1.addCell(cell);
            // aTable1.endHeaders();

            // 
            String obj = (String) dbs.nextElement();
            retList = (List) returnhash.get(obj);
            String contextString1 = "DB2:" + obj + "(" + "IP:" + ip + ")";

            context1 = new Paragraph(contextString1, contextFont);
            // 
            context1.setAlignment(Element.ALIGN_LEFT);
            // context.setFont(contextFont);
            // 
            context1.setSpacingBefore(5);
            // 
            context1.setFirstLineIndent(5);
            int row = 1;
            for (int i = 0; i < retList.size(); i++) {
                Hashtable ht = (Hashtable) retList.get(i);
                if (ht == null)
                    continue;
                String spacename = "";
                if (ht.get("tablespace_name") != null)
                    spacename = ht.get("tablespace_name").toString();
                String size = "";
                if (ht.get("totalspac") != null)
                    size = ht.get("totalspac").toString();
                String free = "";
                if (ht.get("usablespac") != null)
                    free = ht.get("usablespac").toString();
                String percent = "";
                if (ht.get("usableper") != null)
                    percent = ht.get("usableper").toString();
                cell = new PdfPCell(new Phrase(""));
                cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
                cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
                aTable1.addCell(cell);
                cell = new PdfPCell(new Phrase(i + 1 + ""));
                cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
                cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
                aTable1.addCell(cell);
                cell = new PdfPCell(new Phrase(spacename));
                cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
                cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
                aTable1.addCell(cell);
                cell = new PdfPCell(new Phrase(size));
                cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
                cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
                aTable1.addCell(cell);
                cell = new PdfPCell(new Phrase(free));
                cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
                cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
                aTable1.addCell(cell);
                cell = new PdfPCell(new Phrase(percent));
                cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
                cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
                aTable1.addCell(cell);

            }
            document.add(context1);
            document.add(new Paragraph("\n"));
            document.add(aTable1);
        }

        if (impReport.getChart() != null) {
            ByteArrayOutputStream baos = new ByteArrayOutputStream();
            try {
                ChartUtilities.writeChartAsPNG(baos, impReport.getChart().getChart(),
                        impReport.getChart().getWidth(), impReport.getChart().getHeight());
            } catch (IOException ioe) {
            }
            Image img1 = Image.getInstance(baos.toByteArray());
            img1.setAbsolutePosition(0, 0);
            img1.setAlignment(Image.MIDDLE);// 

            document.add(img1);
        }

        document.close();
    } catch (Exception e) {
        // TODO: handle exception
    }
}

From source file:com.afunms.report.abstraction.ExcelReport1.java

public void createReport_tomcatPDF(String file) throws DocumentException, IOException {
    String starttime = (String) reportHash.get("starttime");
    String totime = (String) reportHash.get("totime");

    String hostname = (String) reportHash.get("equipname");
    String ip = (String) reportHash.get("ip");
    String newip = doip(ip);/*  w  w  w  .  j  av  a  2 s .co  m*/
    // WritableSheet sheet = wb.createSheet(hostname + "", 0);
    Hashtable CPU = (Hashtable) reportHash.get("CPU");
    if (CPU == null)
        CPU = new Hashtable();
    String Ping = (String) reportHash.get("Ping");
    Calendar colTime = (Calendar) reportHash.get("time");

    Hashtable maxping = (Hashtable) reportHash.get("ping");
    String jvmnow = (String) reportHash.get("jvmnow");
    Hashtable maxjvm = (Hashtable) reportHash.get("maxjvm");
    SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");

    Document document = new Document(PageSize.A4);
    // (Writer)document(Writer)
    PdfWriter.getInstance(document, new FileOutputStream(file));
    document.open();
    // 
    BaseFont bfChinese = BaseFont.createFont("STSong-Light", "UniGB-UCS2-H", BaseFont.NOT_EMBEDDED);
    // 
    Font titleFont = new Font(bfChinese, 12, Font.BOLD);
    // 
    Font contextFont = new Font(bfChinese, 10, Font.NORMAL);
    Paragraph title = new Paragraph(hostname + "", contextFont);
    // 
    title.setAlignment(Element.ALIGN_CENTER);
    // title.setFont(titleFont);
    document.add(title);
    String contextString = ":" + impReport.getTimeStamp() + " \n"// 
            + ":" + starttime + "  " + totime;
    Paragraph context = new Paragraph(contextString, contextFont);
    // 
    context.setAlignment(Element.ALIGN_LEFT);
    // context.setFont(contextFont);
    // 
    context.setSpacingBefore(5);
    // 
    context.setFirstLineIndent(5);
    document.add(context);
    document.add(new Paragraph("\n"));
    Font fontChinese = new Font(bfChinese, 12, Font.NORMAL, Color.black);
    PdfPTable aTable = new PdfPTable(4);
    float[] widths = { 220f, 300f, 220f, 220f };
    aTable.setWidths(widths);
    aTable.setWidthPercentage(100);

    aTable.addCell(new Phrase("", contextFont));
    aTable.addCell(new Phrase("", contextFont));
    aTable.addCell(new Phrase("", contextFont));
    aTable.addCell(new Phrase("", contextFont));
    // aTable.addCell("3.2",Ping+"%");
    aTable.addCell("");
    aTable.addCell(Ping + "%");
    aTable.addCell((String) maxping.get("pingmax"));
    aTable.addCell((String) maxping.get("avgpingcon"));
    Image img = Image.getInstance(ResourceCenter.getInstance().getSysPath() + "/resource/image/jfreechart/"
            + newip + "TomcatPing" + ".png");
    img.setAlignment(Image.LEFT);// 
    img.scalePercent(75);
    document.add(aTable);
    document.add(img);
    PdfPTable aTable1 = new PdfPTable(4);
    float[] widths1 = { 220f, 300f, 220f, 220f };
    aTable1.setWidths(widths1);
    aTable1.setWidthPercentage(100);
    aTable1.addCell(new Phrase("JVM", contextFont));
    aTable1.addCell(new Phrase("", contextFont));
    aTable1.addCell(new Phrase("", contextFont));
    aTable1.addCell(new Phrase("", contextFont));
    // aTable.addCell("3.2",Ping+"%");
    aTable1.addCell("");
    aTable1.addCell(jvmnow + "%");
    aTable1.addCell((String) maxjvm.get("max_tomcat_jvm"));
    aTable1.addCell((String) maxjvm.get("avg_tomcat_jvm"));

    Image img1 = Image.getInstance(ResourceCenter.getInstance().getSysPath() + "/resource/image/jfreechart/"
            + newip + "tomcat_jvm" + ".png");
    img1.setAlignment(Image.LEFT);// 
    img1.scalePercent(75);
    document.add(aTable1);
    document.add(img1);
    document.close();
}

From source file:com.afunms.report.abstraction.ExcelReport1.java

public void createReport_weblogicPDF(String file) throws DocumentException, IOException {
    String starttime = (String) reportHash.get("starttime");
    String totime = (String) reportHash.get("totime");

    String hostname = (String) reportHash.get("equipname");
    String ip = (String) reportHash.get("ip");
    String newip = doip(ip);/*from  ww w .  j a v  a  2s .c  o m*/
    // WritableSheet sheet = wb.createSheet(hostname + "", 0);
    Calendar colTime = (Calendar) reportHash.get("time");
    Hashtable maxping = (Hashtable) reportHash.get("ping");
    String weblogicnow = (String) reportHash.get("weblogicnow");
    Weblogic weblogic = (Weblogic) reportHash.get("weblogic");
    SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");

    String[] memoryItemch = { "", "", "", "" };
    String[] memoryItem = { "Capability", "Utilization" };
    String[] diskItem = { "AllSize", "UsedSize", "Utilization" };
    String[] diskItemch = { "", "", "" };
    // 
    Document document = new Document(PageSize.A4);
    // (Writer)document(Writer)
    PdfWriter.getInstance(document, new FileOutputStream(file));
    document.open();
    // 
    BaseFont bfChinese = BaseFont.createFont("STSong-Light", "UniGB-UCS2-H", BaseFont.NOT_EMBEDDED);
    // 
    Font titleFont = new Font(bfChinese, 12, Font.BOLD);
    // 
    Font contextFont = new Font(bfChinese, 10, Font.NORMAL);
    Paragraph title = new Paragraph(hostname + "", titleFont);
    // 
    title.setAlignment(Element.ALIGN_CENTER);
    // title.setFont(titleFont);
    document.add(title);
    String contextString = ":" + impReport.getTimeStamp() + " \n"// 
            + ":" + starttime + "  " + totime;
    Paragraph context = new Paragraph(contextString, contextFont);
    // 
    context.setAlignment(Element.ALIGN_LEFT);
    // context.setFont(contextFont);
    // 
    context.setSpacingBefore(5);
    // 
    context.setFirstLineIndent(5);
    document.add(context);
    document.add(new Paragraph("\n"));
    Font fontChinese = new Font(bfChinese, 12, Font.NORMAL, Color.black);
    PdfPTable aTable = new PdfPTable(4);
    float[] widths = { 220f, 300f, 220f, 220f };
    aTable.setWidths(widths);
    aTable.setWidthPercentage(100);

    aTable.addCell(new Phrase("", contextFont));
    aTable.addCell(new Phrase("", contextFont));
    aTable.addCell(new Phrase("", contextFont));
    aTable.addCell(new Phrase("", contextFont));
    // aTable.addCell("3.2",Ping+"%");
    aTable.addCell("");
    aTable.addCell(weblogicnow + "%");
    aTable.addCell((String) maxping.get("pingmax"));
    aTable.addCell((String) maxping.get("avgpingcon"));
    Image img = Image.getInstance(ResourceCenter.getInstance().getSysPath() + "/resource/image/jfreechart/"
            + newip + "WeblogicPing" + ".png");
    img.setAlignment(Image.LEFT);// 
    img.scalePercent(75);
    document.add(aTable);
    document.add(img);

    document.add(new Paragraph("\n"));
    PdfPTable aTable1 = new PdfPTable(7);
    float[] widths1 = { 220f, 220f, 220f, 220f, 220f, 220f, 220f };
    aTable1.setWidths(widths1);
    aTable1.setWidthPercentage(100);
    PdfPCell cell = null;

    cell = new PdfPCell(new Phrase("", contextFont));
    cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
    cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
    aTable1.addCell(cell);

    cell = new PdfPCell(new Phrase("", contextFont));
    cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
    cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
    aTable1.addCell(cell);

    cell = new PdfPCell(new Phrase("", contextFont));
    cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
    cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
    aTable1.addCell(cell);

    cell = new PdfPCell(new Phrase("", contextFont));
    cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
    cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
    aTable1.addCell(cell);

    cell = new PdfPCell(new Phrase("", contextFont));
    cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
    cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
    aTable1.addCell(cell);

    cell = new PdfPCell(new Phrase("", contextFont));
    cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
    cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
    aTable1.addCell(cell);

    cell = new PdfPCell(new Phrase("", contextFont));
    cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
    cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
    aTable1.addCell(cell);
    List queuedatalist = new ArrayList();
    Hashtable hash = null;
    WeblogicSnmp weblogicsnmp = null;
    WeblogicConfigDao weblogicconfigdao = new WeblogicConfigDao();
    // weblogicsnmp = new WeblogicSnmp(weblogic.getIpAddress(),
    // weblogic.getCommunity(), weblogic.getPortnum());
    // hash = weblogicsnmp.collectData();
    if (hash != null) {
        queuedatalist = (List) hash.get("queueValue");
    }
    for (int i = 0; i < queuedatalist.size(); i++) {
        WeblogicQueue vo = (WeblogicQueue) queuedatalist.get(i);
        cell = new PdfPCell(new Phrase(""));
        aTable1.addCell(cell);

        cell = new PdfPCell(new Phrase(i + 1 + "", contextFont));
        cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
        cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
        aTable1.addCell(cell);

        cell = new PdfPCell(new Phrase(vo.getExecuteQueueRuntimeName()));
        cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
        cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
        aTable1.addCell(cell);

        cell = new PdfPCell(new Phrase(vo.getThreadPoolRuntimeExecuteThreadIdleCount()));
        cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
        cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
        aTable1.addCell(cell);

        cell = new PdfPCell(new Phrase(vo.getExecuteQueueRuntimePendingRequestOldestTime()));
        cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
        cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
        aTable1.addCell(cell);

        cell = new PdfPCell(new Phrase(vo.getExecuteQueueRuntimePendingRequestCurrentCount()));
        cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
        cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
        aTable1.addCell(cell);

        cell = new PdfPCell(new Phrase(vo.getExecuteQueueRuntimePendingRequestTotalCount()));
        cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
        cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
        aTable1.addCell(cell);

    }
    document.add(aTable1);
    document.add(new Paragraph("\n"));
    PdfPTable aTable2 = new PdfPTable(8);
    float[] widths2 = { 220f, 220f, 220f, 220f, 220f, 220f, 220f, 220f };
    aTable2.setWidths(widths2);
    aTable2.setWidthPercentage(100);

    cell = new PdfPCell(new Phrase("JDBC", contextFont));
    cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
    cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
    aTable2.addCell(cell);

    cell = new PdfPCell(new Phrase("", contextFont));
    cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
    cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
    aTable2.addCell(cell);

    cell = new PdfPCell(new Phrase("", contextFont));
    cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
    cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
    aTable2.addCell(cell);

    cell = new PdfPCell(new Phrase("", contextFont));
    cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
    cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
    aTable2.addCell(cell);

    cell = new PdfPCell(new Phrase("", contextFont));
    cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
    cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
    aTable2.addCell(cell);

    cell = new PdfPCell(new Phrase("", contextFont));
    cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
    cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
    aTable2.addCell(cell);

    cell = new PdfPCell(new Phrase("", contextFont));
    cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
    cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
    aTable2.addCell(cell);
    cell = new PdfPCell(new Phrase("", contextFont));
    cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
    cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
    aTable2.addCell(cell);
    List jdbcdatalist = new ArrayList();
    // weblogicsnmp = new WeblogicSnmp(weblogic.getIpAddress(),
    // weblogic.getCommunity(), weblogic.getPortnum());
    // hash = weblogicsnmp.collectData();
    jdbcdatalist = (List) hash.get("jdbcValue");
    for (int i = 0; i < jdbcdatalist.size(); i++) {
        WeblogicJdbc vo = (WeblogicJdbc) jdbcdatalist.get(i);
        cell = new PdfPCell(new Phrase(""));
        aTable2.addCell(cell);

        cell = new PdfPCell(new Phrase(i + 1 + ""));
        cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
        cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
        aTable2.addCell(cell);

        cell = new PdfPCell(new Phrase(vo.getJdbcConnectionPoolName()));
        cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
        cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
        aTable2.addCell(cell);

        cell = new PdfPCell(new Phrase(vo.getJdbcConnectionPoolRuntimeActiveConnectionsCurrentCount()));
        cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
        cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
        aTable2.addCell(cell);

        cell = new PdfPCell(new Phrase(vo.getJdbcConnectionPoolRuntimeVersionJDBCDriver()));
        cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
        cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
        aTable2.addCell(cell);
        cell = new PdfPCell(new Phrase(vo.getJdbcConnectionPoolRuntimeMaxCapacity()));
        cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
        cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
        aTable2.addCell(cell);

        cell = new PdfPCell(new Phrase(vo.getJdbcConnectionPoolRuntimeActiveConnectionsAverageCount()));
        cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
        cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
        aTable2.addCell(cell);

        cell = new PdfPCell(new Phrase(vo.getJdbcConnectionPoolRuntimeHighestNumAvailable()));
        cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
        cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
        aTable2.addCell(cell);
    }
    document.add(aTable2);
    document.add(new Paragraph("\n"));
    PdfPTable aTable3 = new PdfPTable(5);
    float[] widths3 = { 220f, 220f, 220f, 220f, 220f };
    aTable3.setWidths(widths3);
    aTable3.setWidthPercentage(100);
    cell = new PdfPCell(new Phrase("JVM", contextFont));
    cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
    cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
    aTable3.addCell(cell);

    cell = new PdfPCell(new Phrase("", contextFont));
    cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
    cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
    aTable3.addCell(cell);

    cell = new PdfPCell(new Phrase("", contextFont));
    cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
    cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
    aTable3.addCell(cell);

    cell = new PdfPCell(new Phrase("", contextFont));
    cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
    cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
    aTable3.addCell(cell);

    cell = new PdfPCell(new Phrase("", contextFont));
    cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
    cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
    aTable3.addCell(cell);
    // weblogicsnmp = new WeblogicSnmp(weblogic.getIpAddress(),
    // weblogic.getCommunity(), weblogic.getPortnum());
    // hash = weblogicsnmp.collectData();
    List heapdatalist = new ArrayList();
    heapdatalist = (List) hash.get("heapValue");
    for (int i = 0; i < heapdatalist.size(); i++) {
        WeblogicHeap vo = (WeblogicHeap) heapdatalist.get(i);
        cell = new PdfPCell(new Phrase(""));
        aTable3.addCell(cell);

        cell = new PdfPCell(new Phrase(i + 1 + ""));
        cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
        cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
        aTable3.addCell(cell);

        cell = new PdfPCell(new Phrase(vo.getJvmRuntimeName()));
        cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
        cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
        aTable3.addCell(cell);

        cell = new PdfPCell(new Phrase(vo.getJvmRuntimeHeapSizeCurrent()));
        cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
        cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
        aTable3.addCell(cell);

        cell = new PdfPCell(new Phrase(vo.getJvmRuntimeHeapFreeCurrent()));
        cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
        cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
        aTable3.addCell(cell);
    }
    document.add(aTable3);
    document.add(new Paragraph("\n"));
    PdfPTable aTable4 = new PdfPTable(8);
    float[] widths4 = { 220f, 220f, 220f, 220f, 220f, 220f, 220f, 220f };
    aTable4.setWidths(widths4);
    aTable4.setWidthPercentage(100);
    cell = new PdfPCell(new Phrase("", contextFont));
    cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
    cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
    aTable4.addCell(cell);

    cell = new PdfPCell(new Phrase("", contextFont));
    cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
    cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
    aTable4.addCell(cell);

    cell = new PdfPCell(new Phrase("", contextFont));
    cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
    cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
    aTable4.addCell(cell);

    cell = new PdfPCell(new Phrase("", contextFont));
    cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
    cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
    aTable4.addCell(cell);

    cell = new PdfPCell(new Phrase("", contextFont));
    cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
    cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
    aTable4.addCell(cell);
    cell = new PdfPCell(new Phrase("Socket", contextFont));
    cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
    cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
    aTable4.addCell(cell);

    cell = new PdfPCell(new Phrase("", contextFont));
    cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
    cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
    aTable4.addCell(cell);

    cell = new PdfPCell(new Phrase("IP", contextFont));
    cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
    cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
    aTable4.addCell(cell);
    // weblogicsnmp = new WeblogicSnmp(weblogic.getIpAddress(),
    // weblogic.getCommunity(), weblogic.getPortnum());
    // hash = weblogicsnmp.collectData();
    List serverdatalist = new ArrayList();
    serverdatalist = (List) hash.get("serverValue");
    for (int i = 0; i < serverdatalist.size(); i++) {
        WeblogicServer vo = (WeblogicServer) serverdatalist.get(i);
        cell = new PdfPCell(new Phrase(""));
        aTable3.addCell(cell);
        aTable4.addCell(cell);
        cell = new PdfPCell(new Phrase(i + 1 + ""));
        cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
        cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
        aTable4.addCell(cell);

        cell = new PdfPCell(new Phrase(vo.getServerRuntimeName()));
        cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
        cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
        aTable4.addCell(cell);

        cell = new PdfPCell(new Phrase(vo.getServerRuntimeListenAddress()));
        cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
        cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
        aTable4.addCell(cell);

        cell = new PdfPCell(new Phrase(vo.getServerRuntimeListenPort()));
        cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
        cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
        aTable4.addCell(cell);
        cell = new PdfPCell(new Phrase(vo.getServerRuntimeOpenSocketsCurrentCount()));
        cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
        cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
        aTable4.addCell(cell);

        cell = new PdfPCell(new Phrase(vo.getServerRuntimeState()));
        cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
        cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
        aTable4.addCell(cell);

        cell = new PdfPCell(new Phrase(weblogic.getIpAddress()));
        cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
        cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
        aTable4.addCell(cell);
    }
    document.add(aTable4);
    document.close();
}

From source file:com.afunms.report.abstraction.ExcelReport1.java

public void createReport_inforPDF(String filename) throws DocumentException, IOException {
    if (impReport.getTable() == null) {
        fileName = null;/*from  w  w  w.  j a v  a2 s .co m*/
        return;
    }
    try {
        // 
        Document document = new Document(PageSize.A4);
        // (Writer)document(Writer)
        PdfWriter.getInstance(document, new FileOutputStream(filename));
        document.open();
        // 
        BaseFont bfChinese = BaseFont.createFont("STSong-Light", "UniGB-UCS2-H", BaseFont.NOT_EMBEDDED);

        // 
        Font titleFont = new Font(bfChinese, 12, Font.BOLD);
        // 
        Font contextFont = new Font(bfChinese, 12, Font.NORMAL);
        Font contextFont1 = new Font(bfChinese, 11, Font.NORMAL);
        String hostname = (String) reportHash.get("dbname");
        String ip = (String) reportHash.get("ip");
        String newip = doip(ip);
        Paragraph title = new Paragraph(hostname + "", titleFont);
        // 
        title.setAlignment(Element.ALIGN_CENTER);
        // title.setFont(titleFont);
        document.add(title);
        String Ping = (String) reportHash.get("Ping");
        String starttime = (String) reportHash.get("starttime");
        String totime = (String) reportHash.get("totime");
        Hashtable 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");// 

        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");

        String contextString = ":" + impReport.getTimeStamp() + " \n"// 
                + ":" + starttime + "  " + totime;

        Paragraph context = new Paragraph(contextString, contextFont1);
        // 
        context.setAlignment(Element.ALIGN_LEFT);
        // context.setFont(contextFont);
        // 
        context.setSpacingBefore(5);
        // 
        context.setFirstLineIndent(5);
        document.add(context);
        document.add(new Paragraph("\n"));
        /*
         * tmpLabel = new Label(0, 1, ":" + impReport.getTimeStamp());
         * sheet.addCell(tmpLabel); tmpLabel = new Label(0, 2, ": " +
         * starttime + "  " + totime);
         */
        PdfPTable aTable = new PdfPTable(3);
        float[] widths = { 220f, 220f, 220f };
        aTable.setWidths(widths);
        aTable.setWidthPercentage(100);
        PdfPCell cell = null;
        cell = new PdfPCell(new Phrase("", titleFont));
        cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
        cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
        aTable.addCell(cell);
        cell = new PdfPCell(new Phrase("", titleFont));
        cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
        cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
        aTable.addCell(cell);
        cell = new PdfPCell(new Phrase("", titleFont));
        cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
        cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
        aTable.addCell(cell);
        cell = new PdfPCell(new Phrase(""));
        cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
        cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
        aTable.addCell(cell);
        cell = new PdfPCell(new Phrase((String) maxping.get("pingmax")));
        cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
        cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
        aTable.addCell(cell);
        cell = new PdfPCell(new Phrase((String) maxping.get("avgpingcon")));
        cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
        cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
        aTable.addCell(cell);

        // 
        Image img = Image.getInstance(ResourceCenter.getInstance().getSysPath() + "/resource/image/jfreechart/"
                + newip + "ConnectUtilization" + ".png");
        img.setAlignment(Image.MIDDLE);// 
        img.scalePercent(76);
        document.add(aTable);
        document.add(img);
        document.add(new Paragraph("\n"));
        // informix 
        PdfPTable aTable1 = new PdfPTable(9);
        float[] width = { 220f, 220f, 220f, 220f, 220f, 220f, 220f, 220f, 220f };
        aTable1.setWidths(width);
        aTable1.setWidthPercentage(100);

        cell = new PdfPCell(new Phrase("", titleFont));
        cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
        cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
        aTable1.addCell(cell);
        cell = new PdfPCell(new Phrase("", titleFont));
        cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
        cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
        aTable1.addCell(cell);
        cell = new PdfPCell(new Phrase("", titleFont));
        cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
        cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
        aTable1.addCell(cell);
        cell = new PdfPCell(new Phrase("", titleFont));
        cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
        cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
        aTable1.addCell(cell);
        cell = new PdfPCell(new Phrase("", titleFont));
        cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
        cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
        aTable1.addCell(cell);
        cell = new PdfPCell(new Phrase("", titleFont));
        cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
        cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
        aTable1.addCell(cell);
        cell = new PdfPCell(new Phrase("", titleFont));
        cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
        cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
        aTable1.addCell(cell);
        cell = new PdfPCell(new Phrase("", titleFont));
        cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
        cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
        aTable1.addCell(cell);
        cell = new PdfPCell(new Phrase("(%)", titleFont));
        cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
        cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
        aTable1.addCell(cell);
        // aTable1.endHeaders();

        // informix 
        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 PdfPCell(new Phrase(rowStr));
                cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
                cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
                aTable1.addCell(cell);
                cell = new PdfPCell(new Phrase((String) tablesVO.get("dbspace")));
                cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
                cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
                aTable1.addCell(cell);
                cell = new PdfPCell(new Phrase((String) tablesVO.get("owner")));
                cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
                cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
                aTable1.addCell(cell);
                cell = new PdfPCell(new Phrase((String) tablesVO.get("fname")));
                cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
                cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
                aTable1.addCell(cell);
                cell = new PdfPCell(new Phrase((String) tablesVO.get("pages_size")));
                cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
                cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
                aTable1.addCell(cell);
                cell = new PdfPCell(new Phrase((String) tablesVO.get("pages_used")));
                cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
                cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
                aTable1.addCell(cell);
                cell = new PdfPCell(new Phrase((String) tablesVO.get("pages_free")));
                cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
                cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
                aTable1.addCell(cell);
                cell = new PdfPCell(new Phrase(str));
                cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
                cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
                aTable1.addCell(cell);
            }
        }
        // informix
        PdfPTable aTable2 = new PdfPTable(9);
        float[] widthss = { 220f, 220f, 220f, 220f, 220f, 220f, 220f, 220f, 220f };
        aTable2.setWidths(widthss);
        aTable2.setWidthPercentage(100);
        cell = new PdfPCell(new Phrase("", titleFont));
        cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
        cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
        aTable2.addCell(cell);
        cell = new PdfPCell(new Phrase("ID", titleFont));
        cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
        cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
        aTable2.addCell(cell);
        cell = new PdfPCell(new Phrase("", titleFont));
        cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
        cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
        aTable2.addCell(cell);
        cell = new PdfPCell(new Phrase("", titleFont));
        cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
        cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
        aTable2.addCell(cell);
        cell = new PdfPCell(new Phrase("", titleFont));
        cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
        cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
        aTable2.addCell(cell);
        cell = new PdfPCell(new Phrase("", titleFont));
        cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
        cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
        aTable2.addCell(cell);
        cell = new PdfPCell(new Phrase("", titleFont));
        cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
        cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
        aTable2.addCell(cell);
        cell = new PdfPCell(new Phrase("", titleFont));
        cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
        cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
        aTable2.addCell(cell);
        cell = new PdfPCell(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 PdfPCell(new Phrase(((Integer) tablesVO.get("uniqid")).intValue() + ""));
                cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
                cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
                aTable2.addCell(cell);
                cell = new PdfPCell(new Phrase(((Integer) tablesVO.get("size")).intValue() + ""));
                cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
                cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
                aTable2.addCell(cell);
                cell = new PdfPCell(new Phrase(((Integer) tablesVO.get("used")).intValue() + ""));
                cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
                cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
                aTable2.addCell(cell);
                cell = new PdfPCell(new Phrase((String) tablesVO.get("is_used")));
                cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
                cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
                aTable2.addCell(cell);
                cell = new PdfPCell(new Phrase((String) tablesVO.get("is_current")));
                cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
                cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
                aTable2.addCell(cell);
                cell = new PdfPCell(new Phrase((String) tablesVO.get("is_backed_up")));
                cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
                cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
                aTable2.addCell(cell);
                cell = new PdfPCell(new Phrase((String) tablesVO.get("is_archived")));
                cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
                cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
                aTable2.addCell(cell);
                cell = new PdfPCell(new Phrase((String) tablesVO.get("is_temp")));
                cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
                cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
                aTable2.addCell(cell);
            }
        }
        // end 
        // --
        PdfPTable aTable3 = new PdfPTable(14);
        float[] widths1 = { 220f, 220f, 220f, 220f, 220f, 220f, 220f, 220f, 220f, 220f, 220f, 220f, 220f,
                220f };
        aTable3.setWidths(widths1);
        aTable3.setWidthPercentage(100);

        cell = new PdfPCell(new Phrase("", titleFont));
        cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
        cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
        aTable3.addCell(cell);
        cell = new PdfPCell(new Phrase("", titleFont));
        cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
        cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
        aTable3.addCell(cell);
        cell = new PdfPCell(new Phrase("", titleFont));
        cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
        cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
        aTable3.addCell(cell);
        cell = new PdfPCell(new Phrase("", titleFont));
        cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
        cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
        aTable3.addCell(cell);
        cell = new PdfPCell(new Phrase("", titleFont));
        cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
        cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
        aTable3.addCell(cell);
        cell = new PdfPCell(new Phrase("", titleFont));
        cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
        cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
        aTable3.addCell(cell);
        cell = new PdfPCell(new Phrase("", titleFont));
        cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
        cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
        aTable3.addCell(cell);
        cell = new PdfPCell(new Phrase("", titleFont));
        cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
        cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
        aTable3.addCell(cell);
        cell = new PdfPCell(new Phrase("", titleFont));
        cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
        cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
        aTable3.addCell(cell);
        cell = new PdfPCell(new Phrase("", titleFont));
        cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
        cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
        aTable3.addCell(cell);
        cell = new PdfPCell(new Phrase("", titleFont));
        cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
        cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
        aTable3.addCell(cell);
        cell = new PdfPCell(new Phrase("", titleFont));
        cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
        cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
        aTable3.addCell(cell);
        cell = new PdfPCell(new Phrase("", titleFont));
        cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
        cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
        aTable3.addCell(cell);
        cell = new PdfPCell(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 PdfPCell(new Phrase(i + 1 + ""));
                cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
                cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
                aTable3.addCell(cell);
                cell = new PdfPCell(new Phrase((String) tablesVO.get("username")));
                cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
                cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
                aTable3.addCell(cell);
                cell = new PdfPCell(new Phrase((String) tablesVO.get("hostname")));
                cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
                cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
                aTable3.addCell(cell);
                cell = new PdfPCell(new Phrase((String) tablesVO.get("access")));
                cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
                cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
                aTable3.addCell(cell);
                cell = new PdfPCell(new Phrase(((Integer) tablesVO.get("lockreqs")).intValue() + ""));
                cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
                cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
                aTable3.addCell(cell);
                cell = new PdfPCell(new Phrase(((Integer) tablesVO.get("locksheld")).intValue() + ""));
                cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
                cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
                aTable3.addCell(cell);
                cell = new PdfPCell(new Phrase(((Integer) tablesVO.get("lockwts")).intValue() + ""));
                cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
                cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
                aTable3.addCell(cell);
                cell = new PdfPCell(new Phrase(((Integer) tablesVO.get("deadlks")).intValue() + ""));
                cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
                cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
                aTable3.addCell(cell);
                cell = new PdfPCell(new Phrase(((Integer) tablesVO.get("lktouts")).intValue() + ""));
                cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
                cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
                aTable3.addCell(cell);
                cell = new PdfPCell(new Phrase(((Integer) tablesVO.get("bufreads")).intValue() + ""));
                cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
                cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
                aTable3.addCell(cell);
                cell = new PdfPCell(new Phrase(((Integer) tablesVO.get("bufwrites")).intValue() + ""));
                cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
                cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
                aTable3.addCell(cell);
                cell = new PdfPCell(new Phrase(((Integer) tablesVO.get("pagreads")).intValue() + ""));
                cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
                cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
                aTable3.addCell(cell);
                cell = new PdfPCell(new Phrase(((Integer) tablesVO.get("pagwrites")).intValue() + ""));
                cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
                cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
                aTable3.addCell(cell);
            }
        }

        // int row4 = row3 + row2;
        int row5 = 0;
        PdfPTable aTable4 = new PdfPTable(7);
        float[] widths2 = { 220f, 220f, 220f, 220f, 220f, 220f, 220f };
        aTable4.setWidths(widths2);
        aTable4.setWidthPercentage(100);
        // 
        cell = new PdfPCell(new Phrase("", titleFont));
        cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
        cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
        aTable4.addCell(cell);
        cell = new PdfPCell(new Phrase("", titleFont));
        cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
        cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
        aTable4.addCell(cell);
        cell = new PdfPCell(new Phrase("", titleFont));
        cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
        cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
        aTable4.addCell(cell);
        cell = new PdfPCell(new Phrase("", titleFont));
        cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
        cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
        aTable4.addCell(cell);
        cell = new PdfPCell(new Phrase("", titleFont));
        cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
        cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
        aTable4.addCell(cell);
        cell = new PdfPCell(new Phrase("", titleFont));
        cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
        cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
        aTable4.addCell(cell);
        cell = new PdfPCell(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 PdfPCell(new Phrase(i + 1 + ""));
                cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
                cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
                aTable4.addCell(cell);
                cell = new PdfPCell(new Phrase((String) tablesVO.get("username")));
                cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
                cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
                aTable4.addCell(cell);
                cell = new PdfPCell(new Phrase((String) tablesVO.get("hostname")));
                cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
                cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
                aTable4.addCell(cell);
                cell = new PdfPCell(new Phrase((String) tablesVO.get("dbsname")));
                cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
                cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
                aTable4.addCell(cell);
                cell = new PdfPCell(new Phrase((String) tablesVO.get("tabname")));
                cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
                cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
                aTable4.addCell(cell);
                cell = new PdfPCell(new Phrase((String) tablesVO.get("desc")));
                cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
                cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
                aTable4.addCell(cell);
            }
        }
        // informix i/o
        PdfPTable aTable5 = new PdfPTable(10);
        float[] widths3 = { 220f, 220f, 220f, 220f, 220f, 220f, 220f, 220f, 220f, 220f };
        aTable5.setWidths(widths3);
        aTable5.setWidthPercentage(100);
        cell = new PdfPCell(new Phrase("I/O", titleFont));
        cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
        cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
        aTable5.addCell(cell);
        cell = new PdfPCell(new Phrase("", titleFont));
        cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
        cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
        aTable5.addCell(cell);
        cell = new PdfPCell(new Phrase("", titleFont));
        cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
        cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
        aTable5.addCell(cell);
        cell = new PdfPCell(new Phrase("", titleFont));
        cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
        cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
        aTable5.addCell(cell);
        cell = new PdfPCell(new Phrase("", titleFont));
        cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
        cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
        aTable5.addCell(cell);
        cell = new PdfPCell(new Phrase("", titleFont));
        cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
        cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
        aTable5.addCell(cell);
        cell = new PdfPCell(new Phrase("", titleFont));
        cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
        cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
        aTable5.addCell(cell);
        cell = new PdfPCell(new Phrase("", titleFont));
        cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
        cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
        aTable5.addCell(cell);
        cell = new PdfPCell(new Phrase("", titleFont));
        cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
        cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
        aTable5.addCell(cell);
        cell = new PdfPCell(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 PdfPCell(new Phrase((String) tablesVO.get("chunknum")));
                cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
                cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
                aTable5.addCell(cell);
                cell = new PdfPCell(new Phrase(((Integer) tablesVO.get("reads")).intValue() + ""));
                cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
                cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
                aTable5.addCell(cell);
                cell = new PdfPCell(new Phrase(((Integer) tablesVO.get("pagesread")).intValue() + ""));
                cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
                cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
                aTable5.addCell(cell);
                cell = new PdfPCell(new Phrase(((Integer) tablesVO.get("writes")).intValue() + ""));
                cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
                cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
                aTable5.addCell(cell);
                cell = new PdfPCell(new Phrase(((Integer) tablesVO.get("pageswritten")).intValue() + ""));
                cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
                cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
                aTable5.addCell(cell);
                cell = new PdfPCell(new Phrase(((Integer) tablesVO.get("mreads")).intValue() + ""));
                cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
                cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
                aTable5.addCell(cell);
                cell = new PdfPCell(new Phrase(((Integer) tablesVO.get("mpagesread")).intValue() + ""));
                cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
                cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
                aTable5.addCell(cell);
                cell = new PdfPCell(new Phrase(((Integer) tablesVO.get("mwrites")).intValue() + ""));
                cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
                cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
                aTable5.addCell(cell);
                cell = new PdfPCell(new Phrase(((Integer) tablesVO.get("mpageswritten")).intValue() + ""));
                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(new Paragraph("\n"));
        document.add(aTable2);
        document.add(new Paragraph("\n"));
        document.add(aTable3);
        document.add(new Paragraph("\n"));
        document.add(aTable4);
        document.add(new Paragraph("\n"));
        document.add(aTable5);
        document.close();
    } catch (Exception e) {
        // SysLogger.error("Error in ExcelReport.createReport()",e);
        SysLogger.error("", e);
    }

}