< prev index next >

src/com/sun/javatest/httpd/PageGenerator.java

Print this page
rev 145 : 7902237: Fixing raw use of parameterized class
Reviewed-by: jjg


 104     /**
 105      * Writes the address block and other info at the end of the body.
 106      */
 107     public static void writeFooter(PrintWriter out) {
 108         out.println(dateFormat.format(new Date()));
 109         out.println("<Address>");
 110 
 111         out.print(i18n.getString("generator.produced.txt"));
 112         out.print(swName);
 113         out.print(" ");
 114         out.println(swVersion);
 115 
 116         out.print(i18n.getString("generator.built.txt"));
 117         out.println(swBuildDate);
 118         out.println("</Address>");
 119     }
 120 
 121     /**
 122      * Prints the contents of any dictionary in a two column table.
 123      */
 124     public static void writeDictionary(PrintWriter out, Dictionary dict,
 125                                        String keyHeader, String valHeader) {
 126         // XXX should include HTML filtering of strings
 127 
 128         if (keyHeader == null) keyHeader = "Key";
 129         if (valHeader == null) valHeader = "Value";
 130 
 131         out.println("<Table Border>");
 132 
 133         StringBuffer buf = new StringBuffer(50);
 134 
 135         // write the table header
 136         buf.append("<tr><th>");
 137         buf.append(keyHeader);
 138         buf.append("<th>");
 139         buf.append(valHeader);
 140         buf.append("</tr>");
 141         out.println(buf.toString());
 142 
 143         if (dict == null || dict.size() == 0) {
 144             // no values to write, fill the space
 145             buf.setLength(0);
 146             buf.append("<tr><td colspan=2>");
 147             buf.append("-EMPTY-");
 148             buf.append("</tr>");
 149         }
 150         else {
 151             Enumeration keys = dict.keys();
 152             while (keys.hasMoreElements()) {
 153                 Object key = keys.nextElement();
 154                 out.println("<tr>");
 155                 buf.setLength(0);
 156                 buf.append("<td>");
 157                 buf.append(key.toString());
 158                 buf.append("<td>");
 159                 buf.append((dict.get(key)).toString());
 160                 out.println(buf.toString());
 161                 out.println("</tr>");
 162             }   // while
 163         }
 164 
 165         out.println("</Table>");
 166     }
 167 
 168     public static void startTable(PrintWriter out, boolean borders) {
 169         out.print("<Table");
 170         if (borders) out.print(" Border");
 171 




 104     /**
 105      * Writes the address block and other info at the end of the body.
 106      */
 107     public static void writeFooter(PrintWriter out) {
 108         out.println(dateFormat.format(new Date()));
 109         out.println("<Address>");
 110 
 111         out.print(i18n.getString("generator.produced.txt"));
 112         out.print(swName);
 113         out.print(" ");
 114         out.println(swVersion);
 115 
 116         out.print(i18n.getString("generator.built.txt"));
 117         out.println(swBuildDate);
 118         out.println("</Address>");
 119     }
 120 
 121     /**
 122      * Prints the contents of any dictionary in a two column table.
 123      */
 124     public static void writeDictionary(PrintWriter out, Dictionary<String, String> dict,
 125                                        String keyHeader, String valHeader) {
 126         // XXX should include HTML filtering of strings
 127 
 128         if (keyHeader == null) keyHeader = "Key";
 129         if (valHeader == null) valHeader = "Value";
 130 
 131         out.println("<Table Border>");
 132 
 133         StringBuffer buf = new StringBuffer(50);
 134 
 135         // write the table header
 136         buf.append("<tr><th>");
 137         buf.append(keyHeader);
 138         buf.append("<th>");
 139         buf.append(valHeader);
 140         buf.append("</tr>");
 141         out.println(buf.toString());
 142 
 143         if (dict == null || dict.size() == 0) {
 144             // no values to write, fill the space
 145             buf.setLength(0);
 146             buf.append("<tr><td colspan=2>");
 147             buf.append("-EMPTY-");
 148             buf.append("</tr>");
 149         }
 150         else {
 151             Enumeration<?> keys = dict.keys();
 152             while (keys.hasMoreElements()) {
 153                 Object key = keys.nextElement();
 154                 out.println("<tr>");
 155                 buf.setLength(0);
 156                 buf.append("<td>");
 157                 buf.append(key.toString());
 158                 buf.append("<td>");
 159                 buf.append((dict.get(key)).toString());
 160                 out.println(buf.toString());
 161                 out.println("</tr>");
 162             }   // while
 163         }
 164 
 165         out.println("</Table>");
 166     }
 167 
 168     public static void startTable(PrintWriter out, boolean borders) {
 169         out.print("<Table");
 170         if (borders) out.print(" Border");
 171 


< prev index next >