Mon, 13 Dec 2010 13:44:47 -0800
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 </HTML> 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 </HEAD> 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 <SCRIPT> start tag with its type
325 * attribute.
326 */
327 public void script() {
328 println("<SCRIPT type=\"text/javascript\">");
329 }
331 /**
332 * Print the Javascript </SCRIPT> end tag.
333 */
334 public void scriptEnd() {
335 println("</SCRIPT>");
336 }
338 /**
339 * Print the Javascript <NOSCRIPT> start tag.
340 */
341 public void noScript() {
342 println("<NOSCRIPT>");
343 }
345 /**
346 * Print the Javascript </NOSCRIPT> end tag.
347 */
348 public void noScriptEnd() {
349 println("</NOSCRIPT>");
350 }
352 /**
353 * Return the Javascript call to be embedded in the <BODY> tag.
354 * Return nothing if winTitle is empty.
355 * @return the Javascript call to be embedded in the <BODY> 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 <BODY BGCOLOR="bgcolor">, 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 </BODY> tag. Add a newline character at the end.
405 */
406 public void bodyEnd() {
407 println("</BODY>");
408 }
410 /**
411 * Print <TITLE> tag. Add a newline character at the end.
412 */
413 public void title() {
414 println("<TITLE>");
415 }
417 /**
418 * Print <TITLE> 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 </TITLE> tag. Add a newline character at the end.
440 */
441 public void titleEnd() {
442 println("</TITLE>");
443 }
445 /**
446 * Print <UL> tag. Add a newline character at the end.
447 */
448 public void ul() {
449 println("<UL>");
450 }
452 /**
453 * Print </UL> tag. Add a newline character at the end.
454 */
455 public void ulEnd() {
456 println("</UL>");
457 }
459 /**
460 * Print <LI> tag.
461 */
462 public void li() {
463 print("<LI>");
464 }
466 /**
467 * Print <LI TYPE="type"> tag.
468 *
469 * @param type Type string.
470 */
471 public void li(String type) {
472 print("<LI TYPE=\"" + type + "\">");
473 }
475 /**
476 * Print <H1> tag. Add a newline character at the end.
477 */
478 public void h1() {
479 println("<H1>");
480 }
482 /**
483 * Print </H1> tag. Add a newline character at the end.
484 */
485 public void h1End() {
486 println("</H1>");
487 }
489 /**
490 * Print text with <H1> tag. Also adds </H1> tag. Add a newline character
491 * at the end of the text.
492 *
493 * @param text Text to be printed with <H1> format.
494 */
495 public void h1(String text) {
496 h1();
497 println(text);
498 h1End();
499 }
501 /**
502 * Print <H2> tag. Add a newline character at the end.
503 */
504 public void h2() {
505 println("<H2>");
506 }
508 /**
509 * Print text with <H2> tag. Also adds </H2> tag. Add a newline character
510 * at the end of the text.
511 *
512 * @param text Text to be printed with <H2> format.
513 */
514 public void h2(String text) {
515 h2();
516 println(text);
517 h2End();
518 }
520 /**
521 * Print </H2> tag. Add a newline character at the end.
522 */
523 public void h2End() {
524 println("</H2>");
525 }
527 /**
528 * Print <H3> tag. Add a newline character at the end.
529 */
530 public void h3() {
531 println("<H3>");
532 }
534 /**
535 * Print text with <H3> tag. Also adds </H3> tag. Add a newline character
536 * at the end of the text.
537 *
538 * @param text Text to be printed with <H3> format.
539 */
540 public void h3(String text) {
541 h3();
542 println(text);
543 h3End();
544 }
546 /**
547 * Print </H3> tag. Add a newline character at the end.
548 */
549 public void h3End() {
550 println("</H3>");
551 }
553 /**
554 * Print <H4> tag. Add a newline character at the end.
555 */
556 public void h4() {
557 println("<H4>");
558 }
560 /**
561 * Print </H4> tag. Add a newline character at the end.
562 */
563 public void h4End() {
564 println("</H4>");
565 }
567 /**
568 * Print text with <H4> tag. Also adds </H4> tag. Add a newline character
569 * at the end of the text.
570 *
571 * @param text Text to be printed with <H4> format.
572 */
573 public void h4(String text) {
574 h4();
575 println(text);
576 h4End();
577 }
579 /**
580 * Print <H5> tag. Add a newline character at the end.
581 */
582 public void h5() {
583 println("<H5>");
584 }
586 /**
587 * Print </H5> tag. Add a newline character at the end.
588 */
589 public void h5End() {
590 println("</H5>");
591 }
593 /**
594 * Print HTML <IMG SRC="imggif" WIDTH="width" HEIGHT="height" ALT="imgname>
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 <MENU> tag. Add a newline character at the end.
612 */
613 public void menu() {
614 println("<MENU>");
615 }
617 /**
618 * Print </MENU> tag. Add a newline character at the end.
619 */
620 public void menuEnd() {
621 println("</MENU>");
622 }
624 /**
625 * Print <PRE> tag. Add a newline character at the end.
626 */
627 public void pre() {
628 println("<PRE>");
629 }
631 /**
632 * Print <PRE> tag without adding new line character at th eend.
633 */
634 public void preNoNewLine() {
635 print("<PRE>");
636 }
638 /**
639 * Print </PRE> tag. Add a newline character at the end.
640 */
641 public void preEnd() {
642 println("</PRE>");
643 }
645 /**
646 * Print <HR> tag. Add a newline character at the end.
647 */
648 public void hr() {
649 println("<HR>");
650 }
652 /**
653 * Print <HR SIZE="size" WIDTH="widthpercent%"> 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 <HR SIZE="size" NOSHADE> 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 "<STRONG>" string.
675 *
676 * @return String Return String "<STRONG>";
677 */
678 public String getStrong() {
679 return "<STRONG>";
680 }
682 /**
683 * Get the "</STRONG>" string.
684 *
685 * @return String Return String "</STRONG>";
686 */
687 public String getStrongEnd() {
688 return "</STRONG>";
689 }
691 /**
692 * Print <STRONG> tag.
693 */
694 public void strong() {
695 print("<STRONG>");
696 }
698 /**
699 * Print </STRONG> tag.
700 */
701 public void strongEnd() {
702 print("</STRONG>");
703 }
705 /**
706 * Print text passed, in strong format using <STRONG> and </STRONG> tags.
707 *
708 * @param text String to be printed in between <STRONG> and </STRONG> tags.
709 */
710 public void strong(String text) {
711 strong();
712 print(text);
713 strongEnd();
714 }
716 /**
717 * Print text passed, in Italics using <I> and </I> tags.
718 *
719 * @param text String to be printed in between <I> and </I> 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 <i> and </i> tags, surrounding it.
729 * So if the text passed is "Hi", then string returned will be "<i>Hi</i>".
730 *
731 * @param text String to be printed in between <I> and </I> 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 "&nbsp;", non-breaking space.
743 */
744 public void space() {
745 print(" ");
746 }
748 /**
749 * Return "&nbsp;", non-breaking space.
750 */
751 public Content getSpace() {
752 return RawHtml.nbsp;
753 }
755 /**
756 * Print <DL> tag. Add a newline character at the end.
757 */
758 public void dl() {
759 println("<DL>");
760 }
762 /**
763 * Print </DL> tag. Add a newline character at the end.
764 */
765 public void dlEnd() {
766 println("</DL>");
767 }
769 /**
770 * Print <DT> tag.
771 */
772 public void dt() {
773 print("<DT>");
774 }
776 /**
777 * Print </DT> tag.
778 */
779 public void dtEnd() {
780 print("</DT>");
781 }
783 /**
784 * Print <DD> tag.
785 */
786 public void dd() {
787 print("<DD>");
788 }
790 /**
791 * Print </DD> tag. Add a newline character at the end.
792 */
793 public void ddEnd() {
794 println("</DD>");
795 }
797 /**
798 * Print <SUP> tag. Add a newline character at the end.
799 */
800 public void sup() {
801 println("<SUP>");
802 }
804 /**
805 * Print </SUP> tag. Add a newline character at the end.
806 */
807 public void supEnd() {
808 println("</SUP>");
809 }
811 /**
812 * Print <FONT SIZE="size"> 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 <FONT SIZE="size"> tag.
822 *
823 * @param size String size.
824 */
825 public void fontNoNewLine(String size) {
826 print("<FONT SIZE=\"" + size + "\">");
827 }
829 /**
830 * Print <FONT CLASS="stylename"> 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 <FONT SIZE="size" CLASS="stylename"> 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 </FONT> tag.
851 */
852 public void fontEnd() {
853 print("</FONT>");
854 }
856 /**
857 * Get the "<FONT COLOR="color">" string.
858 *
859 * @param color String color.
860 * @return String Return String "<FONT COLOR="color">".
861 */
862 public String getFontColor(String color) {
863 return "<FONT COLOR=\"" + color + "\">";
864 }
866 /**
867 * Get the "</FONT>" string.
868 *
869 * @return String Return String "</FONT>";
870 */
871 public String getFontEnd() {
872 return "</FONT>";
873 }
875 /**
876 * Print <CENTER> tag. Add a newline character at the end.
877 */
878 public void center() {
879 println("<CENTER>");
880 }
882 /**
883 * Print </CENTER> tag. Add a newline character at the end.
884 */
885 public void centerEnd() {
886 println("</CENTER>");
887 }
889 /**
890 * Print anchor <A NAME="name"> tag.
891 *
892 * @param name Name String.
893 */
894 public void aName(String name) {
895 print("<A NAME=\"" + name + "\">");
896 }
898 /**
899 * Print </A> tag.
900 */
901 public void aEnd() {
902 print("</A>");
903 }
905 /**
906 * Print <I> tag.
907 */
908 public void italic() {
909 print("<I>");
910 }
912 /**
913 * Print </I> tag.
914 */
915 public void italicEnd() {
916 print("</I>");
917 }
919 /**
920 * Print contents within anchor <A NAME="name"> 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 <A NAME="name"> and </A>tags. Print comment string
933 * "<!-- -->" 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 <P> 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 </P> 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 <BR> tag. Add a newline character at the
961 * end.
962 */
963 public void br() {
964 println();
965 println("<BR>");
966 }
968 /**
969 * Print <ADDRESS> tag. Add a newline character at the end.
970 */
971 public void address() {
972 println("<ADDRESS>");
973 }
975 /**
976 * Print </ADDRESS> tag. Add a newline character at the end.
977 */
978 public void addressEnd() {
979 println("</ADDRESS>");
980 }
982 /**
983 * Print <HEAD> tag. Add a newline character at the end.
984 */
985 public void head() {
986 println("<HEAD>");
987 }
989 /**
990 * Print </HEAD> tag. Add a newline character at the end.
991 */
992 public void headEnd() {
993 println("</HEAD>");
994 }
996 /**
997 * Print <CODE> tag.
998 */
999 public void code() {
1000 print("<CODE>");
1001 }
1003 /**
1004 * Print </CODE> tag.
1005 */
1006 public void codeEnd() {
1007 print("</CODE>");
1008 }
1010 /**
1011 * Print <EM> tag. Add a newline character at the end.
1012 */
1013 public void em() {
1014 println("<EM>");
1015 }
1017 /**
1018 * Print </EM> tag. Add a newline character at the end.
1019 */
1020 public void emEnd() {
1021 println("</EM>");
1022 }
1024 /**
1025 * Print HTML <TABLE BORDER="border" WIDTH="width"
1026 * CELLPADDING="cellpadding" CELLSPACING="cellspacing"> tag.
1027 *
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=\"\">");
1041 }
1043 /**
1044 * Print HTML <TABLE BORDER="border" WIDTH="width"
1045 * CELLPADDING="cellpadding" CELLSPACING="cellspacing" SUMMARY="summary"> tag.
1046 *
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 + "\">");
1061 }
1063 /**
1064 * Print HTML <TABLE BORDER="border" CELLPADDING="cellpadding"
1065 * CELLSPACING="cellspacing"> tag.
1066 *
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=\"\">");
1077 }
1079 /**
1080 * Print HTML <TABLE BORDER="border" CELLPADDING="cellpadding"
1081 * CELLSPACING="cellspacing" SUMMARY="summary"> tag.
1082 *
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 + "\">");
1094 }
1096 /**
1097 * Print HTML <TABLE BORDER="border" WIDTH="width">
1098 *
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=\"\">");
1107 }
1109 /**
1110 * Print the HTML table tag with border size 0 and width 100%.
1111 */
1112 public void table() {
1113 table(0, "100%");
1114 }
1116 /**
1117 * Print </TABLE> tag. Add a newline character at the end.
1118 */
1119 public void tableEnd() {
1120 println("</TABLE>");
1121 }
1123 /**
1124 * Print <TR> tag. Add a newline character at the end.
1125 */
1126 public void tr() {
1127 println("<TR>");
1128 }
1130 /**
1131 * Print </TR> tag. Add a newline character at the end.
1132 */
1133 public void trEnd() {
1134 println("</TR>");
1135 }
1137 /**
1138 * Print <TD> tag.
1139 */
1140 public void td() {
1141 print("<TD>");
1142 }
1144 /**
1145 * Print <TD NOWRAP> tag.
1146 */
1147 public void tdNowrap() {
1148 print("<TD NOWRAP>");
1149 }
1151 /**
1152 * Print <TD WIDTH="width"> tag.
1153 *
1154 * @param width String width.
1155 */
1156 public void tdWidth(String width) {
1157 print("<TD WIDTH=\"" + width + "\">");
1158 }
1160 /**
1161 * Print </TD> tag. Add a newline character at the end.
1162 */
1163 public void tdEnd() {
1164 println("</TD>");
1165 }
1167 /**
1168 * Print <LINK str> tag.
1169 *
1170 * @param str String.
1171 */
1172 public void link(String str) {
1173 println("<LINK " + str + ">");
1174 }
1176 /**
1177 * Print "<!-- " comment start string.
1178 */
1179 public void commentStart() {
1180 print("<!-- ");
1181 }
1183 /**
1184 * Print "-->" comment end string. Add a newline character at the end.
1185 */
1186 public void commentEnd() {
1187 println("-->");
1188 }
1190 /**
1191 * Print <CAPTION CLASS="stylename"> tag. Adds a newline character
1192 * at the end.
1193 *
1194 * @param stylename style to be applied.
1195 */
1196 public void captionStyle(String stylename) {
1197 println("<CAPTION CLASS=\"" + stylename + "\">");
1198 }
1200 /**
1201 * Print </CAPTION> tag. Add a newline character at the end.
1202 */
1203 public void captionEnd() {
1204 println("</CAPTION>");
1205 }
1207 /**
1208 * Print <TR BGCOLOR="color" CLASS="stylename"> tag. Adds a newline character
1209 * at the end.
1210 *
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 + "\">");
1216 }
1218 /**
1219 * Print <TR BGCOLOR="color"> tag. Adds a newline character at the end.
1220 *
1221 * @param color String color.
1222 */
1223 public void trBgcolor(String color) {
1224 println("<TR BGCOLOR=\"" + color + "\">");
1225 }
1227 /**
1228 * Print <TR ALIGN="align" VALIGN="valign"> tag. Adds a newline character
1229 * at the end.
1230 *
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 + "\">");
1236 }
1238 /**
1239 * Print <TH ALIGN="align"> tag.
1240 *
1241 * @param align the align attribute.
1242 */
1243 public void thAlign(String align) {
1244 print("<TH ALIGN=\"" + align + "\">");
1245 }
1247 /**
1248 * Print <TH CLASS="stylename" SCOPE="scope" NOWRAP> tag.
1249 *
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>");
1255 }
1257 /*
1258 * Returns a header for Modifier and Type column of a table.
1259 */
1260 public String getModifierTypeHeader() {
1261 return modifierTypeHeader;
1262 }
1264 /**
1265 * Print <TH align="align" COLSPAN=i> tag.
1266 *
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 + "\">");
1272 }
1274 /**
1275 * Print <TH align="align" NOWRAP> tag.
1276 *
1277 * @param align the align attribute.
1278 */
1279 public void thAlignNowrap(String align) {
1280 print("<TH ALIGN=\"" + align + "\" NOWRAP>");
1281 }
1283 /**
1284 * Print </TH> tag. Add a newline character at the end.
1285 */
1286 public void thEnd() {
1287 println("</TH>");
1288 }
1290 /**
1291 * Print <TD COLSPAN=i> tag.
1292 *
1293 * @param i integer.
1294 */
1295 public void tdColspan(int i) {
1296 print("<TD COLSPAN=" + i + ">");
1297 }
1299 /**
1300 * Print <TD BGCOLOR="color" CLASS="stylename"> tag.
1301 *
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 + "\">");
1307 }
1309 /**
1310 * Print <TD COLSPAN=i BGCOLOR="color" CLASS="stylename"> tag.
1311 *
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 + "\">");
1319 }
1321 /**
1322 * Print <TD ALIGN="align"> tag. Adds a newline character
1323 * at the end.
1324 *
1325 * @param align String align.
1326 */
1327 public void tdAlign(String align) {
1328 print("<TD ALIGN=\"" + align + "\">");
1329 }
1331 /**
1332 * Print <TD ALIGN="align" CLASS="stylename"> tag.
1333 *
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 + "\">");
1339 }
1341 /**
1342 * Print <TD VALIGN="valign"> tag.
1343 *
1344 * @param valign String valign.
1345 */
1346 public void tdVAlign(String valign) {
1347 print("<TD VALIGN=\"" + valign + "\">");
1348 }
1350 /**
1351 * Print <TD ALIGN="align" VALIGN="valign"> tag.
1352 *
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 + "\">");
1358 }
1360 /**
1361 * Print <TD ALIGN="align" ROWSPAN=rowspan> tag.
1362 *
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 + ">");
1368 }
1370 /**
1371 * Print <TD ALIGN="align" VALIGN="valign" ROWSPAN=rowspan> tag.
1372 *
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 + ">");
1381 }
1383 /**
1384 * Print <BLOCKQUOTE> tag. Add a newline character at the end.
1385 */
1386 public void blockquote() {
1387 println("<BLOCKQUOTE>");
1388 }
1390 /**
1391 * Print </BLOCKQUOTE> tag. Add a newline character at the end.
1392 */
1393 public void blockquoteEnd() {
1394 println("</BLOCKQUOTE>");
1395 }
1397 /**
1398 * Get the "<code>" string.
1399 *
1400 * @return String Return String "<code>";
1401 */
1402 public String getCode() {
1403 return "<code>";
1404 }
1406 /**
1407 * Get the "</code>" string.
1408 *
1409 * @return String Return String "</code>";
1410 */
1411 public String getCodeEnd() {
1412 return "</code>";
1413 }
1415 /**
1416 * Print <NOFRAMES> tag. Add a newline character at the end.
1417 */
1418 public void noFrames() {
1419 println("<NOFRAMES>");
1420 }
1422 /**
1423 * Print </NOFRAMES> tag. Add a newline character at the end.
1424 */
1425 public void noFramesEnd() {
1426 println("</NOFRAMES>");
1427 }
1428 }