Switch to unified view

a/tool/src/www/Table.java b/tool/src/www/Table.java
...
...
9
 * FileCopyrightText: <text> Copyright 2013 Nuno Brito, TripleCheck </text>
9
 * FileCopyrightText: <text> Copyright 2013 Nuno Brito, TripleCheck </text>
10
 * FileComment: <text> Eases the creation of HTML tables </text> 
10
 * FileComment: <text> Eases the creation of HTML tables </text> 
11
 */
11
 */
12
12
13
package www;
13
package www;
14
15
import java.util.ArrayList;
16
14
17
15
18
/**
16
/**
19
 *
17
 *
20
 * @author Nuno Brito, 17th of November 2013 in Darmstadt, Germany.
18
 * @author Nuno Brito, 17th of November 2013 in Darmstadt, Germany.
...
...
57
        }
55
        }
58
        // do the header
56
        // do the header
59
        headerData = "<tr>"
57
        headerData = "<tr>"
60
                + result
58
                + result
61
                + "</tr>";
59
                + "</tr>";
60
    }
61
    
62
 
63
       /**
64
     * Public constructor, important to define the array
65
     * @param header 
66
     * @param length 
67
     */
68
    public Table(String[] header, int[] length){
69
        size = header.length;
70
        String result = "";
71
        int i = -1;
72
        for(String item : header){
73
            i++;
74
            result += //"<th>"
75
                    "<th style=\"text-align: left; color: rgb(31, 73, 125); "
76
                    + "width: " + length[i] + "px; "
77
                    + "font-family: Arial;\">"
78
                    + item 
79
                    + "</th>";
80
        }
81
        // do the header
82
        headerData = "<tr>"
83
                + result
84
                + "</tr>";
85
    }
86
    
87
    
88
    /**
89
     * Creates single table fully aligned horizontally with a single line
90
     * @param params an array with text values
91
     * @param size the size for each column
92
     * @return the text in HTML format
93
     */
94
    public static String alignedTable(String[] params, int[] size){
95
        // add the header
96
        String result = "<table style=\"text-align: left;\" border=\"0\"\n" +
97
" cellpadding=\"0\" cellspacing=\"0\"><tbody><tr>";
98
        int i = -1;
99
        for(String param : params){
100
            i++;
101
            result += "<td style=\"width: "
102
                    + size[i]
103
                    + "px;\">"
104
                    + param
105
                    + "</td>"
106
                    ;
107
        }
108
        // add the footer
109
        result += "</tr></tbody></table>";
110
111
        
112
        return result;
62
    }
113
    }
63
    
114
    
64
    /**
115
    /**
65
     * Add this item to our table list
116
     * Add this item to our table list
66
     * @param item the data that we want to fill our list with
117
     * @param item the data that we want to fill our list with