home *** CD-ROM | disk | FTP | other *** search
/ Internet News 1999 October / INEWS_10_CD.ISO / pc / jdk / jdk1.2.2 / docs / tooldocs / javadoc / source / HtmlWriter.java < prev    next >
Encoding:
Java Source  |  1999-09-19  |  24.4 KB  |  992 lines

  1. /*
  2.  * @(#)HtmlWriter.java    1.24 98/09/22
  3.  *
  4.  * Copyright 1997, 1998 by Sun Microsystems, Inc.,
  5.  * 901 San Antonio Road, Palo Alto, California, 94303, U.S.A.
  6.  * All rights reserved.
  7.  *
  8.  * This software is the confidential and proprietary information
  9.  * of Sun Microsystems, Inc. ("Confidential Information").  You
  10.  * shall not disclose such Confidential Information and shall use
  11.  * it only in accordance with the terms of the license agreement
  12.  * you entered into with Sun.
  13.  */
  14.  
  15. package com.sun.tools.doclets;
  16.  
  17. import com.sun.javadoc.*;
  18. import java.io.*;
  19. import java.lang.*;
  20. import java.util.*;
  21.  
  22. /**
  23.  * Class for the Html format code generation. 
  24.  * Initilizes PrintWriter with FileWriter, to enable print
  25.  * related methods to generate the code to the named File through FileWriter.
  26.  *
  27.  * @since JDK1.2
  28.  * @author Atul M Dambalkar 
  29.  */
  30. public class HtmlWriter extends PrintWriter {
  31.  
  32.     /**
  33.      * Name of the file, to which this writer is writing to.
  34.      */
  35.     protected final String htmlFilename;
  36.  
  37.     /**
  38.      * URL file separator string("/").
  39.      */
  40.     public static final String fileseparator = 
  41.                                           DirectoryManager.urlfileseparator;
  42.  
  43.     /**
  44.      * Initializes PrintWriter with the FileWriter.
  45.      *
  46.      * @param filename File Name to which the PrintWriter will do the Output.
  47.      * @param docencoding Encoding to be used for this file.
  48.      * @exception IOException Exception raised by the FileWriter is passed on
  49.      * to next level.
  50.      * @exception UnSupportedEncodingException Exception raised by the 
  51.      * OutputStreamWriter is passed on to next level.
  52.      */
  53.     public HtmlWriter(String filename, String docencoding) 
  54.                       throws IOException, UnsupportedEncodingException {
  55.         super(genWriter(null, filename, docencoding));
  56.         htmlFilename = filename;
  57.     }
  58.  
  59.     /**
  60.      * Initializes PrintWriter with the FileWriter.
  61.      *
  62.      * @param path The directory path to be created for this file.
  63.      * @param filename File Name to which the PrintWriter will do the Output.
  64.      * @param docencoding Encoding to be used for this file.
  65.      * @exception IOException Exception raised by the FileWriter is passed on
  66.      * to next level.
  67.      * @exception UnSupportedEncodingException Exception raised by the 
  68.      * OutputStreamWriter is passed on to next level.
  69.      */
  70.     public HtmlWriter(String path, String filename, String docencoding) 
  71.                       throws IOException, UnsupportedEncodingException {
  72.         super(genWriter(path, filename, docencoding));
  73.         htmlFilename = filename;
  74.     }
  75.  
  76.     /**
  77.      * Create the directory path for the file to be generated, construct 
  78.      * FileOutputStream and OutputStreamWriter depending upon docencoding.
  79.      *
  80.      * @param path The directory path to be created for this file.
  81.      * @param filename File Name to which the PrintWriter will do the Output.
  82.      * @param docencoding Encoding to be used for this file.
  83.      * @exception IOException Exception raised by the FileWriter is passed on
  84.      * to next level.
  85.      * @exception UnSupportedEncodingException Exception raised by the 
  86.      * OutputStreamWriter is passed on to next level.
  87.      * @return Writer Writer for the file getting generated.
  88.      * @see java.io.FileOutputStream
  89.      * @see java.io.OutputStreamWriter
  90.      */
  91.     static Writer genWriter(String path, String filename, String docencoding) 
  92.                             throws IOException, UnsupportedEncodingException {
  93.         FileOutputStream fos;
  94.         if (path != null) {
  95.             DirectoryManager.createDirectory(path);
  96.             fos = new FileOutputStream(((path.length() > 0)? 
  97.                                          path + fileseparator: "") + filename);
  98.         } else {
  99.             fos = new FileOutputStream(filename);
  100.         }
  101.         if (docencoding == null) {
  102.             OutputStreamWriter oswriter = new OutputStreamWriter(fos);
  103.             docencoding = oswriter.getEncoding();
  104.             return oswriter;
  105.         } else {
  106.             return new OutputStreamWriter(fos, docencoding);
  107.         }
  108.     }
  109.  
  110.     /**
  111.      * Print <HTML> tag. Add a newline character at the end.
  112.      */
  113.     public void html() {
  114.         println("<HTML>");
  115.     }
  116.  
  117.     /**
  118.      * Print </HTML> tag. Add a newline character at the end.
  119.      */
  120.     public void htmlEnd() {
  121.         println("</HTML>");
  122.     }
  123.  
  124.     /**
  125.      * Print <BODY> tag. Add a newline character at the end.
  126.      */
  127.     public void body() {
  128.         println("<BODY>");
  129.     }
  130.  
  131.     /**
  132.      * Print <BODY BGCOLOR="bgcolor"> tag. Add a newline character at the end.
  133.      *
  134.      * @param bgcolor BackGroung color.
  135.      */    
  136.     public void body(String bgcolor) {
  137.         println("<BODY BGCOLOR=\"" + bgcolor + "\">");
  138.     }
  139.  
  140.     /**
  141.      * Print </BODY> tag. Add a newline character at the end.
  142.      */
  143.     public void bodyEnd() {
  144.         println("</BODY>");
  145.     }
  146.  
  147.     /**
  148.      * Print <TITLE> tag. Add a newline character at the end.
  149.      */
  150.     public void title() {
  151.         println("<TITLE>");
  152.     }
  153.  
  154.     /**
  155.      * Print </TITLE> tag. Add a newline character at the end.
  156.      */    
  157.     public void titleEnd() {
  158.         println("</TITLE>");
  159.     }
  160.  
  161.     /**
  162.      * Print <UL> tag. Add a newline character at the end.
  163.      */
  164.     public void ul() {
  165.         println("<UL>");
  166.     }
  167.  
  168.     /**
  169.      * Print </UL> tag. Add a newline character at the end.
  170.      */
  171.     public void ulEnd() {
  172.         println("</UL>");
  173.     }
  174.  
  175.     /**
  176.      * Print <LI> tag.
  177.      */
  178.     public void li() {
  179.         print("<LI>");
  180.     }
  181.  
  182.     /**
  183.      * Print <LI TYPE="type"> tag.
  184.      *
  185.      * @param type Type string.
  186.      */
  187.     public void li(String type) {
  188.         print("<LI TYPE=\"" + type + "\">");
  189.     }
  190.  
  191.     /**
  192.      * Print <H1> tag. Add a newline character at the end.
  193.      */
  194.     public void h1() {
  195.         println("<H1>");
  196.     }
  197.  
  198.     /**
  199.      * Print </H1> tag. Add a newline character at the end.
  200.      */
  201.     public void h1End() {
  202.         println("</H1>");
  203.     }
  204.  
  205.     /**
  206.      * Print text with <H1> tag. Also adds </H1> tag. Add a newline character
  207.      * at the end of the text. 
  208.      *
  209.      * @param text Text to be printed with <H1> format.
  210.      */
  211.     public void h1(String text) {
  212.         h1();
  213.         println(text);
  214.         h1End();
  215.     }
  216.  
  217.     /**
  218.      * Print <H2> tag. Add a newline character at the end.
  219.      */
  220.     public void h2() {
  221.         println("<H2>");
  222.     }
  223.  
  224.     /**
  225.      * Print text with <H2> tag. Also adds </H2> tag. Add a newline character
  226.      *  at the end of the text. 
  227.      *
  228.      * @param text Text to be printed with <H2> format.
  229.      */
  230.     public void h2(String text) {
  231.         h2();
  232.         println(text);
  233.         h2End();
  234.     }
  235.  
  236.     /**
  237.      * Print </H2> tag. Add a newline character at the end.
  238.      */
  239.     public void h2End() {
  240.         println("</H2>");
  241.     }
  242.  
  243.     /**
  244.      * Print <H3> tag. Add a newline character at the end.
  245.      */
  246.     public void h3() {
  247.         println("<H3>");
  248.     }
  249.  
  250.     /**
  251.      * Print text with <H3> tag. Also adds </H3> tag. Add a newline character
  252.      *  at the end of the text.  
  253.      *
  254.      * @param text Text to be printed with <H3> format.
  255.      */
  256.     public void h3(String text) {
  257.         h3();
  258.         println(text);
  259.         h3End();
  260.     }
  261.  
  262.     /**
  263.      * Print </H3> tag. Add a newline character at the end.
  264.      */
  265.     public void h3End() {
  266.         println("</H3>");
  267.     }
  268.  
  269.     /**
  270.      * Print <H4> tag. Add a newline character at the end.
  271.      */
  272.     public void h4() {
  273.         println("<H4>");
  274.     }
  275.  
  276.     /**
  277.      * Print </H4> tag. Add a newline character at the end.
  278.      */
  279.     public void h4End() {
  280.         println("</H4>");
  281.     }
  282.  
  283.     /**
  284.      * Print text with <H4> tag. Also adds </H4> tag. Add a newline character
  285.      * at the end of the text.  
  286.      *
  287.      * @param text Text to be printed with <H4> format.
  288.      */
  289.     public void h4(String text) {
  290.         h4();
  291.         println(text);
  292.         h4End();
  293.     }
  294.  
  295.     /**
  296.      * Print <H5> tag. Add a newline character at the end.
  297.      */
  298.     public void h5() {
  299.         println("<H5>");
  300.     }
  301.  
  302.     /**
  303.      * Print </H5> tag. Add a newline character at the end.
  304.      */
  305.     public void h5End() {
  306.         println("</H5>");
  307.     }
  308.  
  309.     /**
  310.      * Print HTML <IMG SRC="imggif" WIDTH="width" HEIGHT="height" ALT="imgname>
  311.      * tag. It prepends the "images" directory name to the "imggif". This 
  312.      * method is used for oneone format generation. Add a newline character 
  313.      * at the end.
  314.      * 
  315.      * @param imggif   Image GIF file.
  316.      * @param imgname  Image name.
  317.      * @param width    Width of the image.
  318.      * @param height   Height of the image.
  319.      */
  320.     public void img(String imggif, String imgname, int width, int height) {
  321.         println("<IMG SRC=\"images/" + imggif + ".gif\"" 
  322.               + " WIDTH=\"" + width + "\" HEIGHT=\"" + height 
  323.               + "\" ALT=\"" + imgname + "\">");
  324.     }
  325.  
  326.     /**
  327.      * Print <MENU> tag. Add a newline character at the end.
  328.      */
  329.     public void menu() {
  330.         println("<MENU>");
  331.     }
  332.  
  333.     /**
  334.      * Print </MENU> tag. Add a newline character at the end.
  335.      */
  336.     public void menuEnd() {
  337.         println("</MENU>");
  338.     }
  339.  
  340.     /**
  341.      * Print <PRE> tag. Add a newline character at the end.
  342.      */
  343.     public void pre() {
  344.         println("<PRE>");
  345.     }
  346.  
  347.     /**
  348.      * Print </PRE> tag. Add a newline character at the end.
  349.      */
  350.     public void preEnd() {
  351.         println("</PRE>");
  352.     }
  353.     
  354.     /**
  355.      * Print <HR> tag. Add a newline character at the end.
  356.      */
  357.     public void hr() {
  358.         println("<HR>");
  359.     }
  360.  
  361.     /**
  362.      * Print <HR SIZE="size" WIDTH="widthpercent%"> tag. Add a newline 
  363.      * character at the end.
  364.      *
  365.      * @param size           Size of the ruler.
  366.      * @param widthPercent   Percentage Width of the ruler
  367.      */
  368.     public void hr(int size, int widthPercent) {
  369.         println("<HR SIZE=\"" + size + "\" WIDTH=\"" + widthPercent + "%\">");
  370.     }
  371.  
  372.     /**
  373.      * Print <HR SIZE="size" NOSHADE> tag. Add a newline character at the end.
  374.      *
  375.      * @param size           Size of the ruler.
  376.      * @param noshade        noshade string.
  377.      */
  378.     public void hr(int size, String noshade) {
  379.         println("<HR SIZE=\"" + size + "\" NOSHADE>");
  380.     }
  381.  
  382.     /**
  383.      * Get the "<B>" string.
  384.      *
  385.      * @return String Return String "<B>";
  386.      */
  387.     public String getBold() {
  388.         return "<B>";
  389.     }
  390.  
  391.     /**
  392.      * Get the "</B>" string.
  393.      *
  394.      * @return String Return String "</B>";
  395.      */
  396.     public String getBoldEnd() {
  397.         return "</B>";
  398.     }
  399.  
  400.     /**
  401.      * Print <B> tag.
  402.      */
  403.     public void bold() {
  404.         print("<B>");
  405.     }
  406.  
  407.     /**
  408.      * Print </B> tag.
  409.      */
  410.     public void boldEnd() {
  411.         print("</B>");
  412.     }
  413.  
  414.     /**
  415.      * Print text passed, in bold format using <B> and </B> tags.
  416.      * 
  417.      * @param text String to be printed in between <B> and </B> tags.
  418.      */
  419.     public void bold(String text) {
  420.         bold();
  421.         print(text);
  422.         boldEnd();
  423.     }
  424.     
  425.     /**
  426.      * Print text passed, in Italics using <I> and </I> tags.
  427.      * 
  428.      * @param text String to be printed in between <I> and </I> tags.
  429.      */
  430.     public void italics(String text) {
  431.         print("<I>");
  432.         print(text);
  433.         println("</I>");
  434.     }
  435.  
  436.     /**
  437.      * Return, text passed, with Italics <I> and </I> tags, surrounding it.
  438.      * So if the text passed is "Hi", then string returned will be "<I>Hi</I>".
  439.      *
  440.      * @param text String to be printed in between <I> and </I> tags.
  441.      */
  442.     public String italicsText(String text) {
  443.         return "<I>" + text + "</I>";
  444.     }
  445.  
  446.     /**
  447.      * Print "&nbsp;", non-breaking space.
  448.      */
  449.     public void space() {
  450.         print(" ");
  451.     }
  452.  
  453.     /**
  454.      * Print <DL> tag. Add a newline character at the end.
  455.      */        
  456.     public void dl() {
  457.         println("<DL>");
  458.     }
  459.  
  460.     /**
  461.      * Print </DL> tag. Add a newline character at the end.
  462.      */
  463.     public void dlEnd() {
  464.         println("</DL>");
  465.     }
  466.  
  467.     /**
  468.      * Print <DT> tag. 
  469.      */         
  470.     public void dt() {
  471.         print("<DT>");
  472.     }
  473.  
  474.     /**
  475.      * Print <DT> tag. 
  476.      */  
  477.     public void dd() {
  478.         print("<DD>");
  479.     }
  480.  
  481.     /**
  482.      * Print </DD> tag. Add a newline character at the end.
  483.      */
  484.     public void ddEnd() {
  485.         println("</DD>"); 
  486.     }
  487.  
  488.     /**
  489.      * Print <SUP> tag. Add a newline character at the end.
  490.      */
  491.     public void sup() {
  492.         println("<SUP>");
  493.     }
  494.  
  495.     /**
  496.      * Print </SUP> tag. Add a newline character at the end.
  497.      */
  498.     public void supEnd() {
  499.         println("</SUP>");
  500.     }
  501.     
  502.     /**
  503.      * Print <FONT SIZE="size"> tag. Add a newline character at the end.
  504.      *
  505.      * @param size String size.
  506.      */
  507.     public void font(String size) {
  508.         println("<FONT SIZE=\"" + size + "\">");
  509.     }
  510.  
  511.     /**
  512.      * Print <FONT ID="stylename"> tag. Add a newline character at the end.
  513.      *
  514.      * @param stylename String stylename.
  515.      */
  516.     public void fontStyle(String stylename) {
  517.         print("<FONT ID=\"" + stylename + "\">");
  518.     }
  519.    
  520.     /**
  521.      * Print <FONT SIZE="size" ID="stylename"> tag. Add a newline character 
  522.      * at the end.
  523.      *
  524.      * @param size String size.
  525.      * @param stylename String stylename.
  526.      */ 
  527.     public void fontSizeStyle(String size, String stylename) {
  528.         println("<FONT size=\"" + size + "\" ID=\"" + stylename + "\">");
  529.     }
  530.     
  531.     /**
  532.      * Print </FONT> tag. 
  533.      */
  534.     public void fontEnd() {
  535.         print("</FONT>");
  536.     }
  537.    
  538.     /**
  539.      * Get the "<FONT COLOR="color">" string.
  540.      *
  541.      * @param color String color.
  542.      * @return String Return String "<FONT COLOR="color">".
  543.      */
  544.     public String getFontColor(String color) {
  545.         return "<FONT COLOR=\"" + color + "\">";
  546.     }
  547.  
  548.     /**
  549.      * Get the "</FONT>" string.
  550.      *
  551.      * @return String Return String "</FONT>";
  552.      */
  553.     public String getFontEnd() {
  554.         return "</FONT>";
  555.     }
  556.  
  557.     /**
  558.      * Print <CENTER> tag. Add a newline character at the end.
  559.      */    
  560.     public void center() {
  561.         println("<CENTER>");
  562.     }
  563.  
  564.     /**
  565.      * Print </CENTER> tag. Add a newline character at the end.
  566.      */
  567.     public void centerEnd() {
  568.         println("</CENTER>");
  569.     }
  570.     
  571.     /**
  572.      * Print anchor <A NAME="name"> tag. 
  573.      * 
  574.      * @param name Name String.
  575.      */
  576.     public void aName(String name) {
  577.         print("<A NAME=\"" + name + "\">");
  578.     }
  579.  
  580.     /**
  581.      * Print </A> tag. 
  582.      */
  583.     public void aEnd() {
  584.         print("</A>");
  585.     }
  586.  
  587.     /**
  588.      * Print <I> tag. 
  589.      */
  590.     public void italic() {
  591.         print("<I>");
  592.     }
  593.  
  594.     /**
  595.      * Print </I> tag. 
  596.      */
  597.     public void italicEnd() {
  598.         print("</I>");
  599.     }
  600.  
  601.     /**
  602.      * Print contents within anchor <A NAME="name"> tags. 
  603.      *
  604.      * @param name String name.
  605.      * @param content String contents.
  606.      */ 
  607.     public void anchor(String name, String content) {
  608.         aName(name);
  609.         print(content);
  610.         aEnd();
  611.     }
  612.  
  613.     /**
  614.      * Print anchor <A NAME="name"> and </A>tags. Print comment string 
  615.      * "<!-- -->" within those tags. 
  616.      *
  617.      * @param name String name.
  618.      */ 
  619.     public void anchor(String name) {
  620.         aName(name);
  621.         print("<!-- -->");
  622.         aEnd();
  623.     }
  624.  
  625.     /**
  626.      * Print newline and then print <P> tag. Add a newline character at the 
  627.      * end.
  628.      */
  629.     public void p() {
  630.         println();
  631.         println("<P>");
  632.     }
  633.  
  634.     /**
  635.      * Print newline and then print <BR> tag. Add a newline character at the 
  636.      * end.
  637.      */
  638.     public void br() {
  639.         println();
  640.         println("<BR>");
  641.     }
  642.  
  643.     /**
  644.      * Print <ADDRESS> tag. Add a newline character at the end.
  645.      */
  646.     public void address() {
  647.         println("<ADDRESS>");
  648.     }
  649.  
  650.     /**
  651.      * Print </ADDRESS> tag. Add a newline character at the end.
  652.      */
  653.     public void addressEnd() {
  654.         println("</ADDRESS>");
  655.     }
  656.  
  657.     /**
  658.      * Print <HEAD> tag. Add a newline character at the end.
  659.      */    
  660.     public void head() {
  661.         println("<HEAD>");
  662.     }
  663.  
  664.     /**
  665.      * Print </HEAD> tag. Add a newline character at the end.
  666.      */
  667.     public void headEnd() {
  668.         println("</HEAD>");
  669.     }
  670.  
  671.     /**
  672.      * Print <CODE> tag. 
  673.      */    
  674.     public void code() {
  675.         print("<CODE>");
  676.     }
  677.  
  678.     /**
  679.      * Print </CODE> tag. 
  680.      */
  681.     public void codeEnd() {
  682.         print("</CODE>");
  683.     }
  684.     
  685.     /**
  686.      * Print <EM> tag. Add a newline character at the end.
  687.      */
  688.     public void em() {
  689.         println("<EM>");
  690.     }
  691.  
  692.     /**
  693.      * Print </EM> tag. Add a newline character at the end.
  694.      */
  695.     public void emEnd() {
  696.         println("</EM>");
  697.     }
  698.  
  699.     /**
  700.      * Print HTML <TABLE BORDER="border" WIDTH="width" 
  701.      * CELLPADDING="cellpadding" CELLSPACING="cellspacing"> tag.
  702.      * 
  703.      * @param border       Border size.
  704.      * @param width        Width of the table.
  705.      * @param cellpadding  Cellpadding for the table cells.
  706.      * @param cellspacing  Cellspacing for the table cells.
  707.      */
  708.     public void table(int border, String width, int cellpadding, 
  709.                       int cellspacing) {
  710.         println("\n<TABLE BORDER=\"" + border +
  711.                 "\" WIDTH=\"" + width +
  712.                 "\" CELLPADDING=\"" + cellpadding +
  713.                 "\" CELLSPACING=\"" + cellspacing + "\">");
  714.     } 
  715.  
  716.     /**
  717.      * Print HTML <TABLE BORDER="border" CELLPADDING="cellpadding" 
  718.      * CELLSPACING="cellspacing"> tag.
  719.      * 
  720.      * @param border       Border size.
  721.      * @param cellpadding  Cellpadding for the table cells.
  722.      * @param cellspacing  Cellspacing for the table cells.
  723.      */   
  724.     public void table(int border, int cellpadding, int cellspacing) {
  725.         println("\n<TABLE BORDER=\"" + border +
  726.                 "\" CELLPADDING=\"" + cellpadding +
  727.                 "\" CELLSPACING=\"" + cellspacing + "\">");
  728.     } 
  729.  
  730.     /**
  731.      * Print HTML <TABLE BORDER="border" WIDTH="width"> 
  732.      * 
  733.      * @param border       Border size.
  734.      * @param width        Width of the table.
  735.      */    
  736.     public void table(int border, String width) {
  737.         println("\n<TABLE BORDER=\"" + border +
  738.                 "\" WIDTH=\"" + width + "\">");
  739.     } 
  740.  
  741.     /**    
  742.      * Print the HTML table tag with border size 0 and width 100%.
  743.      */
  744.     public void table() {
  745.         table(0, "100%"); 
  746.     } 
  747.     
  748.     /**
  749.      * Print </TABLE> tag. Add a newline character at the end.
  750.      */
  751.     public void tableEnd() {
  752.         println("</TABLE>");
  753.     }
  754.  
  755.     /**
  756.      * Print <TR> tag. Add a newline character at the end.
  757.      */
  758.     public void tr() {
  759.         println("<TR>");
  760.     }
  761.  
  762.     /**
  763.      * Print </TR> tag. Add a newline character at the end.
  764.      */
  765.     public void trEnd() {
  766.         println("</TR>");
  767.     }
  768.    
  769.     /**
  770.      * Print <TD> tag. 
  771.      */
  772.     public void td() {
  773.         print("<TD>");
  774.     }
  775.  
  776.     /**
  777.      * Print <TD NOWRAP> tag. 
  778.      */
  779.     public void tdNowrap() {
  780.         print("<TD NOWRAP>");
  781.     }
  782.  
  783.     /**
  784.      * Print <TD WIDTH="width"> tag. 
  785.      * 
  786.      * @param width String width.
  787.      */
  788.     public void tdWidth(String width) {
  789.         print("<TD WIDTH=\"" + width + "\">");
  790.     }
  791.  
  792.     /**
  793.      * Print </TD> tag. Add a newline character at the end.
  794.      */
  795.     public void tdEnd() {
  796.         println("</TD>");
  797.     }
  798.  
  799.     /**
  800.      * Print <LINK str> tag. 
  801.      * 
  802.      * @param str String.
  803.      */
  804.     public void link(String str) {
  805.         println("<LINK " + str + ">");
  806.     }
  807.  
  808.     /**
  809.      * Print "<!-- " comment start string. 
  810.      */
  811.     public void commentStart() {
  812.          print("<!-- ");
  813.     }
  814.  
  815.     /**
  816.      * Print "-->" comment end string. Add a newline character at the end.
  817.      */
  818.     public void commentEnd() {
  819.          println("-->");
  820.     }
  821.  
  822.     /**
  823.      * Print <TR BGCOLOR="color" ID="stylename"> tag. Adds a newline character
  824.      * at the end.
  825.      *
  826.      * @param color String color.
  827.      * @param stylename String stylename.
  828.      */ 
  829.     public void trBgcolorStyle(String color, String stylename) {
  830.         println("<TR BGCOLOR=\"" + color + "\" ID=\"" + stylename + "\">");
  831.     }
  832.  
  833.     /**
  834.      * Print <TR BGCOLOR="color"> tag. Adds a newline character at the end.
  835.      *
  836.      * @param color String color.
  837.      */
  838.     public void trBgcolor(String color) {
  839.         println("<TR BGCOLOR=\"" + color + "\">");
  840.     }
  841.  
  842.     /**
  843.      * Print <TR ALIGN="align" VALIGN="valign"> tag. Adds a newline character
  844.      * at the end.
  845.      *
  846.      * @param align String align.
  847.      * @param valign String valign.
  848.      */
  849.     public void trAlignVAlign(String align, String valign) {
  850.         println("<TR ALIGN=\"" + align + "\" VALIGN=\"" + valign + "\">");
  851.     }
  852.  
  853.     /**
  854.      * Print <TD COLSPAN=i> tag. 
  855.      *
  856.      * @param i integer.
  857.      */
  858.     public void tdColspan(int i) {
  859.         print("<TD COLSPAN=" + i + ">");
  860.     }
  861.  
  862.     /**
  863.      * Print <TD BGCOLOR="color" ID="stylename"> tag. 
  864.      *
  865.      * @param color String color.
  866.      * @param stylename String stylename.
  867.      */ 
  868.     public void tdBgcolorStyle(String color, String stylename) {
  869.         print("<TD BGCOLOR=\"" + color + "\" ID=\"" + stylename + "\">");
  870.     }
  871.  
  872.     /**
  873.      * Print <TD COLSPAN=i BGCOLOR="color" ID="stylename"> tag. 
  874.      *
  875.      * @param i integer.
  876.      * @param color String color.
  877.      * @param stylename String stylename.
  878.      */        
  879.     public void tdColspanBgcolorStyle(int i, String color, String stylename) {
  880.         print("<TD COLSPAN=" + i + " BGCOLOR=\"" + color + "\" ID=\"" +
  881.               stylename + "\">");
  882.     }
  883.  
  884.     /**
  885.      * Print <TD ALIGN="align"> tag. Adds a newline character
  886.      * at the end.
  887.      *
  888.      * @param align String align.
  889.      */        
  890.     public void tdAlign(String align) {
  891.         print("<TD ALIGN=\"" + align + "\">");
  892.     }
  893.  
  894.     /**
  895.      * Print <TD ALIGN="align" ID="stylename"> tag.
  896.      *
  897.      * @param align        String align.
  898.      * @param stylename    String stylename.
  899.      */
  900.     public void tdVAlignClass(String align, String stylename) {
  901.         print("<TD VALIGN=\"" + align + "\" ID=\"" + stylename + "\">");
  902.     }
  903.  
  904.     /**
  905.      * Print <TD VALIGN="valign"> tag. 
  906.      *
  907.      * @param valign String valign.
  908.      */
  909.     public void tdVAlign(String valign) {
  910.         print("<TD VALIGN=\"" + valign + "\">");
  911.     }
  912.  
  913.     /**
  914.      * Print <TD ALIGN="align" VALIGN="valign"> tag. 
  915.      *
  916.      * @param align   String align.
  917.      * @param valign  String valign.
  918.      */
  919.     public void tdAlignVAlign(String align, String valign) {
  920.         print("<TD ALIGN=\"" + align + "\" VALIGN=\"" + valign + "\">");
  921.     }
  922.  
  923.     /**
  924.      * Print <TD ALIGN="align" ROWSPAN=rowspan> tag. 
  925.      *
  926.      * @param align    String align.
  927.      * @param rowspan  integer rowspan.
  928.      */
  929.     public void tdAlignRowspan(String align, int rowspan) {
  930.         print("<TD ALIGN=\"" + align + "\" ROWSPAN=" + rowspan + ">");
  931.     }
  932.  
  933.     /**
  934.      * Print <TD ALIGN="align" VALIGN="valign" ROWSPAN=rowspan> tag. 
  935.      *
  936.      * @param align    String align.
  937.      * @param valign  String valign.
  938.      * @param rowspan  integer rowspan.
  939.      */
  940.     public void tdAlignVAlignRowspan(String align, String valign, 
  941.                                      int rowspan) {
  942.         print("<TD ALIGN=\"" + align + "\" VALIGN=\"" + valign 
  943.                 + "\" ROWSPAN=" + rowspan + ">");
  944.     }
  945.  
  946.     /**
  947.      * Print <BLOCKQUOTE> tag. Add a newline character at the end.
  948.      */
  949.     public void blockquote() {
  950.         println("<BLOCKQUOTE>");
  951.     }
  952.  
  953.     /**
  954.      * Print </BLOCKQUOTE> tag. Add a newline character at the end.
  955.      */
  956.     public void blockquoteEnd() {
  957.         println("</BLOCKQUOTE>");
  958.     }
  959.  
  960.     /**
  961.      * Get the "<CODE>" string.
  962.      *
  963.      * @return String Return String "<CODE>";
  964.      */
  965.     public String getCode() {
  966.         return "<CODE>";
  967.     }
  968.  
  969.     /**
  970.      * Get the "</CODE>" string.
  971.      *
  972.      * @return String Return String "</CODE>";
  973.      */
  974.     public String getCodeEnd() {
  975.         return "</CODE>";
  976.     }
  977.  
  978.     /**
  979.      * Print <NOFRAMES> tag. Add a newline character at the end.
  980.      */
  981.     public void noFrames() {
  982.         println("<NOFRAMES>");
  983.     }
  984.  
  985.     /**
  986.      * Print </NOFRAMES> tag. Add a newline character at the end.
  987.      */
  988.     public void noFramesEnd() {
  989.         println("</NOFRAMES>");
  990.     }
  991. }
  992.