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

Mon, 13 Dec 2010 13:44:47 -0800

author
bpatel
date
Mon, 13 Dec 2010 13:44:47 -0800
changeset 793
ffbf2b2a8611
parent 766
90af8d87741f
child 798
4868a36f6fd8
permissions
-rw-r--r--

7006270: Several javadoc regression tests are failing on windows
Reviewed-by: jjg

     1 /*
     2  * Copyright (c) 1997, 2009, Oracle and/or its affiliates. All rights reserved.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     4  *
     5  * This code is free software; you can redistribute it and/or modify it
     6  * under the terms of the GNU General Public License version 2 only, as
     7  * published by the Free Software Foundation.  Oracle designates this
     8  * particular file as subject to the "Classpath" exception as provided
     9  * by Oracle in the LICENSE file that accompanied this code.
    10  *
    11  * This code is distributed in the hope that it will be useful, but WITHOUT
    12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
    13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
    14  * version 2 for more details (a copy is included in the LICENSE file that
    15  * accompanied this code).
    16  *
    17  * You should have received a copy of the GNU General Public License version
    18  * 2 along with this work; if not, write to the Free Software Foundation,
    19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
    20  *
    21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
    22  * or visit www.oracle.com if you need additional information or have any
    23  * questions.
    24  */
    26 package com.sun.tools.doclets.formats.html.markup;
    28 import java.io.*;
    30 import com.sun.tools.doclets.internal.toolkit.*;
    31 import com.sun.tools.doclets.internal.toolkit.util.*;
    33 /**
    34  * Class for the Html format code generation.
    35  * Initilizes PrintWriter with FileWriter, to enable print
    36  * related methods to generate the code to the named File through FileWriter.
    37  *
    38  * @since 1.2
    39  * @author Atul M Dambalkar
    40  * @author Bhavesh Patel (Modified)
    41  */
    42 public class HtmlWriter extends PrintWriter {
    44     /**
    45      * Name of the file, to which this writer is writing to.
    46      */
    47     protected final String htmlFilename;
    49     /**
    50      * The window title of this file
    51      */
    52     protected String winTitle;
    54     /**
    55      * URL file separator string("/").
    56      */
    57     public static final String fileseparator =
    58          DirectoryManager.URL_FILE_SEPARATOR;
    60     /**
    61      * The configuration
    62      */
    63     protected Configuration configuration;
    65     /**
    66      * The flag to indicate whether a member details list is printed or not.
    67      */
    68     protected boolean memberDetailsListPrinted;
    70     /**
    71      * Header for tables displaying packages and description..
    72      */
    73     protected final String[] packageTableHeader;
    75     /**
    76      * Summary for use tables displaying class and package use.
    77      */
    78     protected final String useTableSummary;
    80     /**
    81      * Column header for class docs displaying Modifier and Type header.
    82      */
    83     protected final String modifierTypeHeader;
    85     public final Content overviewLabel;
    87     public final Content defaultPackageLabel;
    89     public final Content packageLabel;
    91     public final Content useLabel;
    93     public final Content prevLabel;
    95     public final Content nextLabel;
    97     public final Content prevclassLabel;
    99     public final Content nextclassLabel;
   101     public final Content summaryLabel;
   103     public final Content detailLabel;
   105     public final Content framesLabel;
   107     public final Content noframesLabel;
   109     public final Content treeLabel;
   111     public final Content classLabel;
   113     public final Content deprecatedLabel;
   115     public final Content deprecatedPhrase;
   117     public final Content allclassesLabel;
   119     public final Content indexLabel;
   121     public final Content helpLabel;
   123     public final Content seeLabel;
   125     public final Content descriptionLabel;
   127     public final Content prevpackageLabel;
   129     public final Content nextpackageLabel;
   131     public final Content packagesLabel;
   133     public final Content methodDetailsLabel;
   135     public final Content annotationTypeDetailsLabel;
   137     public final Content fieldDetailsLabel;
   139     public final Content constructorDetailsLabel;
   141     public final Content enumConstantsDetailsLabel;
   143     public final Content specifiedByLabel;
   145     public final Content overridesLabel;
   147     public final Content descfrmClassLabel;
   149     public final Content descfrmInterfaceLabel;
   151     /**
   152      * Constructor.
   153      *
   154      * @param path The directory path to be created for this file
   155      *             or null if none to be created.
   156      * @param filename File Name to which the PrintWriter will
   157      *                 do the Output.
   158      * @param docencoding Encoding to be used for this file.
   159      * @exception IOException Exception raised by the FileWriter is passed on
   160      * to next level.
   161      * @exception UnSupportedEncodingException Exception raised by the
   162      * OutputStreamWriter is passed on to next level.
   163      */
   164     public HtmlWriter(Configuration configuration,
   165                       String path, String filename, String docencoding)
   166                       throws IOException, UnsupportedEncodingException {
   167         super(Util.genWriter(configuration, path, filename, docencoding));
   168         this.configuration = configuration;
   169         htmlFilename = filename;
   170         this.memberDetailsListPrinted = false;
   171         packageTableHeader = new String[] {
   172             configuration.getText("doclet.Package"),
   173             configuration.getText("doclet.Description")
   174         };
   175         useTableSummary = configuration.getText("doclet.Use_Table_Summary",
   176                 configuration.getText("doclet.packages"));
   177         modifierTypeHeader = configuration.getText("doclet.0_and_1",
   178                 configuration.getText("doclet.Modifier"),
   179                 configuration.getText("doclet.Type"));
   180         overviewLabel = getResource("doclet.Overview");
   181         defaultPackageLabel = new RawHtml(
   182                 DocletConstants.DEFAULT_PACKAGE_NAME);
   183         packageLabel = getResource("doclet.Package");
   184         useLabel = getResource("doclet.navClassUse");
   185         prevLabel = getResource("doclet.Prev");
   186         nextLabel = getResource("doclet.Next");
   187         prevclassLabel = getResource("doclet.Prev_Class");
   188         nextclassLabel = getResource("doclet.Next_Class");
   189         summaryLabel = getResource("doclet.Summary");
   190         detailLabel = getResource("doclet.Detail");
   191         framesLabel = getResource("doclet.FRAMES");
   192         noframesLabel = getResource("doclet.NO_FRAMES");
   193         treeLabel = getResource("doclet.Tree");
   194         classLabel = getResource("doclet.Class");
   195         deprecatedLabel = getResource("doclet.navDeprecated");
   196         deprecatedPhrase = getResource("doclet.Deprecated");
   197         allclassesLabel = getResource("doclet.All_Classes");
   198         indexLabel = getResource("doclet.Index");
   199         helpLabel = getResource("doclet.Help");
   200         seeLabel = getResource("doclet.See");
   201         descriptionLabel = getResource("doclet.Description");
   202         prevpackageLabel = getResource("doclet.Prev_Package");
   203         nextpackageLabel = getResource("doclet.Next_Package");
   204         packagesLabel = getResource("doclet.Packages");
   205         methodDetailsLabel = getResource("doclet.Method_Detail");
   206         annotationTypeDetailsLabel = getResource("doclet.Annotation_Type_Member_Detail");
   207         fieldDetailsLabel = getResource("doclet.Field_Detail");
   208         constructorDetailsLabel = getResource("doclet.Constructor_Detail");
   209         enumConstantsDetailsLabel = getResource("doclet.Enum_Constant_Detail");
   210         specifiedByLabel = getResource("doclet.Specified_By");
   211         overridesLabel = getResource("doclet.Overrides");
   212         descfrmClassLabel = getResource("doclet.Description_From_Class");
   213         descfrmInterfaceLabel = getResource("doclet.Description_From_Interface");
   214     }
   216     /**
   217      * Get the configuration string as a content.
   218      *
   219      * @param key the key to look for in the configuration file
   220      * @return a content tree for the text
   221      */
   222     public Content getResource(String key) {
   223         return new StringContent(configuration.getText(key));
   224     }
   226     /**
   227      * Get the configuration string as a content.
   228      *
   229      * @param key the key to look for in the configuration file
   230      * @param a1 string argument added to configuration text
   231      * @return a content tree for the text
   232      */
   233     public Content getResource(String key, String a1) {
   234         return new RawHtml(configuration.getText(key, a1));
   235     }
   237     /**
   238      * Get the configuration string as a content.
   239      *
   240      * @param key the key to look for in the configuration file
   241      * @param a1 string argument added to configuration text
   242      * @param a2 string argument added to configuration text
   243      * @return a content tree for the text
   244      */
   245     public Content getResource(String key, String a1, String a2) {
   246         return new RawHtml(configuration.getText(key, a1, a2));
   247     }
   249     /**
   250      * Print <HTML> tag. Add a newline character at the end.
   251      */
   252     public void html() {
   253         println("<HTML lang=\"" + configuration.getLocale().getLanguage() + "\">");
   254     }
   256     /**
   257      * Print &lt;/HTML&gt; tag. Add a newline character at the end.
   258      */
   259     public void htmlEnd() {
   260         println("</HTML>");
   261     }
   263     /**
   264      * Print the script code to be embeded before the  &lt;/HEAD&gt; tag.
   265      */
   266     protected void printWinTitleScript(String winTitle){
   267         if(winTitle != null && winTitle.length() > 0) {
   268             script();
   269             println("function windowTitle()");
   270             println("{");
   271             println("    if (location.href.indexOf('is-external=true') == -1) {");
   272             println("        parent.document.title=\"" + winTitle + "\";");
   273             println("    }");
   274             println("}");
   275             scriptEnd();
   276             noScript();
   277             noScriptEnd();
   278         }
   279     }
   281     /**
   282      * Returns an HtmlTree for the SCRIPT tag.
   283      *
   284      * @return an HtmlTree for the SCRIPT tag
   285      */
   286     protected HtmlTree getWinTitleScript(){
   287         HtmlTree script = new HtmlTree(HtmlTag.SCRIPT);
   288         if(winTitle != null && winTitle.length() > 0) {
   289             script.addAttr(HtmlAttr.TYPE, "text/javascript");
   290             String scriptCode = "<!--" + DocletConstants.NL +
   291                     "    if (location.href.indexOf('is-external=true') == -1) {" + DocletConstants.NL +
   292                     "        parent.document.title=\"" + winTitle + "\";" + DocletConstants.NL +
   293                     "    }" + DocletConstants.NL +
   294                     "//-->" + DocletConstants.NL;
   295             RawHtml scriptContent = new RawHtml(scriptCode);
   296             script.addContent(scriptContent);
   297         }
   298         return script;
   299     }
   301     /**
   302      * Returns a content tree for the SCRIPT tag for the main page(index.html).
   303      *
   304      * @return a content for the SCRIPT tag
   305      */
   306     protected Content getFramesetJavaScript(){
   307         HtmlTree script = new HtmlTree(HtmlTag.SCRIPT);
   308         script.addAttr(HtmlAttr.TYPE, "text/javascript");
   309         String scriptCode = DocletConstants.NL + "    targetPage = \"\" + window.location.search;" + DocletConstants.NL +
   310                 "    if (targetPage != \"\" && targetPage != \"undefined\")" + DocletConstants.NL +
   311                 "        targetPage = targetPage.substring(1);" + DocletConstants.NL +
   312                 "    if (targetPage.indexOf(\":\") != -1)" + DocletConstants.NL +
   313                 "        targetPage = \"undefined\";" + DocletConstants.NL +
   314                 "    function loadFrames() {" + DocletConstants.NL +
   315                 "        if (targetPage != \"\" && targetPage != \"undefined\")" + DocletConstants.NL +
   316                 "             top.classFrame.location = top.targetPage;" + DocletConstants.NL +
   317                 "    }" + DocletConstants.NL;
   318         RawHtml scriptContent = new RawHtml(scriptCode);
   319         script.addContent(scriptContent);
   320         return script;
   321     }
   323     /**
   324      * Print the Javascript &lt;SCRIPT&gt; start tag with its type
   325      * attribute.
   326      */
   327     public void script() {
   328         println("<SCRIPT type=\"text/javascript\">");
   329     }
   331     /**
   332      * Print the Javascript &lt;/SCRIPT&gt; end tag.
   333      */
   334     public void scriptEnd() {
   335         println("</SCRIPT>");
   336     }
   338     /**
   339      * Print the Javascript &lt;NOSCRIPT&gt; start tag.
   340      */
   341     public void noScript() {
   342         println("<NOSCRIPT>");
   343     }
   345     /**
   346      * Print the Javascript &lt;/NOSCRIPT&gt; end tag.
   347      */
   348     public void noScriptEnd() {
   349         println("</NOSCRIPT>");
   350     }
   352     /**
   353      * Return the Javascript call to be embedded in the &lt;BODY&gt; tag.
   354      * Return nothing if winTitle is empty.
   355      * @return the Javascript call to be embedded in the &lt;BODY&gt; tag.
   356      */
   357     protected String getWindowTitleOnload(){
   358         if(winTitle != null && winTitle.length() > 0) {
   359             return " onload=\"windowTitle();\"";
   360         } else {
   361             return "";
   362         }
   363     }
   365     /**
   366      * Print &lt;BODY BGCOLOR="bgcolor"&gt;, including JavaScript
   367      * "onload" call to load windowtitle script.  This script shows the name
   368      * of the document in the window title bar when frames are on.
   369      *
   370      * @param bgcolor Background color.
   371      * @param includeScript  boolean set true if printing windowtitle script
   372      */
   373     public void body(String bgcolor, boolean includeScript) {
   374         print("<BODY BGCOLOR=\"" + bgcolor + "\"");
   375         if (includeScript) {
   376             print(getWindowTitleOnload());
   377         }
   378         println(">");
   379     }
   381     /**
   382      * Returns an HtmlTree for the BODY tag.
   383      *
   384      * @param includeScript  set true if printing windowtitle script
   385      * @param title title for the window
   386      * @return an HtmlTree for the BODY tag
   387      */
   388     public HtmlTree getBody(boolean includeScript, String title) {
   389         HtmlTree body = new HtmlTree(HtmlTag.BODY);
   390         // Set window title string which is later printed
   391         this.winTitle = title;
   392         // Don't print windowtitle script for overview-frame, allclasses-frame
   393         // and package-frame
   394         if (includeScript) {
   395             body.addContent(getWinTitleScript());
   396             Content noScript = HtmlTree.NOSCRIPT(
   397                     HtmlTree.DIV(getResource("doclet.No_Script_Message")));
   398             body.addContent(noScript);
   399         }
   400         return body;
   401     }
   403     /**
   404      * Print &lt;/BODY&gt; tag. Add a newline character at the end.
   405      */
   406     public void bodyEnd() {
   407         println("</BODY>");
   408     }
   410     /**
   411      * Print &lt;TITLE&gt; tag. Add a newline character at the end.
   412      */
   413     public void title() {
   414         println("<TITLE>");
   415     }
   417     /**
   418      * Print &lt;TITLE&gt; tag. Add a newline character at the end.
   419      *
   420      * @param winTitle The title of this document.
   421      */
   422     public void title(String winTitle) {
   423         // Set window title string which is later printed
   424         this.winTitle = winTitle;
   425         title();
   426     }
   428     /**
   429      * Returns an HtmlTree for the TITLE tag.
   430      *
   431      * @return an HtmlTree for the TITLE tag
   432      */
   433     public HtmlTree getTitle() {
   434         HtmlTree title = HtmlTree.TITLE(new StringContent(winTitle));
   435         return title;
   436     }
   438     /**
   439      * Print &lt;/TITLE&gt; tag. Add a newline character at the end.
   440      */
   441     public void titleEnd() {
   442         println("</TITLE>");
   443     }
   445     /**
   446      * Print &lt;UL&gt; tag. Add a newline character at the end.
   447      */
   448     public void ul() {
   449         println("<UL>");
   450     }
   452     /**
   453      * Print &lt;/UL&gt; tag. Add a newline character at the end.
   454      */
   455     public void ulEnd() {
   456         println("</UL>");
   457     }
   459     /**
   460      * Print &lt;LI&gt; tag.
   461      */
   462     public void li() {
   463         print("<LI>");
   464     }
   466     /**
   467      * Print &lt;LI TYPE="type"&gt; tag.
   468      *
   469      * @param type Type string.
   470      */
   471     public void li(String type) {
   472         print("<LI TYPE=\"" + type + "\">");
   473     }
   475     /**
   476      * Print &lt;H1&gt; tag. Add a newline character at the end.
   477      */
   478     public void h1() {
   479         println("<H1>");
   480     }
   482     /**
   483      * Print &lt;/H1&gt; tag. Add a newline character at the end.
   484      */
   485     public void h1End() {
   486         println("</H1>");
   487     }
   489     /**
   490      * Print text with &lt;H1&gt; tag. Also adds &lt;/H1&gt; tag. Add a newline character
   491      * at the end of the text.
   492      *
   493      * @param text Text to be printed with &lt;H1&gt; format.
   494      */
   495     public void h1(String text) {
   496         h1();
   497         println(text);
   498         h1End();
   499     }
   501     /**
   502      * Print &lt;H2&gt; tag. Add a newline character at the end.
   503      */
   504     public void h2() {
   505         println("<H2>");
   506     }
   508     /**
   509      * Print text with &lt;H2&gt; tag. Also adds &lt;/H2&gt; tag. Add a newline character
   510      *  at the end of the text.
   511      *
   512      * @param text Text to be printed with &lt;H2&gt; format.
   513      */
   514     public void h2(String text) {
   515         h2();
   516         println(text);
   517         h2End();
   518     }
   520     /**
   521      * Print &lt;/H2&gt; tag. Add a newline character at the end.
   522      */
   523     public void h2End() {
   524         println("</H2>");
   525     }
   527     /**
   528      * Print &lt;H3&gt; tag. Add a newline character at the end.
   529      */
   530     public void h3() {
   531         println("<H3>");
   532     }
   534     /**
   535      * Print text with &lt;H3&gt; tag. Also adds &lt;/H3&gt; tag. Add a newline character
   536      *  at the end of the text.
   537      *
   538      * @param text Text to be printed with &lt;H3&gt; format.
   539      */
   540     public void h3(String text) {
   541         h3();
   542         println(text);
   543         h3End();
   544     }
   546     /**
   547      * Print &lt;/H3&gt; tag. Add a newline character at the end.
   548      */
   549     public void h3End() {
   550         println("</H3>");
   551     }
   553     /**
   554      * Print &lt;H4&gt; tag. Add a newline character at the end.
   555      */
   556     public void h4() {
   557         println("<H4>");
   558     }
   560     /**
   561      * Print &lt;/H4&gt; tag. Add a newline character at the end.
   562      */
   563     public void h4End() {
   564         println("</H4>");
   565     }
   567     /**
   568      * Print text with &lt;H4&gt; tag. Also adds &lt;/H4&gt; tag. Add a newline character
   569      * at the end of the text.
   570      *
   571      * @param text Text to be printed with &lt;H4&gt; format.
   572      */
   573     public void h4(String text) {
   574         h4();
   575         println(text);
   576         h4End();
   577     }
   579     /**
   580      * Print &lt;H5&gt; tag. Add a newline character at the end.
   581      */
   582     public void h5() {
   583         println("<H5>");
   584     }
   586     /**
   587      * Print &lt;/H5&gt; tag. Add a newline character at the end.
   588      */
   589     public void h5End() {
   590         println("</H5>");
   591     }
   593     /**
   594      * Print HTML &lt;IMG SRC="imggif" WIDTH="width" HEIGHT="height" ALT="imgname&gt;
   595      * tag. It prepends the "images" directory name to the "imggif". This
   596      * method is used for oneone format generation. Add a newline character
   597      * at the end.
   598      *
   599      * @param imggif   Image GIF file.
   600      * @param imgname  Image name.
   601      * @param width    Width of the image.
   602      * @param height   Height of the image.
   603      */
   604     public void img(String imggif, String imgname, int width, int height) {
   605         println("<IMG SRC=\"images/" + imggif + ".gif\""
   606               + " WIDTH=\"" + width + "\" HEIGHT=\"" + height
   607               + "\" ALT=\"" + imgname + "\">");
   608     }
   610     /**
   611      * Print &lt;MENU&gt; tag. Add a newline character at the end.
   612      */
   613     public void menu() {
   614         println("<MENU>");
   615     }
   617     /**
   618      * Print &lt;/MENU&gt; tag. Add a newline character at the end.
   619      */
   620     public void menuEnd() {
   621         println("</MENU>");
   622     }
   624     /**
   625      * Print &lt;PRE&gt; tag. Add a newline character at the end.
   626      */
   627     public void pre() {
   628         println("<PRE>");
   629     }
   631     /**
   632      * Print &lt;PRE&gt; tag without adding new line character at th eend.
   633      */
   634     public void preNoNewLine() {
   635         print("<PRE>");
   636     }
   638     /**
   639      * Print &lt;/PRE&gt; tag. Add a newline character at the end.
   640      */
   641     public void preEnd() {
   642         println("</PRE>");
   643     }
   645     /**
   646      * Print &lt;HR&gt; tag. Add a newline character at the end.
   647      */
   648     public void hr() {
   649         println("<HR>");
   650     }
   652     /**
   653      * Print &lt;HR SIZE="size" WIDTH="widthpercent%"&gt; tag. Add a newline
   654      * character at the end.
   655      *
   656      * @param size           Size of the ruler.
   657      * @param widthPercent   Percentage Width of the ruler
   658      */
   659     public void hr(int size, int widthPercent) {
   660         println("<HR SIZE=\"" + size + "\" WIDTH=\"" + widthPercent + "%\">");
   661     }
   663     /**
   664      * Print &lt;HR SIZE="size" NOSHADE&gt; tag. Add a newline character at the end.
   665      *
   666      * @param size           Size of the ruler.
   667      * @param noshade        noshade string.
   668      */
   669     public void hr(int size, String noshade) {
   670         println("<HR SIZE=\"" + size + "\" NOSHADE>");
   671     }
   673     /**
   674      * Get the "&lt;STRONG&gt;" string.
   675      *
   676      * @return String Return String "&lt;STRONG&gt;";
   677      */
   678     public String getStrong() {
   679         return "<STRONG>";
   680     }
   682     /**
   683      * Get the "&lt;/STRONG&gt;" string.
   684      *
   685      * @return String Return String "&lt;/STRONG&gt;";
   686      */
   687     public String getStrongEnd() {
   688         return "</STRONG>";
   689     }
   691     /**
   692      * Print &lt;STRONG&gt; tag.
   693      */
   694     public void strong() {
   695         print("<STRONG>");
   696     }
   698     /**
   699      * Print &lt;/STRONG&gt; tag.
   700      */
   701     public void strongEnd() {
   702         print("</STRONG>");
   703     }
   705     /**
   706      * Print text passed, in strong format using &lt;STRONG&gt; and &lt;/STRONG&gt; tags.
   707      *
   708      * @param text String to be printed in between &lt;STRONG&gt; and &lt;/STRONG&gt; tags.
   709      */
   710     public void strong(String text) {
   711         strong();
   712         print(text);
   713         strongEnd();
   714     }
   716     /**
   717      * Print text passed, in Italics using &lt;I&gt; and &lt;/I&gt; tags.
   718      *
   719      * @param text String to be printed in between &lt;I&gt; and &lt;/I&gt; tags.
   720      */
   721     public void italics(String text) {
   722         print("<I>");
   723         print(text);
   724         println("</I>");
   725     }
   727     /**
   728      * Return, text passed, with Italics &lt;i&gt; and &lt;/i&gt; tags, surrounding it.
   729      * So if the text passed is "Hi", then string returned will be "&lt;i&gt;Hi&lt;/i&gt;".
   730      *
   731      * @param text String to be printed in between &lt;I&gt; and &lt;/I&gt; tags.
   732      */
   733     public String italicsText(String text) {
   734         return "<i>" + text + "</i>";
   735     }
   737     public String codeText(String text) {
   738         return "<code>" + text + "</code>";
   739     }
   741     /**
   742      * Print "&#38;nbsp;", non-breaking space.
   743      */
   744     public void space() {
   745         print("&nbsp;");
   746     }
   748     /**
   749      * Return "&#38;nbsp;", non-breaking space.
   750      */
   751     public Content getSpace() {
   752         return RawHtml.nbsp;
   753     }
   755     /**
   756      * Print &lt;DL&gt; tag. Add a newline character at the end.
   757      */
   758     public void dl() {
   759         println("<DL>");
   760     }
   762     /**
   763      * Print &lt;/DL&gt; tag. Add a newline character at the end.
   764      */
   765     public void dlEnd() {
   766         println("</DL>");
   767     }
   769     /**
   770      * Print &lt;DT&gt; tag.
   771      */
   772     public void dt() {
   773         print("<DT>");
   774     }
   776     /**
   777      * Print &lt;/DT&gt; tag.
   778      */
   779     public void dtEnd() {
   780         print("</DT>");
   781     }
   783     /**
   784      * Print &lt;DD&gt; tag.
   785      */
   786     public void dd() {
   787         print("<DD>");
   788     }
   790     /**
   791      * Print &lt;/DD&gt; tag. Add a newline character at the end.
   792      */
   793     public void ddEnd() {
   794         println("</DD>");
   795     }
   797     /**
   798      * Print &lt;SUP&gt; tag. Add a newline character at the end.
   799      */
   800     public void sup() {
   801         println("<SUP>");
   802     }
   804     /**
   805      * Print &lt;/SUP&gt; tag. Add a newline character at the end.
   806      */
   807     public void supEnd() {
   808         println("</SUP>");
   809     }
   811     /**
   812      * Print &lt;FONT SIZE="size"&gt; tag. Add a newline character at the end.
   813      *
   814      * @param size String size.
   815      */
   816     public void font(String size) {
   817         println("<FONT SIZE=\"" + size + "\">");
   818     }
   820     /**
   821      * Print &lt;FONT SIZE="size"&gt; tag.
   822      *
   823      * @param size String size.
   824      */
   825     public void fontNoNewLine(String size) {
   826         print("<FONT SIZE=\"" + size + "\">");
   827     }
   829     /**
   830      * Print &lt;FONT CLASS="stylename"&gt; tag. Add a newline character at the end.
   831      *
   832      * @param stylename String stylename.
   833      */
   834     public void fontStyle(String stylename) {
   835         print("<FONT CLASS=\"" + stylename + "\">");
   836     }
   838     /**
   839      * Print &lt;FONT SIZE="size" CLASS="stylename"&gt; tag. Add a newline character
   840      * at the end.
   841      *
   842      * @param size String size.
   843      * @param stylename String stylename.
   844      */
   845     public void fontSizeStyle(String size, String stylename) {
   846         println("<FONT size=\"" + size + "\" CLASS=\"" + stylename + "\">");
   847     }
   849     /**
   850      * Print &lt;/FONT&gt; tag.
   851      */
   852     public void fontEnd() {
   853         print("</FONT>");
   854     }
   856     /**
   857      * Get the "&lt;FONT COLOR="color"&gt;" string.
   858      *
   859      * @param color String color.
   860      * @return String Return String "&lt;FONT COLOR="color"&gt;".
   861      */
   862     public String getFontColor(String color) {
   863         return "<FONT COLOR=\"" + color + "\">";
   864     }
   866     /**
   867      * Get the "&lt;/FONT&gt;" string.
   868      *
   869      * @return String Return String "&lt;/FONT&gt;";
   870      */
   871     public String getFontEnd() {
   872         return "</FONT>";
   873     }
   875     /**
   876      * Print &lt;CENTER&gt; tag. Add a newline character at the end.
   877      */
   878     public void center() {
   879         println("<CENTER>");
   880     }
   882     /**
   883      * Print &lt;/CENTER&gt; tag. Add a newline character at the end.
   884      */
   885     public void centerEnd() {
   886         println("</CENTER>");
   887     }
   889     /**
   890      * Print anchor &lt;A NAME="name"&gt; tag.
   891      *
   892      * @param name Name String.
   893      */
   894     public void aName(String name) {
   895         print("<A NAME=\"" + name + "\">");
   896     }
   898     /**
   899      * Print &lt;/A&gt; tag.
   900      */
   901     public void aEnd() {
   902         print("</A>");
   903     }
   905     /**
   906      * Print &lt;I&gt; tag.
   907      */
   908     public void italic() {
   909         print("<I>");
   910     }
   912     /**
   913      * Print &lt;/I&gt; tag.
   914      */
   915     public void italicEnd() {
   916         print("</I>");
   917     }
   919     /**
   920      * Print contents within anchor &lt;A NAME="name"&gt; tags.
   921      *
   922      * @param name String name.
   923      * @param content String contents.
   924      */
   925     public void anchor(String name, String content) {
   926         aName(name);
   927         print(content);
   928         aEnd();
   929     }
   931     /**
   932      * Print anchor &lt;A NAME="name"&gt; and &lt;/A&gt;tags. Print comment string
   933      * "&lt;!-- --&gt;" within those tags.
   934      *
   935      * @param name String name.
   936      */
   937     public void anchor(String name) {
   938         anchor(name, "<!-- -->");
   939     }
   941     /**
   942      * Print newline and then print &lt;P&gt; tag. Add a newline character at the
   943      * end.
   944      */
   945     public void p() {
   946         println();
   947         println("<P>");
   948     }
   950     /**
   951      * Print newline and then print &lt;/P&gt; tag. Add a newline character at the
   952      * end.
   953      */
   954     public void pEnd() {
   955         println();
   956         println("</P>");
   957     }
   959     /**
   960      * Print newline and then print &lt;BR&gt; tag. Add a newline character at the
   961      * end.
   962      */
   963     public void br() {
   964         println();
   965         println("<BR>");
   966     }
   968     /**
   969      * Print &lt;ADDRESS&gt; tag. Add a newline character at the end.
   970      */
   971     public void address() {
   972         println("<ADDRESS>");
   973     }
   975     /**
   976      * Print &lt;/ADDRESS&gt; tag. Add a newline character at the end.
   977      */
   978     public void addressEnd() {
   979         println("</ADDRESS>");
   980     }
   982     /**
   983      * Print &lt;HEAD&gt; tag. Add a newline character at the end.
   984      */
   985     public void head() {
   986         println("<HEAD>");
   987     }
   989     /**
   990      * Print &lt;/HEAD&gt; tag. Add a newline character at the end.
   991      */
   992     public void headEnd() {
   993         println("</HEAD>");
   994     }
   996     /**
   997      * Print &lt;CODE&gt; tag.
   998      */
   999     public void code() {
  1000         print("<CODE>");
  1003     /**
  1004      * Print &lt;/CODE&gt; tag.
  1005      */
  1006     public void codeEnd() {
  1007         print("</CODE>");
  1010     /**
  1011      * Print &lt;EM&gt; tag. Add a newline character at the end.
  1012      */
  1013     public void em() {
  1014         println("<EM>");
  1017     /**
  1018      * Print &lt;/EM&gt; tag. Add a newline character at the end.
  1019      */
  1020     public void emEnd() {
  1021         println("</EM>");
  1024     /**
  1025      * Print HTML &lt;TABLE BORDER="border" WIDTH="width"
  1026      * CELLPADDING="cellpadding" CELLSPACING="cellspacing"&gt; tag.
  1028      * @param border       Border size.
  1029      * @param width        Width of the table.
  1030      * @param cellpadding  Cellpadding for the table cells.
  1031      * @param cellspacing  Cellspacing for the table cells.
  1032      */
  1033     public void table(int border, String width, int cellpadding,
  1034                       int cellspacing) {
  1035         println(DocletConstants.NL +
  1036                 "<TABLE BORDER=\"" + border +
  1037                 "\" WIDTH=\"" + width +
  1038                 "\" CELLPADDING=\"" + cellpadding +
  1039                 "\" CELLSPACING=\"" + cellspacing +
  1040                 "\" SUMMARY=\"\">");
  1043     /**
  1044      * Print HTML &lt;TABLE BORDER="border" WIDTH="width"
  1045      * CELLPADDING="cellpadding" CELLSPACING="cellspacing" SUMMARY="summary"&gt; tag.
  1047      * @param border       Border size.
  1048      * @param width        Width of the table.
  1049      * @param cellpadding  Cellpadding for the table cells.
  1050      * @param cellspacing  Cellspacing for the table cells.
  1051      * @param summary      Table summary.
  1052      */
  1053     public void table(int border, String width, int cellpadding,
  1054                       int cellspacing, String summary) {
  1055         println(DocletConstants.NL +
  1056                 "<TABLE BORDER=\"" + border +
  1057                 "\" WIDTH=\"" + width +
  1058                 "\" CELLPADDING=\"" + cellpadding +
  1059                 "\" CELLSPACING=\"" + cellspacing +
  1060                 "\" SUMMARY=\"" + summary + "\">");
  1063     /**
  1064      * Print HTML &lt;TABLE BORDER="border" CELLPADDING="cellpadding"
  1065      * CELLSPACING="cellspacing"&gt; tag.
  1067      * @param border       Border size.
  1068      * @param cellpadding  Cellpadding for the table cells.
  1069      * @param cellspacing  Cellspacing for the table cells.
  1070      */
  1071     public void table(int border, int cellpadding, int cellspacing) {
  1072         println(DocletConstants.NL +
  1073                 "<TABLE BORDER=\"" + border +
  1074                 "\" CELLPADDING=\"" + cellpadding +
  1075                 "\" CELLSPACING=\"" + cellspacing +
  1076                 "\" SUMMARY=\"\">");
  1079     /**
  1080      * Print HTML &lt;TABLE BORDER="border" CELLPADDING="cellpadding"
  1081      * CELLSPACING="cellspacing" SUMMARY="summary"&gt; tag.
  1083      * @param border       Border size.
  1084      * @param cellpadding  Cellpadding for the table cells.
  1085      * @param cellspacing  Cellspacing for the table cells.
  1086      * @param summary      Table summary.
  1087      */
  1088     public void table(int border, int cellpadding, int cellspacing, String summary) {
  1089         println(DocletConstants.NL +
  1090                 "<TABLE BORDER=\"" + border +
  1091                 "\" CELLPADDING=\"" + cellpadding +
  1092                 "\" CELLSPACING=\"" + cellspacing +
  1093                 "\" SUMMARY=\"" + summary + "\">");
  1096     /**
  1097      * Print HTML &lt;TABLE BORDER="border" WIDTH="width"&gt;
  1099      * @param border       Border size.
  1100      * @param width        Width of the table.
  1101      */
  1102     public void table(int border, String width) {
  1103         println(DocletConstants.NL +
  1104                 "<TABLE BORDER=\"" + border +
  1105                 "\" WIDTH=\"" + width +
  1106                 "\" SUMMARY=\"\">");
  1109     /**
  1110      * Print the HTML table tag with border size 0 and width 100%.
  1111      */
  1112     public void table() {
  1113         table(0, "100%");
  1116     /**
  1117      * Print &lt;/TABLE&gt; tag. Add a newline character at the end.
  1118      */
  1119     public void tableEnd() {
  1120         println("</TABLE>");
  1123     /**
  1124      * Print &lt;TR&gt; tag. Add a newline character at the end.
  1125      */
  1126     public void tr() {
  1127         println("<TR>");
  1130     /**
  1131      * Print &lt;/TR&gt; tag. Add a newline character at the end.
  1132      */
  1133     public void trEnd() {
  1134         println("</TR>");
  1137     /**
  1138      * Print &lt;TD&gt; tag.
  1139      */
  1140     public void td() {
  1141         print("<TD>");
  1144     /**
  1145      * Print &lt;TD NOWRAP&gt; tag.
  1146      */
  1147     public void tdNowrap() {
  1148         print("<TD NOWRAP>");
  1151     /**
  1152      * Print &lt;TD WIDTH="width"&gt; tag.
  1154      * @param width String width.
  1155      */
  1156     public void tdWidth(String width) {
  1157         print("<TD WIDTH=\"" + width + "\">");
  1160     /**
  1161      * Print &lt;/TD&gt; tag. Add a newline character at the end.
  1162      */
  1163     public void tdEnd() {
  1164         println("</TD>");
  1167     /**
  1168      * Print &lt;LINK str&gt; tag.
  1170      * @param str String.
  1171      */
  1172     public void link(String str) {
  1173         println("<LINK " + str + ">");
  1176     /**
  1177      * Print "&lt;!-- " comment start string.
  1178      */
  1179     public void commentStart() {
  1180          print("<!-- ");
  1183     /**
  1184      * Print "--&gt;" comment end string. Add a newline character at the end.
  1185      */
  1186     public void commentEnd() {
  1187          println("-->");
  1190     /**
  1191      * Print &lt;CAPTION CLASS="stylename"&gt; tag. Adds a newline character
  1192      * at the end.
  1194      * @param stylename style to be applied.
  1195      */
  1196     public void captionStyle(String stylename) {
  1197         println("<CAPTION CLASS=\"" + stylename + "\">");
  1200     /**
  1201      * Print &lt;/CAPTION&gt; tag. Add a newline character at the end.
  1202      */
  1203     public void captionEnd() {
  1204         println("</CAPTION>");
  1207     /**
  1208      * Print &lt;TR BGCOLOR="color" CLASS="stylename"&gt; tag. Adds a newline character
  1209      * at the end.
  1211      * @param color String color.
  1212      * @param stylename String stylename.
  1213      */
  1214     public void trBgcolorStyle(String color, String stylename) {
  1215         println("<TR BGCOLOR=\"" + color + "\" CLASS=\"" + stylename + "\">");
  1218     /**
  1219      * Print &lt;TR BGCOLOR="color"&gt; tag. Adds a newline character at the end.
  1221      * @param color String color.
  1222      */
  1223     public void trBgcolor(String color) {
  1224         println("<TR BGCOLOR=\"" + color + "\">");
  1227     /**
  1228      * Print &lt;TR ALIGN="align" VALIGN="valign"&gt; tag. Adds a newline character
  1229      * at the end.
  1231      * @param align String align.
  1232      * @param valign String valign.
  1233      */
  1234     public void trAlignVAlign(String align, String valign) {
  1235         println("<TR ALIGN=\"" + align + "\" VALIGN=\"" + valign + "\">");
  1238     /**
  1239      * Print &lt;TH ALIGN="align"&gt; tag.
  1241      * @param align the align attribute.
  1242      */
  1243     public void thAlign(String align) {
  1244         print("<TH ALIGN=\"" + align + "\">");
  1247     /**
  1248      * Print &lt;TH CLASS="stylename" SCOPE="scope" NOWRAP&gt; tag.
  1250      * @param stylename style to be applied.
  1251      * @param scope the scope attribute.
  1252      */
  1253     public void thScopeNoWrap(String stylename, String scope) {
  1254         print("<TH CLASS=\"" + stylename + "\" SCOPE=\"" + scope + "\" NOWRAP>");
  1257     /*
  1258      * Returns a header for Modifier and Type column of a table.
  1259      */
  1260     public String getModifierTypeHeader() {
  1261         return modifierTypeHeader;
  1264     /**
  1265      * Print &lt;TH align="align" COLSPAN=i&gt; tag.
  1267      * @param align the align attribute.
  1268      * @param i integer.
  1269      */
  1270     public void thAlignColspan(String align, int i) {
  1271         print("<TH ALIGN=\"" + align + "\" COLSPAN=\"" + i + "\">");
  1274     /**
  1275      * Print &lt;TH align="align" NOWRAP&gt; tag.
  1277      * @param align the align attribute.
  1278      */
  1279     public void thAlignNowrap(String align) {
  1280         print("<TH ALIGN=\"" + align + "\" NOWRAP>");
  1283     /**
  1284      * Print &lt;/TH&gt; tag. Add a newline character at the end.
  1285      */
  1286     public void thEnd() {
  1287         println("</TH>");
  1290     /**
  1291      * Print &lt;TD COLSPAN=i&gt; tag.
  1293      * @param i integer.
  1294      */
  1295     public void tdColspan(int i) {
  1296         print("<TD COLSPAN=" + i + ">");
  1299     /**
  1300      * Print &lt;TD BGCOLOR="color" CLASS="stylename"&gt; tag.
  1302      * @param color String color.
  1303      * @param stylename String stylename.
  1304      */
  1305     public void tdBgcolorStyle(String color, String stylename) {
  1306         print("<TD BGCOLOR=\"" + color + "\" CLASS=\"" + stylename + "\">");
  1309     /**
  1310      * Print &lt;TD COLSPAN=i BGCOLOR="color" CLASS="stylename"&gt; tag.
  1312      * @param i integer.
  1313      * @param color String color.
  1314      * @param stylename String stylename.
  1315      */
  1316     public void tdColspanBgcolorStyle(int i, String color, String stylename) {
  1317         print("<TD COLSPAN=" + i + " BGCOLOR=\"" + color + "\" CLASS=\"" +
  1318               stylename + "\">");
  1321     /**
  1322      * Print &lt;TD ALIGN="align"&gt; tag. Adds a newline character
  1323      * at the end.
  1325      * @param align String align.
  1326      */
  1327     public void tdAlign(String align) {
  1328         print("<TD ALIGN=\"" + align + "\">");
  1331     /**
  1332      * Print &lt;TD ALIGN="align" CLASS="stylename"&gt; tag.
  1334      * @param align        String align.
  1335      * @param stylename    String stylename.
  1336      */
  1337     public void tdVAlignClass(String align, String stylename) {
  1338         print("<TD VALIGN=\"" + align + "\" CLASS=\"" + stylename + "\">");
  1341     /**
  1342      * Print &lt;TD VALIGN="valign"&gt; tag.
  1344      * @param valign String valign.
  1345      */
  1346     public void tdVAlign(String valign) {
  1347         print("<TD VALIGN=\"" + valign + "\">");
  1350     /**
  1351      * Print &lt;TD ALIGN="align" VALIGN="valign"&gt; tag.
  1353      * @param align   String align.
  1354      * @param valign  String valign.
  1355      */
  1356     public void tdAlignVAlign(String align, String valign) {
  1357         print("<TD ALIGN=\"" + align + "\" VALIGN=\"" + valign + "\">");
  1360     /**
  1361      * Print &lt;TD ALIGN="align" ROWSPAN=rowspan&gt; tag.
  1363      * @param align    String align.
  1364      * @param rowspan  integer rowspan.
  1365      */
  1366     public void tdAlignRowspan(String align, int rowspan) {
  1367         print("<TD ALIGN=\"" + align + "\" ROWSPAN=" + rowspan + ">");
  1370     /**
  1371      * Print &lt;TD ALIGN="align" VALIGN="valign" ROWSPAN=rowspan&gt; tag.
  1373      * @param align    String align.
  1374      * @param valign  String valign.
  1375      * @param rowspan  integer rowspan.
  1376      */
  1377     public void tdAlignVAlignRowspan(String align, String valign,
  1378                                      int rowspan) {
  1379         print("<TD ALIGN=\"" + align + "\" VALIGN=\"" + valign
  1380                 + "\" ROWSPAN=" + rowspan + ">");
  1383     /**
  1384      * Print &lt;BLOCKQUOTE&gt; tag. Add a newline character at the end.
  1385      */
  1386     public void blockquote() {
  1387         println("<BLOCKQUOTE>");
  1390     /**
  1391      * Print &lt;/BLOCKQUOTE&gt; tag. Add a newline character at the end.
  1392      */
  1393     public void blockquoteEnd() {
  1394         println("</BLOCKQUOTE>");
  1397     /**
  1398      * Get the "&lt;code&gt;" string.
  1400      * @return String Return String "&lt;code&gt;";
  1401      */
  1402     public String getCode() {
  1403         return "<code>";
  1406     /**
  1407      * Get the "&lt;/code&gt;" string.
  1409      * @return String Return String "&lt;/code&gt;";
  1410      */
  1411     public String getCodeEnd() {
  1412         return "</code>";
  1415     /**
  1416      * Print &lt;NOFRAMES&gt; tag. Add a newline character at the end.
  1417      */
  1418     public void noFrames() {
  1419         println("<NOFRAMES>");
  1422     /**
  1423      * Print &lt;/NOFRAMES&gt; tag. Add a newline character at the end.
  1424      */
  1425     public void noFramesEnd() {
  1426         println("</NOFRAMES>");

mercurial