src/share/classes/com/sun/tools/doclets/formats/html/markup/HtmlWriter.java

changeset 1
9a66ca7c79fa
child 182
47a62d8d98b4
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/src/share/classes/com/sun/tools/doclets/formats/html/markup/HtmlWriter.java	Sat Dec 01 00:00:00 2007 +0000
     1.3 @@ -0,0 +1,1105 @@
     1.4 +/*
     1.5 + * Copyright 1997-2006 Sun Microsystems, Inc.  All Rights Reserved.
     1.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     1.7 + *
     1.8 + * This code is free software; you can redistribute it and/or modify it
     1.9 + * under the terms of the GNU General Public License version 2 only, as
    1.10 + * published by the Free Software Foundation.  Sun designates this
    1.11 + * particular file as subject to the "Classpath" exception as provided
    1.12 + * by Sun in the LICENSE file that accompanied this code.
    1.13 + *
    1.14 + * This code is distributed in the hope that it will be useful, but WITHOUT
    1.15 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
    1.16 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
    1.17 + * version 2 for more details (a copy is included in the LICENSE file that
    1.18 + * accompanied this code).
    1.19 + *
    1.20 + * You should have received a copy of the GNU General Public License version
    1.21 + * 2 along with this work; if not, write to the Free Software Foundation,
    1.22 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
    1.23 + *
    1.24 + * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
    1.25 + * CA 95054 USA or visit www.sun.com if you need additional information or
    1.26 + * have any questions.
    1.27 + */
    1.28 +
    1.29 +package com.sun.tools.doclets.formats.html.markup;
    1.30 +
    1.31 +import com.sun.tools.doclets.internal.toolkit.*;
    1.32 +import com.sun.tools.doclets.internal.toolkit.util.*;
    1.33 +import java.io.*;
    1.34 +
    1.35 +/**
    1.36 + * Class for the Html format code generation.
    1.37 + * Initilizes PrintWriter with FileWriter, to enable print
    1.38 + * related methods to generate the code to the named File through FileWriter.
    1.39 + *
    1.40 + * @since 1.2
    1.41 + * @author Atul M Dambalkar
    1.42 + */
    1.43 +public class HtmlWriter extends PrintWriter {
    1.44 +
    1.45 +    /**
    1.46 +     * Name of the file, to which this writer is writing to.
    1.47 +     */
    1.48 +    protected final String htmlFilename;
    1.49 +
    1.50 +    /**
    1.51 +     * The window title of this file
    1.52 +     */
    1.53 +    protected String winTitle;
    1.54 +
    1.55 +    /**
    1.56 +     * URL file separator string("/").
    1.57 +     */
    1.58 +    public static final String fileseparator =
    1.59 +         DirectoryManager.URL_FILE_SEPERATOR;
    1.60 +
    1.61 +    /**
    1.62 +     * The configuration
    1.63 +     */
    1.64 +    protected Configuration configuration;
    1.65 +
    1.66 +    /**
    1.67 +     * Constructor.
    1.68 +     *
    1.69 +     * @param path The directory path to be created for this file
    1.70 +     *             or null if none to be created.
    1.71 +     * @param filename File Name to which the PrintWriter will
    1.72 +     *                 do the Output.
    1.73 +     * @param docencoding Encoding to be used for this file.
    1.74 +     * @exception IOException Exception raised by the FileWriter is passed on
    1.75 +     * to next level.
    1.76 +     * @exception UnSupportedEncodingException Exception raised by the
    1.77 +     * OutputStreamWriter is passed on to next level.
    1.78 +     */
    1.79 +    public HtmlWriter(Configuration configuration,
    1.80 +                      String path, String filename, String docencoding)
    1.81 +                      throws IOException, UnsupportedEncodingException {
    1.82 +        super(Util.genWriter(configuration, path, filename, docencoding));
    1.83 +        this.configuration = configuration;
    1.84 +        htmlFilename = filename;
    1.85 +    }
    1.86 +
    1.87 +    /**
    1.88 +     * Print <HTML> tag. Add a newline character at the end.
    1.89 +     */
    1.90 +    public void html() {
    1.91 +        println("<HTML>");
    1.92 +    }
    1.93 +
    1.94 +    /**
    1.95 +     * Print &lt;/HTML&gt; tag. Add a newline character at the end.
    1.96 +     */
    1.97 +    public void htmlEnd() {
    1.98 +        println("</HTML>");
    1.99 +    }
   1.100 +
   1.101 +    /**
   1.102 +     * Print the script code to be embeded before the  &lt;/HEAD&gt; tag.
   1.103 +     */
   1.104 +    protected void printWinTitleScript(String winTitle){
   1.105 +        if(winTitle != null && winTitle.length() > 0) {
   1.106 +            script();
   1.107 +            println("function windowTitle()");
   1.108 +            println("{");
   1.109 +            println("    if (location.href.indexOf('is-external=true') == -1) {");
   1.110 +            println("        parent.document.title=\"" + winTitle + "\";");
   1.111 +            println("    }");
   1.112 +            println("}");
   1.113 +            scriptEnd();
   1.114 +            noScript();
   1.115 +            noScriptEnd();
   1.116 +        }
   1.117 +    }
   1.118 +
   1.119 +    /**
   1.120 +     * Print the Javascript &lt;SCRIPT&gt; start tag with its type
   1.121 +     * attribute.
   1.122 +     */
   1.123 +    public void script() {
   1.124 +        println("<SCRIPT type=\"text/javascript\">");
   1.125 +    }
   1.126 +
   1.127 +    /**
   1.128 +     * Print the Javascript &lt;/SCRIPT&gt; end tag.
   1.129 +     */
   1.130 +    public void scriptEnd() {
   1.131 +        println("</SCRIPT>");
   1.132 +    }
   1.133 +
   1.134 +    /**
   1.135 +     * Print the Javascript &lt;NOSCRIPT&gt; start tag.
   1.136 +     */
   1.137 +    public void noScript() {
   1.138 +        println("<NOSCRIPT>");
   1.139 +    }
   1.140 +
   1.141 +    /**
   1.142 +     * Print the Javascript &lt;/NOSCRIPT&gt; end tag.
   1.143 +     */
   1.144 +    public void noScriptEnd() {
   1.145 +        println("</NOSCRIPT>");
   1.146 +    }
   1.147 +
   1.148 +    /**
   1.149 +     * Return the Javascript call to be embedded in the &lt;BODY&gt; tag.
   1.150 +     * Return nothing if winTitle is empty.
   1.151 +     * @return the Javascript call to be embedded in the &lt;BODY&gt; tag.
   1.152 +     */
   1.153 +    protected String getWindowTitleOnload(){
   1.154 +        if(winTitle != null && winTitle.length() > 0) {
   1.155 +            return " onload=\"windowTitle();\"";
   1.156 +        } else {
   1.157 +            return "";
   1.158 +        }
   1.159 +    }
   1.160 +
   1.161 +    /**
   1.162 +     * Print &lt;BODY BGCOLOR="bgcolor"&gt;, including JavaScript
   1.163 +     * "onload" call to load windowtitle script.  This script shows the name
   1.164 +     * of the document in the window title bar when frames are on.
   1.165 +     *
   1.166 +     * @param bgcolor Background color.
   1.167 +     * @param includeScript  boolean set true if printing windowtitle script
   1.168 +     */
   1.169 +    public void body(String bgcolor, boolean includeScript) {
   1.170 +        print("<BODY BGCOLOR=\"" + bgcolor + "\"");
   1.171 +        if (includeScript) {
   1.172 +            print(getWindowTitleOnload());
   1.173 +        }
   1.174 +        println(">");
   1.175 +    }
   1.176 +
   1.177 +    /**
   1.178 +     * Print &lt;/BODY&gt; tag. Add a newline character at the end.
   1.179 +     */
   1.180 +    public void bodyEnd() {
   1.181 +        println("</BODY>");
   1.182 +    }
   1.183 +
   1.184 +    /**
   1.185 +     * Print &lt;TITLE&gt; tag. Add a newline character at the end.
   1.186 +     */
   1.187 +    public void title() {
   1.188 +        println("<TITLE>");
   1.189 +    }
   1.190 +
   1.191 +    /**
   1.192 +     * Print &lt;TITLE&gt; tag. Add a newline character at the end.
   1.193 +     *
   1.194 +     * @param winTitle The title of this document.
   1.195 +     */
   1.196 +    public void title(String winTitle) {
   1.197 +        // Set window title string which is later printed
   1.198 +        this.winTitle = winTitle;
   1.199 +        title();
   1.200 +    }
   1.201 +
   1.202 +
   1.203 +    /**
   1.204 +     * Print &lt;/TITLE&gt; tag. Add a newline character at the end.
   1.205 +     */
   1.206 +    public void titleEnd() {
   1.207 +        println("</TITLE>");
   1.208 +    }
   1.209 +
   1.210 +    /**
   1.211 +     * Print &lt;UL&gt; tag. Add a newline character at the end.
   1.212 +     */
   1.213 +    public void ul() {
   1.214 +        println("<UL>");
   1.215 +    }
   1.216 +
   1.217 +    /**
   1.218 +     * Print &lt;/UL&gt; tag. Add a newline character at the end.
   1.219 +     */
   1.220 +    public void ulEnd() {
   1.221 +        println("</UL>");
   1.222 +    }
   1.223 +
   1.224 +    /**
   1.225 +     * Print &lt;LI&gt; tag.
   1.226 +     */
   1.227 +    public void li() {
   1.228 +        print("<LI>");
   1.229 +    }
   1.230 +
   1.231 +    /**
   1.232 +     * Print &lt;LI TYPE="type"&gt; tag.
   1.233 +     *
   1.234 +     * @param type Type string.
   1.235 +     */
   1.236 +    public void li(String type) {
   1.237 +        print("<LI TYPE=\"" + type + "\">");
   1.238 +    }
   1.239 +
   1.240 +    /**
   1.241 +     * Print &lt;H1&gt; tag. Add a newline character at the end.
   1.242 +     */
   1.243 +    public void h1() {
   1.244 +        println("<H1>");
   1.245 +    }
   1.246 +
   1.247 +    /**
   1.248 +     * Print &lt;/H1&gt; tag. Add a newline character at the end.
   1.249 +     */
   1.250 +    public void h1End() {
   1.251 +        println("</H1>");
   1.252 +    }
   1.253 +
   1.254 +    /**
   1.255 +     * Print text with &lt;H1&gt; tag. Also adds &lt;/H1&gt; tag. Add a newline character
   1.256 +     * at the end of the text.
   1.257 +     *
   1.258 +     * @param text Text to be printed with &lt;H1&gt; format.
   1.259 +     */
   1.260 +    public void h1(String text) {
   1.261 +        h1();
   1.262 +        println(text);
   1.263 +        h1End();
   1.264 +    }
   1.265 +
   1.266 +    /**
   1.267 +     * Print &lt;H2&gt; tag. Add a newline character at the end.
   1.268 +     */
   1.269 +    public void h2() {
   1.270 +        println("<H2>");
   1.271 +    }
   1.272 +
   1.273 +    /**
   1.274 +     * Print text with &lt;H2&gt; tag. Also adds &lt;/H2&gt; tag. Add a newline character
   1.275 +     *  at the end of the text.
   1.276 +     *
   1.277 +     * @param text Text to be printed with &lt;H2&gt; format.
   1.278 +     */
   1.279 +    public void h2(String text) {
   1.280 +        h2();
   1.281 +        println(text);
   1.282 +        h2End();
   1.283 +    }
   1.284 +
   1.285 +    /**
   1.286 +     * Print &lt;/H2&gt; tag. Add a newline character at the end.
   1.287 +     */
   1.288 +    public void h2End() {
   1.289 +        println("</H2>");
   1.290 +    }
   1.291 +
   1.292 +    /**
   1.293 +     * Print &lt;H3&gt; tag. Add a newline character at the end.
   1.294 +     */
   1.295 +    public void h3() {
   1.296 +        println("<H3>");
   1.297 +    }
   1.298 +
   1.299 +    /**
   1.300 +     * Print text with &lt;H3&gt; tag. Also adds &lt;/H3&gt; tag. Add a newline character
   1.301 +     *  at the end of the text.
   1.302 +     *
   1.303 +     * @param text Text to be printed with &lt;H3&gt; format.
   1.304 +     */
   1.305 +    public void h3(String text) {
   1.306 +        h3();
   1.307 +        println(text);
   1.308 +        h3End();
   1.309 +    }
   1.310 +
   1.311 +    /**
   1.312 +     * Print &lt;/H3&gt; tag. Add a newline character at the end.
   1.313 +     */
   1.314 +    public void h3End() {
   1.315 +        println("</H3>");
   1.316 +    }
   1.317 +
   1.318 +    /**
   1.319 +     * Print &lt;H4&gt; tag. Add a newline character at the end.
   1.320 +     */
   1.321 +    public void h4() {
   1.322 +        println("<H4>");
   1.323 +    }
   1.324 +
   1.325 +    /**
   1.326 +     * Print &lt;/H4&gt; tag. Add a newline character at the end.
   1.327 +     */
   1.328 +    public void h4End() {
   1.329 +        println("</H4>");
   1.330 +    }
   1.331 +
   1.332 +    /**
   1.333 +     * Print text with &lt;H4&gt; tag. Also adds &lt;/H4&gt; tag. Add a newline character
   1.334 +     * at the end of the text.
   1.335 +     *
   1.336 +     * @param text Text to be printed with &lt;H4&gt; format.
   1.337 +     */
   1.338 +    public void h4(String text) {
   1.339 +        h4();
   1.340 +        println(text);
   1.341 +        h4End();
   1.342 +    }
   1.343 +
   1.344 +    /**
   1.345 +     * Print &lt;H5&gt; tag. Add a newline character at the end.
   1.346 +     */
   1.347 +    public void h5() {
   1.348 +        println("<H5>");
   1.349 +    }
   1.350 +
   1.351 +    /**
   1.352 +     * Print &lt;/H5&gt; tag. Add a newline character at the end.
   1.353 +     */
   1.354 +    public void h5End() {
   1.355 +        println("</H5>");
   1.356 +    }
   1.357 +
   1.358 +    /**
   1.359 +     * Print HTML &lt;IMG SRC="imggif" WIDTH="width" HEIGHT="height" ALT="imgname&gt;
   1.360 +     * tag. It prepends the "images" directory name to the "imggif". This
   1.361 +     * method is used for oneone format generation. Add a newline character
   1.362 +     * at the end.
   1.363 +     *
   1.364 +     * @param imggif   Image GIF file.
   1.365 +     * @param imgname  Image name.
   1.366 +     * @param width    Width of the image.
   1.367 +     * @param height   Height of the image.
   1.368 +     */
   1.369 +    public void img(String imggif, String imgname, int width, int height) {
   1.370 +        println("<IMG SRC=\"images/" + imggif + ".gif\""
   1.371 +              + " WIDTH=\"" + width + "\" HEIGHT=\"" + height
   1.372 +              + "\" ALT=\"" + imgname + "\">");
   1.373 +    }
   1.374 +
   1.375 +    /**
   1.376 +     * Print &lt;MENU&gt; tag. Add a newline character at the end.
   1.377 +     */
   1.378 +    public void menu() {
   1.379 +        println("<MENU>");
   1.380 +    }
   1.381 +
   1.382 +    /**
   1.383 +     * Print &lt;/MENU&gt; tag. Add a newline character at the end.
   1.384 +     */
   1.385 +    public void menuEnd() {
   1.386 +        println("</MENU>");
   1.387 +    }
   1.388 +
   1.389 +    /**
   1.390 +     * Print &lt;PRE&gt; tag. Add a newline character at the end.
   1.391 +     */
   1.392 +    public void pre() {
   1.393 +        println("<PRE>");
   1.394 +    }
   1.395 +
   1.396 +    /**
   1.397 +     * Print &lt;PRE&gt; tag without adding new line character at th eend.
   1.398 +     */
   1.399 +    public void preNoNewLine() {
   1.400 +        print("<PRE>");
   1.401 +    }
   1.402 +
   1.403 +    /**
   1.404 +     * Print &lt;/PRE&gt; tag. Add a newline character at the end.
   1.405 +     */
   1.406 +    public void preEnd() {
   1.407 +        println("</PRE>");
   1.408 +    }
   1.409 +
   1.410 +    /**
   1.411 +     * Print &lt;HR&gt; tag. Add a newline character at the end.
   1.412 +     */
   1.413 +    public void hr() {
   1.414 +        println("<HR>");
   1.415 +    }
   1.416 +
   1.417 +    /**
   1.418 +     * Print &lt;HR SIZE="size" WIDTH="widthpercent%"&gt; tag. Add a newline
   1.419 +     * character at the end.
   1.420 +     *
   1.421 +     * @param size           Size of the ruler.
   1.422 +     * @param widthPercent   Percentage Width of the ruler
   1.423 +     */
   1.424 +    public void hr(int size, int widthPercent) {
   1.425 +        println("<HR SIZE=\"" + size + "\" WIDTH=\"" + widthPercent + "%\">");
   1.426 +    }
   1.427 +
   1.428 +    /**
   1.429 +     * Print &lt;HR SIZE="size" NOSHADE&gt; tag. Add a newline character at the end.
   1.430 +     *
   1.431 +     * @param size           Size of the ruler.
   1.432 +     * @param noshade        noshade string.
   1.433 +     */
   1.434 +    public void hr(int size, String noshade) {
   1.435 +        println("<HR SIZE=\"" + size + "\" NOSHADE>");
   1.436 +    }
   1.437 +
   1.438 +    /**
   1.439 +     * Get the "&lt;B&gt;" string.
   1.440 +     *
   1.441 +     * @return String Return String "&lt;B&gt;";
   1.442 +     */
   1.443 +    public String getBold() {
   1.444 +        return "<B>";
   1.445 +    }
   1.446 +
   1.447 +    /**
   1.448 +     * Get the "&lt;/B&gt;" string.
   1.449 +     *
   1.450 +     * @return String Return String "&lt;/B&gt;";
   1.451 +     */
   1.452 +    public String getBoldEnd() {
   1.453 +        return "</B>";
   1.454 +    }
   1.455 +
   1.456 +    /**
   1.457 +     * Print &lt;B&gt; tag.
   1.458 +     */
   1.459 +    public void bold() {
   1.460 +        print("<B>");
   1.461 +    }
   1.462 +
   1.463 +    /**
   1.464 +     * Print &lt;/B&gt; tag.
   1.465 +     */
   1.466 +    public void boldEnd() {
   1.467 +        print("</B>");
   1.468 +    }
   1.469 +
   1.470 +    /**
   1.471 +     * Print text passed, in bold format using &lt;B&gt; and &lt;/B&gt; tags.
   1.472 +     *
   1.473 +     * @param text String to be printed in between &lt;B&gt; and &lt;/B&gt; tags.
   1.474 +     */
   1.475 +    public void bold(String text) {
   1.476 +        bold();
   1.477 +        print(text);
   1.478 +        boldEnd();
   1.479 +    }
   1.480 +
   1.481 +    /**
   1.482 +     * Print text passed, in Italics using &lt;I&gt; and &lt;/I&gt; tags.
   1.483 +     *
   1.484 +     * @param text String to be printed in between &lt;I&gt; and &lt;/I&gt; tags.
   1.485 +     */
   1.486 +    public void italics(String text) {
   1.487 +        print("<I>");
   1.488 +        print(text);
   1.489 +        println("</I>");
   1.490 +    }
   1.491 +
   1.492 +    /**
   1.493 +     * Return, text passed, with Italics &lt;I&gt; and &lt;/I&gt; tags, surrounding it.
   1.494 +     * So if the text passed is "Hi", then string returned will be "&lt;I&gt;Hi&lt;/I&gt;".
   1.495 +     *
   1.496 +     * @param text String to be printed in between &lt;I&gt; and &lt;/I&gt; tags.
   1.497 +     */
   1.498 +    public String italicsText(String text) {
   1.499 +        return "<I>" + text + "</I>";
   1.500 +    }
   1.501 +
   1.502 +    public String codeText(String text) {
   1.503 +        return "<CODE>" + text + "</CODE>";
   1.504 +    }
   1.505 +
   1.506 +    /**
   1.507 +     * Print "&#38;nbsp;", non-breaking space.
   1.508 +     */
   1.509 +    public void space() {
   1.510 +        print("&nbsp;");
   1.511 +    }
   1.512 +
   1.513 +    /**
   1.514 +     * Print &lt;DL&gt; tag. Add a newline character at the end.
   1.515 +     */
   1.516 +    public void dl() {
   1.517 +        println("<DL>");
   1.518 +    }
   1.519 +
   1.520 +    /**
   1.521 +     * Print &lt;/DL&gt; tag. Add a newline character at the end.
   1.522 +     */
   1.523 +    public void dlEnd() {
   1.524 +        println("</DL>");
   1.525 +    }
   1.526 +
   1.527 +    /**
   1.528 +     * Print &lt;DT&gt; tag.
   1.529 +     */
   1.530 +    public void dt() {
   1.531 +        print("<DT>");
   1.532 +    }
   1.533 +
   1.534 +    /**
   1.535 +     * Print &lt;DT&gt; tag.
   1.536 +     */
   1.537 +    public void dd() {
   1.538 +        print("<DD>");
   1.539 +    }
   1.540 +
   1.541 +    /**
   1.542 +     * Print &lt;/DD&gt; tag. Add a newline character at the end.
   1.543 +     */
   1.544 +    public void ddEnd() {
   1.545 +        println("</DD>");
   1.546 +    }
   1.547 +
   1.548 +    /**
   1.549 +     * Print &lt;SUP&gt; tag. Add a newline character at the end.
   1.550 +     */
   1.551 +    public void sup() {
   1.552 +        println("<SUP>");
   1.553 +    }
   1.554 +
   1.555 +    /**
   1.556 +     * Print &lt;/SUP&gt; tag. Add a newline character at the end.
   1.557 +     */
   1.558 +    public void supEnd() {
   1.559 +        println("</SUP>");
   1.560 +    }
   1.561 +
   1.562 +    /**
   1.563 +     * Print &lt;FONT SIZE="size"&gt; tag. Add a newline character at the end.
   1.564 +     *
   1.565 +     * @param size String size.
   1.566 +     */
   1.567 +    public void font(String size) {
   1.568 +        println("<FONT SIZE=\"" + size + "\">");
   1.569 +    }
   1.570 +
   1.571 +    /**
   1.572 +     * Print &lt;FONT SIZE="size"&gt; tag.
   1.573 +     *
   1.574 +     * @param size String size.
   1.575 +     */
   1.576 +    public void fontNoNewLine(String size) {
   1.577 +        print("<FONT SIZE=\"" + size + "\">");
   1.578 +    }
   1.579 +
   1.580 +    /**
   1.581 +     * Print &lt;FONT CLASS="stylename"&gt; tag. Add a newline character at the end.
   1.582 +     *
   1.583 +     * @param stylename String stylename.
   1.584 +     */
   1.585 +    public void fontStyle(String stylename) {
   1.586 +        print("<FONT CLASS=\"" + stylename + "\">");
   1.587 +    }
   1.588 +
   1.589 +    /**
   1.590 +     * Print &lt;FONT SIZE="size" CLASS="stylename"&gt; tag. Add a newline character
   1.591 +     * at the end.
   1.592 +     *
   1.593 +     * @param size String size.
   1.594 +     * @param stylename String stylename.
   1.595 +     */
   1.596 +    public void fontSizeStyle(String size, String stylename) {
   1.597 +        println("<FONT size=\"" + size + "\" CLASS=\"" + stylename + "\">");
   1.598 +    }
   1.599 +
   1.600 +    /**
   1.601 +     * Print &lt;/FONT&gt; tag.
   1.602 +     */
   1.603 +    public void fontEnd() {
   1.604 +        print("</FONT>");
   1.605 +    }
   1.606 +
   1.607 +    /**
   1.608 +     * Get the "&lt;FONT COLOR="color"&gt;" string.
   1.609 +     *
   1.610 +     * @param color String color.
   1.611 +     * @return String Return String "&lt;FONT COLOR="color"&gt;".
   1.612 +     */
   1.613 +    public String getFontColor(String color) {
   1.614 +        return "<FONT COLOR=\"" + color + "\">";
   1.615 +    }
   1.616 +
   1.617 +    /**
   1.618 +     * Get the "&lt;/FONT&gt;" string.
   1.619 +     *
   1.620 +     * @return String Return String "&lt;/FONT&gt;";
   1.621 +     */
   1.622 +    public String getFontEnd() {
   1.623 +        return "</FONT>";
   1.624 +    }
   1.625 +
   1.626 +    /**
   1.627 +     * Print &lt;CENTER&gt; tag. Add a newline character at the end.
   1.628 +     */
   1.629 +    public void center() {
   1.630 +        println("<CENTER>");
   1.631 +    }
   1.632 +
   1.633 +    /**
   1.634 +     * Print &lt;/CENTER&gt; tag. Add a newline character at the end.
   1.635 +     */
   1.636 +    public void centerEnd() {
   1.637 +        println("</CENTER>");
   1.638 +    }
   1.639 +
   1.640 +    /**
   1.641 +     * Print anchor &lt;A NAME="name"&gt; tag.
   1.642 +     *
   1.643 +     * @param name Name String.
   1.644 +     */
   1.645 +    public void aName(String name) {
   1.646 +        print("<A NAME=\"" + name + "\">");
   1.647 +    }
   1.648 +
   1.649 +    /**
   1.650 +     * Print &lt;/A&gt; tag.
   1.651 +     */
   1.652 +    public void aEnd() {
   1.653 +        print("</A>");
   1.654 +    }
   1.655 +
   1.656 +    /**
   1.657 +     * Print &lt;I&gt; tag.
   1.658 +     */
   1.659 +    public void italic() {
   1.660 +        print("<I>");
   1.661 +    }
   1.662 +
   1.663 +    /**
   1.664 +     * Print &lt;/I&gt; tag.
   1.665 +     */
   1.666 +    public void italicEnd() {
   1.667 +        print("</I>");
   1.668 +    }
   1.669 +
   1.670 +    /**
   1.671 +     * Print contents within anchor &lt;A NAME="name"&gt; tags.
   1.672 +     *
   1.673 +     * @param name String name.
   1.674 +     * @param content String contents.
   1.675 +     */
   1.676 +    public void anchor(String name, String content) {
   1.677 +        aName(name);
   1.678 +        print(content);
   1.679 +        aEnd();
   1.680 +    }
   1.681 +
   1.682 +    /**
   1.683 +     * Print anchor &lt;A NAME="name"&gt; and &lt;/A&gt;tags. Print comment string
   1.684 +     * "&lt;!-- --&gt;" within those tags.
   1.685 +     *
   1.686 +     * @param name String name.
   1.687 +     */
   1.688 +    public void anchor(String name) {
   1.689 +        anchor(name, "<!-- -->");
   1.690 +    }
   1.691 +
   1.692 +    /**
   1.693 +     * Print newline and then print &lt;P&gt; tag. Add a newline character at the
   1.694 +     * end.
   1.695 +     */
   1.696 +    public void p() {
   1.697 +        println();
   1.698 +        println("<P>");
   1.699 +    }
   1.700 +
   1.701 +    /**
   1.702 +     * Print newline and then print &lt;/P&gt; tag. Add a newline character at the
   1.703 +     * end.
   1.704 +     */
   1.705 +    public void pEnd() {
   1.706 +        println();
   1.707 +        println("</P>");
   1.708 +    }
   1.709 +
   1.710 +    /**
   1.711 +     * Print newline and then print &lt;BR&gt; tag. Add a newline character at the
   1.712 +     * end.
   1.713 +     */
   1.714 +    public void br() {
   1.715 +        println();
   1.716 +        println("<BR>");
   1.717 +    }
   1.718 +
   1.719 +    /**
   1.720 +     * Print &lt;ADDRESS&gt; tag. Add a newline character at the end.
   1.721 +     */
   1.722 +    public void address() {
   1.723 +        println("<ADDRESS>");
   1.724 +    }
   1.725 +
   1.726 +    /**
   1.727 +     * Print &lt;/ADDRESS&gt; tag. Add a newline character at the end.
   1.728 +     */
   1.729 +    public void addressEnd() {
   1.730 +        println("</ADDRESS>");
   1.731 +    }
   1.732 +
   1.733 +    /**
   1.734 +     * Print &lt;HEAD&gt; tag. Add a newline character at the end.
   1.735 +     */
   1.736 +    public void head() {
   1.737 +        println("<HEAD>");
   1.738 +    }
   1.739 +
   1.740 +    /**
   1.741 +     * Print &lt;/HEAD&gt; tag. Add a newline character at the end.
   1.742 +     */
   1.743 +    public void headEnd() {
   1.744 +        println("</HEAD>");
   1.745 +    }
   1.746 +
   1.747 +    /**
   1.748 +     * Print &lt;CODE&gt; tag.
   1.749 +     */
   1.750 +    public void code() {
   1.751 +        print("<CODE>");
   1.752 +    }
   1.753 +
   1.754 +    /**
   1.755 +     * Print &lt;/CODE&gt; tag.
   1.756 +     */
   1.757 +    public void codeEnd() {
   1.758 +        print("</CODE>");
   1.759 +    }
   1.760 +
   1.761 +    /**
   1.762 +     * Print &lt;EM&gt; tag. Add a newline character at the end.
   1.763 +     */
   1.764 +    public void em() {
   1.765 +        println("<EM>");
   1.766 +    }
   1.767 +
   1.768 +    /**
   1.769 +     * Print &lt;/EM&gt; tag. Add a newline character at the end.
   1.770 +     */
   1.771 +    public void emEnd() {
   1.772 +        println("</EM>");
   1.773 +    }
   1.774 +
   1.775 +    /**
   1.776 +     * Print HTML &lt;TABLE BORDER="border" WIDTH="width"
   1.777 +     * CELLPADDING="cellpadding" CELLSPACING="cellspacing"&gt; tag.
   1.778 +     *
   1.779 +     * @param border       Border size.
   1.780 +     * @param width        Width of the table.
   1.781 +     * @param cellpadding  Cellpadding for the table cells.
   1.782 +     * @param cellspacing  Cellspacing for the table cells.
   1.783 +     */
   1.784 +    public void table(int border, String width, int cellpadding,
   1.785 +                      int cellspacing) {
   1.786 +        println(DocletConstants.NL +
   1.787 +                "<TABLE BORDER=\"" + border +
   1.788 +                "\" WIDTH=\"" + width +
   1.789 +                "\" CELLPADDING=\"" + cellpadding +
   1.790 +                "\" CELLSPACING=\"" + cellspacing +
   1.791 +                "\" SUMMARY=\"\">");
   1.792 +    }
   1.793 +
   1.794 +    /**
   1.795 +     * Print HTML &lt;TABLE BORDER="border" CELLPADDING="cellpadding"
   1.796 +     * CELLSPACING="cellspacing"&gt; tag.
   1.797 +     *
   1.798 +     * @param border       Border size.
   1.799 +     * @param cellpadding  Cellpadding for the table cells.
   1.800 +     * @param cellspacing  Cellspacing for the table cells.
   1.801 +     */
   1.802 +    public void table(int border, int cellpadding, int cellspacing) {
   1.803 +        println(DocletConstants.NL +
   1.804 +                "<TABLE BORDER=\"" + border +
   1.805 +                "\" CELLPADDING=\"" + cellpadding +
   1.806 +                "\" CELLSPACING=\"" + cellspacing +
   1.807 +                "\" SUMMARY=\"\">");
   1.808 +    }
   1.809 +
   1.810 +    /**
   1.811 +     * Print HTML &lt;TABLE BORDER="border" WIDTH="width"&gt;
   1.812 +     *
   1.813 +     * @param border       Border size.
   1.814 +     * @param width        Width of the table.
   1.815 +     */
   1.816 +    public void table(int border, String width) {
   1.817 +        println(DocletConstants.NL +
   1.818 +                "<TABLE BORDER=\"" + border +
   1.819 +                "\" WIDTH=\"" + width +
   1.820 +                "\" SUMMARY=\"\">");
   1.821 +    }
   1.822 +
   1.823 +    /**
   1.824 +     * Print the HTML table tag with border size 0 and width 100%.
   1.825 +     */
   1.826 +    public void table() {
   1.827 +        table(0, "100%");
   1.828 +    }
   1.829 +
   1.830 +    /**
   1.831 +     * Print &lt;/TABLE&gt; tag. Add a newline character at the end.
   1.832 +     */
   1.833 +    public void tableEnd() {
   1.834 +        println("</TABLE>");
   1.835 +    }
   1.836 +
   1.837 +    /**
   1.838 +     * Print &lt;TR&gt; tag. Add a newline character at the end.
   1.839 +     */
   1.840 +    public void tr() {
   1.841 +        println("<TR>");
   1.842 +    }
   1.843 +
   1.844 +    /**
   1.845 +     * Print &lt;/TR&gt; tag. Add a newline character at the end.
   1.846 +     */
   1.847 +    public void trEnd() {
   1.848 +        println("</TR>");
   1.849 +    }
   1.850 +
   1.851 +    /**
   1.852 +     * Print &lt;TD&gt; tag.
   1.853 +     */
   1.854 +    public void td() {
   1.855 +        print("<TD>");
   1.856 +    }
   1.857 +
   1.858 +    /**
   1.859 +     * Print &lt;TD NOWRAP&gt; tag.
   1.860 +     */
   1.861 +    public void tdNowrap() {
   1.862 +        print("<TD NOWRAP>");
   1.863 +    }
   1.864 +
   1.865 +    /**
   1.866 +     * Print &lt;TD WIDTH="width"&gt; tag.
   1.867 +     *
   1.868 +     * @param width String width.
   1.869 +     */
   1.870 +    public void tdWidth(String width) {
   1.871 +        print("<TD WIDTH=\"" + width + "\">");
   1.872 +    }
   1.873 +
   1.874 +    /**
   1.875 +     * Print &lt;/TD&gt; tag. Add a newline character at the end.
   1.876 +     */
   1.877 +    public void tdEnd() {
   1.878 +        println("</TD>");
   1.879 +    }
   1.880 +
   1.881 +    /**
   1.882 +     * Print &lt;LINK str&gt; tag.
   1.883 +     *
   1.884 +     * @param str String.
   1.885 +     */
   1.886 +    public void link(String str) {
   1.887 +        println("<LINK " + str + ">");
   1.888 +    }
   1.889 +
   1.890 +    /**
   1.891 +     * Print "&lt;!-- " comment start string.
   1.892 +     */
   1.893 +    public void commentStart() {
   1.894 +         print("<!-- ");
   1.895 +    }
   1.896 +
   1.897 +    /**
   1.898 +     * Print "--&gt;" comment end string. Add a newline character at the end.
   1.899 +     */
   1.900 +    public void commentEnd() {
   1.901 +         println("-->");
   1.902 +    }
   1.903 +
   1.904 +    /**
   1.905 +     * Print &lt;TR BGCOLOR="color" CLASS="stylename"&gt; tag. Adds a newline character
   1.906 +     * at the end.
   1.907 +     *
   1.908 +     * @param color String color.
   1.909 +     * @param stylename String stylename.
   1.910 +     */
   1.911 +    public void trBgcolorStyle(String color, String stylename) {
   1.912 +        println("<TR BGCOLOR=\"" + color + "\" CLASS=\"" + stylename + "\">");
   1.913 +    }
   1.914 +
   1.915 +    /**
   1.916 +     * Print &lt;TR BGCOLOR="color"&gt; tag. Adds a newline character at the end.
   1.917 +     *
   1.918 +     * @param color String color.
   1.919 +     */
   1.920 +    public void trBgcolor(String color) {
   1.921 +        println("<TR BGCOLOR=\"" + color + "\">");
   1.922 +    }
   1.923 +
   1.924 +    /**
   1.925 +     * Print &lt;TR ALIGN="align" VALIGN="valign"&gt; tag. Adds a newline character
   1.926 +     * at the end.
   1.927 +     *
   1.928 +     * @param align String align.
   1.929 +     * @param valign String valign.
   1.930 +     */
   1.931 +    public void trAlignVAlign(String align, String valign) {
   1.932 +        println("<TR ALIGN=\"" + align + "\" VALIGN=\"" + valign + "\">");
   1.933 +    }
   1.934 +
   1.935 +    /**
   1.936 +     * Print &lt;TH ALIGN="align"&gt; tag.
   1.937 +     *
   1.938 +     * @param align the align attribute.
   1.939 +     */
   1.940 +    public void thAlign(String align) {
   1.941 +        print("<TH ALIGN=\"" + align + "\">");
   1.942 +    }
   1.943 +
   1.944 +    /**
   1.945 +     * Print &lt;TH align="align" COLSPAN=i&gt; tag.
   1.946 +     *
   1.947 +     * @param align the align attribute.
   1.948 +     * @param i integer.
   1.949 +     */
   1.950 +    public void thAlignColspan(String align, int i) {
   1.951 +        print("<TH ALIGN=\"" + align + "\" COLSPAN=\"" + i + "\">");
   1.952 +    }
   1.953 +
   1.954 +    /**
   1.955 +     * Print &lt;TH align="align" NOWRAP&gt; tag.
   1.956 +     *
   1.957 +     * @param align the align attribute.
   1.958 +     */
   1.959 +    public void thAlignNowrap(String align) {
   1.960 +        print("<TH ALIGN=\"" + align + "\" NOWRAP>");
   1.961 +    }
   1.962 +
   1.963 +    /**
   1.964 +     * Print &lt;/TH&gt; tag. Add a newline character at the end.
   1.965 +     */
   1.966 +    public void thEnd() {
   1.967 +        println("</TH>");
   1.968 +    }
   1.969 +
   1.970 +    /**
   1.971 +     * Print &lt;TD COLSPAN=i&gt; tag.
   1.972 +     *
   1.973 +     * @param i integer.
   1.974 +     */
   1.975 +    public void tdColspan(int i) {
   1.976 +        print("<TD COLSPAN=" + i + ">");
   1.977 +    }
   1.978 +
   1.979 +    /**
   1.980 +     * Print &lt;TD BGCOLOR="color" CLASS="stylename"&gt; tag.
   1.981 +     *
   1.982 +     * @param color String color.
   1.983 +     * @param stylename String stylename.
   1.984 +     */
   1.985 +    public void tdBgcolorStyle(String color, String stylename) {
   1.986 +        print("<TD BGCOLOR=\"" + color + "\" CLASS=\"" + stylename + "\">");
   1.987 +    }
   1.988 +
   1.989 +    /**
   1.990 +     * Print &lt;TD COLSPAN=i BGCOLOR="color" CLASS="stylename"&gt; tag.
   1.991 +     *
   1.992 +     * @param i integer.
   1.993 +     * @param color String color.
   1.994 +     * @param stylename String stylename.
   1.995 +     */
   1.996 +    public void tdColspanBgcolorStyle(int i, String color, String stylename) {
   1.997 +        print("<TD COLSPAN=" + i + " BGCOLOR=\"" + color + "\" CLASS=\"" +
   1.998 +              stylename + "\">");
   1.999 +    }
  1.1000 +
  1.1001 +    /**
  1.1002 +     * Print &lt;TD ALIGN="align"&gt; tag. Adds a newline character
  1.1003 +     * at the end.
  1.1004 +     *
  1.1005 +     * @param align String align.
  1.1006 +     */
  1.1007 +    public void tdAlign(String align) {
  1.1008 +        print("<TD ALIGN=\"" + align + "\">");
  1.1009 +    }
  1.1010 +
  1.1011 +    /**
  1.1012 +     * Print &lt;TD ALIGN="align" CLASS="stylename"&gt; tag.
  1.1013 +     *
  1.1014 +     * @param align        String align.
  1.1015 +     * @param stylename    String stylename.
  1.1016 +     */
  1.1017 +    public void tdVAlignClass(String align, String stylename) {
  1.1018 +        print("<TD VALIGN=\"" + align + "\" CLASS=\"" + stylename + "\">");
  1.1019 +    }
  1.1020 +
  1.1021 +    /**
  1.1022 +     * Print &lt;TD VALIGN="valign"&gt; tag.
  1.1023 +     *
  1.1024 +     * @param valign String valign.
  1.1025 +     */
  1.1026 +    public void tdVAlign(String valign) {
  1.1027 +        print("<TD VALIGN=\"" + valign + "\">");
  1.1028 +    }
  1.1029 +
  1.1030 +    /**
  1.1031 +     * Print &lt;TD ALIGN="align" VALIGN="valign"&gt; tag.
  1.1032 +     *
  1.1033 +     * @param align   String align.
  1.1034 +     * @param valign  String valign.
  1.1035 +     */
  1.1036 +    public void tdAlignVAlign(String align, String valign) {
  1.1037 +        print("<TD ALIGN=\"" + align + "\" VALIGN=\"" + valign + "\">");
  1.1038 +    }
  1.1039 +
  1.1040 +    /**
  1.1041 +     * Print &lt;TD ALIGN="align" ROWSPAN=rowspan&gt; tag.
  1.1042 +     *
  1.1043 +     * @param align    String align.
  1.1044 +     * @param rowspan  integer rowspan.
  1.1045 +     */
  1.1046 +    public void tdAlignRowspan(String align, int rowspan) {
  1.1047 +        print("<TD ALIGN=\"" + align + "\" ROWSPAN=" + rowspan + ">");
  1.1048 +    }
  1.1049 +
  1.1050 +    /**
  1.1051 +     * Print &lt;TD ALIGN="align" VALIGN="valign" ROWSPAN=rowspan&gt; tag.
  1.1052 +     *
  1.1053 +     * @param align    String align.
  1.1054 +     * @param valign  String valign.
  1.1055 +     * @param rowspan  integer rowspan.
  1.1056 +     */
  1.1057 +    public void tdAlignVAlignRowspan(String align, String valign,
  1.1058 +                                     int rowspan) {
  1.1059 +        print("<TD ALIGN=\"" + align + "\" VALIGN=\"" + valign
  1.1060 +                + "\" ROWSPAN=" + rowspan + ">");
  1.1061 +    }
  1.1062 +
  1.1063 +    /**
  1.1064 +     * Print &lt;BLOCKQUOTE&gt; tag. Add a newline character at the end.
  1.1065 +     */
  1.1066 +    public void blockquote() {
  1.1067 +        println("<BLOCKQUOTE>");
  1.1068 +    }
  1.1069 +
  1.1070 +    /**
  1.1071 +     * Print &lt;/BLOCKQUOTE&gt; tag. Add a newline character at the end.
  1.1072 +     */
  1.1073 +    public void blockquoteEnd() {
  1.1074 +        println("</BLOCKQUOTE>");
  1.1075 +    }
  1.1076 +
  1.1077 +    /**
  1.1078 +     * Get the "&lt;CODE&gt;" string.
  1.1079 +     *
  1.1080 +     * @return String Return String "&lt;CODE>";
  1.1081 +     */
  1.1082 +    public String getCode() {
  1.1083 +        return "<CODE>";
  1.1084 +    }
  1.1085 +
  1.1086 +    /**
  1.1087 +     * Get the "&lt;/CODE&gt;" string.
  1.1088 +     *
  1.1089 +     * @return String Return String "&lt;/CODE&gt;";
  1.1090 +     */
  1.1091 +    public String getCodeEnd() {
  1.1092 +        return "</CODE>";
  1.1093 +    }
  1.1094 +
  1.1095 +    /**
  1.1096 +     * Print &lt;NOFRAMES&gt; tag. Add a newline character at the end.
  1.1097 +     */
  1.1098 +    public void noFrames() {
  1.1099 +        println("<NOFRAMES>");
  1.1100 +    }
  1.1101 +
  1.1102 +    /**
  1.1103 +     * Print &lt;/NOFRAMES&gt; tag. Add a newline character at the end.
  1.1104 +     */
  1.1105 +    public void noFramesEnd() {
  1.1106 +        println("</NOFRAMES>");
  1.1107 +    }
  1.1108 +}

mercurial