Example usage for java.util Hashtable size

List of usage examples for java.util Hashtable size

Introduction

In this page you can find the example usage for java.util Hashtable size.

Prototype

public synchronized int size() 

Source Link

Document

Returns the number of keys in this hashtable.

Usage

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

/**
 * @author sunqichang///from   w ww  . ja v  a  2s . c  o  m
 * 
 * 
 * @param sheet
 * @param ip
 * @param reportHash
 */
protected void createMemory(WritableSheet sheet, String ip, Hashtable reportHash) {
    int allRow = 24;
    Label label = null;
    Label tmpLabel = null;
    String[] memoryItemch = { "", "", "", "" };
    String[] memoryItem = { "Capability", "Utilization" };
    Hashtable Memory = (Hashtable) reportHash.get("Memory");
    Hashtable memMaxHash = (Hashtable) reportHash.get("memmaxhash");
    Hashtable memAvgHash = (Hashtable) reportHash.get("memavghash");
    // String ip = (String) reportHash.get("ip");
    String newip = doip(ip);
    try {
        tmpLabel = new Label(0, allRow, "", b_labelFormat);
        sheet.addCell(tmpLabel);
        sheet.mergeCells(0, allRow, 0, allRow + 10);
        // 
        label = new Label(1, allRow, "", _labelFormat);
        sheet.addCell(label);
        int count = 0;
        for (int i = 0; i < memoryItemch.length; i++) {
            label = new Label(count + 2, allRow, memoryItemch[i], _labelFormat);
            sheet.addCell(label);
            sheet.mergeCells(count + 2, allRow, count + 2 + 1, allRow);
            count += 2;
        }
        File file;
        if (Memory != null && Memory.size() > 0) {
            // 
            for (int i = 0; i < Memory.size(); i++) {
                p_labelFormat = colorChange(i);
                Hashtable mhash = (Hashtable) (Memory.get(new Integer(i)));
                String name = (String) mhash.get("name");
                allRow = allRow + 1;
                label = new Label(1, allRow, name, p_labelFormat);
                sheet.addCell(label);
                int count1 = 0;
                for (int j = 0; j < memoryItem.length; j++) {
                    String value = "";
                    if (mhash.get(memoryItem[j]) != null) {
                        value = (String) mhash.get(memoryItem[j]);
                    }
                    label = new Label(count1 + 2, allRow, value, p_labelFormat);
                    sheet.addCell(label);
                    sheet.mergeCells(count1 + 2, allRow, count1 + 2 + 1, allRow);
                    count1 += 2;
                }
                String value = "";
                if (memMaxHash.get(name) != null) {
                    value = (String) memMaxHash.get(name);
                    label = new Label(memoryItem.length + 4, allRow, value, p_labelFormat);
                    sheet.addCell(label);
                    sheet.mergeCells(memoryItem.length + 4, allRow, memoryItem.length + 4 + 1, allRow);
                }
                String avgvalue = "";
                if (memAvgHash.get(name) != null) {
                    avgvalue = (String) memAvgHash.get(name);
                    label = new Label(memoryItem.length + 6, allRow, avgvalue, p_labelFormat);
                    sheet.addCell(label);
                    sheet.mergeCells(memoryItem.length + 6, allRow, memoryItem.length + 6 + 1, allRow);
                }

            } // end 
              // 
            file = new File(ResourceCenter.getInstance().getSysPath() + "/resource/image/jfreechart/" + newip
                    + "memory" + ".png");
            // sheet,0,0,5,1,,,
            allRow = allRow + 1;
            sheet.addImage(new WritableImage(1, allRow, 9, 8, file));
        } else {
            // 
            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++) {
                p_labelFormat = colorChange(i);
                String name = names[i];
                allRow = allRow + 1;
                label = new Label(1, allRow, names[i], p_labelFormat);
                sheet.addCell(label);
                int count2 = 0;
                for (int j = 0; j < memoryItem.length; j++) {
                    // 
                    String value = "";
                    label = new Label(j + 2, allRow, value, p_labelFormat);
                    sheet.addCell(label);
                    sheet.mergeCells(count2 + 2, allRow, count2 + 2 + 1, allRow);
                    count2 += 2;
                }
                String value = "";
                if (memMaxHash.get(name) != null) {
                    value = (String) memMaxHash.get(name);
                    label = new Label(memoryItem.length + 4, allRow, value, p_labelFormat);
                    sheet.addCell(label);
                } else {
                    label = new Label(memoryItem.length + 4, allRow, value, p_labelFormat);
                    sheet.addCell(label);
                }
                sheet.mergeCells(memoryItem.length + 4, allRow, memoryItem.length + 4 + 1, allRow);
                String avgvalue = "";
                if (memAvgHash.get(name) != null) {
                    avgvalue = (String) memAvgHash.get(name);
                    label = new Label(memoryItem.length + 5, allRow, avgvalue, p_labelFormat);
                    sheet.addCell(label);
                } else {
                    label = new Label(memoryItem.length + 6, allRow, avgvalue, p_labelFormat);
                    sheet.addCell(label);
                }
                sheet.mergeCells(memoryItem.length + 6, allRow, memoryItem.length + 6 + 1, allRow);

            } // end 
              // 
            file = new File(ResourceCenter.getInstance().getSysPath() + "/resource/image/jfreechart/" + newip
                    + "memory" + ".png");
            // sheet,0,0,5,1,,,
            allRow = allRow + 1;
            sheet.addImage(new WritableImage(1, allRow, 9, 8, file));
        }
    } catch (RowsExceededException e) {
        SysLogger.error("", e);
    } catch (WriteException e) {
        SysLogger.error("", e);
    }

}

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

/**
 * @author HONGLI MySQLword,pdf/*from w ww. ja v  a  2s.c om*/
 * @param filename
 * @param type
 * @throws IOException
 */
public void createReport_MySQLCldDoc(String filename, String type) throws IOException {
    if (impReport.getTable() == null) {
        fileName = null;
        return;
    }
    try {
        // 
        Document document = new Document(PageSize.A4);
        // (Writer)document(Writer)
        if ("pdf".equals(type)) {
            PdfWriter.getInstance(document, new FileOutputStream(filename));
        } else {
            RtfWriter2.getInstance(document, new FileOutputStream(filename));
        }
        document.open();
        // 
        BaseFont bfChinese = BaseFont.createFont("STSong-Light", "UniGB-UCS2-H", BaseFont.NOT_EMBEDDED);
        // 
        Font titleFont = new Font(bfChinese, 12, Font.BOLD);
        // 
        Font contextFont = new Font(bfChinese, 12, Font.NORMAL);
        String hostname = (String) reportHash.get("dbname");
        String ip = (String) reportHash.get("ip");
        String typename = (String) reportHash.get("typename");
        String runstr = (String) reportHash.get("runstr");
        String grade = (String) reportHash.get("grade");
        String pingnow = (String) reportHash.get("pingnow");
        String pingmin = (String) reportHash.get("pingmin");
        String pingconavg = (String) reportHash.get("pingconavg");
        DBVo vo = (DBVo) reportHash.get("vo");

        Vector val = (Vector) reportHash.get("Val");
        if (val == null) {
            val = new Vector();
        }
        List sessionlist = (ArrayList) reportHash.get("sessionlist");
        if (sessionlist == null) {
            sessionlist = new ArrayList();
        }
        Hashtable tablesHash = (Hashtable) reportHash.get("tablesHash");
        if (tablesHash == null) {
            tablesHash = new Hashtable();
        }
        Vector tableinfo_v = (Vector) reportHash.get("tableinfo_v");
        if (tableinfo_v == null) {
            tableinfo_v = new Vector();
        }
        String newip = doip(ip);
        Paragraph title = new Paragraph(hostname + "", titleFont);
        // 
        title.setAlignment(Element.ALIGN_CENTER);
        // title.setFont(titleFont);
        document.add(title);
        String Ping = (String) reportHash.get("Ping");
        String starttime = (String) reportHash.get("starttime");
        String totime = (String) reportHash.get("totime");

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

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

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

        Paragraph context = new Paragraph(contextString, contextFont);
        // 
        context.setAlignment(Element.ALIGN_LEFT);
        // context.setFont(contextFont);
        // 
        context.setSpacingBefore(5);
        // 
        context.setFirstLineIndent(5);
        document.add(context);
        /*
         * tmpLabel = new Label(0, 1, ":" + impReport.getTimeStamp());
         * sheet.addCell(tmpLabel); tmpLabel = new Label(0, 2, ": " +
         * starttime + "  " + totime);
         */
        // 
        Table dbTable = new Table(5);
        this.setTableFormat(dbTable);
        // float[] cellWidths = { 220f, 220f, 220f, 220f, 220f };
        // dbTable.setWidths(cellWidths);
        // dbTable.setWidth(100); //  90%
        // dbTable.setAlignment(Element.ALIGN_CENTER);// 
        // dbTable.setAutoFillEmptyCells(true); // 
        // dbTable.setBorderWidth(1); // 
        // dbTable.setBorderColor(new Color(0, 125, 255)); // 
        // dbTable.setPadding(2);// 
        // dbTable.setSpacing(0);// 
        // dbTable.setBorder(2);// 
        // dbTable.endHeaders();

        Cell dbCell = null;
        dbCell = new Cell(new Phrase("", titleFont));
        this.setCellFormat(dbCell, true);
        dbCell.setColspan(5);
        dbTable.addCell(dbCell);
        dbCell = new Cell(new Phrase("", titleFont));
        this.setCellFormat(dbCell, true);
        dbTable.addCell(dbCell);
        dbCell = new Cell(new Phrase("IP", titleFont));
        this.setCellFormat(dbCell, true);
        dbTable.addCell(dbCell);
        dbCell = new Cell(new Phrase("", titleFont));
        this.setCellFormat(dbCell, true);
        dbTable.addCell(dbCell);
        dbCell = new Cell(new Phrase("", titleFont));
        this.setCellFormat(dbCell, true);
        dbTable.addCell(dbCell);
        dbCell = new Cell(new Phrase("", titleFont));
        this.setCellFormat(dbCell, true);
        dbTable.addCell(dbCell);
        dbCell = new Cell(new Phrase(vo.getDbName(), contextFont));
        this.setCellFormat(dbCell, false);
        dbTable.addCell(dbCell);
        dbCell = new Cell(new Phrase(ip, contextFont));
        this.setCellFormat(dbCell, false);
        dbTable.addCell(dbCell);
        dbCell = new Cell(new Phrase(typename, contextFont));
        this.setCellFormat(dbCell, false);
        dbTable.addCell(dbCell);
        dbCell = new Cell(new Phrase(runstr, contextFont));
        this.setCellFormat(dbCell, false);
        dbTable.addCell(dbCell);
        dbCell = new Cell(new Phrase(grade, contextFont));
        this.setCellFormat(dbCell, false);
        dbTable.addCell(dbCell);

        Table aTable = new Table(3);
        this.setTableFormat(aTable);
        // float[] widths = { 220f, 220f, 220f };
        // aTable.setWidths(widths);
        // aTable.setWidth(100); //  90%
        // aTable.setAlignment(Element.ALIGN_CENTER);// 
        // aTable.setAutoFillEmptyCells(true); // 
        // aTable.setBorderWidth(1); // 
        // aTable.setBorderColor(new Color(0, 125, 255)); // 
        // aTable.setPadding(2);// 
        // aTable.setSpacing(0);// 
        // aTable.setBorder(2);// 
        // aTable.endHeaders();
        Cell cell = null;
        cell = new Cell(new Phrase("", titleFont));
        this.setCellFormat(cell, true);
        aTable.addCell(cell);
        cell = new Cell(new Phrase("", titleFont));
        this.setCellFormat(cell, true);
        aTable.addCell(cell);
        cell = new Cell(new Phrase("", titleFont));
        this.setCellFormat(cell, true);
        aTable.addCell(cell);
        cell = new Cell(new Phrase(pingnow + "%", contextFont));
        this.setCellFormat(cell, false);
        aTable.addCell(cell);
        cell = new Cell(new Phrase(pingmin + "%", contextFont));
        this.setCellFormat(cell, false);
        aTable.addCell(cell);
        cell = new Cell(new Phrase(pingconavg + "%", contextFont));
        this.setCellFormat(cell, false);
        aTable.addCell(cell);

        // 
        Image img = Image.getInstance(ResourceCenter.getInstance().getSysPath() + "/resource/image/jfreechart/"
                + newip + "ConnectUtilization" + ".png");
        // img.setAbsolutePosition(0, 0);
        img.scalePercent(76);
        img.setAlignment(Image.LEFT);// 
        document.add(dbTable);
        document.add(aTable);
        document.add(img);
        document.add(new Paragraph("\n"));

        Table xnTable = new Table(2);
        this.setTableFormat(xnTable);
        // float[] width = { 220f, 220f };
        // xnTable.setWidths(width);
        // xnTable.setWidth(100); //  90%
        // xnTable.setAlignment(Element.ALIGN_CENTER);// 
        // xnTable.setAutoFillEmptyCells(true); // 
        // xnTable.setBorderWidth(1); // 
        // xnTable.setBorderColor(new Color(0, 125, 255)); // 
        // xnTable.setPadding(2);// 
        // xnTable.setSpacing(0);// 
        // xnTable.setBorder(2);// 
        cell = new Cell(new Phrase("", titleFont));
        this.setCellFormat(cell, true);
        cell.setColspan(2);
        xnTable.addCell(cell);
        // 
        if (val != null && val.size() > 0) {
            for (int i = 0; i < val.size(); i++) {
                Hashtable return_value = (Hashtable) val.get(i);
                if (return_value != null && return_value.size() > 0) {
                    String name = return_value.get("variable_name").toString();
                    String value = return_value.get("value").toString();
                    if (name.equalsIgnoreCase("Max_used_connections")) {
                        name = "";
                    }
                    if (name.equalsIgnoreCase("Handler_read_first")) {
                        name = "";
                    }
                    if (name.equalsIgnoreCase("Handler_read_key")) {
                        name = "";
                    }
                    if (name.equalsIgnoreCase("Handler_read_next")) {
                        name = "";
                    }
                    if (name.equalsIgnoreCase("Handler_read_prev")) {
                        name = "";
                    }
                    if (name.equalsIgnoreCase("Handler_read_rnd")) {
                        name = "H";
                    }
                    if (name.equalsIgnoreCase("Handler_read_rnd_next")) {
                        name = "";
                    }
                    if (name.equalsIgnoreCase("Open_tables")) {
                        name = "";
                    }
                    if (name.equalsIgnoreCase("Opened_tables")) {
                        name = "";
                    }
                    if (name.equalsIgnoreCase("Threads_cached")) {
                        name = "";
                    }
                    if (name.equalsIgnoreCase("Threads_connected")) {
                        name = "";
                    }
                    if (name.equalsIgnoreCase("Threads_created")) {
                        name = "";
                    }
                    if (name.equalsIgnoreCase("Threads_running")) {
                        name = "";
                    }
                    if (name.equalsIgnoreCase("Table_locks_immediate")) {
                        name = "";
                    }
                    if (name.equalsIgnoreCase("Table_locks_waited")) {
                        name = "";
                    }
                    if (name.equalsIgnoreCase("Key_read_requests")) {
                        name = "";
                    }
                    if (name.equalsIgnoreCase("Key_reads")) {
                        name = "";
                    }
                    if (name.equalsIgnoreCase("log_slow_queries")) {
                        name = "";
                    }
                    if (name.equalsIgnoreCase("slow_launch_time")) {
                        name = "Slow_launch_threads";
                    }
                    cell = new Cell(new Phrase(name, contextFont));
                    this.setCellFormat(cell, true);
                    xnTable.addCell(cell);
                    cell = new Cell(new Phrase(value, contextFont));
                    this.setCellFormat(cell, false);
                    xnTable.addCell(cell);
                }
            }
        }
        document.add(xnTable);

        // 
        Table dbInfoTable = new Table(6);
        this.setTableFormat(dbInfoTable);
        // float[] dbInfoWidths = { 220f, 220f, 220f, 220f, 220f, 220f };
        // dbInfoTable.setWidths(dbInfoWidths);
        // dbInfoTable.setWidth(100); //  90%
        // dbInfoTable.setAlignment(Element.ALIGN_CENTER);// 
        // dbInfoTable.setAutoFillEmptyCells(true); // 
        // dbInfoTable.setBorderWidth(1); // 
        // dbInfoTable.setBorderColor(new Color(0, 125, 255)); // 
        // dbInfoTable.setPadding(2);// 
        // dbInfoTable.setSpacing(0);// 
        // dbInfoTable.setBorder(2);// 
        cell = new Cell(new Phrase("   ", titleFont));
        this.setCellFormat(cell, true);
        cell.setColspan(6);
        dbInfoTable.addCell(cell);

        cell = new Cell(new Phrase("", titleFont));
        this.setCellFormat(cell, true);
        dbInfoTable.addCell(cell);
        cell = new Cell(new Phrase("", titleFont));
        this.setCellFormat(cell, true);
        dbInfoTable.addCell(cell);
        cell = new Cell(new Phrase(" ", titleFont));
        this.setCellFormat(cell, true);
        dbInfoTable.addCell(cell);
        cell = new Cell(new Phrase("  ", titleFont));
        this.setCellFormat(cell, true);
        dbInfoTable.addCell(cell);
        cell = new Cell(new Phrase("  ", titleFont));
        this.setCellFormat(cell, true);
        dbInfoTable.addCell(cell);
        cell = new Cell(new Phrase("", titleFont));
        this.setCellFormat(cell, true);
        dbInfoTable.addCell(cell);
        if (sessionlist != null && sessionlist.size() > 0) {
            for (int i = 0; i < sessionlist.size(); i++) {
                List ipsessionlist = (List) sessionlist.get(i);
                if (ipsessionlist != null && ipsessionlist.size() > 0) {
                    for (int k = 0; k < ipsessionlist.size(); k++) {
                        String[] sessions = (String[]) ipsessionlist.get(k);
                        if (sessions != null && sessions.length == 5) {
                            cell = new Cell(new Phrase((k + 1) + "", contextFont));
                            this.setCellFormat(cell, false);
                            dbInfoTable.addCell(cell);
                            cell = new Cell(new Phrase(sessions[4], contextFont));
                            this.setCellFormat(cell, false);
                            dbInfoTable.addCell(cell);
                            cell = new Cell(new Phrase(sessions[0], contextFont));
                            this.setCellFormat(cell, false);
                            dbInfoTable.addCell(cell);
                            cell = new Cell(new Phrase(sessions[1], contextFont));
                            this.setCellFormat(cell, false);
                            dbInfoTable.addCell(cell);
                            cell = new Cell(new Phrase(sessions[2], contextFont));
                            this.setCellFormat(cell, false);
                            dbInfoTable.addCell(cell);
                            cell = new Cell(new Phrase(sessions[3], contextFont));
                            this.setCellFormat(cell, false);
                            dbInfoTable.addCell(cell);
                        }
                    }
                }
            }
        }
        document.add(dbInfoTable);

        // 
        Table tabTable = new Table(5);
        this.setTableFormat(tabTable);
        // float[] sysInfoWidths = { 220f, 220f, 220f, 220f, 220f };
        // dbInfoTable.setWidths(dbInfoWidths);
        // tabTable.setWidth(100); //  90%
        // tabTable.setAlignment(Element.ALIGN_CENTER);// 
        // tabTable.setAutoFillEmptyCells(true); // 
        // tabTable.setBorderWidth(1); // 
        // tabTable.setBorderColor(new Color(0, 125, 255)); // 
        // tabTable.setPadding(2);// 
        // tabTable.setSpacing(0);// 
        // tabTable.setBorder(2);// 
        Hashtable sysValue = (Hashtable) reportHash.get("sysValue");// 
        cell = new Cell(new Phrase(" ", titleFont));
        this.setCellFormat(cell, true);
        cell.setColspan(5);
        tabTable.addCell(cell);

        cell = new Cell(new Phrase(" ", titleFont));
        this.setCellFormat(cell, true);
        tabTable.addCell(cell);
        cell = new Cell(new Phrase(" ", titleFont));
        this.setCellFormat(cell, true);
        tabTable.addCell(cell);
        cell = new Cell(new Phrase("  ", titleFont));
        this.setCellFormat(cell, true);
        tabTable.addCell(cell);
        cell = new Cell(new Phrase(" ", titleFont));
        this.setCellFormat(cell, true);
        tabTable.addCell(cell);
        cell = new Cell(new Phrase(" ", titleFont));
        this.setCellFormat(cell, true);
        tabTable.addCell(cell);
        String[] dbs = vo.getDbName().split(",");
        if (dbs != null && dbs.length > 0) {
            for (int i = 0; i < dbs.length; i++) {
                String dbStr = dbs[i];
                // System.out.println(dbStr+"====="+tablesHash.size());
                if (tablesHash.containsKey(dbStr)) {
                    List tableslist = (List) tablesHash.get(dbStr);
                    if (tableslist != null && tableslist.size() > 0) {
                        for (int k = 0; k < tableslist.size(); k++) {
                            String[] tables = (String[]) tableslist.get(k);
                            if (tables != null && tables.length == 4) {
                                cell = new Cell(new Phrase((k + 1) + "", contextFont));
                                this.setCellFormat(cell, false);
                                tabTable.addCell(cell);
                                cell = new Cell(new Phrase(tables[0], contextFont));
                                this.setCellFormat(cell, false);
                                tabTable.addCell(cell);
                                cell = new Cell(new Phrase(tables[1], contextFont));
                                this.setCellFormat(cell, false);
                                tabTable.addCell(cell);
                                cell = new Cell(new Phrase(tables[2], contextFont));
                                this.setCellFormat(cell, false);
                                tabTable.addCell(cell);
                                cell = new Cell(new Phrase(tables[3], contextFont));
                                this.setCellFormat(cell, false);
                                tabTable.addCell(cell);
                            }
                        }
                    }
                }
            }
        }
        document.add(tabTable);

        // 
        Table stateTable = new Table(3);
        this.setTableFormat(stateTable);
        // float[] statewidth = { 220f, 220f, 220f };
        // stateTable.setWidths(statewidth);
        // stateTable.setWidth(100); //  90%
        // stateTable.setAlignment(Element.ALIGN_CENTER);// 
        // stateTable.setAutoFillEmptyCells(true); // 
        // stateTable.setBorderWidth(1); // 
        // stateTable.setBorderColor(new Color(0, 125, 255)); // 
        // stateTable.setPadding(2);// 
        // stateTable.setSpacing(0);// 
        // stateTable.setBorder(2);// 
        cell = new Cell(new Phrase("", titleFont));
        this.setCellFormat(cell, true);
        cell.setColspan(3);// HONGLILI
        stateTable.addCell(cell);
        cell = new Cell(new Phrase(" ", titleFont));
        this.setCellFormat(cell, true);
        stateTable.addCell(cell);
        cell = new Cell(new Phrase(" ", titleFont));
        this.setCellFormat(cell, true);
        stateTable.addCell(cell);
        cell = new Cell(new Phrase("  ", titleFont));
        this.setCellFormat(cell, true);
        stateTable.addCell(cell);
        if (tableinfo_v != null) {
            for (int i = 0; i < tableinfo_v.size(); i++) {
                Hashtable ht = (Hashtable) tableinfo_v.get(i);
                String size = ht.get("variable_name").toString();
                String free = ht.get("value").toString();
                if (size.equalsIgnoreCase("auto_increment_increment")) {
                    size = "";
                }
                if (size.equalsIgnoreCase("auto_increment_offset")) {
                    size = "AUTO_INCREMENT";
                }
                if (size.equalsIgnoreCase("automatic_sp_privileges")) {
                    size = "automatic_sp_privileges";
                }
                if (size.equalsIgnoreCase("back_log")) {
                    size = "";
                }
                if (size.equalsIgnoreCase("basedir")) {
                    size = "MySQL";
                }
                if (size.equalsIgnoreCase("binlog_cache_size")) {
                    size = "SQL";
                }
                if (size.equalsIgnoreCase("bulk_insert_buffer_size")) {
                    size = "";
                }
                if (size.equalsIgnoreCase("character_set_client")) {
                    size = "";
                }
                if (size.equalsIgnoreCase("character_set_connection")) {
                    size = "";
                }
                if (size.equalsIgnoreCase("character_set_database")) {
                    size = "";
                }
                if (size.equalsIgnoreCase("character_set_filesystem")) {
                    size = "character_set_filesystem";
                }
                if (size.equalsIgnoreCase("character_set_results")) {
                    size = "";
                }
                if (size.equalsIgnoreCase("character_set_server")) {
                    size = "";
                }
                if (size.equalsIgnoreCase("character_set_system")) {
                    size = "";
                }
                if (size.equalsIgnoreCase("character_sets_dir")) {
                    size = "";
                }
                if (size.equalsIgnoreCase("collation_connection")) {
                    size = "";
                }
                if (size.equalsIgnoreCase("collation_database")) {
                    size = "";
                }
                if (size.equalsIgnoreCase("collation_server")) {
                    size = "";
                }
                if (size.equalsIgnoreCase("completion_type")) {
                    size = "";
                }
                if (size.equalsIgnoreCase("concurrent_insert")) {
                    size = "";
                }
                if (size.equalsIgnoreCase("connect_timeout")) {
                    size = "Bad handshake";
                }
                if (size.equalsIgnoreCase("datadir")) {
                    size = "MySQL";
                }
                if (size.equalsIgnoreCase("date_format")) {
                    size = "date_format()";
                }
                if (size.equalsIgnoreCase("datetime_format")) {
                    size = "datetime_format()";
                }
                if (size.equalsIgnoreCase("default_week_format")) {
                    size = "WEEK() ";
                }
                if (size.equalsIgnoreCase("delay_key_write")) {
                    size = "DELAY_KEY_WRITE";
                }
                if (size.equalsIgnoreCase("delayed_insert_limit")) {
                    size = "INSERT DELAYEDSELECT";
                }
                if (size.equalsIgnoreCase("delayed_insert_timeout")) {
                    size = "INSERT DELAYEDINSERT";
                }
                if (size.equalsIgnoreCase("delayed_queue_size")) {
                    size = "INSERT DELAYED";
                }
                if (size.equalsIgnoreCase("div_precision_increment")) {
                    size = "/";
                }
                if (size.equalsIgnoreCase("engine_condition_pushdown")) {
                    size = "NDB";
                }
                if (size.equalsIgnoreCase("expire_logs_days")) {
                    size = "";
                }
                if (size.equalsIgnoreCase("flush")) {
                    size = "flushmysqld";
                }
                if (size.equalsIgnoreCase("flush_time")) {
                    size = "";
                }
                if (size.equalsIgnoreCase("ft_boolean_syntax")) {
                    size = "IN BOOLEAN MODE";
                }
                if (size.equalsIgnoreCase("ft_max_word_len")) {
                    size = "FULLTEXT";
                }
                if (size.equalsIgnoreCase("ft_min_word_len")) {
                    size = "FULLTEXT";
                }
                if (size.equalsIgnoreCase("ft_query_expansion_limit")) {
                    size = "WITH QUERY EXPANSION";
                }
                if (size.equalsIgnoreCase("ft_stopword_file")) {
                    size = "";
                }
                if (size.equalsIgnoreCase("group_concat_max_len")) {
                    size = "GROUP_CONCAT()";
                }
                if (size.equalsIgnoreCase("have_archive")) {
                    size = "mysqldARCHIVE";
                }
                if (size.equalsIgnoreCase("have_bdb")) {
                    size = "mysqldBDB";
                }
                if (size.equalsIgnoreCase("have_blackhole_engine")) {
                    size = "mysqldBLACKHOLE";
                }
                if (size.equalsIgnoreCase("have_compress")) {
                    size = "zlib";
                }
                if (size.equalsIgnoreCase("have_crypt")) {
                    size = "crypt()";
                }
                if (size.equalsIgnoreCase("have_csv")) {
                    size = "mysqldARCHIVE";
                }
                if (size.equalsIgnoreCase("have_example_engine")) {
                    size = "mysqldEXAMPLE";
                }
                if (size.equalsIgnoreCase("have_federated_engine")) {
                    size = "mysqldFEDERATED";
                }
                if (size.equalsIgnoreCase("have_geometry")) {
                    size = "";
                }
                if (size.equalsIgnoreCase("have_innodb")) {
                    size = "mysqldInnoDB";
                }
                if (size.equalsIgnoreCase("have_isam")) {
                    size = "";
                }
                if (size.equalsIgnoreCase("have_ndbcluster")) {
                    size = "mysqldNDB CLUSTER";
                }
                if (size.equalsIgnoreCase("have_openssl")) {
                    size = "mysqld/SSL()";
                }
                if (size.equalsIgnoreCase("have_query_cache")) {
                    size = "mysqld";
                }
                if (size.equalsIgnoreCase("have_raid")) {
                    size = "mysqldRAID";
                }
                if (size.equalsIgnoreCase("have_rtree_keys")) {
                    size = "RTREE";
                }
                if (size.equalsIgnoreCase("have_symlink")) {
                    size = "";
                }
                if (size.equalsIgnoreCase("init_connect")) {
                    size = "";
                }
                if (size.equalsIgnoreCase("init_file")) {
                    size = "--init-file";
                }
                if (size.equalsIgnoreCase("init_slave")) {
                    size = "SQL";
                }
                if (size.equalsIgnoreCase("innodb_additional_mem_pool_size")) {
                    size = "InnoDB";
                }
                if (size.equalsIgnoreCase("innodb_autoextend_increment")) {
                    size = "";
                }
                if (size.equalsIgnoreCase("innodb_buffer_pool_awe_mem_mb")) {
                    size = "32WindowsAWE";
                }
                if (size.equalsIgnoreCase("innodb_buffer_pool_size")) {
                    size = "InnoDB";
                }
                if (size.equalsIgnoreCase("innodb_checksums")) {
                    size = "InnoDB";
                }
                if (size.equalsIgnoreCase("innodb_commit_concurrency")) {
                    size = "innodb_commit_concurrency";
                }
                if (size.equalsIgnoreCase("innodb_concurrency_tickets")) {
                    size = "innodb_concurrency_tickets";
                }
                if (size.equalsIgnoreCase("innodb_data_file_path")) {
                    size = "";
                }
                if (size.equalsIgnoreCase("innodb_data_home_dir")) {
                    size = "InnoDB";
                }
                if (size.equalsIgnoreCase("innodb_doublewrite")) {
                    size = "InnoDB";
                }
                if (size.equalsIgnoreCase("innodb_fast_shutdown")) {
                    size = "InnoDB";
                }
                if (size.equalsIgnoreCase("innodb_file_io_threads")) {
                    size = "InnoDBI/O";
                }
                if (size.equalsIgnoreCase("innodb_file_per_table")) {
                    size = "InnoDB.ibd";
                }
                if (size.equalsIgnoreCase("innodb_flush_log_at_trx_commit")) {
                    size = "InnoDB";
                }
                if (size.equalsIgnoreCase("innodb_flush_method")) {
                    size = "InnoDBfsync()";
                }
                if (size.equalsIgnoreCase("innodb_force_recovery")) {
                    size = "";
                }
                if (size.equalsIgnoreCase("innodb_lock_wait_timeout")) {
                    size = "InnoDB";
                }
                if (size.equalsIgnoreCase("innodb_locks_unsafe_for_binlog")) {
                    size = "InnoDB";
                }
                if (size.equalsIgnoreCase("innodb_log_arch_dir")) {
                    size = " ";
                }
                if (size.equalsIgnoreCase("innodb_log_archive")) {
                    size = "";
                }
                if (size.equalsIgnoreCase("innodb_log_buffer_size")) {
                    size = "InnoDB";
                }
                if (size.equalsIgnoreCase("innodb_log_file_size")) {
                    size = "";
                }
                if (size.equalsIgnoreCase("innodb_log_files_in_group")) {
                    size = "";
                }
                if (size.equalsIgnoreCase("innodb_log_group_home_dir")) {
                    size = "InnoDB";
                }
                if (size.equalsIgnoreCase("innodb_max_dirty_pages_pct")) {
                    size = "InnoDB";
                }
                if (size.equalsIgnoreCase("innodb_max_purge_lag")) {
                    size = "INSERT,UPDATEDELETE";
                }
                if (size.equalsIgnoreCase("innodb_mirrored_log_groups")) {
                    size = "";
                }
                if (size.equalsIgnoreCase("innodb_open_files")) {
                    size = "InnoDB.ibd";
                }
                if (size.equalsIgnoreCase("innodb_support_xa")) {
                    size = "InnoDBXA";
                }
                if (size.equalsIgnoreCase("innodb_sync_spin_loops")) {
                    size = "innodb_sync_spin_loops";
                }
                if (size.equalsIgnoreCase("innodb_table_locks")) {
                    size = "InnoDB";
                }
                if (size.equalsIgnoreCase("innodb_thread_concurrency")) {
                    size = "InnoDBInnoDB";
                }
                if (size.equalsIgnoreCase("innodb_thread_sleep_delay")) {
                    size = "InnoDBSHOW INNODB STATUS<datadir>/innodb_status";
                }
                if (size.equalsIgnoreCase("interactive_timeout")) {
                    size = "";
                }
                if (size.equalsIgnoreCase("join_buffer_size")) {
                    size = "";
                }
                if (size.equalsIgnoreCase("key_buffer_size")) {
                    size = "";
                }
                if (size.equalsIgnoreCase("key_cache_age_threshold")) {
                    size = "(sub-chain)(sub-chain)";
                }
                if (size.equalsIgnoreCase("key_cache_block_size")) {
                    size = "";
                }
                if (size.equalsIgnoreCase("key_cache_division_limit")) {
                    size = "";
                }
                if (size.equalsIgnoreCase("language")) {
                    size = "";
                }
                if (size.equalsIgnoreCase("large_files_support")) {
                    size = "mysqld";
                }
                if (size.equalsIgnoreCase("large_page_size")) {
                    size = "large_page_size";
                }
                if (size.equalsIgnoreCase("large_pages")) {
                    size = "";
                }
                if (size.equalsIgnoreCase("license")) {
                    size = "";
                }
                if (size.equalsIgnoreCase("local_infile")) {
                    size = "LOCALLOAD DATA INFILE";
                }
                if (size.equalsIgnoreCase("log")) {
                    size = "";
                }
                if (size.equalsIgnoreCase("log_bin")) {
                    size = "";
                }
                if (size.equalsIgnoreCase("log_bin_trust_function_creators")) {
                    size = "";
                }
                if (size.equalsIgnoreCase("log_error")) {
                    size = "";
                }
                if (size.equalsIgnoreCase("log_slave_updates")) {
                    size = "";
                }
                if (size.equalsIgnoreCase("log_slow_queries")) {
                    size = "";
                }
                if (size.equalsIgnoreCase("log_warnings")) {
                    size = "";
                }
                if (size.equalsIgnoreCase("long_query_time")) {
                    size = "Slow_queries";
                }
                if (size.equalsIgnoreCase("low_priority_updates")) {
                    size = "sqlSELECTLOCK TABLE READ";
                }
                if (size.equalsIgnoreCase("lower_case_file_system")) {
                    size = "";
                }
                if (size.equalsIgnoreCase("lower_case_table_names")) {
                    size = "1";
                }
                if (size.equalsIgnoreCase("max_allowed_packet")) {
                    size = "/";
                }
                if (size.equalsIgnoreCase("max_binlog_cache_size")) {
                    size = "";
                }
                if (size.equalsIgnoreCase("max_binlog_size")) {
                    size = "";
                }
                if (size.equalsIgnoreCase("max_connect_errors")) {
                    size = "";
                }
                if (size.equalsIgnoreCase("max_connections")) {
                    size = "";
                }
                if (size.equalsIgnoreCase("max_delayed_threads")) {
                    size = "INSERT DELAYED";
                }
                if (size.equalsIgnoreCase("max_error_count")) {
                    size = "SHOW ERRORSSHOW WARNINGS";
                }
                if (size.equalsIgnoreCase("max_heap_table_size")) {
                    size = "MEMORY (HEAP)";
                }
                if (size.equalsIgnoreCase("max_insert_delayed_threads")) {
                    size = "INSERT DELAYED(max_delayed_threads)";
                }
                if (size.equalsIgnoreCase("max_join_size")) {
                    size = "max_join_size";
                }
                if (size.equalsIgnoreCase("max_length_for_sort_data")) {
                    size = "filesort";
                }
                if (size.equalsIgnoreCase("max_prepared_stmt_count")) {
                    size = "max_prepared_stmt_count";
                }
                if (size.equalsIgnoreCase("max_relay_log_size")) {
                    size = "";
                }
                if (size.equalsIgnoreCase("max_seeks_for_key")) {
                    size = "";
                }
                if (size.equalsIgnoreCase("max_sort_length")) {
                    size = "BLOBTEXT";
                }
                if (size.equalsIgnoreCase("max_sp_recursion_depth")) {
                    size = "max_sp_recursion_depth";
                }
                if (size.equalsIgnoreCase("max_tmp_tables")) {
                    size = "";
                }
                if (size.equalsIgnoreCase("max_user_connections")) {
                    size = "MySQL";
                }
                if (size.equalsIgnoreCase("max_write_lock_count")) {
                    size = "";
                }
                if (size.equalsIgnoreCase("multi_range_count")) {
                    size = "multi_range_count";
                }
                if (size.equalsIgnoreCase("myisam_data_pointer_size")) {
                    size = "";
                }
                if (size.equalsIgnoreCase("myisam_max_sort_file_size")) {
                    size = "MyISAMMySQL";
                }
                if (size.equalsIgnoreCase("myisam_recover_options")) {
                    size = "myisam-recover";
                }
                if (size.equalsIgnoreCase("myisam_repair_threads")) {
                    size = "1Repair by sortingMyISAM";
                }
                if (size.equalsIgnoreCase("myisam_sort_buffer_size")) {
                    size = "REPAIR TABLECREATE INDEXALTER TABLEMyISAM";
                }
                if (size.equalsIgnoreCase("myisam_stats_method")) {
                    size = "MyISAMNULL";
                }
                if (size.equalsIgnoreCase("named_pipe")) {
                    size = "";
                }
                if (size.equalsIgnoreCase("net_buffer_length")) {
                    size = "";
                }
                if (size.equalsIgnoreCase("net_read_timeout")) {
                    size = "";
                }
                if (size.equalsIgnoreCase("net_retry_count")) {
                    size = "";
                }
                if (size.equalsIgnoreCase("net_write_timeout")) {
                    size = "";
                }
                if (size.equalsIgnoreCase("new")) {
                    size = "MySQL 4.04.1";
                }
                if (size.equalsIgnoreCase("old_passwords")) {
                    size = "MySQLpre-4.1-style";
                }
                if (size.equalsIgnoreCase("open_files_limit")) {
                    size = "mysqld";
                }
                if (size.equalsIgnoreCase("optimizer_prune_level")) {
                    size = " 0";
                }
                if (size.equalsIgnoreCase("optimizer_search_depth")) {
                    size = "";
                }
                if (size.equalsIgnoreCase("pid_file")) {
                    size = "ID (PID)";
                }
                if (size.equalsIgnoreCase("prepared_stmt_count")) {
                    size = "prepared_stmt_count";
                }
                if (size.equalsIgnoreCase("port")) {
                    size = "TCP/IP";
                }
                if (size.equalsIgnoreCase("preload_buffer_size")) {
                    size = "";
                }
                if (size.equalsIgnoreCase("protocol_version")) {
                    size = "MySQL/";
                }
                if (size.equalsIgnoreCase("query_alloc_block_size")) {
                    size = "";
                }
                if (size.equalsIgnoreCase("query_cache_limit")) {
                    size = "";
                }
                if (size.equalsIgnoreCase("query_cache_min_res_unit")) {
                    size = "()";
                }
                if (size.equalsIgnoreCase("query_cache_size")) {
                    size = "";
                }
                if (size.equalsIgnoreCase("query_cache_type")) {
                    size = "";
                }
                if (size.equalsIgnoreCase("query_cache_wlock_invalidate")) {
                    size = "WRITE";
                }
                if (size.equalsIgnoreCase("query_prealloc_size")) {
                    size = "";
                }
                if (size.equalsIgnoreCase("range_alloc_block_size")) {
                    size = "";
                }
                if (size.equalsIgnoreCase("read_buffer_size")) {
                    size = "()";
                }
                if (size.equalsIgnoreCase("read_only")) {
                    size = "ON";
                }
                if (size.equalsIgnoreCase("read_only")) {
                    size = "ON";
                }
                if (size.equalsIgnoreCase("relay_log_purge")) {
                    size = "";
                }
                if (size.equalsIgnoreCase("read_rnd_buffer_size")) {
                    size = "";
                }
                if (size.equalsIgnoreCase("secure_auth")) {
                    size = "--secure-authMySQL(4.1)";
                }
                if (size.equalsIgnoreCase("shared_memory")) {
                    size = "(Windows)";
                }
                if (size.equalsIgnoreCase("shared_memory_base_name")) {
                    size = "(Windows)";
                }
                if (size.equalsIgnoreCase("server_id")) {
                    size = "";
                }
                if (size.equalsIgnoreCase("skip_external_locking")) {
                    size = "mysqld";
                }
                if (size.equalsIgnoreCase("skip_networking")) {
                    size = "(TCP/IP)";
                }
                if (size.equalsIgnoreCase("skip_show_database")) {
                    size = "SHOW DATABASESSHOW DATABASES";
                }
                if (size.equalsIgnoreCase("slave_compressed_protocol")) {
                    size = "/";
                }
                if (size.equalsIgnoreCase("slave_load_tmpdir")) {
                    size = "LOAD DATA INFILE";
                }
                if (size.equalsIgnoreCase("slave_net_timeout")) {
                    size = "/";
                }
                if (size.equalsIgnoreCase("slave_skip_errors")) {
                    size = "()";
                }
                if (size.equalsIgnoreCase("slave_transaction_retries")) {
                    size = "SQLslave_transaction_retries";
                }
                if (size.equalsIgnoreCase("slow_launch_time")) {
                    size = "Slow_launch_threads";
                }
                if (size.equalsIgnoreCase("sort_buffer_size")) {
                    size = "";
                }
                if (size.equalsIgnoreCase("sql_mode")) {
                    size = "SQL";
                }
                if (size.equalsIgnoreCase("storage_engine")) {
                    size = "table_typeisMySQL 5.1,storage_engine";
                }
                if (size.equalsIgnoreCase("sync_binlog")) {
                    size = "sync_binlog'thMySQL";
                }
                if (size.equalsIgnoreCase("sync_frm")) {
                    size = "1,.frm";
                }
                if (size.equalsIgnoreCase("system_time_zone")) {
                    size = "";
                }
                if (size.equalsIgnoreCase("table_cache")) {
                    size = "";
                }
                if (size.equalsIgnoreCase("table_type")) {
                    size = "()";
                }
                if (size.equalsIgnoreCase("thread_cache_size")) {
                    size = "";
                }
                if (size.equalsIgnoreCase("thread_stack")) {
                    size = "";
                }
                if (size.equalsIgnoreCase("time_format")) {
                    size = "";
                }
                if (size.equalsIgnoreCase("time_zone")) {
                    size = "";
                }
                if (size.equalsIgnoreCase("tmp_table_size")) {
                    size = "MySQLMyISAM";
                }
                if (size.equalsIgnoreCase("tmpdir")) {
                    size = "";
                }
                if (size.equalsIgnoreCase("transaction_alloc_block_size")) {
                    size = "()";
                }
                if (size.equalsIgnoreCase("transaction_prealloc_size")) {
                    size = "transaction_alloc_blocks";
                }
                if (size.equalsIgnoreCase("tx_isolation")) {
                    size = "";
                }
                if (size.equalsIgnoreCase("updatable_views_with_limit")) {
                    size = "LIMIT";
                }
                if (size.equalsIgnoreCase("version")) {
                    size = "";
                }
                if (size.equalsIgnoreCase("version_bdb")) {
                    size = "BDB";
                }
                if (size.equalsIgnoreCase("version_comment")) {
                    size = "configure--with-commentMySQL";
                }
                if (size.equalsIgnoreCase("version_compile_machine")) {
                    size = "MySQL";
                }
                if (size.equalsIgnoreCase("version_compile_os")) {
                    size = "MySQL";
                }
                if (size.equalsIgnoreCase("wait_timeout")) {
                    size = "";
                }
                cell = new Cell(new Phrase(String.valueOf(i + 1), contextFont));
                this.setCellFormat(cell, false);
                stateTable.addCell(cell);
                cell = new Cell(new Phrase(size, contextFont));
                this.setCellFormat(cell, false);
                stateTable.addCell(cell);
                cell = new Cell(new Phrase(free, contextFont));
                this.setCellFormat(cell, false);
                stateTable.addCell(cell);
                // stateTable.endHeaders();
            }
        } // HONGLILI
        document.add(stateTable);

        //    
        Table evenInfoTable = new Table(2);
        this.setTableFormat(evenInfoTable);
        // float[] evenInfoWidths = { 220f, 220f };
        // evenInfoTable.setWidths(evenInfoWidths);
        // evenInfoTable.setWidth(100); //  90%
        // evenInfoTable.setAlignment(Element.ALIGN_CENTER);// 
        // evenInfoTable.setAutoFillEmptyCells(true); // 
        // evenInfoTable.setBorderWidth(1); // 
        // evenInfoTable.setBorderColor(new Color(0, 125, 255)); // 
        // evenInfoTable.setPadding(2);// 
        // evenInfoTable.setSpacing(0);// 
        // evenInfoTable.setBorder(2);// 
        String downnum = (String) reportHash.get("downnum");
        String count = (Integer) reportHash.get("count") + "";
        cell = new Cell(new Phrase("", titleFont));
        cell.setColspan(2);
        this.setCellFormat(cell, true);
        evenInfoTable.addCell(cell);
        cell = new Cell(new Phrase("", titleFont));
        this.setCellFormat(cell, true);
        evenInfoTable.addCell(cell);
        cell = new Cell(new Phrase("", titleFont));
        this.setCellFormat(cell, true);
        evenInfoTable.addCell(cell);
        cell = new Cell(new Phrase(downnum, contextFont));
        this.setCellFormat(cell, false);
        evenInfoTable.addCell(cell);
        cell = new Cell(new Phrase(count, contextFont));
        this.setCellFormat(cell, false);
        evenInfoTable.addCell(cell);
        document.add(evenInfoTable);
        // 
        addEventListToDoc(document, titleFont, contextFont);
        document.close();
    } catch (Exception e) {
        // SysLogger.error("Error in ExcelReport.createReport()",e);
        SysLogger.error("", e);
    }
}

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

/**
 * @author HONGLI MySQLpdf/*  w ww  .  ja  va  2 s . c om*/
 * @param filename
 * @throws DocumentException
 * @throws IOException
 */
public void createReport_MySQLCldPdf(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);
        String hostname = (String) reportHash.get("dbname");
        String ip = (String) reportHash.get("ip");
        String typename = (String) reportHash.get("typename");
        String runstr = (String) reportHash.get("runstr");
        String grade = (String) reportHash.get("grade");
        String pingnow = (String) reportHash.get("pingnow");
        String pingmin = (String) reportHash.get("pingmin");
        String pingconavg = (String) reportHash.get("pingconavg");
        DBVo vo = (DBVo) reportHash.get("vo");
        Vector val = (Vector) reportHash.get("Val");
        if (val == null) {
            val = new Vector();
        }
        List sessionlist = (ArrayList) reportHash.get("sessionlist");
        if (sessionlist == null) {
            sessionlist = new ArrayList();
        }
        Hashtable tablesHash = (Hashtable) reportHash.get("tablesHash");
        if (tablesHash == null) {
            tablesHash = new Hashtable();
        }
        Vector tableinfo_v = (Vector) reportHash.get("tableinfo_v");
        if (tableinfo_v == null) {
            tableinfo_v = new Vector();
        }
        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 dbTable = new PdfPTable(5);
        float[] cellWidths = { 220f, 220f, 220f, 220f, 220f };
        dbTable.setWidths(cellWidths);
        dbTable.setWidthPercentage(100);
        PdfPCell dbCell = null;
        dbCell = new PdfPCell(new Phrase("", titleFont));
        dbCell.setColspan(5);
        dbCell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
        dbCell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
        dbTable.addCell(dbCell);
        dbCell = new PdfPCell(new Phrase("", titleFont));
        dbCell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
        dbCell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
        dbTable.addCell(dbCell);
        dbCell = new PdfPCell(new Phrase("IP", titleFont));
        dbCell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
        dbCell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
        dbTable.addCell(dbCell);
        dbCell = new PdfPCell(new Phrase("", titleFont));
        dbCell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
        dbCell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
        dbTable.addCell(dbCell);
        dbCell = new PdfPCell(new Phrase("", titleFont));
        dbCell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
        dbCell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
        dbTable.addCell(dbCell);
        dbCell = new PdfPCell(new Phrase("", titleFont));
        dbCell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
        dbCell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
        dbTable.addCell(dbCell);
        dbCell = new PdfPCell(new Phrase(vo.getDbName(), contextFont));
        dbCell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
        dbCell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
        dbTable.addCell(dbCell);
        dbCell = new PdfPCell(new Phrase(ip, contextFont));
        dbCell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
        dbCell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
        dbTable.addCell(dbCell);
        dbCell = new PdfPCell(new Phrase(typename, contextFont));
        dbCell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
        dbCell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
        dbTable.addCell(dbCell);
        dbCell = new PdfPCell(new Phrase(runstr, contextFont));
        dbCell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
        dbCell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
        dbTable.addCell(dbCell);
        dbCell = new PdfPCell(new Phrase(grade, contextFont));
        dbCell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
        dbCell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
        dbTable.addCell(dbCell);

        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.setColspan(3);
        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("", titleFont));
        cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
        cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
        aTable.addCell(cell);
        cell = new PdfPCell(new Phrase(pingnow + "%", contextFont));
        cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
        cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
        aTable.addCell(cell);
        cell = new PdfPCell(new Phrase(pingmin + "%", contextFont));
        cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
        cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
        aTable.addCell(cell);
        cell = new PdfPCell(new Phrase(pingconavg + "%", contextFont));
        cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
        cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
        aTable.addCell(cell);

        // 
        Image img = Image.getInstance(ResourceCenter.getInstance().getSysPath() + "/resource/image/jfreechart/"
                + newip + "ConnectUtilization" + ".png");
        // img.setAbsolutePosition(0, 0);
        img.scalePercent(76);
        img.setAlignment(Image.MIDDLE);// 
        document.add(dbTable);
        document.add(new Paragraph("\n"));
        document.add(aTable);
        document.add(img);
        document.add(new Paragraph("\n"));

        // 
        PdfPTable xnTable = new PdfPTable(2);
        float[] width = { 220f, 220f };
        xnTable.setWidths(width);
        xnTable.setWidthPercentage(100);
        cell = new PdfPCell(new Phrase("     ", titleFont));
        cell.setColspan(2);
        cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
        cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
        xnTable.addCell(cell);
        if (val != null && val.size() > 0) {
            for (int i = 0; i < val.size(); i++) {
                Hashtable return_value = (Hashtable) val.get(i);
                if (return_value != null && return_value.size() > 0) {
                    String name = return_value.get("variable_name").toString();
                    String value = return_value.get("value").toString();
                    if (name.equalsIgnoreCase("Max_used_connections")) {
                        name = "";
                    }
                    if (name.equalsIgnoreCase("Handler_read_first")) {
                        name = "";
                    }
                    if (name.equalsIgnoreCase("Handler_read_key")) {
                        name = "";
                    }
                    if (name.equalsIgnoreCase("Handler_read_next")) {
                        name = "";
                    }
                    if (name.equalsIgnoreCase("Handler_read_prev")) {
                        name = "";
                    }
                    if (name.equalsIgnoreCase("Handler_read_rnd")) {
                        name = "H";
                    }
                    if (name.equalsIgnoreCase("Handler_read_rnd_next")) {
                        name = "";
                    }
                    if (name.equalsIgnoreCase("Open_tables")) {
                        name = "";
                    }
                    if (name.equalsIgnoreCase("Opened_tables")) {
                        name = "";
                    }
                    if (name.equalsIgnoreCase("Threads_cached")) {
                        name = "";
                    }
                    if (name.equalsIgnoreCase("Threads_connected")) {
                        name = "";
                    }
                    if (name.equalsIgnoreCase("Threads_created")) {
                        name = "";
                    }
                    if (name.equalsIgnoreCase("Threads_running")) {
                        name = "";
                    }
                    if (name.equalsIgnoreCase("Table_locks_immediate")) {
                        name = "";
                    }
                    if (name.equalsIgnoreCase("Table_locks_waited")) {
                        name = "";
                    }
                    if (name.equalsIgnoreCase("Key_read_requests")) {
                        name = "";
                    }
                    if (name.equalsIgnoreCase("Key_reads")) {
                        name = "";
                    }
                    if (name.equalsIgnoreCase("log_slow_queries")) {
                        name = "";
                    }
                    if (name.equalsIgnoreCase("slow_launch_time")) {
                        name = "Slow_launch_threads";
                    }
                    cell = new PdfPCell(new Phrase(name, titleFont));
                    cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
                    cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
                    xnTable.addCell(cell);
                    cell = new PdfPCell(new Phrase(value, contextFont));
                    cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
                    cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
                    xnTable.addCell(cell);
                    // xnTable.endHeaders();
                }
            }
        }
        document.add(xnTable);
        document.add(new Paragraph("\n"));
        // 
        PdfPTable connTable = new PdfPTable(6);
        float[] cwidth = { 220f, 220f, 220f, 220f, 220f, 220f };
        connTable.setWidths(cwidth);
        connTable.setWidthPercentage(100);
        cell = new PdfPCell(new Phrase("      ", titleFont));
        cell.setColspan(6);
        cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
        cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
        connTable.addCell(cell);
        cell = new PdfPCell(new Phrase("", titleFont));
        cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
        cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
        connTable.addCell(cell);
        cell = new PdfPCell(new Phrase("", titleFont));
        cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
        cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
        connTable.addCell(cell);
        cell = new PdfPCell(new Phrase(" ", titleFont));
        cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
        cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
        connTable.addCell(cell);
        cell = new PdfPCell(new Phrase(" ", titleFont));
        cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
        cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
        connTable.addCell(cell);
        cell = new PdfPCell(new Phrase(" ", titleFont));
        cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
        cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
        connTable.addCell(cell);
        cell = new PdfPCell(new Phrase("", titleFont));
        cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
        cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
        connTable.addCell(cell);
        if (sessionlist != null && sessionlist.size() > 0) {
            int rowI = 1;
            for (int i = 0; i < sessionlist.size(); i++) {
                List ipsessionlist = (List) sessionlist.get(i);
                if (ipsessionlist != null && ipsessionlist.size() > 0) {
                    for (int k = 0; k < ipsessionlist.size(); k++) {
                        String[] sessions = (String[]) ipsessionlist.get(k);
                        if (sessions != null && sessions.length == 5) {
                            cell = new PdfPCell(new Phrase(String.valueOf(rowI), contextFont));
                            cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
                            cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
                            connTable.addCell(cell);
                            cell = new PdfPCell(new Phrase(sessions[4], contextFont));
                            cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
                            cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
                            connTable.addCell(cell);
                            cell = new PdfPCell(new Phrase(sessions[0], contextFont));
                            cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
                            cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
                            connTable.addCell(cell);
                            cell = new PdfPCell(new Phrase(sessions[1], contextFont));
                            cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
                            cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
                            connTable.addCell(cell);
                            cell = new PdfPCell(new Phrase(sessions[2], contextFont));
                            cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
                            cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
                            connTable.addCell(cell);
                            cell = new PdfPCell(new Phrase(sessions[3], contextFont));
                            cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
                            cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
                            connTable.addCell(cell);
                            // connTable.endHeaders();
                            rowI++;
                        }
                    }
                }
            }
        }
        document.add(connTable);
        document.add(new Paragraph("\n"));
        // 
        PdfPTable tabTable = new PdfPTable(5);
        float[] tabwidth = { 220f, 220f, 220f, 220f, 220f };
        tabTable.setWidths(tabwidth);
        tabTable.setWidthPercentage(100);
        cell = new PdfPCell(new Phrase("      ", titleFont));
        cell.setColspan(5);
        cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
        cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
        tabTable.addCell(cell);
        cell = new PdfPCell(new Phrase("", titleFont));
        cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
        cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
        tabTable.addCell(cell);
        cell = new PdfPCell(new Phrase(" ", titleFont));
        cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
        cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
        tabTable.addCell(cell);
        cell = new PdfPCell(new Phrase(" ", titleFont));
        cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
        cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
        tabTable.addCell(cell);
        cell = new PdfPCell(new Phrase("  ", titleFont));
        cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
        cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
        tabTable.addCell(cell);
        cell = new PdfPCell(new Phrase(" ", titleFont));
        cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
        cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
        tabTable.addCell(cell);
        String[] dbs = vo.getDbName().split(",");
        if (dbs != null && dbs.length > 0) {
            int rowI = 1;
            for (int i = 0; i < dbs.length; i++) {
                String dbStr = dbs[i];
                // System.out.println(dbStr+"====="+tablesHash.size());
                if (tablesHash.containsKey(dbStr)) {
                    List tableslist = (List) tablesHash.get(dbStr);
                    if (tableslist != null && tableslist.size() > 0) {
                        for (int k = 0; k < tableslist.size(); k++) {
                            String[] tables = (String[]) tableslist.get(k);
                            if (tables != null && tables.length == 4) {
                                cell = new PdfPCell(new Phrase(String.valueOf(rowI), contextFont));
                                cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
                                cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
                                tabTable.addCell(cell);
                                cell = new PdfPCell(new Phrase(tables[0], contextFont));
                                cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
                                cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
                                tabTable.addCell(cell);
                                cell = new PdfPCell(new Phrase(tables[1], contextFont));
                                cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
                                cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
                                tabTable.addCell(cell);
                                cell = new PdfPCell(new Phrase(tables[2], contextFont));
                                cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
                                cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
                                tabTable.addCell(cell);
                                cell = new PdfPCell(new Phrase(tables[3], contextFont));
                                cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
                                cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
                                tabTable.addCell(cell);
                                // tabTable.endHeaders();
                                rowI++;
                            }
                        }
                    }
                }
            }
        }
        document.add(tabTable);
        document.add(new Paragraph("\n"));

        // 
        PdfPTable stateTable = new PdfPTable(3);
        float[] swidth = { 220f, 220f, 220f };
        stateTable.setWidths(swidth);
        stateTable.setWidthPercentage(100);
        cell = new PdfPCell(new Phrase("    ", titleFont));
        cell.setColspan(3);
        cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
        cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
        stateTable.addCell(cell);
        cell = new PdfPCell(new Phrase("", titleFont));
        cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
        cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
        stateTable.addCell(cell);
        cell = new PdfPCell(new Phrase(" ", titleFont));
        cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
        cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
        stateTable.addCell(cell);
        cell = new PdfPCell(new Phrase(" ", titleFont));
        cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
        cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
        stateTable.addCell(cell);
        if (tableinfo_v != null) {
            int rowI = 1;
            for (int i = 0; i < tableinfo_v.size(); i++) {
                Hashtable ht = (Hashtable) tableinfo_v.get(i);
                String size = ht.get("variable_name").toString();
                String free = ht.get("value").toString();
                if (size.equalsIgnoreCase("auto_increment_increment")) {
                    size = "";
                }
                if (size.equalsIgnoreCase("auto_increment_offset")) {
                    size = "AUTO_INCREMENT";
                }
                if (size.equalsIgnoreCase("automatic_sp_privileges")) {
                    size = "automatic_sp_privileges";
                }
                if (size.equalsIgnoreCase("back_log")) {
                    size = "";
                }
                if (size.equalsIgnoreCase("basedir")) {
                    size = "MySQL";
                }
                if (size.equalsIgnoreCase("binlog_cache_size")) {
                    size = "SQL";
                }
                if (size.equalsIgnoreCase("bulk_insert_buffer_size")) {
                    size = "";
                }
                if (size.equalsIgnoreCase("character_set_client")) {
                    size = "";
                }
                if (size.equalsIgnoreCase("character_set_connection")) {
                    size = "";
                }
                if (size.equalsIgnoreCase("character_set_database")) {
                    size = "";
                }
                if (size.equalsIgnoreCase("character_set_filesystem")) {
                    size = "character_set_filesystem";
                }
                if (size.equalsIgnoreCase("character_set_results")) {
                    size = "";
                }
                if (size.equalsIgnoreCase("character_set_server")) {
                    size = "";
                }
                if (size.equalsIgnoreCase("character_set_system")) {
                    size = "";
                }
                if (size.equalsIgnoreCase("character_sets_dir")) {
                    size = "";
                }
                if (size.equalsIgnoreCase("collation_connection")) {
                    size = "";
                }
                if (size.equalsIgnoreCase("collation_database")) {
                    size = "";
                }
                if (size.equalsIgnoreCase("collation_server")) {
                    size = "";
                }
                if (size.equalsIgnoreCase("completion_type")) {
                    size = "";
                }
                if (size.equalsIgnoreCase("concurrent_insert")) {
                    size = "";
                }
                if (size.equalsIgnoreCase("connect_timeout")) {
                    size = "Bad handshake";
                }
                if (size.equalsIgnoreCase("datadir")) {
                    size = "MySQL";
                }
                if (size.equalsIgnoreCase("date_format")) {
                    size = "date_format()";
                }
                if (size.equalsIgnoreCase("datetime_format")) {
                    size = "datetime_format()";
                }
                if (size.equalsIgnoreCase("default_week_format")) {
                    size = "WEEK() ";
                }
                if (size.equalsIgnoreCase("delay_key_write")) {
                    size = "DELAY_KEY_WRITE";
                }
                if (size.equalsIgnoreCase("delayed_insert_limit")) {
                    size = "INSERT DELAYEDSELECT";
                }
                if (size.equalsIgnoreCase("delayed_insert_timeout")) {
                    size = "INSERT DELAYEDINSERT";
                }
                if (size.equalsIgnoreCase("delayed_queue_size")) {
                    size = "INSERT DELAYED";
                }
                if (size.equalsIgnoreCase("div_precision_increment")) {
                    size = "/";
                }
                if (size.equalsIgnoreCase("engine_condition_pushdown")) {
                    size = "NDB";
                }
                if (size.equalsIgnoreCase("expire_logs_days")) {
                    size = "";
                }
                if (size.equalsIgnoreCase("flush")) {
                    size = "flushmysqld";
                }
                if (size.equalsIgnoreCase("flush_time")) {
                    size = "";
                }
                if (size.equalsIgnoreCase("ft_boolean_syntax")) {
                    size = "IN BOOLEAN MODE";
                }
                if (size.equalsIgnoreCase("ft_max_word_len")) {
                    size = "FULLTEXT";
                }
                if (size.equalsIgnoreCase("ft_min_word_len")) {
                    size = "FULLTEXT";
                }
                if (size.equalsIgnoreCase("ft_query_expansion_limit")) {
                    size = "WITH QUERY EXPANSION";
                }
                if (size.equalsIgnoreCase("ft_stopword_file")) {
                    size = "";
                }
                if (size.equalsIgnoreCase("group_concat_max_len")) {
                    size = "GROUP_CONCAT()";
                }
                if (size.equalsIgnoreCase("have_archive")) {
                    size = "mysqldARCHIVE";
                }
                if (size.equalsIgnoreCase("have_bdb")) {
                    size = "mysqldBDB";
                }
                if (size.equalsIgnoreCase("have_blackhole_engine")) {
                    size = "mysqldBLACKHOLE";
                }
                if (size.equalsIgnoreCase("have_compress")) {
                    size = "zlib";
                }
                if (size.equalsIgnoreCase("have_crypt")) {
                    size = "crypt()";
                }
                if (size.equalsIgnoreCase("have_csv")) {
                    size = "mysqldARCHIVE";
                }
                if (size.equalsIgnoreCase("have_example_engine")) {
                    size = "mysqldEXAMPLE";
                }
                if (size.equalsIgnoreCase("have_federated_engine")) {
                    size = "mysqldFEDERATED";
                }
                if (size.equalsIgnoreCase("have_geometry")) {
                    size = "";
                }
                if (size.equalsIgnoreCase("have_innodb")) {
                    size = "mysqldInnoDB";
                }
                if (size.equalsIgnoreCase("have_isam")) {
                    size = "";
                }
                if (size.equalsIgnoreCase("have_ndbcluster")) {
                    size = "mysqldNDB CLUSTER";
                }
                if (size.equalsIgnoreCase("have_openssl")) {
                    size = "mysqld/SSL()";
                }
                if (size.equalsIgnoreCase("have_query_cache")) {
                    size = "mysqld";
                }
                if (size.equalsIgnoreCase("have_raid")) {
                    size = "mysqldRAID";
                }
                if (size.equalsIgnoreCase("have_rtree_keys")) {
                    size = "RTREE";
                }
                if (size.equalsIgnoreCase("have_symlink")) {
                    size = "";
                }
                if (size.equalsIgnoreCase("init_connect")) {
                    size = "";
                }
                if (size.equalsIgnoreCase("init_file")) {
                    size = "--init-file";
                }
                if (size.equalsIgnoreCase("init_slave")) {
                    size = "SQL";
                }
                if (size.equalsIgnoreCase("innodb_additional_mem_pool_size")) {
                    size = "InnoDB";
                }
                if (size.equalsIgnoreCase("innodb_autoextend_increment")) {
                    size = "";
                }
                if (size.equalsIgnoreCase("innodb_buffer_pool_awe_mem_mb")) {
                    size = "32WindowsAWE";
                }
                if (size.equalsIgnoreCase("innodb_buffer_pool_size")) {
                    size = "InnoDB";
                }
                if (size.equalsIgnoreCase("innodb_checksums")) {
                    size = "InnoDB";
                }
                if (size.equalsIgnoreCase("innodb_commit_concurrency")) {
                    size = "innodb_commit_concurrency";
                }
                if (size.equalsIgnoreCase("innodb_concurrency_tickets")) {
                    size = "innodb_concurrency_tickets";
                }
                if (size.equalsIgnoreCase("innodb_data_file_path")) {
                    size = "";
                }
                if (size.equalsIgnoreCase("innodb_data_home_dir")) {
                    size = "InnoDB";
                }
                if (size.equalsIgnoreCase("innodb_doublewrite")) {
                    size = "InnoDB";
                }
                if (size.equalsIgnoreCase("innodb_fast_shutdown")) {
                    size = "InnoDB";
                }
                if (size.equalsIgnoreCase("innodb_file_io_threads")) {
                    size = "InnoDBI/O";
                }
                if (size.equalsIgnoreCase("innodb_file_per_table")) {
                    size = "InnoDB.ibd";
                }
                if (size.equalsIgnoreCase("innodb_flush_log_at_trx_commit")) {
                    size = "InnoDB";
                }
                if (size.equalsIgnoreCase("innodb_flush_method")) {
                    size = "InnoDBfsync()";
                }
                if (size.equalsIgnoreCase("innodb_force_recovery")) {
                    size = "";
                }
                if (size.equalsIgnoreCase("innodb_lock_wait_timeout")) {
                    size = "InnoDB";
                }
                if (size.equalsIgnoreCase("innodb_locks_unsafe_for_binlog")) {
                    size = "InnoDB";
                }
                if (size.equalsIgnoreCase("innodb_log_arch_dir")) {
                    size = " ";
                }
                if (size.equalsIgnoreCase("innodb_log_archive")) {
                    size = "";
                }
                if (size.equalsIgnoreCase("innodb_log_buffer_size")) {
                    size = "InnoDB";
                }
                if (size.equalsIgnoreCase("innodb_log_file_size")) {
                    size = "";
                }
                if (size.equalsIgnoreCase("innodb_log_files_in_group")) {
                    size = "";
                }
                if (size.equalsIgnoreCase("innodb_log_group_home_dir")) {
                    size = "InnoDB";
                }
                if (size.equalsIgnoreCase("innodb_max_dirty_pages_pct")) {
                    size = "InnoDB";
                }
                if (size.equalsIgnoreCase("innodb_max_purge_lag")) {
                    size = "INSERT,UPDATEDELETE";
                }
                if (size.equalsIgnoreCase("innodb_mirrored_log_groups")) {
                    size = "";
                }
                if (size.equalsIgnoreCase("innodb_open_files")) {
                    size = "InnoDB.ibd";
                }
                if (size.equalsIgnoreCase("innodb_support_xa")) {
                    size = "InnoDBXA";
                }
                if (size.equalsIgnoreCase("innodb_sync_spin_loops")) {
                    size = "innodb_sync_spin_loops";
                }
                if (size.equalsIgnoreCase("innodb_table_locks")) {
                    size = "InnoDB";
                }
                if (size.equalsIgnoreCase("innodb_thread_concurrency")) {
                    size = "InnoDBInnoDB";
                }
                if (size.equalsIgnoreCase("innodb_thread_sleep_delay")) {
                    size = "InnoDBSHOW INNODB STATUS<datadir>/innodb_status";
                }
                if (size.equalsIgnoreCase("interactive_timeout")) {
                    size = "";
                }
                if (size.equalsIgnoreCase("join_buffer_size")) {
                    size = "";
                }
                if (size.equalsIgnoreCase("key_buffer_size")) {
                    size = "";
                }
                if (size.equalsIgnoreCase("key_cache_age_threshold")) {
                    size = "(sub-chain)(sub-chain)";
                }
                if (size.equalsIgnoreCase("key_cache_block_size")) {
                    size = "";
                }
                if (size.equalsIgnoreCase("key_cache_division_limit")) {
                    size = "";
                }
                if (size.equalsIgnoreCase("language")) {
                    size = "";
                }
                if (size.equalsIgnoreCase("large_files_support")) {
                    size = "mysqld";
                }
                if (size.equalsIgnoreCase("large_page_size")) {
                    size = "large_page_size";
                }
                if (size.equalsIgnoreCase("large_pages")) {
                    size = "";
                }
                if (size.equalsIgnoreCase("license")) {
                    size = "";
                }
                if (size.equalsIgnoreCase("local_infile")) {
                    size = "LOCALLOAD DATA INFILE";
                }
                if (size.equalsIgnoreCase("log")) {
                    size = "";
                }
                if (size.equalsIgnoreCase("log_bin")) {
                    size = "";
                }
                if (size.equalsIgnoreCase("log_bin_trust_function_creators")) {
                    size = "";
                }
                if (size.equalsIgnoreCase("log_error")) {
                    size = "";
                }
                if (size.equalsIgnoreCase("log_slave_updates")) {
                    size = "";
                }
                if (size.equalsIgnoreCase("log_slow_queries")) {
                    size = "";
                }
                if (size.equalsIgnoreCase("log_warnings")) {
                    size = "";
                }
                if (size.equalsIgnoreCase("long_query_time")) {
                    size = "Slow_queries";
                }
                if (size.equalsIgnoreCase("low_priority_updates")) {
                    size = "sqlSELECTLOCK TABLE READ";
                }
                if (size.equalsIgnoreCase("lower_case_file_system")) {
                    size = "";
                }
                if (size.equalsIgnoreCase("lower_case_table_names")) {
                    size = "1";
                }
                if (size.equalsIgnoreCase("max_allowed_packet")) {
                    size = "/";
                }
                if (size.equalsIgnoreCase("max_binlog_cache_size")) {
                    size = "";
                }
                if (size.equalsIgnoreCase("max_binlog_size")) {
                    size = "";
                }
                if (size.equalsIgnoreCase("max_connect_errors")) {
                    size = "";
                }
                if (size.equalsIgnoreCase("max_connections")) {
                    size = "";
                }
                if (size.equalsIgnoreCase("max_delayed_threads")) {
                    size = "INSERT DELAYED";
                }
                if (size.equalsIgnoreCase("max_error_count")) {
                    size = "SHOW ERRORSSHOW WARNINGS";
                }
                if (size.equalsIgnoreCase("max_heap_table_size")) {
                    size = "MEMORY (HEAP)";
                }
                if (size.equalsIgnoreCase("max_insert_delayed_threads")) {
                    size = "INSERT DELAYED(max_delayed_threads)";
                }
                if (size.equalsIgnoreCase("max_join_size")) {
                    size = "max_join_size";
                }
                if (size.equalsIgnoreCase("max_length_for_sort_data")) {
                    size = "filesort";
                }
                if (size.equalsIgnoreCase("max_prepared_stmt_count")) {
                    size = "max_prepared_stmt_count";
                }
                if (size.equalsIgnoreCase("max_relay_log_size")) {
                    size = "";
                }
                if (size.equalsIgnoreCase("max_seeks_for_key")) {
                    size = "";
                }
                if (size.equalsIgnoreCase("max_sort_length")) {
                    size = "BLOBTEXT";
                }
                if (size.equalsIgnoreCase("max_sp_recursion_depth")) {
                    size = "max_sp_recursion_depth";
                }
                if (size.equalsIgnoreCase("max_tmp_tables")) {
                    size = "";
                }
                if (size.equalsIgnoreCase("max_user_connections")) {
                    size = "MySQL";
                }
                if (size.equalsIgnoreCase("max_write_lock_count")) {
                    size = "";
                }
                if (size.equalsIgnoreCase("multi_range_count")) {
                    size = "multi_range_count";
                }
                if (size.equalsIgnoreCase("myisam_data_pointer_size")) {
                    size = "";
                }
                if (size.equalsIgnoreCase("myisam_max_sort_file_size")) {
                    size = "MyISAMMySQL";
                }
                if (size.equalsIgnoreCase("myisam_recover_options")) {
                    size = "myisam-recover";
                }
                if (size.equalsIgnoreCase("myisam_repair_threads")) {
                    size = "1Repair by sortingMyISAM";
                }
                if (size.equalsIgnoreCase("myisam_sort_buffer_size")) {
                    size = "REPAIR TABLECREATE INDEXALTER TABLEMyISAM";
                }
                if (size.equalsIgnoreCase("myisam_stats_method")) {
                    size = "MyISAMNULL";
                }
                if (size.equalsIgnoreCase("named_pipe")) {
                    size = "";
                }
                if (size.equalsIgnoreCase("net_buffer_length")) {
                    size = "";
                }
                if (size.equalsIgnoreCase("net_read_timeout")) {
                    size = "";
                }
                if (size.equalsIgnoreCase("net_retry_count")) {
                    size = "";
                }
                if (size.equalsIgnoreCase("net_write_timeout")) {
                    size = "";
                }
                if (size.equalsIgnoreCase("new")) {
                    size = "MySQL 4.04.1";
                }
                if (size.equalsIgnoreCase("old_passwords")) {
                    size = "MySQLpre-4.1-style";
                }
                if (size.equalsIgnoreCase("open_files_limit")) {
                    size = "mysqld";
                }
                if (size.equalsIgnoreCase("optimizer_prune_level")) {
                    size = " 0";
                }
                if (size.equalsIgnoreCase("optimizer_search_depth")) {
                    size = "";
                }
                if (size.equalsIgnoreCase("pid_file")) {
                    size = "ID (PID)";
                }
                if (size.equalsIgnoreCase("prepared_stmt_count")) {
                    size = "prepared_stmt_count";
                }
                if (size.equalsIgnoreCase("port")) {
                    size = "TCP/IP";
                }
                if (size.equalsIgnoreCase("preload_buffer_size")) {
                    size = "";
                }
                if (size.equalsIgnoreCase("protocol_version")) {
                    size = "MySQL/";
                }
                if (size.equalsIgnoreCase("query_alloc_block_size")) {
                    size = "";
                }
                if (size.equalsIgnoreCase("query_cache_limit")) {
                    size = "";
                }
                if (size.equalsIgnoreCase("query_cache_min_res_unit")) {
                    size = "()";
                }
                if (size.equalsIgnoreCase("query_cache_size")) {
                    size = "";
                }
                if (size.equalsIgnoreCase("query_cache_type")) {
                    size = "";
                }
                if (size.equalsIgnoreCase("query_cache_wlock_invalidate")) {
                    size = "WRITE";
                }
                if (size.equalsIgnoreCase("query_prealloc_size")) {
                    size = "";
                }
                if (size.equalsIgnoreCase("range_alloc_block_size")) {
                    size = "";
                }
                if (size.equalsIgnoreCase("read_buffer_size")) {
                    size = "()";
                }
                if (size.equalsIgnoreCase("read_only")) {
                    size = "ON";
                }
                if (size.equalsIgnoreCase("read_only")) {
                    size = "ON";
                }
                if (size.equalsIgnoreCase("relay_log_purge")) {
                    size = "";
                }
                if (size.equalsIgnoreCase("read_rnd_buffer_size")) {
                    size = "";
                }
                if (size.equalsIgnoreCase("secure_auth")) {
                    size = "--secure-authMySQL(4.1)";
                }
                if (size.equalsIgnoreCase("shared_memory")) {
                    size = "(Windows)";
                }
                if (size.equalsIgnoreCase("shared_memory_base_name")) {
                    size = "(Windows)";
                }
                if (size.equalsIgnoreCase("server_id")) {
                    size = "";
                }
                if (size.equalsIgnoreCase("skip_external_locking")) {
                    size = "mysqld";
                }
                if (size.equalsIgnoreCase("skip_networking")) {
                    size = "(TCP/IP)";
                }
                if (size.equalsIgnoreCase("skip_show_database")) {
                    size = "SHOW DATABASESSHOW DATABASES";
                }
                if (size.equalsIgnoreCase("slave_compressed_protocol")) {
                    size = "/";
                }
                if (size.equalsIgnoreCase("slave_load_tmpdir")) {
                    size = "LOAD DATA INFILE";
                }
                if (size.equalsIgnoreCase("slave_net_timeout")) {
                    size = "/";
                }
                if (size.equalsIgnoreCase("slave_skip_errors")) {
                    size = "()";
                }
                if (size.equalsIgnoreCase("slave_transaction_retries")) {
                    size = "SQLslave_transaction_retries";
                }
                if (size.equalsIgnoreCase("slow_launch_time")) {
                    size = "Slow_launch_threads";
                }
                if (size.equalsIgnoreCase("sort_buffer_size")) {
                    size = "";
                }
                if (size.equalsIgnoreCase("sql_mode")) {
                    size = "SQL";
                }
                if (size.equalsIgnoreCase("storage_engine")) {
                    size = "table_typeisMySQL 5.1,storage_engine";
                }
                if (size.equalsIgnoreCase("sync_binlog")) {
                    size = "sync_binlog'thMySQL";
                }
                if (size.equalsIgnoreCase("sync_frm")) {
                    size = "1,.frm";
                }
                if (size.equalsIgnoreCase("system_time_zone")) {
                    size = "";
                }
                if (size.equalsIgnoreCase("table_cache")) {
                    size = "";
                }
                if (size.equalsIgnoreCase("table_type")) {
                    size = "()";
                }
                if (size.equalsIgnoreCase("thread_cache_size")) {
                    size = "";
                }
                if (size.equalsIgnoreCase("thread_stack")) {
                    size = "";
                }
                if (size.equalsIgnoreCase("time_format")) {
                    size = "";
                }
                if (size.equalsIgnoreCase("time_zone")) {
                    size = "";
                }
                if (size.equalsIgnoreCase("tmp_table_size")) {
                    size = "MySQLMyISAM";
                }
                if (size.equalsIgnoreCase("tmpdir")) {
                    size = "";
                }
                if (size.equalsIgnoreCase("transaction_alloc_block_size")) {
                    size = "()";
                }
                if (size.equalsIgnoreCase("transaction_prealloc_size")) {
                    size = "transaction_alloc_blocks";
                }
                if (size.equalsIgnoreCase("tx_isolation")) {
                    size = "";
                }
                if (size.equalsIgnoreCase("updatable_views_with_limit")) {
                    size = "LIMIT";
                }
                if (size.equalsIgnoreCase("version")) {
                    size = "";
                }
                if (size.equalsIgnoreCase("version_bdb")) {
                    size = "BDB";
                }
                if (size.equalsIgnoreCase("version_comment")) {
                    size = "configure--with-commentMySQL";
                }
                if (size.equalsIgnoreCase("version_compile_machine")) {
                    size = "MySQL";
                }
                if (size.equalsIgnoreCase("version_compile_os")) {
                    size = "MySQL";
                }
                if (size.equalsIgnoreCase("wait_timeout")) {
                    size = "";
                }
                cell = new PdfPCell(new Phrase(String.valueOf(rowI), contextFont));// mark
                cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
                cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
                stateTable.addCell(cell);
                cell = new PdfPCell(new Phrase(size, contextFont));
                cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
                cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
                stateTable.addCell(cell);
                cell = new PdfPCell(new Phrase(free, contextFont));
                cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
                cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
                stateTable.addCell(cell);
                rowI++;
            }
        }
        document.add(stateTable);
        document.add(new Paragraph("\n"));

        // 
        PdfPTable eventTable = new PdfPTable(2);
        float[] eventWidths = { 220f, 220f };
        eventTable.setWidths(eventWidths);
        eventTable.setWidthPercentage(100);
        cell = new PdfPCell(new Phrase("", titleFont));
        cell.setColspan(2);
        cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
        cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
        eventTable.addCell(cell);
        cell = new PdfPCell(new Phrase("", titleFont));
        cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
        cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
        eventTable.addCell(cell);
        cell = new PdfPCell(new Phrase("", titleFont));
        cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
        cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
        eventTable.addCell(cell);
        cell = new PdfPCell(new Phrase((String) reportHash.get("downnum"), contextFont));
        cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
        cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
        eventTable.addCell(cell);
        cell = new PdfPCell(new Phrase(reportHash.get("count") + "", contextFont));
        cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
        cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
        eventTable.addCell(cell);
        document.add(eventTable);

        document.add(new Paragraph("\n"));
        // 
        addEventLisToPdf(document);
        document.close();
    } catch (Exception e) {
        // SysLogger.error("Error in ExcelReport.createReport()",e);
        SysLogger.error("", e);
    }
}

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

/**
 * mysql xls//from  w w  w  .  j a v  a 2 s  . c om
 * 
 * @param filename
 */
public void createReport_mysqlall(String filename) {
    if (impReport.getTable() == null) {
        fileName = null;
        return;
    }
    WritableWorkbook wb = null;
    try {
        // fileName = ResourceCenter.getInstance().getSysPath() +
        // "temp\\dhcnms_report.xls";
        fileName = ResourceCenter.getInstance().getSysPath() + filename;
        wb = Workbook.createWorkbook(new File(fileName));
        Hashtable allreporthash = new Hashtable();
        allreporthash = reportHash;
        if (allreporthash != null && allreporthash.size() > 0) {
            Iterator keys = allreporthash.keySet().iterator();
            String ip = "";
            int sheetNum = 0;
            while (keys.hasNext()) {
                ip = keys.next().toString();
                String newip = doip(ip);
                Hashtable report_has = (Hashtable) allreporthash.get(ip);

                String hostname = (String) report_has.get("dbname");
                WritableSheet sheet = wb.createSheet(hostname + "", 0);
                String Ping = (String) report_has.get("Ping");
                String starttime = (String) report_has.get("starttime");
                String totime = (String) report_has.get("totime");
                String typename = (String) report_has.get("typename");
                String runstr = (String) report_has.get("runstr");
                String grade = (String) report_has.get("grade");
                String pingnow = (String) report_has.get("pingnow");
                String pingmin = (String) report_has.get("pingmin");
                String pingconavg = (String) report_has.get("pingconavg");
                DBVo vo = (DBVo) report_has.get("vo");
                Vector val = (Vector) report_has.get("Val");
                if (val == null) {
                    val = new Vector();
                }
                List sessionlist = (ArrayList) report_has.get("sessionlist");
                if (sessionlist == null) {
                    sessionlist = new ArrayList();
                }
                Hashtable tablesHash = (Hashtable) report_has.get("tablesHash");
                if (tablesHash == null) {
                    tablesHash = new Hashtable();
                }
                Vector tableinfo_v = (Vector) report_has.get("tableinfo_v");
                if (tableinfo_v == null) {
                    tableinfo_v = new Vector();
                }
                Hashtable maxping = (Hashtable) report_has.get("ping");

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

                // WritableFont labelFont = new
                // WritableFont(WritableFont.createFont(""), 12,
                // WritableFont.BOLD,
                // false);
                // WritableCellFormat labelFormat = new
                // WritableCellFormat(labelFont);
                //
                // WritableCellFormat _labelFormat = new
                // WritableCellFormat();
                // _labelFormat.setBackground(jxl.format.Colour.GRAY_25);
                //
                // WritableCellFormat p_labelFormat = new
                // WritableCellFormat();
                // p_labelFormat.setBackground(jxl.format.Colour.ICE_BLUE);
                //
                // WritableCellFormat b_labelFormat = new
                // WritableCellFormat();
                // b_labelFormat.setBackground(jxl.format.Colour.GRAY_50);

                Label tmpLabel = null;
                tmpLabel = new Label(0, 0, hostname + "", labelFormat);
                sheet.addCell(tmpLabel);
                tmpLabel = new Label(0, 1, ":" + impReport.getTimeStamp(), labelFormat1);
                sheet.addCell(tmpLabel);
                tmpLabel = new Label(0, 2, ": " + starttime + "  " + totime, labelFormat1);
                sheet.addCell(tmpLabel);
                sheet.mergeCells(0, 0, 6, 0);
                sheet.mergeCells(0, 1, 6, 1);
                sheet.mergeCells(0, 2, 6, 2);
                // ip
                tmpLabel = new Label(0, 4, "", b_labelFormat);
                sheet.addCell(tmpLabel);
                tmpLabel = new Label(1, 4, "IP", b_labelFormat);
                sheet.addCell(tmpLabel);
                tmpLabel = new Label(2, 4, "", b_labelFormat);
                sheet.addCell(tmpLabel);
                tmpLabel = new Label(3, 4, "", b_labelFormat);
                sheet.addCell(tmpLabel);
                tmpLabel = new Label(5, 4, "", b_labelFormat);
                sheet.addCell(tmpLabel);
                sheet.mergeCells(3, 4, 4, 4);
                sheet.mergeCells(5, 4, 6, 4);
                tmpLabel = new Label(0, 5, vo.getDbName(), p_labelFormat);
                sheet.addCell(tmpLabel);
                tmpLabel = new Label(1, 5, ip, p_labelFormat);
                sheet.addCell(tmpLabel);
                tmpLabel = new Label(2, 5, typename, p_labelFormat);
                sheet.addCell(tmpLabel);
                tmpLabel = new Label(3, 5, runstr, p_labelFormat);
                sheet.addCell(tmpLabel);
                tmpLabel = new Label(5, 5, grade, p_labelFormat);
                sheet.addCell(tmpLabel);
                sheet.mergeCells(3, 5, 4, 5);
                sheet.mergeCells(5, 5, 6, 5);

                // 
                tmpLabel = new Label(0, 7, "", b_labelFormat);
                sheet.addCell(tmpLabel);
                tmpLabel = new Label(2, 7, "", b_labelFormat);
                sheet.addCell(tmpLabel);
                tmpLabel = new Label(5, 7, "", b_labelFormat);
                sheet.addCell(tmpLabel);
                sheet.mergeCells(0, 7, 1, 7);
                sheet.mergeCells(2, 7, 4, 7);
                sheet.mergeCells(5, 7, 6, 7);
                tmpLabel = new Label(0, 8, pingnow + "%", p_labelFormat);
                sheet.addCell(tmpLabel);
                tmpLabel = new Label(2, 8, pingmin + "%", p_labelFormat);
                sheet.addCell(tmpLabel);
                tmpLabel = new Label(5, 8, pingconavg + "%", p_labelFormat);
                sheet.addCell(tmpLabel);
                sheet.mergeCells(0, 8, 1, 8);
                sheet.mergeCells(2, 8, 4, 8);
                sheet.mergeCells(5, 8, 6, 8);

                // 
                File file = new File(ResourceCenter.getInstance().getSysPath() + "/resource/image/jfreechart/"
                        + newip + "ConnectUtilization" + ".png");
                // sheet,0,0,5,1,,,
                // allRow = allRow+2;
                sheet.addImage(new WritableImage(0, 9, 7, 7, file));
                // allRow = allRow+7;

                tmpLabel = new Label(0, 18, " ", b_labelFormat);
                sheet.mergeCells(0, 18, 6, 18);
                sheet.addCell(tmpLabel);
                int row = 19;
                if (val != null && val.size() > 0) {
                    for (int i = 0; i < val.size(); i++) {
                        Hashtable return_value = (Hashtable) val.get(i);
                        if (return_value != null && return_value.size() > 0) {
                            String name = return_value.get("variable_name").toString();
                            String value = return_value.get("value").toString();
                            if (name.equalsIgnoreCase("Max_used_connections")) {
                                name = "";
                            }
                            if (name.equalsIgnoreCase("Handler_read_first")) {
                                name = "";
                            }
                            if (name.equalsIgnoreCase("Handler_read_key")) {
                                name = "";
                            }
                            if (name.equalsIgnoreCase("Handler_read_next")) {
                                name = "";
                            }
                            if (name.equalsIgnoreCase("Handler_read_prev")) {
                                name = "";
                            }
                            if (name.equalsIgnoreCase("Handler_read_rnd")) {
                                name = "H";
                            }
                            if (name.equalsIgnoreCase("Handler_read_rnd_next")) {
                                name = "";
                            }
                            if (name.equalsIgnoreCase("Open_tables")) {
                                name = "";
                            }
                            if (name.equalsIgnoreCase("Opened_tables")) {
                                name = "";
                            }
                            if (name.equalsIgnoreCase("Threads_cached")) {
                                name = "";
                            }
                            if (name.equalsIgnoreCase("Threads_connected")) {
                                name = "";
                            }
                            if (name.equalsIgnoreCase("Threads_created")) {
                                name = "";
                            }
                            if (name.equalsIgnoreCase("Threads_running")) {
                                name = "";
                            }
                            if (name.equalsIgnoreCase("Table_locks_immediate")) {
                                name = "";
                            }
                            if (name.equalsIgnoreCase("Table_locks_waited")) {
                                name = "";
                            }
                            if (name.equalsIgnoreCase("Key_read_requests")) {
                                name = "";
                            }
                            if (name.equalsIgnoreCase("Key_reads")) {
                                name = "";
                            }
                            if (name.equalsIgnoreCase("log_slow_queries")) {
                                name = "";
                            }
                            if (name.equalsIgnoreCase("slow_launch_time")) {
                                name = "Slow_launch_threads";
                            }
                            p_labelFormat = super.colorChange(i);
                            tmpLabel = new Label(0, row, name, p_labelFormat);
                            sheet.mergeCells(0, row, 4, row);
                            sheet.addCell(tmpLabel);
                            tmpLabel = new Label(5, row, value, p_labelFormat);
                            sheet.addCell(tmpLabel);
                            sheet.mergeCells(5, row, 6, row);
                            row++;
                        }
                    }
                }
                // 
                row = row + 2;
                tmpLabel = new Label(0, row, " ", b_labelFormat);
                sheet.addCell(tmpLabel);
                sheet.mergeCells(0, row, 6, row);
                row++;
                tmpLabel = new Label(0, row, "", b_labelFormat);
                sheet.addCell(tmpLabel);
                tmpLabel = new Label(1, row, " ", b_labelFormat);
                sheet.addCell(tmpLabel);
                tmpLabel = new Label(2, row, "  ", b_labelFormat);
                sheet.addCell(tmpLabel);
                tmpLabel = new Label(3, row, " ", b_labelFormat);
                sheet.mergeCells(3, row, 4, row);
                sheet.addCell(tmpLabel);
                tmpLabel = new Label(5, row, " ", b_labelFormat);
                sheet.addCell(tmpLabel);
                tmpLabel = new Label(6, row, " ", b_labelFormat);
                sheet.addCell(tmpLabel);
                row++;
                if (sessionlist != null && sessionlist.size() > 0) {
                    for (int i = 0; i < sessionlist.size(); i++) {
                        List ipsessionlist = (List) sessionlist.get(i);
                        if (ipsessionlist != null && ipsessionlist.size() > 0) {
                            for (int k = 0; k < ipsessionlist.size(); k++) {
                                String[] sessions = (String[]) ipsessionlist.get(k);
                                if (sessions != null && sessions.length == 5) {
                                    p_labelFormat = super.colorChange(k);
                                    tmpLabel = new Label(0, row, String.valueOf(k + 1), p_labelFormat);
                                    sheet.addCell(tmpLabel);
                                    tmpLabel = new Label(1, row, sessions[4], p_labelFormat);
                                    sheet.addCell(tmpLabel);
                                    tmpLabel = new Label(2, row, sessions[0], p_labelFormat);
                                    sheet.addCell(tmpLabel);
                                    tmpLabel = new Label(3, row, sessions[1], p_labelFormat);
                                    sheet.mergeCells(3, row, 4, row);
                                    sheet.addCell(tmpLabel);
                                    tmpLabel = new Label(5, row, sessions[2], p_labelFormat);
                                    sheet.addCell(tmpLabel);
                                    tmpLabel = new Label(6, row, sessions[3], p_labelFormat);
                                    sheet.addCell(tmpLabel);
                                    row++;
                                }

                            }
                        }
                    }
                }

                // 
                row = row + 2;
                tmpLabel = new Label(0, row, " ", b_labelFormat);
                sheet.addCell(tmpLabel);
                sheet.mergeCells(0, row, 6, row);
                row++;
                tmpLabel = new Label(0, row, "", b_labelFormat);
                sheet.addCell(tmpLabel);
                tmpLabel = new Label(1, row, " ", b_labelFormat);
                sheet.mergeCells(1, row, 2, row);
                sheet.addCell(tmpLabel);
                tmpLabel = new Label(3, row, "   ", b_labelFormat);
                sheet.addCell(tmpLabel);
                tmpLabel = new Label(4, row, "  ", b_labelFormat);
                sheet.addCell(tmpLabel);
                tmpLabel = new Label(5, row, "  ", b_labelFormat);
                sheet.mergeCells(5, row, 6, row);
                sheet.addCell(tmpLabel);
                row++;
                String[] dbs = vo.getDbName().split(",");
                if (dbs != null && dbs.length > 0) {
                    for (int i = 0; i < dbs.length; i++) {
                        String dbStr = dbs[i];
                        // System.out.println(dbStr+"====="+tablesHash.size());
                        if (tablesHash.containsKey(dbStr)) {
                            List tableslist = (List) tablesHash.get(dbStr);
                            if (tableslist != null && tableslist.size() > 0) {
                                for (int k = 0; k < tableslist.size(); k++) {
                                    String[] tables = (String[]) tableslist.get(k);
                                    if (tables != null && tables.length == 4) {
                                        p_labelFormat = super.colorChange(k);
                                        tmpLabel = new Label(0, row, String.valueOf(k + 1), p_labelFormat);
                                        sheet.addCell(tmpLabel);
                                        tmpLabel = new Label(1, row, tables[0], p_labelFormat);
                                        sheet.mergeCells(1, row, 2, row);
                                        sheet.addCell(tmpLabel);
                                        tmpLabel = new Label(3, row, tables[1], p_labelFormat);
                                        sheet.addCell(tmpLabel);
                                        tmpLabel = new Label(4, row, tables[2], p_labelFormat);
                                        sheet.addCell(tmpLabel);
                                        tmpLabel = new Label(5, row, tables[3], p_labelFormat);
                                        sheet.mergeCells(5, row, 6, row);
                                        sheet.addCell(tmpLabel);
                                        row++;
                                    }

                                }
                            }
                        }
                    }
                }

                // 
                row = row + 2;
                tmpLabel = new Label(0, row, "  ", b_labelFormat);
                sheet.mergeCells(0, row, 1, row);
                sheet.mergeCells(0, row, 6, row);
                sheet.addCell(tmpLabel);
                row++;
                tmpLabel = new Label(0, row, "  ", b_labelFormat);
                sheet.addCell(tmpLabel);
                tmpLabel = new Label(1, row, "  ", b_labelFormat);
                sheet.mergeCells(1, row, 3, row);
                sheet.addCell(tmpLabel);
                tmpLabel = new Label(4, row, "  ", b_labelFormat);
                sheet.mergeCells(4, row, 6, row);
                sheet.addCell(tmpLabel);
                row++;
                if (tableinfo_v != null) {// HONGLILI
                    for (int i = 0; i < tableinfo_v.size(); i++) {
                        Hashtable ht = (Hashtable) tableinfo_v.get(i);
                        String size = ht.get("variable_name").toString();
                        String free = ht.get("value").toString();
                        if (size.equalsIgnoreCase("auto_increment_increment")) {
                            size = "";
                        }
                        if (size.equalsIgnoreCase("auto_increment_offset")) {
                            size = "AUTO_INCREMENT";
                        }
                        if (size.equalsIgnoreCase("automatic_sp_privileges")) {
                            size = "automatic_sp_privileges";
                        }
                        if (size.equalsIgnoreCase("back_log")) {
                            size = "";
                        }
                        if (size.equalsIgnoreCase("basedir")) {
                            size = "MySQL";
                        }
                        if (size.equalsIgnoreCase("binlog_cache_size")) {
                            size = "SQL";
                        }
                        if (size.equalsIgnoreCase("bulk_insert_buffer_size")) {
                            size = "";
                        }
                        if (size.equalsIgnoreCase("character_set_client")) {
                            size = "";
                        }
                        if (size.equalsIgnoreCase("character_set_connection")) {
                            size = "";
                        }
                        if (size.equalsIgnoreCase("character_set_database")) {
                            size = "";
                        }
                        if (size.equalsIgnoreCase("character_set_filesystem")) {
                            size = "character_set_filesystem";
                        }
                        if (size.equalsIgnoreCase("character_set_results")) {
                            size = "";
                        }
                        if (size.equalsIgnoreCase("character_set_server")) {
                            size = "";
                        }
                        if (size.equalsIgnoreCase("character_set_system")) {
                            size = "";
                        }
                        if (size.equalsIgnoreCase("character_sets_dir")) {
                            size = "";
                        }
                        if (size.equalsIgnoreCase("collation_connection")) {
                            size = "";
                        }
                        if (size.equalsIgnoreCase("collation_database")) {
                            size = "";
                        }
                        if (size.equalsIgnoreCase("collation_server")) {
                            size = "";
                        }
                        if (size.equalsIgnoreCase("completion_type")) {
                            size = "";
                        }
                        if (size.equalsIgnoreCase("concurrent_insert")) {
                            size = "";
                        }
                        if (size.equalsIgnoreCase("connect_timeout")) {
                            size = "Bad handshake";
                        }
                        if (size.equalsIgnoreCase("datadir")) {
                            size = "MySQL";
                        }
                        if (size.equalsIgnoreCase("date_format")) {
                            size = "date_format()";
                        }
                        if (size.equalsIgnoreCase("datetime_format")) {
                            size = "datetime_format()";
                        }
                        if (size.equalsIgnoreCase("default_week_format")) {
                            size = "WEEK() ";
                        }
                        if (size.equalsIgnoreCase("delay_key_write")) {
                            size = "DELAY_KEY_WRITE";
                        }
                        if (size.equalsIgnoreCase("delayed_insert_limit")) {
                            size = "INSERT DELAYEDSELECT";
                        }
                        if (size.equalsIgnoreCase("delayed_insert_timeout")) {
                            size = "INSERT DELAYEDINSERT";
                        }
                        if (size.equalsIgnoreCase("delayed_queue_size")) {
                            size = "INSERT DELAYED";
                        }
                        if (size.equalsIgnoreCase("div_precision_increment")) {
                            size = "/";
                        }
                        if (size.equalsIgnoreCase("engine_condition_pushdown")) {
                            size = "NDB";
                        }
                        if (size.equalsIgnoreCase("expire_logs_days")) {
                            size = "";
                        }
                        if (size.equalsIgnoreCase("flush")) {
                            size = "flushmysqld";
                        }
                        if (size.equalsIgnoreCase("flush_time")) {
                            size = "";
                        }
                        if (size.equalsIgnoreCase("ft_boolean_syntax")) {
                            size = "IN BOOLEAN MODE";
                        }
                        if (size.equalsIgnoreCase("ft_max_word_len")) {
                            size = "FULLTEXT";
                        }
                        if (size.equalsIgnoreCase("ft_min_word_len")) {
                            size = "FULLTEXT";
                        }
                        if (size.equalsIgnoreCase("ft_query_expansion_limit")) {
                            size = "WITH QUERY EXPANSION";
                        }
                        if (size.equalsIgnoreCase("ft_stopword_file")) {
                            size = "";
                        }
                        if (size.equalsIgnoreCase("group_concat_max_len")) {
                            size = "GROUP_CONCAT()";
                        }
                        if (size.equalsIgnoreCase("have_archive")) {
                            size = "mysqldARCHIVE";
                        }
                        if (size.equalsIgnoreCase("have_bdb")) {
                            size = "mysqldBDB";
                        }
                        if (size.equalsIgnoreCase("have_blackhole_engine")) {
                            size = "mysqldBLACKHOLE";
                        }
                        if (size.equalsIgnoreCase("have_compress")) {
                            size = "zlib";
                        }
                        if (size.equalsIgnoreCase("have_crypt")) {
                            size = "crypt()";
                        }
                        if (size.equalsIgnoreCase("have_csv")) {
                            size = "mysqldARCHIVE";
                        }
                        if (size.equalsIgnoreCase("have_example_engine")) {
                            size = "mysqldEXAMPLE";
                        }
                        if (size.equalsIgnoreCase("have_federated_engine")) {
                            size = "mysqldFEDERATED";
                        }
                        if (size.equalsIgnoreCase("have_geometry")) {
                            size = "";
                        }
                        if (size.equalsIgnoreCase("have_innodb")) {
                            size = "mysqldInnoDB";
                        }
                        if (size.equalsIgnoreCase("have_isam")) {
                            size = "";
                        }
                        if (size.equalsIgnoreCase("have_ndbcluster")) {
                            size = "mysqldNDB CLUSTER";
                        }
                        if (size.equalsIgnoreCase("have_openssl")) {
                            size = "mysqld/SSL()";
                        }
                        if (size.equalsIgnoreCase("have_query_cache")) {
                            size = "mysqld";
                        }
                        if (size.equalsIgnoreCase("have_raid")) {
                            size = "mysqldRAID";
                        }
                        if (size.equalsIgnoreCase("have_rtree_keys")) {
                            size = "RTREE";
                        }
                        if (size.equalsIgnoreCase("have_symlink")) {
                            size = "";
                        }
                        if (size.equalsIgnoreCase("init_connect")) {
                            size = "";
                        }
                        if (size.equalsIgnoreCase("init_file")) {
                            size = "--init-file";
                        }
                        if (size.equalsIgnoreCase("init_slave")) {
                            size = "SQL";
                        }
                        if (size.equalsIgnoreCase("innodb_additional_mem_pool_size")) {
                            size = "InnoDB";
                        }
                        if (size.equalsIgnoreCase("innodb_autoextend_increment")) {
                            size = "";
                        }
                        if (size.equalsIgnoreCase("innodb_buffer_pool_awe_mem_mb")) {
                            size = "32WindowsAWE";
                        }
                        if (size.equalsIgnoreCase("innodb_buffer_pool_size")) {
                            size = "InnoDB";
                        }
                        if (size.equalsIgnoreCase("innodb_checksums")) {
                            size = "InnoDB";
                        }
                        if (size.equalsIgnoreCase("innodb_commit_concurrency")) {
                            size = "innodb_commit_concurrency";
                        }
                        if (size.equalsIgnoreCase("innodb_concurrency_tickets")) {
                            size = "innodb_concurrency_tickets";
                        }
                        if (size.equalsIgnoreCase("innodb_data_file_path")) {
                            size = "";
                        }
                        if (size.equalsIgnoreCase("innodb_data_home_dir")) {
                            size = "InnoDB";
                        }
                        if (size.equalsIgnoreCase("innodb_doublewrite")) {
                            size = "InnoDB";
                        }
                        if (size.equalsIgnoreCase("innodb_fast_shutdown")) {
                            size = "InnoDB";
                        }
                        if (size.equalsIgnoreCase("innodb_file_io_threads")) {
                            size = "InnoDBI/O";
                        }
                        if (size.equalsIgnoreCase("innodb_file_per_table")) {
                            size = "InnoDB.ibd";
                        }
                        if (size.equalsIgnoreCase("innodb_flush_log_at_trx_commit")) {
                            size = "InnoDB";
                        }
                        if (size.equalsIgnoreCase("innodb_flush_method")) {
                            size = "InnoDBfsync()";
                        }
                        if (size.equalsIgnoreCase("innodb_force_recovery")) {
                            size = "";
                        }
                        if (size.equalsIgnoreCase("innodb_lock_wait_timeout")) {
                            size = "InnoDB";
                        }
                        if (size.equalsIgnoreCase("innodb_locks_unsafe_for_binlog")) {
                            size = "InnoDB";
                        }
                        if (size.equalsIgnoreCase("innodb_log_arch_dir")) {
                            size = " ";
                        }
                        if (size.equalsIgnoreCase("innodb_log_archive")) {
                            size = "";
                        }
                        if (size.equalsIgnoreCase("innodb_log_buffer_size")) {
                            size = "InnoDB";
                        }
                        if (size.equalsIgnoreCase("innodb_log_file_size")) {
                            size = "";
                        }
                        if (size.equalsIgnoreCase("innodb_log_files_in_group")) {
                            size = "";
                        }
                        if (size.equalsIgnoreCase("innodb_log_group_home_dir")) {
                            size = "InnoDB";
                        }
                        if (size.equalsIgnoreCase("innodb_max_dirty_pages_pct")) {
                            size = "InnoDB";
                        }
                        if (size.equalsIgnoreCase("innodb_max_purge_lag")) {
                            size = "INSERT,UPDATEDELETE";
                        }
                        if (size.equalsIgnoreCase("innodb_mirrored_log_groups")) {
                            size = "";
                        }
                        if (size.equalsIgnoreCase("innodb_open_files")) {
                            size = "InnoDB.ibd";
                        }
                        if (size.equalsIgnoreCase("innodb_support_xa")) {
                            size = "InnoDBXA";
                        }
                        if (size.equalsIgnoreCase("innodb_sync_spin_loops")) {
                            size = "innodb_sync_spin_loops";
                        }
                        if (size.equalsIgnoreCase("innodb_table_locks")) {
                            size = "InnoDB";
                        }
                        if (size.equalsIgnoreCase("innodb_thread_concurrency")) {
                            size = "InnoDBInnoDB";
                        }
                        if (size.equalsIgnoreCase("innodb_thread_sleep_delay")) {
                            size = "InnoDBSHOW INNODB STATUS<datadir>/innodb_status";
                        }
                        if (size.equalsIgnoreCase("interactive_timeout")) {
                            size = "";
                        }
                        if (size.equalsIgnoreCase("join_buffer_size")) {
                            size = "";
                        }
                        if (size.equalsIgnoreCase("key_buffer_size")) {
                            size = "";
                        }
                        if (size.equalsIgnoreCase("key_cache_age_threshold")) {
                            size = "(sub-chain)(sub-chain)";
                        }
                        if (size.equalsIgnoreCase("key_cache_block_size")) {
                            size = "";
                        }
                        if (size.equalsIgnoreCase("key_cache_division_limit")) {
                            size = "";
                        }
                        if (size.equalsIgnoreCase("language")) {
                            size = "";
                        }
                        if (size.equalsIgnoreCase("large_files_support")) {
                            size = "mysqld";
                        }
                        if (size.equalsIgnoreCase("large_page_size")) {
                            size = "large_page_size";
                        }
                        if (size.equalsIgnoreCase("large_pages")) {
                            size = "";
                        }
                        if (size.equalsIgnoreCase("license")) {
                            size = "";
                        }
                        if (size.equalsIgnoreCase("local_infile")) {
                            size = "LOCALLOAD DATA INFILE";
                        }
                        if (size.equalsIgnoreCase("log")) {
                            size = "";
                        }
                        if (size.equalsIgnoreCase("log_bin")) {
                            size = "";
                        }
                        if (size.equalsIgnoreCase("log_bin_trust_function_creators")) {
                            size = "";
                        }
                        if (size.equalsIgnoreCase("log_error")) {
                            size = "";
                        }
                        if (size.equalsIgnoreCase("log_slave_updates")) {
                            size = "";
                        }
                        if (size.equalsIgnoreCase("log_slow_queries")) {
                            size = "";
                        }
                        if (size.equalsIgnoreCase("log_warnings")) {
                            size = "";
                        }
                        if (size.equalsIgnoreCase("long_query_time")) {
                            size = "Slow_queries";
                        }
                        if (size.equalsIgnoreCase("low_priority_updates")) {
                            size = "sqlSELECTLOCK TABLE READ";
                        }
                        if (size.equalsIgnoreCase("lower_case_file_system")) {
                            size = "";
                        }
                        if (size.equalsIgnoreCase("lower_case_table_names")) {
                            size = "1";
                        }
                        if (size.equalsIgnoreCase("max_allowed_packet")) {
                            size = "/";
                        }
                        if (size.equalsIgnoreCase("max_binlog_cache_size")) {
                            size = "";
                        }
                        if (size.equalsIgnoreCase("max_binlog_size")) {
                            size = "";
                        }
                        if (size.equalsIgnoreCase("max_connect_errors")) {
                            size = "";
                        }
                        if (size.equalsIgnoreCase("max_connections")) {
                            size = "";
                        }
                        if (size.equalsIgnoreCase("max_delayed_threads")) {
                            size = "INSERT DELAYED";
                        }
                        if (size.equalsIgnoreCase("max_error_count")) {
                            size = "SHOW ERRORSSHOW WARNINGS";
                        }
                        if (size.equalsIgnoreCase("max_heap_table_size")) {
                            size = "MEMORY (HEAP)";
                        }
                        if (size.equalsIgnoreCase("max_insert_delayed_threads")) {
                            size = "INSERT DELAYED(max_delayed_threads)";
                        }
                        if (size.equalsIgnoreCase("max_join_size")) {
                            size = "max_join_size";
                        }
                        if (size.equalsIgnoreCase("max_length_for_sort_data")) {
                            size = "filesort";
                        }
                        if (size.equalsIgnoreCase("max_prepared_stmt_count")) {
                            size = "max_prepared_stmt_count";
                        }
                        if (size.equalsIgnoreCase("max_relay_log_size")) {
                            size = "";
                        }
                        if (size.equalsIgnoreCase("max_seeks_for_key")) {
                            size = "";
                        }
                        if (size.equalsIgnoreCase("max_sort_length")) {
                            size = "BLOBTEXT";
                        }
                        if (size.equalsIgnoreCase("max_sp_recursion_depth")) {
                            size = "max_sp_recursion_depth";
                        }
                        if (size.equalsIgnoreCase("max_tmp_tables")) {
                            size = "";
                        }
                        if (size.equalsIgnoreCase("max_user_connections")) {
                            size = "MySQL";
                        }
                        if (size.equalsIgnoreCase("max_write_lock_count")) {
                            size = "";
                        }
                        if (size.equalsIgnoreCase("multi_range_count")) {
                            size = "multi_range_count";
                        }
                        if (size.equalsIgnoreCase("myisam_data_pointer_size")) {
                            size = "";
                        }
                        if (size.equalsIgnoreCase("myisam_max_sort_file_size")) {
                            size = "MyISAMMySQL";
                        }
                        if (size.equalsIgnoreCase("myisam_recover_options")) {
                            size = "myisam-recover";
                        }
                        if (size.equalsIgnoreCase("myisam_repair_threads")) {
                            size = "1Repair by sortingMyISAM";
                        }
                        if (size.equalsIgnoreCase("myisam_sort_buffer_size")) {
                            size = "REPAIR TABLECREATE INDEXALTER TABLEMyISAM";
                        }
                        if (size.equalsIgnoreCase("myisam_stats_method")) {
                            size = "MyISAMNULL";
                        }
                        if (size.equalsIgnoreCase("named_pipe")) {
                            size = "";
                        }
                        if (size.equalsIgnoreCase("net_buffer_length")) {
                            size = "";
                        }
                        if (size.equalsIgnoreCase("net_read_timeout")) {
                            size = "";
                        }
                        if (size.equalsIgnoreCase("net_retry_count")) {
                            size = "";
                        }
                        if (size.equalsIgnoreCase("net_write_timeout")) {
                            size = "";
                        }
                        if (size.equalsIgnoreCase("new")) {
                            size = "MySQL 4.04.1";
                        }
                        if (size.equalsIgnoreCase("old_passwords")) {
                            size = "MySQLpre-4.1-style";
                        }
                        if (size.equalsIgnoreCase("open_files_limit")) {
                            size = "mysqld";
                        }
                        if (size.equalsIgnoreCase("optimizer_prune_level")) {
                            size = " 0";
                        }
                        if (size.equalsIgnoreCase("optimizer_search_depth")) {
                            size = "";
                        }
                        if (size.equalsIgnoreCase("pid_file")) {
                            size = "ID (PID)";
                        }
                        if (size.equalsIgnoreCase("prepared_stmt_count")) {
                            size = "prepared_stmt_count";
                        }
                        if (size.equalsIgnoreCase("port")) {
                            size = "TCP/IP";
                        }
                        if (size.equalsIgnoreCase("preload_buffer_size")) {
                            size = "";
                        }
                        if (size.equalsIgnoreCase("protocol_version")) {
                            size = "MySQL/";
                        }
                        if (size.equalsIgnoreCase("query_alloc_block_size")) {
                            size = "";
                        }
                        if (size.equalsIgnoreCase("query_cache_limit")) {
                            size = "";
                        }
                        if (size.equalsIgnoreCase("query_cache_min_res_unit")) {
                            size = "()";
                        }
                        if (size.equalsIgnoreCase("query_cache_size")) {
                            size = "";
                        }
                        if (size.equalsIgnoreCase("query_cache_type")) {
                            size = "";
                        }
                        if (size.equalsIgnoreCase("query_cache_wlock_invalidate")) {
                            size = "WRITE";
                        }
                        if (size.equalsIgnoreCase("query_prealloc_size")) {
                            size = "";
                        }
                        if (size.equalsIgnoreCase("range_alloc_block_size")) {
                            size = "";
                        }
                        if (size.equalsIgnoreCase("read_buffer_size")) {
                            size = "()";
                        }
                        if (size.equalsIgnoreCase("read_only")) {
                            size = "ON";
                        }
                        if (size.equalsIgnoreCase("read_only")) {
                            size = "ON";
                        }
                        if (size.equalsIgnoreCase("relay_log_purge")) {
                            size = "";
                        }
                        if (size.equalsIgnoreCase("read_rnd_buffer_size")) {
                            size = "";
                        }
                        if (size.equalsIgnoreCase("secure_auth")) {
                            size = "--secure-authMySQL(4.1)";
                        }
                        if (size.equalsIgnoreCase("shared_memory")) {
                            size = "(Windows)";
                        }
                        if (size.equalsIgnoreCase("shared_memory_base_name")) {
                            size = "(Windows)";
                        }
                        if (size.equalsIgnoreCase("server_id")) {
                            size = "";
                        }
                        if (size.equalsIgnoreCase("skip_external_locking")) {
                            size = "mysqld";
                        }
                        if (size.equalsIgnoreCase("skip_networking")) {
                            size = "(TCP/IP)";
                        }
                        if (size.equalsIgnoreCase("skip_show_database")) {
                            size = "SHOW DATABASESSHOW DATABASES";
                        }
                        if (size.equalsIgnoreCase("slave_compressed_protocol")) {
                            size = "/";
                        }
                        if (size.equalsIgnoreCase("slave_load_tmpdir")) {
                            size = "LOAD DATA INFILE";
                        }
                        if (size.equalsIgnoreCase("slave_net_timeout")) {
                            size = "/";
                        }
                        if (size.equalsIgnoreCase("slave_skip_errors")) {
                            size = "()";
                        }
                        if (size.equalsIgnoreCase("slave_transaction_retries")) {
                            size = "SQLslave_transaction_retries";
                        }
                        if (size.equalsIgnoreCase("slow_launch_time")) {
                            size = "Slow_launch_threads";
                        }
                        if (size.equalsIgnoreCase("sort_buffer_size")) {
                            size = "";
                        }
                        if (size.equalsIgnoreCase("sql_mode")) {
                            size = "SQL";
                        }
                        if (size.equalsIgnoreCase("storage_engine")) {
                            size = "table_typeisMySQL 5.1,storage_engine";
                        }
                        if (size.equalsIgnoreCase("sync_binlog")) {
                            size = "sync_binlog'thMySQL";
                        }
                        if (size.equalsIgnoreCase("sync_frm")) {
                            size = "1,.frm";
                        }
                        if (size.equalsIgnoreCase("system_time_zone")) {
                            size = "";
                        }
                        if (size.equalsIgnoreCase("table_cache")) {
                            size = "";
                        }
                        if (size.equalsIgnoreCase("table_type")) {
                            size = "()";
                        }
                        if (size.equalsIgnoreCase("thread_cache_size")) {
                            size = "";
                        }
                        if (size.equalsIgnoreCase("thread_stack")) {
                            size = "";
                        }
                        if (size.equalsIgnoreCase("time_format")) {
                            size = "";
                        }
                        if (size.equalsIgnoreCase("time_zone")) {
                            size = "";
                        }
                        if (size.equalsIgnoreCase("tmp_table_size")) {
                            size = "MySQLMyISAM";
                        }
                        if (size.equalsIgnoreCase("tmpdir")) {
                            size = "";
                        }
                        if (size.equalsIgnoreCase("transaction_alloc_block_size")) {
                            size = "()";
                        }
                        if (size.equalsIgnoreCase("transaction_prealloc_size")) {
                            size = "transaction_alloc_blocks";
                        }
                        if (size.equalsIgnoreCase("tx_isolation")) {
                            size = "";
                        }
                        if (size.equalsIgnoreCase("updatable_views_with_limit")) {
                            size = "LIMIT";
                        }
                        if (size.equalsIgnoreCase("version")) {
                            size = "";
                        }
                        if (size.equalsIgnoreCase("version_bdb")) {
                            size = "BDB";
                        }
                        if (size.equalsIgnoreCase("version_comment")) {
                            size = "configure--with-commentMySQL";
                        }
                        if (size.equalsIgnoreCase("version_compile_machine")) {
                            size = "MySQL";
                        }
                        if (size.equalsIgnoreCase("version_compile_os")) {
                            size = "MySQL";
                        }
                        if (size.equalsIgnoreCase("wait_timeout")) {
                            size = "";
                        }
                        p_labelFormat = super.colorChange(i);
                        tmpLabel = new Label(0, row, String.valueOf(i + 1), p_labelFormat);
                        sheet.addCell(tmpLabel);
                        tmpLabel = new Label(1, row, size, p_labelFormat);
                        sheet.mergeCells(1, row, 3, row);
                        sheet.addCell(tmpLabel);
                        tmpLabel = new Label(4, row, free, p_labelFormat);
                        sheet.mergeCells(4, row, 6, row);
                        sheet.addCell(tmpLabel);
                        row++;
                    }
                }

                //    
                row = row + 2;
                tmpLabel = new Label(0, row, "     ", labelFormat);
                sheet.addCell(tmpLabel);
                sheet.mergeCells(0, row, 6, row);
                row++;
                tmpLabel = new Label(0, row, "", b_labelFormat);
                sheet.addCell(tmpLabel);
                sheet.mergeCells(0, row, 2, row);
                tmpLabel = new Label(3, row, " ", b_labelFormat);
                sheet.addCell(tmpLabel);
                sheet.mergeCells(3, row, 6, row);
                row++;
                tmpLabel = new Label(0, row, (String) report_has.get("downnum"), p_labelFormat);
                sheet.addCell(tmpLabel);
                sheet.mergeCells(0, row, 2, row);
                tmpLabel = new Label(3, row, report_has.get("count") + "", p_labelFormat);
                sheet.addCell(tmpLabel);
                sheet.mergeCells(3, row, 6, row);

                // 
                // 
                WritableCellFormat red_labelFormat = new WritableCellFormat();
                WritableCellFormat orange_labelFormat = new WritableCellFormat();
                WritableCellFormat yellow_labelFormat = new WritableCellFormat();

                red_labelFormat.setBackground(jxl.format.Colour.RED);
                orange_labelFormat.setBackground(jxl.format.Colour.ORANGE);
                yellow_labelFormat.setBackground(jxl.format.Colour.YELLOW);

                row = row + 2;
                tmpLabel = new Label(0, row, "", labelFormat);
                sheet.addCell(tmpLabel);
                sheet.mergeCells(0, row, 6, row);
                row++;
                tmpLabel = new Label(0, row, " ", b_labelFormat);
                sheet.addCell(tmpLabel);
                tmpLabel = new Label(1, row, "", b_labelFormat);
                sheet.addCell(tmpLabel);
                tmpLabel = new Label(2, row, " ", b_labelFormat);
                sheet.addCell(tmpLabel);
                sheet.mergeCells(2, row, 3, row);
                tmpLabel = new Label(4, row, " ", b_labelFormat);
                sheet.addCell(tmpLabel);
                tmpLabel = new Label(5, row, "", b_labelFormat);
                sheet.addCell(tmpLabel);
                tmpLabel = new Label(6, row, "", b_labelFormat);
                sheet.addCell(tmpLabel);
                row++;
                int index = 0;
                java.text.SimpleDateFormat _sdf = new java.text.SimpleDateFormat("MM-dd HH:mm");
                List list = (ArrayList) report_has.get("list");
                if (list != null && list.size() > 0) {
                    for (int i = 0; i < list.size(); i++) {
                        p_labelFormat = super.colorChange(i);
                        index++;
                        EventList eventlist = (EventList) list.get(i);
                        Date cc = eventlist.getRecordtime().getTime();
                        Integer eventid = eventlist.getId();
                        String eventlocation = eventlist.getEventlocation();
                        String content = eventlist.getContent();
                        String level = String.valueOf(eventlist.getLevel1());
                        String status = String.valueOf(eventlist.getManagesign());
                        String s = status;
                        String showlevel = null;
                        String act = "";
                        if ("1".equals(level)) {
                            showlevel = "";
                        } else if ("2".equals(level)) {
                            showlevel = "";
                        } else {
                            showlevel = "";
                        }
                        if ("0".equals(status)) {
                            status = "";
                        }
                        if ("1".equals(status)) {
                            status = "";
                        }
                        if ("2".equals(status)) {
                            status = "";
                        }
                        String rptman = eventlist.getReportman();
                        String rtime1 = _sdf.format(cc);

                        tmpLabel = new Label(0, row, String.valueOf(index), p_labelFormat);
                        sheet.addCell(tmpLabel);
                        if ("3".equals(level)) {
                            tmpLabel = new Label(1, row, showlevel, red_labelFormat);
                            sheet.addCell(tmpLabel);
                        } else if ("2".equals(level)) {
                            tmpLabel = new Label(1, row, showlevel, orange_labelFormat);
                            sheet.addCell(tmpLabel);
                        } else {
                            tmpLabel = new Label(1, row, showlevel, yellow_labelFormat);
                            sheet.addCell(tmpLabel);
                        }
                        tmpLabel = new Label(2, row, content, p_labelFormat);
                        sheet.addCell(tmpLabel);
                        sheet.mergeCells(2, row, 3, row);
                        tmpLabel = new Label(4, row, rtime1, p_labelFormat);
                        sheet.addCell(tmpLabel);
                        tmpLabel = new Label(5, row, rptman, p_labelFormat);
                        sheet.addCell(tmpLabel);
                        tmpLabel = new Label(6, row, status, p_labelFormat);
                        sheet.addCell(tmpLabel);
                        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) {
                    }
                    WritableImage wi = new WritableImage(2, 10000 + 5, 8, 12, baos.toByteArray());
                    sheet.addImage(wi);
                }
            }
            wb.write();
        }

    } catch (Exception e) {
        // SysLogger.error("Error in ExcelReport.createReport()",e);
        SysLogger.error("", e);
    } finally {
        try {
            if (wb != null)
                wb.close();
        } catch (Exception e) {
        }
    }
}

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

public void createReport_serviceworkchoce(String starttime, String totime, String file, String username,
        String positionname) throws DocumentException, IOException {
    Hashtable allreporthash = new Hashtable();
    allreporthash = reportHash;// w  ww .ja v a 2 s.  c  om
    /*
     * String starttime = (String) reportHash.get("starttime"); String
     * totime = (String) reportHash.get("totime");
     */

    Document document = new Document(PageSize.A4);
    // (Writer)document(Writer)
    RtfWriter2.getInstance(document, new FileOutputStream(file));
    document.open();
    // 
    BaseFont bfChinese = BaseFont.createFont("Times-Roman", "", BaseFont.NOT_EMBEDDED);
    // 
    Font titleFont1 = new Font(bfChinese, 14, Font.BOLD);
    Font titleFont = new Font(bfChinese, 14, Font.BOLD);
    // 
    Font contextFont = new Font(bfChinese, 14, Font.NORMAL);
    Font fontChinese = new Font(bfChinese, 12, Font.NORMAL, Color.black);
    try {
        fileName = ResourceCenter.getInstance().getSysPath() + file;
        Table aTable = new Table(13);
        float[] widths = { 40f, 100f, 40f, 40f, 40f, 40f, 40f, 40f, 40f, 40f, 40f, 40f, 40f };
        aTable.setWidths(widths);
        aTable.setWidth(100); //  90%
        aTable.setAlignment(Element.ALIGN_CENTER);// 
        aTable.setAutoFillEmptyCells(true); // 
        aTable.setBorderWidth(1); // 
        aTable.setBorderColor(new Color(0, 125, 255)); // 
        aTable.setPadding(2);// 
        aTable.setSpacing(0);// 
        aTable.setBorder(2);// 

        aTable.endHeaders();
        Cell cell = null;
        cell = new Cell(new Phrase("", titleFont1));
        cell.setColspan(13);
        cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
        cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
        aTable.addCell(cell);
        cell = new Cell(new Phrase("", titleFont));
        cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
        cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
        aTable.addCell(cell);
        // cell = new Cell("");
        cell = new Cell(new Phrase("" + starttime + "" + totime, contextFont));
        cell.setColspan(12);
        aTable.addCell(cell);
        cell = new Cell(new Phrase("", titleFont));
        cell.setColspan(2);
        cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
        cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
        aTable.addCell(cell);
        cell = new Cell(new Phrase(username, contextFont));

        cell.setColspan(4);

        aTable.addCell(cell);
        cell = new Cell(new Phrase("", titleFont));
        cell.setColspan(2);
        cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
        cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
        aTable.addCell(cell);
        cell = new Cell(new Phrase(positionname, contextFont));
        cell.setColspan(5);
        cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
        cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
        aTable.addCell(cell);

        cell = new Cell(new Phrase("", titleFont));
        cell.setColspan(2);
        cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
        cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
        aTable.addCell(cell);
        cell = new Cell(new Phrase("", contextFont));
        cell.setColspan(11);
        aTable.addCell(cell);

        cell = new Cell(new Phrase("", titleFont));
        cell.setColspan(2);
        cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
        cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
        aTable.addCell(cell);
        cell = new Cell(new Phrase("", contextFont));
        cell.setColspan(11);
        aTable.addCell(cell);

        cell = new Cell(new Phrase("", titleFont));
        cell.setColspan(13);
        cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
        cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
        aTable.addCell(cell);
        int netsize = 0;
        Hashtable netreporthash = (Hashtable) allreporthash.get("netreporthash");
        if (netreporthash != null) {
            netsize = netreporthash.size();
        }
        cell = new Cell(new Phrase("" + "\n" + "", titleFont));
        cell.setRowspan(3 + netsize);
        cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
        cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
        aTable.addCell(cell);

        cell = new Cell(new Phrase("IP", titleFont));
        cell.setRowspan(3);
        cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
        cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
        aTable.addCell(cell);

        cell = new Cell(new Phrase("" + "\n" + "(%)", titleFont));
        cell.setColspan(2);
        cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
        cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
        aTable.addCell(cell);

        cell = new Cell(new Phrase("CPU(%)", titleFont));
        cell.setColspan(2);
        cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
        cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
        aTable.addCell(cell);

        cell = new Cell(new Phrase("(%)", titleFont));
        cell.setColspan(2);
        cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
        cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
        aTable.addCell(cell);

        cell = new Cell(new Phrase("KB/S", titleFont));
        cell.setColspan(4);
        cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
        cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
        aTable.addCell(cell);

        cell = new Cell(new Phrase("", titleFont));
        cell.setRowspan(3);
        cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
        cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
        aTable.addCell(cell);

        cell = new Cell(new Phrase("" + "\n" + "", titleFont));
        cell.setRowspan(2);
        cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
        cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
        aTable.addCell(cell);

        cell = new Cell(new Phrase("" + "\n" + "", titleFont));
        cell.setRowspan(2);
        cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
        cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
        aTable.addCell(cell);

        cell = new Cell(new Phrase("" + "\n" + "", titleFont));
        cell.setRowspan(2);
        cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
        cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
        aTable.addCell(cell);

        cell = new Cell(new Phrase("" + "\n" + "", titleFont));
        cell.setRowspan(2);
        cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
        cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
        aTable.addCell(cell);

        cell = new Cell(new Phrase("" + "\n" + "", titleFont));
        cell.setRowspan(2);
        cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
        cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
        aTable.addCell(cell);

        cell = new Cell(new Phrase("" + "\n" + "", titleFont));
        cell.setRowspan(2);
        cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
        cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
        aTable.addCell(cell);

        cell = new Cell(new Phrase("", titleFont));
        cell.setColspan(2);
        cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
        cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
        aTable.addCell(cell);

        cell = new Cell(new Phrase("", titleFont));
        cell.setColspan(2);
        cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
        cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
        aTable.addCell(cell);

        cell = new Cell(new Phrase("" + "\n" + "", titleFont));
        cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
        cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
        aTable.addCell(cell);

        cell = new Cell(new Phrase("" + "\n" + "", titleFont));
        cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
        cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
        aTable.addCell(cell);

        cell = new Cell(new Phrase("" + "\n" + "", titleFont));
        cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
        cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
        aTable.addCell(cell);

        cell = new Cell(new Phrase("" + "\n" + "", titleFont));
        cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
        cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
        aTable.addCell(cell);
        java.text.NumberFormat formatenet = java.text.NumberFormat.getNumberInstance();
        formatenet.setMaximumFractionDigits(0);//
        if (netreporthash != null && netreporthash.size() > 0) {
            Iterator keys = netreporthash.keySet().iterator();
            HostNode node = null;
            while (keys.hasNext()) {
                node = (HostNode) keys.next();
                Hashtable report_has = (Hashtable) netreporthash.get(node);
                String hostname = (String) report_has.get("equipname");
                // WritableSheet sheet = wb.createSheet(hostname+"",
                // sheetNum);

                Hashtable CPU = (Hashtable) report_has.get("CPU");
                String Ping = (String) report_has.get("Ping");
                String ip = (String) report_has.get("ip");
                Calendar colTime = Calendar.getInstance();
                Date cc = colTime.getTime();
                Vector netifVector = (Vector) report_has.get("netifVector");
                Hashtable portconfigHash = (Hashtable) report_has.get("portconfigHash");
                List reportports = (List) report_has.get("reportports");
                Vector iprouterVector = (Vector) report_has.get("iprouterVector");

                Hashtable memMaxHash = (Hashtable) report_has.get("memmaxhash");
                Hashtable maxping = (Hashtable) report_has.get("ping");

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

                String[] netIfItemch = { "", "", "", "(M)", "", "",
                        "" };
                String[] ipRouterItemch = { "", "", "", "", "",
                        "" };
                String[] memoryItem = { "Capability", "Utilization" };
                String[] diskItem = { "AllSize", "UsedSize", "Utilization", "INodeUsedSize",
                        "INodeUtilization" };
                String[] diskItemch = { "", "", "", "i-node", "i-node" };
                String[] iproutertype = { "", "", "", "direct(3)", "indirect(4)" };
                String[] iprouterproto = { "", "other(1)", "local(2)", "netmgmt(3)", "icmp(4)", "egp(5)",
                        "ggp(6)", "hello(7)", "rip(8)", "is-is(9)", "es-is(10)", "ciscoIgrp(11)",
                        "bbnSpfIgp(12)", "ospf(13)", "bgp(14)" };
                String avginput = (String) report_has.get("avginput");
                String avgoutput = (String) report_has.get("avgoutput");
                String maxinput = (String) report_has.get("maxinput");
                String maxoutput = (String) report_has.get("maxoutput");

                String level4 = (String) report_has.get("level4");

                cell = new Cell(new Phrase(ip, contextFont));
                cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
                cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
                aTable.addCell(cell);

                String string1 = ((String) maxping.get("pingmax")).replace("%", "");
                String string2 = ((String) maxping.get("avgpingcon")).replace("%", "");

                cell = new Cell(new Phrase(formatenet.format(Double.valueOf(string2)), contextFont));
                cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
                cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
                aTable.addCell(cell);

                cell = new Cell(new Phrase(formatenet.format(Double.valueOf(string1)), contextFont));
                cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
                cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
                aTable.addCell(cell);

                String cpu = "";
                if (CPU.get("cpu") != null)
                    cpu = (String) CPU.get("cpu");
                String cpumax = "";
                if (CPU.get("cpumax") != null)
                    cpumax = (String) CPU.get("cpumax");
                String avgcpu = "";
                if (CPU.get("avgcpu") != null)
                    avgcpu = (String) CPU.get("avgcpu");
                String string3 = avgcpu.replace("%", "");
                String string4 = cpumax.replace("%", "");
                cell = new Cell(new Phrase(formatenet.format(Double.valueOf(string3)), contextFont));
                cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
                cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
                aTable.addCell(cell);
                cell = new Cell(new Phrase(formatenet.format(Double.valueOf(string4)), contextFont));
                cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
                cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
                aTable.addCell(cell);

                cell = new Cell("");
                aTable.addCell(cell);
                cell = new Cell("");
                aTable.addCell(cell);

                cell = new Cell(new Phrase(avgoutput.replace(".0", ""), contextFont));
                cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
                cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
                aTable.addCell(cell);
                cell = new Cell(new Phrase(maxoutput.replace(".0", ""), contextFont));
                cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
                cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
                aTable.addCell(cell);
                cell = new Cell(new Phrase(avginput.replace(".0", ""), contextFont));
                cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
                cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
                aTable.addCell(cell);
                cell = new Cell(new Phrase(maxinput.replace(".0", ""), contextFont));
                cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
                cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
                aTable.addCell(cell);

                cell = new Cell(new Phrase(level4, contextFont));
                cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
                cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
                aTable.addCell(cell);
            }
        }

        // =====================================================================
        Hashtable hostreporthash = (Hashtable) allreporthash.get("hostreporthash");
        int hostsize = 0;
        if (hostreporthash != null) {
            hostsize = hostreporthash.size();
        }
        cell = new Cell(new Phrase("" + "\n" + "" + "\n" + "", titleFont));
        cell.setRowspan(2 + hostsize);
        cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
        cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
        aTable.addCell(cell);

        cell = new Cell(new Phrase("IP", titleFont));
        cell.setRowspan(2);
        cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
        cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
        aTable.addCell(cell);

        cell = new Cell(new Phrase("" + "\n" + "(%)", titleFont));
        cell.setColspan(2);
        cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
        cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
        aTable.addCell(cell);

        cell = new Cell(new Phrase("CPU(%)", titleFont));
        cell.setColspan(2);
        cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
        cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
        aTable.addCell(cell);

        cell = new Cell(new Phrase("(%)", titleFont));
        cell.setColspan(2);
        cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
        cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
        aTable.addCell(cell);

        cell = new Cell(new Phrase("KB/S", titleFont));
        cell.setColspan(4);
        cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
        cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
        aTable.addCell(cell);

        cell = new Cell(new Phrase("", titleFont));
        cell.setRowspan(2);
        cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
        cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
        aTable.addCell(cell);

        cell = new Cell(new Phrase("" + "\n" + "", titleFont));
        cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
        cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
        aTable.addCell(cell);

        cell = new Cell(new Phrase("" + "\n" + "", titleFont));
        cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
        cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
        aTable.addCell(cell);

        cell = new Cell(new Phrase("" + "\n" + "", titleFont));
        cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
        cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
        aTable.addCell(cell);

        cell = new Cell(new Phrase("" + "\n" + "", titleFont));
        cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
        cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
        aTable.addCell(cell);

        cell = new Cell(new Phrase("" + "\n" + "", titleFont));
        cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
        cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
        aTable.addCell(cell);

        cell = new Cell(new Phrase("" + "\n" + "", titleFont));
        cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
        cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
        aTable.addCell(cell);

        cell = new Cell(new Phrase("" + "\n" + "", titleFont));
        cell.setColspan(2);
        cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
        cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
        aTable.addCell(cell);

        cell = new Cell(new Phrase("" + "\n" + "", titleFont));
        cell.setColspan(2);
        cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
        cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
        aTable.addCell(cell);
        java.text.NumberFormat formatehost = java.text.NumberFormat.getNumberInstance();
        formatehost.setMaximumFractionDigits(0);//
        if (hostreporthash != null && hostreporthash.size() > 0) {
            Iterator keys = hostreporthash.keySet().iterator();
            HostNode node = null;
            while (keys.hasNext()) {

                node = (HostNode) keys.next();
                // String newip = doip(ip);
                Hashtable report_has = (Hashtable) hostreporthash.get(node);
                String hostname = (String) report_has.get("equipname");
                Hashtable CPU = (Hashtable) report_has.get("CPU");
                String Ping = (String) report_has.get("Ping");
                Calendar colTime = (Calendar) report_has.get("time");
                Date cc = colTime.getTime();
                Hashtable Memory = (Hashtable) report_has.get("Memory");
                Hashtable Disk = (Hashtable) report_has.get("Disk");

                Hashtable memMaxHash = (Hashtable) report_has.get("memmaxhash");
                Hashtable memAvgHash = (Hashtable) report_has.get("memavghash");
                Hashtable maxping = (Hashtable) report_has.get("ping");
                String ip = (String) report_has.get("ip");
                SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");

                String[] memoryItemch = { "", "", "", "" };
                String[] memoryItem = { "Capability", "c" };
                String[] diskItem = { "AllSize", "UsedSize", "Utilization", "Utilizationvalue" };
                String[] diskItemch = { "", "", "" };

                String level4 = (String) report_has.get("level4");
                cell = new Cell(new Phrase(ip, contextFont));
                cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
                cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
                aTable.addCell(cell);
                // =======
                String string7 = ((String) maxping.get("pingmax")).replace("%", "");
                String string8 = ((String) maxping.get("avgpingcon")).replace("%", "");

                // formate.format(Double.valueOf(string1));
                // System.out.println(formate.format(Double.valueOf(string))+"@@@@@@@0000000000");
                cell = new Cell(new Phrase(formatehost.format(Double.valueOf(string8)), contextFont));
                cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
                cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
                aTable.addCell(cell);
                cell = new Cell(new Phrase(formatehost.format(Double.valueOf(string7)), contextFont));
                cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
                cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
                aTable.addCell(cell);

                String cpu = "";
                if (CPU.get("cpu") != null)
                    cpu = (String) CPU.get("cpu");
                String cpumax = "";
                if (CPU.get("cpumax") != null)
                    cpumax = (String) CPU.get("cpumax");
                String avgcpu = "";
                if (CPU.get("avgcpu") != null)
                    avgcpu = (String) CPU.get("avgcpu");
                String string3 = avgcpu.replace("%", "");
                String string4 = cpumax.replace("%", "");

                cell = new Cell(new Phrase(formatehost.format(Double.valueOf(string3)), contextFont));
                cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
                cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
                aTable.addCell(cell);
                cell = new Cell(new Phrase(formatehost.format(Double.valueOf(string4)), contextFont));
                cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
                cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
                aTable.addCell(cell);
                String avgvalue = "0.0%";
                if (memAvgHash.get("PhysicalMemory") != null) {

                    avgvalue = (String) memAvgHash.get("PhysicalMemory");
                    String string5 = avgvalue.replace("%", "");
                    cell = new Cell(new Phrase(formatehost.format(Double.valueOf(string5)), contextFont));
                    cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
                    cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
                    aTable.addCell(cell);
                } else {
                    String string5 = avgvalue.replace("%", "");
                    cell = new Cell(new Phrase(formatehost.format(Double.valueOf(string5)), contextFont));
                    cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
                    cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
                    aTable.addCell(cell);
                }
                String value = "0.0%";
                if (memMaxHash.get("PhysicalMemory") != null) {

                    value = (String) memMaxHash.get("PhysicalMemory");
                    String string6 = value.replace("%", "");
                    cell = new Cell(new Phrase(formatehost.format(Double.valueOf(string6)), contextFont));
                    cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
                    cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
                    aTable.addCell(cell);
                } else {
                    String string6 = value.replace("%", "");
                    cell = new Cell(new Phrase(formatehost.format(Double.valueOf(string6)), contextFont));
                    cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
                    cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
                    aTable.addCell(cell);
                }
                String value1 = "0";
                String value2 = "100";
                String name = "";
                String name1 = "";
                String Utilization = "";
                String Utilization1 = "";
                if (Disk != null && Disk.size() > 0) {
                    for (int i = 0; i < Disk.size(); i++) {
                        Hashtable diskhash = (Hashtable) (Disk.get(new Integer(i)));
                        if (diskhash.get(diskItem[3]) != null) {
                            if (value1.compareTo((String) diskhash.get(diskItem[3])) < 0) {
                                value1 = (String) diskhash.get(diskItem[3]);
                                name = (String) diskhash.get("name");
                                Utilization = (String) diskhash.get(diskItem[2]);
                            }
                        }

                        if (diskhash.get(diskItem[3]) != null) {
                            if (value2.compareTo((String) diskhash.get(diskItem[3])) >= 0) {
                                value2 = (String) diskhash.get(diskItem[3]);
                                name1 = (String) diskhash.get("name");
                                Utilization1 = (String) diskhash.get(diskItem[2]);
                            }
                        }
                    }
                    cell = new Cell(name + "  " + Utilization);
                    cell.setColspan(2);
                    aTable.addCell(cell);

                    cell = new Cell(name1 + "  " + Utilization1);
                    cell.setColspan(2);
                    aTable.addCell(cell);
                } else {
                    cell = new Cell("---");
                    cell.setColspan(2);
                    cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
                    cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
                    aTable.addCell(cell);

                    cell = new Cell("---");
                    cell.setColspan(2);
                    cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
                    cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
                    aTable.addCell(cell);
                }

                cell = new Cell(new Phrase(level4, contextFont));
                cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
                cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
                aTable.addCell(cell);
            }
        }

        // ===========================================================================
        Hashtable dbreporthash = (Hashtable) allreporthash.get("dbreporthash");
        int dbsize = 0;
        if (dbreporthash != null) {
            dbsize = dbreporthash.size();
        }
        cell = new Cell(new Phrase("" + "\n" + "" + "\n" + "", titleFont));
        cell.setRowspan(2 + dbsize);
        cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
        cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
        aTable.addCell(cell);

        cell = new Cell(new Phrase("IP", titleFont));
        cell.setRowspan(2);
        cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
        cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
        aTable.addCell(cell);

        cell = new Cell(new Phrase("", titleFont));
        cell.setRowspan(2);
        cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
        cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
        aTable.addCell(cell);

        cell = new Cell(new Phrase("" + "\n" + "(%)", titleFont));
        cell.setColspan(2);
        cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
        cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
        aTable.addCell(cell);

        cell = new Cell(new Phrase("" + "\n" + "(%)", titleFont));
        cell.setColspan(2);
        cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
        cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
        aTable.addCell(cell);

        for (int i = 0; i < 6; i++) {
            cell = new Cell(new Phrase("", contextFont));
            cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
            cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
            aTable.addCell(cell);
        }

        cell = new Cell(new Phrase("" + "\n" + "", titleFont));
        cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
        cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
        aTable.addCell(cell);

        cell = new Cell(new Phrase("" + "\n" + "", titleFont));
        cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
        cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
        aTable.addCell(cell);

        cell = new Cell(new Phrase("" + "\n" + "", titleFont));
        cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
        cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
        aTable.addCell(cell);

        cell = new Cell(new Phrase("" + "\n" + "", titleFont));
        cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
        cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
        aTable.addCell(cell);

        for (int i = 0; i < 6; i++) {
            cell = new Cell(new Phrase("", contextFont));
            cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
            cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
            aTable.addCell(cell);
        }
        java.text.NumberFormat formatedb = java.text.NumberFormat.getNumberInstance();
        formatedb.setMaximumFractionDigits(0);//
        if (dbreporthash != null && dbreporthash.size() > 0) {
            Iterator keys = dbreporthash.keySet().iterator();
            DBVo node = null;
            while (keys.hasNext()) {
                // String newip = doip(ip);
                node = (DBVo) keys.next();
                Hashtable report_has = (Hashtable) dbreporthash.get(node);
                Hashtable maxping = (Hashtable) report_has.get("maxping");
                String string1 = ((String) maxping.get("pingmax")).replace("%", "");
                String string2 = ((String) maxping.get("avgpingcon")).replace("%", "");
                String ip = (String) report_has.get("ip");
                cell = new Cell(new Phrase(ip, contextFont));
                cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
                cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
                aTable.addCell(cell);
                String dbtype = (String) report_has.get("dbtype");
                cell = new Cell(new Phrase(dbtype, contextFont));
                cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
                cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
                aTable.addCell(cell);
                // =======
                cell = new Cell(new Phrase(formatedb.format(Double.valueOf(string2)), contextFont));
                cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
                cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
                aTable.addCell(cell);
                cell = new Cell(new Phrase(formatedb.format(Double.valueOf(string1)), contextFont));
                cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
                cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
                aTable.addCell(cell);

                String maxspace = "";
                String minspace = "";
                if ((Integer) report_has.get("maxspace") != 0) {
                    maxspace = (Integer) report_has.get("maxspace") + "";

                }
                if ((Integer) report_has.get("mixspace") != 0) {
                    minspace = (Integer) report_has.get("mixspace") + "";

                }
                if (dbtype.equals("SQLServer") || dbtype.equals("Sybase") || dbtype.equals("Informix")) {
                    maxspace = "---";
                    minspace = "---";
                }
                cell = new Cell(new Phrase(maxspace, contextFont));
                cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
                cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
                aTable.addCell(cell);

                cell = new Cell(new Phrase(minspace, contextFont));
                cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
                cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
                aTable.addCell(cell);

                for (int i = 0; i < 6; i++) {
                    cell = new Cell(new Phrase("", contextFont));
                    cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
                    cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
                    aTable.addCell(cell);
                }
            }

        }
        // ===================================================================

        Hashtable tomcatreporthash = (Hashtable) allreporthash.get("tomcatreporthash");
        Hashtable iisreporthash = (Hashtable) allreporthash.get("iisreporthash");
        Hashtable weblogicreporthash = (Hashtable) allreporthash.get("weblogicreporthash");
        int tomcatsize = 0;
        if (tomcatreporthash != null) {
            tomcatsize = tomcatreporthash.size();
        }
        int iissize = 0;
        if (iisreporthash != null) {
            iissize = iisreporthash.size();
        }
        int weblogicsize = 0;
        if (weblogicreporthash != null) {
            weblogicsize = weblogicreporthash.size();
        }
        cell = new Cell(new Phrase("" + "\n" + "" + "\n" + "", titleFont));
        cell.setRowspan(2 + tomcatsize + iissize + weblogicsize);
        cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
        cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
        aTable.addCell(cell);

        cell = new Cell(new Phrase("IP", titleFont));
        cell.setRowspan(2);
        cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
        cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
        aTable.addCell(cell);

        cell = new Cell(new Phrase("", titleFont));
        cell.setRowspan(2);
        cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
        cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
        aTable.addCell(cell);

        cell = new Cell(new Phrase("" + "\n" + "(%)", titleFont));
        cell.setColspan(2);
        cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
        cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
        aTable.addCell(cell);

        for (int i = 0; i < 8; i++) {
            cell = new Cell(new Phrase("", contextFont));
            cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
            cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
            aTable.addCell(cell);
        }

        cell = new Cell(new Phrase("" + "\n" + "", titleFont));
        cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
        cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
        aTable.addCell(cell);

        cell = new Cell(new Phrase("" + "\n" + "", titleFont));
        cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
        cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
        aTable.addCell(cell);

        for (int i = 0; i < 8; i++) {
            cell = new Cell(new Phrase("", titleFont));
            cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
            cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
            aTable.addCell(cell);
        }

        // tomcat============================================================
        java.text.NumberFormat formatetomcat = java.text.NumberFormat.getNumberInstance();
        formatetomcat.setMaximumFractionDigits(0);//
        if (tomcatreporthash != null && tomcatreporthash.size() > 0) {
            Iterator keys = tomcatreporthash.keySet().iterator();
            Node node = null;
            while (keys.hasNext()) {

                node = (Node) keys.next();

                Hashtable report_has = (Hashtable) tomcatreporthash.get(node);
                Hashtable maxping = (Hashtable) report_has.get("maxping");
                String string1 = ((String) maxping.get("pingmax")).replace("%", "");
                String string2 = ((String) maxping.get("avgpingcon")).replace("%", "");
                String ip = (String) report_has.get("ip");
                cell = new Cell(new Phrase(ip, contextFont));
                cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
                cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
                aTable.addCell(cell);
                String tomcattype = (String) report_has.get("TOMCAT");
                cell = new Cell(new Phrase(tomcattype, contextFont));
                cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
                cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
                aTable.addCell(cell);

                // =======

                cell = new Cell(new Phrase(formatetomcat.format(Double.valueOf(string2)), contextFont));
                cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
                cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
                aTable.addCell(cell);
                cell = new Cell(new Phrase(formatetomcat.format(Double.valueOf(string1)), contextFont));
                cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
                cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
                aTable.addCell(cell);

                for (int i = 0; i < 8; i++) {
                    cell = new Cell(new Phrase("", contextFont));
                    cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
                    cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
                    aTable.addCell(cell);
                }

            }
        }
        // IIS============================================================================
        java.text.NumberFormat formateiis = java.text.NumberFormat.getNumberInstance();
        formateiis.setMaximumFractionDigits(0);//
        if (iisreporthash != null && iisreporthash.size() > 0) {
            Iterator keys = iisreporthash.keySet().iterator();
            Node node = null;
            while (keys.hasNext()) {

                node = (Node) keys.next();

                Hashtable report_has = (Hashtable) iisreporthash.get(node);
                Hashtable maxping = (Hashtable) report_has.get("maxping");
                String string1 = ((String) maxping.get("pingmax")).replace("%", "");
                String string2 = ((String) maxping.get("avgpingcon")).replace("%", "");
                String ip = (String) report_has.get("ip");
                cell = new Cell(new Phrase(ip, contextFont));
                cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
                cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
                aTable.addCell(cell);
                String tomcattype = (String) report_has.get("IIS");
                cell = new Cell(new Phrase(tomcattype, contextFont));
                cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
                cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
                aTable.addCell(cell);

                // =======

                cell = new Cell(new Phrase(formateiis.format(Double.valueOf(string2)), contextFont));
                cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
                cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
                aTable.addCell(cell);
                cell = new Cell(new Phrase(formateiis.format(Double.valueOf(string1)), contextFont));
                cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
                cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
                aTable.addCell(cell);
                for (int i = 0; i < 8; i++) {
                    cell = new Cell(new Phrase("", contextFont));
                    cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
                    cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
                    aTable.addCell(cell);
                }

            }
        }
        // weblogic================================================================
        java.text.NumberFormat formateweblogic = java.text.NumberFormat.getNumberInstance();
        formateweblogic.setMaximumFractionDigits(0);//
        if (weblogicreporthash != null && weblogicreporthash.size() > 0) {
            Iterator keys = weblogicreporthash.keySet().iterator();
            Node node = null;
            while (keys.hasNext()) {

                node = (Node) keys.next();

                Hashtable report_has = (Hashtable) weblogicreporthash.get(node);
                Hashtable maxping = (Hashtable) report_has.get("maxping");
                String string1 = ((String) maxping.get("pingmax")).replace("%", "");
                String string2 = ((String) maxping.get("avgpingcon")).replace("%", "");
                String ip = (String) report_has.get("ip");
                cell = new Cell(new Phrase(ip, contextFont));
                cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
                cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
                aTable.addCell(cell);
                String tomcattype = (String) report_has.get("WEBLOGIC");
                cell = new Cell(new Phrase(tomcattype, contextFont));
                cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
                cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
                aTable.addCell(cell);

                // =======

                cell = new Cell(new Phrase(formateweblogic.format(Double.valueOf(string2)), contextFont));
                cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
                cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
                aTable.addCell(cell);
                cell = new Cell(new Phrase(formateweblogic.format(Double.valueOf(string1)), contextFont));
                cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
                cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
                aTable.addCell(cell);

                for (int i = 0; i < 8; i++) {
                    cell = new Cell(new Phrase("", contextFont));
                    cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
                    cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
                    aTable.addCell(cell);

                }
            }
        }
        // =============================================================
        cell = new Cell(new Phrase("" + "\n" + "" + "\n" + "" + "\n" + "" + "\n" + "" + "\n" + "",
                titleFont));
        cell.setRowspan(6);
        cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
        cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
        aTable.addCell(cell);

        cell = new Cell(new Phrase("", titleFont));
        cell.setRowspan(2);
        cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
        cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
        aTable.addCell(cell);

        // =======

        cell = new Cell(new Phrase("(%)", titleFont));
        cell.setColspan(2);
        cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
        cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
        aTable.addCell(cell);
        cell = new Cell(new Phrase("(%)", titleFont));
        cell.setColspan(2);
        cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
        cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
        aTable.addCell(cell);

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

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

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

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

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

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

        cell = new Cell(new Phrase("()", titleFont));
        cell.setRowspan(2);
        cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
        cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
        aTable.addCell(cell);

        cell = new Cell(new Phrase("" + "\n" + "", titleFont));
        cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
        cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
        aTable.addCell(cell);

        cell = new Cell(new Phrase("" + "\n" + "", titleFont));
        cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
        cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
        aTable.addCell(cell);

        cell = new Cell(new Phrase("" + "\n" + "", titleFont));
        cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
        cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
        aTable.addCell(cell);

        cell = new Cell(new Phrase("" + "\n" + "", titleFont));
        cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
        cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
        aTable.addCell(cell);

        for (int i = 0; i < 6; i++) {
            cell = new Cell(new Phrase("", contextFont));
            cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
            cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
            aTable.addCell(cell);
        }

        cell = new Cell(new Phrase("", titleFont));
        cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
        cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
        aTable.addCell(cell);

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

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

        for (int i = 0; i < 6; i++) {
            cell = new Cell(new Phrase("", contextFont));
            cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
            cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
            aTable.addCell(cell);
        }
        cell = new Cell(new Phrase("0", contextFont));
        cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
        cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
        aTable.addCell(cell);

        cell = new Cell(new Phrase("", titleFont));
        cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
        cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
        aTable.addCell(cell);

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

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

        for (int i = 0; i < 6; i++) {
            cell = new Cell(new Phrase("", contextFont));
            cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
            cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
            aTable.addCell(cell);
        }
        cell = new Cell(new Phrase("0", contextFont));
        cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
        cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
        aTable.addCell(cell);

        cell = new Cell(new Phrase("", titleFont));
        cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
        cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
        aTable.addCell(cell);

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

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

        for (int i = 0; i < 6; i++) {
            cell = new Cell(new Phrase("", contextFont));
            cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
            cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
            aTable.addCell(cell);
        }
        cell = new Cell(new Phrase("0", contextFont));
        cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
        cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
        aTable.addCell(cell);

        cell = new Cell(new Phrase("SSO", titleFont));
        cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
        cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
        aTable.addCell(cell);

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

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

        for (int i = 0; i < 6; i++) {
            cell = new Cell(new Phrase("", contextFont));
            cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
            cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
            aTable.addCell(cell);
        }
        cell = new Cell(new Phrase("0", contextFont));
        cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
        cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
        aTable.addCell(cell);
        document.add(aTable);
        document.close();
    } catch (Exception e) {
        // TODO: handle exception
    }
}

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

public void createExcelReport_disk(String filename) {
    if (impReport.getTable() == null) {
        fileName = null;//w  w  w .  j  a v a2  s .  c  o m
        return;
    }
    WritableWorkbook wb = null;
    try {
        // fileName = ResourceCenter.getInstance().getSysPath() +
        // "temp\\dhcnms_report.xls";
        // fileName = CommonAppUtil.getAppName() +
        // "/temp/hostnms_report.xls";
        fileName = ResourceCenter.getInstance().getSysPath() + filename;
        wb = Workbook.createWorkbook(new File(fileName));
        String starttime = (String) reportHash.get("starttime");
        String totime = (String) reportHash.get("totime");

        String hostname = (String) reportHash.get("equipname");
        String ip = (String) reportHash.get("ip");
        String newip = doip(ip);
        WritableSheet sheet = wb.createSheet(hostname + "", 0);
        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 = { "", "", "" };

        WritableFont labelFont = new WritableFont(WritableFont.createFont(""), 12, WritableFont.BOLD,
                false);
        WritableCellFormat labelFormat = new WritableCellFormat(labelFont);

        WritableCellFormat _labelFormat = new WritableCellFormat();
        _labelFormat.setBackground(jxl.format.Colour.GRAY_25);

        WritableCellFormat p_labelFormat = new WritableCellFormat();
        p_labelFormat.setBackground(jxl.format.Colour.ICE_BLUE);

        WritableCellFormat b_labelFormat = new WritableCellFormat();
        b_labelFormat.setBackground(jxl.format.Colour.GRAY_50);

        Label tmpLabel = null;
        tmpLabel = new Label(1, 0, hostname + "", labelFormat);
        sheet.addCell(tmpLabel);
        tmpLabel = new Label(0, 1, ":" + impReport.getTimeStamp());
        sheet.addCell(tmpLabel);
        tmpLabel = new Label(0, 2, ": " + starttime + "  " + totime);
        sheet.addCell(tmpLabel);

        // 
        File file = new File(ResourceCenter.getInstance().getSysPath() + "/resource/image/jfreechart/" + newip
                + "ConnectUtilization" + ".png");
        // sheet,0,0,5,1,,,
        // allRow = allRow+2;
        // sheet.addImage(new WritableImage(1, 6, 7, 7, file));
        // allRow = allRow+7;

        int allRow = 4;
        if (Disk != null && Disk.size() > 0) {
            // memoryRow = Disk.size();
            // allRow = allRow + 1 + 7;
            tmpLabel = new Label(0, allRow, "", b_labelFormat);
            sheet.addCell(tmpLabel);
            // 
            allRow = allRow;
            Label label = new Label(1, allRow, "", _labelFormat);
            // CellFormat cf = new CellFormat();
            // label.setCellFormat(cf)

            sheet.addCell(label);
            for (int i = 0; i < diskItemch.length; i++) {
                label = new Label(i + 2, allRow, diskItemch[i], _labelFormat);
                sheet.addCell(label);
            }
            // 

            for (int i = 0; i < Disk.size(); i++) {
                Hashtable diskhash = (Hashtable) (Disk.get(new Integer(i)));
                String name = (String) diskhash.get("name");
                allRow = allRow + 1;
                label = new Label(1, allRow, name);
                sheet.addCell(label);
                for (int j = 0; j < diskItem.length; j++) {
                    String value = "";
                    if (diskhash.get(diskItem[j]) != null) {
                        value = (String) diskhash.get(diskItem[j]);
                    }
                    label = new Label(j + 2, allRow, value, p_labelFormat);
                    sheet.addCell(label);
                }
            } // end 
              // 
            file = new File(ResourceCenter.getInstance().getSysPath() + "/resource/image/jfreechart/" + newip
                    + "disk" + ".png");
            // sheet,0,0,5,1,,,
            sheet.addImage(new WritableImage(1, allRow + 2, 9, 9, file));

        }

        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());
            sheet.addImage(wi);
        }
        wb.write();
    } catch (Exception e) {
        // SysLogger.error("Error in ExcelReport.createReport()",e);
        SysLogger.error("", e);
    } finally {
        try {
            if (wb != null)
                wb.close();
        } catch (Exception e) {
        }
    }
}

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  w  w . j av  a 2 s .com*/
    // 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_diskDoc(String file) throws DocumentException, IOException {
    String starttime = (String) reportHash.get("starttime");
    String totime = (String) reportHash.get("totime");

    String hostname = (String) reportHash.get("equipname");
    String ip = (String) reportHash.get("ip");
    String newip = doip(ip);//from   w w w.j a  va 2s .  c  om
    // WritableSheet sheet = wb.createSheet(hostname + "", 0);
    Hashtable CPU = (Hashtable) reportHash.get("CPU");
    if (CPU == null)
        CPU = new Hashtable();
    String Ping = (String) reportHash.get("Ping");
    // 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)
    RtfWriter2.getInstance(document, new FileOutputStream(file));
    document.open();
    // 
    BaseFont bfChinese = BaseFont.createFont("Times-Roman", "", BaseFont.NOT_EMBEDDED);
    // 
    Font titleFont = new Font(bfChinese, 12, Font.BOLD);
    // 
    Font contextFont = new Font(bfChinese, 10, Font.NORMAL);
    Paragraph title = new Paragraph(hostname + "");
    // 
    title.setAlignment(Element.ALIGN_CENTER);
    // title.setFont(titleFont);
    document.add(title);
    String contextString = ":" + impReport.getTimeStamp() + " \n"// 
            + ":" + starttime + "  " + totime;
    Paragraph context = new Paragraph(contextString);
    // 
    context.setAlignment(Element.ALIGN_LEFT);
    // context.setFont(contextFont);
    // 
    context.setSpacingBefore(5);
    // 
    context.setFirstLineIndent(5);
    document.add(context);
    Font fontChinese = new Font(bfChinese, 12, Font.NORMAL, Color.black);

    // Image img =
    // Image.getInstance(ResourceCenter.getInstance().getSysPath()
    // + "/resource/image/jfreechart/" + newip + "ConnectUtilization"
    // + ".png");
    // img.setAbsolutePosition(0, 0);
    // img.setAlignment(Image.LEFT);// 

    Table aTable3 = new Table(5);
    float[] widthss1 = { 220f, 440f, 150f, 150f, 220f };
    aTable3.setWidths(widthss1);
    aTable3.setWidth(100); //  90%
    aTable3.setAlignment(Element.ALIGN_CENTER);// 
    aTable3.setAutoFillEmptyCells(true); // 
    aTable3.setBorderWidth(1); // 
    aTable3.setBorderColor(new Color(0, 125, 255)); // 
    aTable3.setPadding(2);// 
    aTable3.setSpacing(0);// 
    aTable3.setBorder(2);// 
    aTable3.endHeaders();
    if (Disk != null && Disk.size() > 0) {
        aTable3.addCell("");
        aTable3.addCell("");

        for (int i = 0; i < diskItemch.length; i++) {
            Cell cell = new Cell(diskItemch[i]);
            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");
            Cell cell = new Cell(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]);
                }
                Cell cell1 = new Cell(value);
                // System.out.println(value+"================value===============");
                aTable3.addCell(cell1);
            }
        } // end 
          // 
        Image img3 = Image.getInstance(ResourceCenter.getInstance().getSysPath() + "/resource/image/jfreechart/"
                + newip + "disk" + ".png");
        img3.setAbsolutePosition(0, 0);
        img3.setAlignment(Image.MIDDLE);// 
        document.add(aTable3);
        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.setAbsolutePosition(0, 0);
        img3.setAlignment(Image.MIDDLE);// 

        document.add(img3);
    }
    document.close();
}

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

public void createReport_network(String filename) {
    if (impReport.getTable() == null) {
        fileName = null;/*from   w w  w. j  a va 2 s. c  o  m*/
        return;
    }
    WritableWorkbook wb = null;
    try {
        fileName = ResourceCenter.getInstance().getSysPath() + filename;
        wb = Workbook.createWorkbook(new File(fileName));
        String runmodel = PollingEngine.getCollectwebflag(); // 
        WritableSheet sheet = wb.createSheet("", 0);
        String ip = (String) reportHash.get("ip");
        String newip = doip(ip);
        Vector netifVector = (Vector) reportHash.get("netifVector");
        Hashtable portconfigHash = (Hashtable) reportHash.get("portconfigHash");
        List reportports = (List) reportHash.get("reportports");
        Vector iprouterVector = (Vector) reportHash.get("iprouterVector");
        String hostname = (String) reportHash.get("equipname");

        String[] netIfItemch = { "", "", "", "(M)", "", "",
                "" };
        String[] ipRouterItemch = { "", "", "", "", "", "" };
        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)" };
        createReportTitle(sheet, reportHash);
        createPingAndCpu(sheet, ip, reportHash);
        Label tmpLabel = null;
        int allRow = 23;
        if (netifVector != null && netifVector.size() > 0) {
            allRow = allRow + 1;
            tmpLabel = new Label(0, allRow, "", b_labelFormat);
            sheet.addCell(tmpLabel);
            sheet.mergeCells(0, allRow, 0, allRow + netifVector.size());
            // 
            // allRow = allRow;
            Label label = null;
            label = new Label(1, allRow, netIfItemch[0], _labelFormat);
            sheet.addCell(label);
            label = new Label(2, allRow, netIfItemch[1], _labelFormat);
            sheet.mergeCells(2, allRow, 3, allRow);
            sheet.addCell(label);
            label = new Label(4, allRow, netIfItemch[2], _labelFormat);
            sheet.addCell(label);
            sheet.mergeCells(4, allRow, 5, allRow);
            label = new Label(6, allRow, netIfItemch[3], _labelFormat);
            sheet.addCell(label);
            label = new Label(7, allRow, netIfItemch[4], _labelFormat);
            sheet.addCell(label);
            label = new Label(8, allRow, netIfItemch[5], _labelFormat);
            sheet.addCell(label);
            label = new Label(9, allRow, netIfItemch[6], _labelFormat);
            sheet.addCell(label);
            // 
            for (int i = 0; i < netifVector.size(); i++) {
                allRow = allRow + 1;
                String[] strs = (String[]) netifVector.get(i);
                String ifname = strs[1];
                String index = strs[0];
                p_labelFormat = super.colorChange(i);
                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);
                        }
                        label = new Label(j + 1, allRow, strs[j], p_labelFormat);
                        sheet.addCell(label);
                        sheet.mergeCells(j + 1, allRow, j + 2, allRow);
                        label = new Label(j + 3, allRow, linkuse, p_labelFormat);
                        sheet.addCell(label);
                        sheet.mergeCells(j + 3, allRow, j + 3 + 1, allRow);
                    } else if (j > 1) {
                        label = new Label(j + 4, allRow, strs[j], p_labelFormat);
                        sheet.addCell(label);
                    } else {
                        label = new Label(j + 1, allRow, strs[j], p_labelFormat);
                        sheet.addCell(label);
                    }
                } // end 
            }
        }
        if ("0".equals(runmodel)) {
            if (iprouterVector != null && iprouterVector.size() > 0) {
                allRow = allRow + 2;
                tmpLabel = new Label(0, allRow, "", b_labelFormat);
                sheet.addCell(tmpLabel);
                sheet.mergeCells(0, allRow, 0, allRow + iprouterVector.size());
                // 
                // allRow = allRow+1;
                for (int i = 0; i < ipRouterItemch.length; i++) {
                    Label label = new Label(i + 1, allRow, ipRouterItemch[i], _labelFormat);
                    sheet.addCell(label);
                    if (i == 2) {
                        break;
                    }
                }
                Label label = new Label(4, allRow, ipRouterItemch[3], _labelFormat);
                sheet.addCell(label);
                label = new Label(6, allRow, ipRouterItemch[4], _labelFormat);
                sheet.addCell(label);
                label = new Label(8, allRow, ipRouterItemch[5], _labelFormat);
                sheet.addCell(label);
                sheet.mergeCells(4, allRow, 5, allRow);
                sheet.mergeCells(6, allRow, 7, allRow);
                sheet.mergeCells(8, allRow, 9, allRow);
                // 

                for (int i = 0; i < iprouterVector.size(); i++) {
                    p_labelFormat = super.colorChange(i);
                    allRow = allRow + 1;
                    IpRouter iprouter = (IpRouter) iprouterVector.get(i);
                    label = new Label(1, allRow, iprouter.getIfindex(), p_labelFormat);
                    sheet.addCell(label);
                    label = new Label(2, allRow, iprouter.getDest(), p_labelFormat);
                    sheet.addCell(label);
                    label = new Label(3, allRow, iprouter.getNexthop(), p_labelFormat);
                    sheet.addCell(label);
                    label = new Label(4, allRow,
                            iproutertype[Integer.parseInt(iprouter.getType().longValue() + "")], p_labelFormat);
                    sheet.addCell(label);
                    label = new Label(6, allRow,
                            iprouterproto[Integer.parseInt(iprouter.getProto().longValue() + "")],
                            p_labelFormat);
                    sheet.addCell(label);
                    label = new Label(8, allRow, iprouter.getMask(), p_labelFormat);
                    sheet.addCell(label);
                    sheet.mergeCells(4, allRow, 5, allRow);
                    sheet.mergeCells(6, allRow, 7, allRow);
                    sheet.mergeCells(8, allRow, 9, allRow);
                }
            }
        } else {
            // 
            // allRow = allRow+1;
            List routeList = (ArrayList) reportHash.get("routerList");
            if (routeList != null) {
                allRow = allRow + 2;
                tmpLabel = new Label(0, allRow, "", b_labelFormat);
                sheet.addCell(tmpLabel);
                sheet.mergeCells(0, allRow, 0, allRow + routeList.size());
                for (int i = 0; i < routeList.size(); i++) {
                    allRow = allRow + 1;
                    RouterNodeTemp iprouter = (RouterNodeTemp) routeList.get(i);
                    Label label = new Label(1, allRow, iprouter.getIfindex(), p_labelFormat);
                    sheet.addCell(label);
                    label = new Label(2, allRow, iprouter.getDest(), p_labelFormat);
                    sheet.addCell(label);
                    label = new Label(3, allRow, iprouter.getNexthop(), p_labelFormat);
                    sheet.addCell(label);
                    label = new Label(4, allRow, iprouter.getType(), p_labelFormat);
                    sheet.addCell(label);
                    label = new Label(6, allRow, iprouter.getProto(), p_labelFormat);
                    sheet.addCell(label);
                    label = new Label(8, allRow, iprouter.getMask(), p_labelFormat);
                    sheet.addCell(label);
                    sheet.mergeCells(4, allRow, 5, allRow);
                    sheet.mergeCells(6, allRow, 7, allRow);
                    sheet.mergeCells(8, allRow, 9, allRow);
                }
            }
        }

        allRow = allRow + 2;
        if (reportports != null && reportports.size() > 0) {
            // 
            for (int i = 0; i < reportports.size(); i++) {
                // SysLogger.info(reportports.get(i).getClass()+"=============================================");
                com.afunms.config.model.Portconfig portconfig = (com.afunms.config.model.Portconfig) reportports
                        .get(i);
                tmpLabel = new Label(0, allRow,
                        "" + portconfig.getPortindex() + "(" + portconfig.getName() + ")", b_labelFormat);
                sheet.addCell(tmpLabel);
                if (portconfig.getLinkuse() == null)
                    portconfig.setLinkuse("");
                tmpLabel = new Label(1, allRow, ":" + portconfig.getLinkuse());
                sheet.addCell(tmpLabel);
                // 
                File file = new File(ResourceCenter.getInstance().getSysPath() + "/resource/image/jfreechart/"
                        + newip + portconfig.getPortindex() + "ifspeed_day.png");
                // sheet,0,0,5,1,,,
                allRow = allRow + 1;
                sheet.addImage(new WritableImage(1, allRow, 8, 7, file));
                allRow = allRow + 8;
            }
        }

        /*
         * if ( reportports != null && reportports.size()>0){ //
         * for(int i =0;i<reportports.size();i++){ Portconfig portconfig =
         * (Portconfig)reportports.get(i); //  file = new
         * File(CommonAppUtil.getAppName()+"/images/jfreechart/"+newip+portconfig.getPortindex()+"ifspeed_day.png");
         * //sheet,0,0,5,1,,, allRow =
         * allRow+2; sheet.addImage(new WritableImage(1,allRow,8,7,file));
         * allRow = allRow+7; } }
         */
        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());
            sheet.addImage(wi);
        }
        wb.write();
    } catch (Exception e) {
        SysLogger.error("", e);
    } finally {
        try {
            if (wb != null)
                wb.close();
        } catch (Exception e) {
            SysLogger.error("", e);
        }
    }
}

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   w  w  w  . j  av  a2 s  .  com
    // 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();
}