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

Fri, 27 Feb 2009 18:57:17 -0800

author
bpatel
date
Fri, 27 Feb 2009 18:57:17 -0800
changeset 233
5240b1120530
parent 191
d79ad96ce47c
child 240
8c55d5b0ed71
permissions
-rw-r--r--

6786690: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - DL tag and nesting issue
Reviewed-by: jjg

duke@1 1 /*
duke@1 2 * Copyright 1997-2006 Sun Microsystems, Inc. All Rights Reserved.
duke@1 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
duke@1 4 *
duke@1 5 * This code is free software; you can redistribute it and/or modify it
duke@1 6 * under the terms of the GNU General Public License version 2 only, as
duke@1 7 * published by the Free Software Foundation. Sun designates this
duke@1 8 * particular file as subject to the "Classpath" exception as provided
duke@1 9 * by Sun in the LICENSE file that accompanied this code.
duke@1 10 *
duke@1 11 * This code is distributed in the hope that it will be useful, but WITHOUT
duke@1 12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
duke@1 13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
duke@1 14 * version 2 for more details (a copy is included in the LICENSE file that
duke@1 15 * accompanied this code).
duke@1 16 *
duke@1 17 * You should have received a copy of the GNU General Public License version
duke@1 18 * 2 along with this work; if not, write to the Free Software Foundation,
duke@1 19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
duke@1 20 *
duke@1 21 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
duke@1 22 * CA 95054 USA or visit www.sun.com if you need additional information or
duke@1 23 * have any questions.
duke@1 24 */
duke@1 25
duke@1 26 package com.sun.tools.doclets.formats.html.markup;
duke@1 27
bpatel@233 28 import java.io.*;
bpatel@233 29
duke@1 30 import com.sun.tools.doclets.internal.toolkit.*;
duke@1 31 import com.sun.tools.doclets.internal.toolkit.util.*;
duke@1 32
duke@1 33 /**
duke@1 34 * Class for the Html format code generation.
duke@1 35 * Initilizes PrintWriter with FileWriter, to enable print
duke@1 36 * related methods to generate the code to the named File through FileWriter.
duke@1 37 *
duke@1 38 * @since 1.2
duke@1 39 * @author Atul M Dambalkar
duke@1 40 */
duke@1 41 public class HtmlWriter extends PrintWriter {
duke@1 42
duke@1 43 /**
duke@1 44 * Name of the file, to which this writer is writing to.
duke@1 45 */
duke@1 46 protected final String htmlFilename;
duke@1 47
duke@1 48 /**
duke@1 49 * The window title of this file
duke@1 50 */
duke@1 51 protected String winTitle;
duke@1 52
duke@1 53 /**
duke@1 54 * URL file separator string("/").
duke@1 55 */
duke@1 56 public static final String fileseparator =
duke@1 57 DirectoryManager.URL_FILE_SEPERATOR;
duke@1 58
duke@1 59 /**
duke@1 60 * The configuration
duke@1 61 */
duke@1 62 protected Configuration configuration;
duke@1 63
duke@1 64 /**
bpatel@233 65 * The flag to indicate whether a member details list is printed or not.
bpatel@233 66 */
bpatel@233 67 protected boolean memberDetailsListPrinted;
bpatel@233 68
bpatel@233 69 /**
duke@1 70 * Constructor.
duke@1 71 *
duke@1 72 * @param path The directory path to be created for this file
duke@1 73 * or null if none to be created.
duke@1 74 * @param filename File Name to which the PrintWriter will
duke@1 75 * do the Output.
duke@1 76 * @param docencoding Encoding to be used for this file.
duke@1 77 * @exception IOException Exception raised by the FileWriter is passed on
duke@1 78 * to next level.
duke@1 79 * @exception UnSupportedEncodingException Exception raised by the
duke@1 80 * OutputStreamWriter is passed on to next level.
duke@1 81 */
duke@1 82 public HtmlWriter(Configuration configuration,
duke@1 83 String path, String filename, String docencoding)
duke@1 84 throws IOException, UnsupportedEncodingException {
duke@1 85 super(Util.genWriter(configuration, path, filename, docencoding));
duke@1 86 this.configuration = configuration;
duke@1 87 htmlFilename = filename;
bpatel@233 88 this.memberDetailsListPrinted = false;
duke@1 89 }
duke@1 90
duke@1 91 /**
duke@1 92 * Print <HTML> tag. Add a newline character at the end.
duke@1 93 */
duke@1 94 public void html() {
bpatel@191 95 println("<HTML lang=\"" + configuration.getLocale().getLanguage() + "\">");
duke@1 96 }
duke@1 97
duke@1 98 /**
duke@1 99 * Print &lt;/HTML&gt; tag. Add a newline character at the end.
duke@1 100 */
duke@1 101 public void htmlEnd() {
duke@1 102 println("</HTML>");
duke@1 103 }
duke@1 104
duke@1 105 /**
duke@1 106 * Print the script code to be embeded before the &lt;/HEAD&gt; tag.
duke@1 107 */
duke@1 108 protected void printWinTitleScript(String winTitle){
duke@1 109 if(winTitle != null && winTitle.length() > 0) {
duke@1 110 script();
duke@1 111 println("function windowTitle()");
duke@1 112 println("{");
duke@1 113 println(" if (location.href.indexOf('is-external=true') == -1) {");
duke@1 114 println(" parent.document.title=\"" + winTitle + "\";");
duke@1 115 println(" }");
duke@1 116 println("}");
duke@1 117 scriptEnd();
duke@1 118 noScript();
duke@1 119 noScriptEnd();
duke@1 120 }
duke@1 121 }
duke@1 122
duke@1 123 /**
duke@1 124 * Print the Javascript &lt;SCRIPT&gt; start tag with its type
duke@1 125 * attribute.
duke@1 126 */
duke@1 127 public void script() {
duke@1 128 println("<SCRIPT type=\"text/javascript\">");
duke@1 129 }
duke@1 130
duke@1 131 /**
duke@1 132 * Print the Javascript &lt;/SCRIPT&gt; end tag.
duke@1 133 */
duke@1 134 public void scriptEnd() {
duke@1 135 println("</SCRIPT>");
duke@1 136 }
duke@1 137
duke@1 138 /**
duke@1 139 * Print the Javascript &lt;NOSCRIPT&gt; start tag.
duke@1 140 */
duke@1 141 public void noScript() {
duke@1 142 println("<NOSCRIPT>");
duke@1 143 }
duke@1 144
duke@1 145 /**
duke@1 146 * Print the Javascript &lt;/NOSCRIPT&gt; end tag.
duke@1 147 */
duke@1 148 public void noScriptEnd() {
duke@1 149 println("</NOSCRIPT>");
duke@1 150 }
duke@1 151
duke@1 152 /**
duke@1 153 * Return the Javascript call to be embedded in the &lt;BODY&gt; tag.
duke@1 154 * Return nothing if winTitle is empty.
duke@1 155 * @return the Javascript call to be embedded in the &lt;BODY&gt; tag.
duke@1 156 */
duke@1 157 protected String getWindowTitleOnload(){
duke@1 158 if(winTitle != null && winTitle.length() > 0) {
duke@1 159 return " onload=\"windowTitle();\"";
duke@1 160 } else {
duke@1 161 return "";
duke@1 162 }
duke@1 163 }
duke@1 164
duke@1 165 /**
duke@1 166 * Print &lt;BODY BGCOLOR="bgcolor"&gt;, including JavaScript
duke@1 167 * "onload" call to load windowtitle script. This script shows the name
duke@1 168 * of the document in the window title bar when frames are on.
duke@1 169 *
duke@1 170 * @param bgcolor Background color.
duke@1 171 * @param includeScript boolean set true if printing windowtitle script
duke@1 172 */
duke@1 173 public void body(String bgcolor, boolean includeScript) {
duke@1 174 print("<BODY BGCOLOR=\"" + bgcolor + "\"");
duke@1 175 if (includeScript) {
duke@1 176 print(getWindowTitleOnload());
duke@1 177 }
duke@1 178 println(">");
duke@1 179 }
duke@1 180
duke@1 181 /**
duke@1 182 * Print &lt;/BODY&gt; tag. Add a newline character at the end.
duke@1 183 */
duke@1 184 public void bodyEnd() {
duke@1 185 println("</BODY>");
duke@1 186 }
duke@1 187
duke@1 188 /**
duke@1 189 * Print &lt;TITLE&gt; tag. Add a newline character at the end.
duke@1 190 */
duke@1 191 public void title() {
duke@1 192 println("<TITLE>");
duke@1 193 }
duke@1 194
duke@1 195 /**
duke@1 196 * Print &lt;TITLE&gt; tag. Add a newline character at the end.
duke@1 197 *
duke@1 198 * @param winTitle The title of this document.
duke@1 199 */
duke@1 200 public void title(String winTitle) {
duke@1 201 // Set window title string which is later printed
duke@1 202 this.winTitle = winTitle;
duke@1 203 title();
duke@1 204 }
duke@1 205
duke@1 206
duke@1 207 /**
duke@1 208 * Print &lt;/TITLE&gt; tag. Add a newline character at the end.
duke@1 209 */
duke@1 210 public void titleEnd() {
duke@1 211 println("</TITLE>");
duke@1 212 }
duke@1 213
duke@1 214 /**
duke@1 215 * Print &lt;UL&gt; tag. Add a newline character at the end.
duke@1 216 */
duke@1 217 public void ul() {
duke@1 218 println("<UL>");
duke@1 219 }
duke@1 220
duke@1 221 /**
duke@1 222 * Print &lt;/UL&gt; tag. Add a newline character at the end.
duke@1 223 */
duke@1 224 public void ulEnd() {
duke@1 225 println("</UL>");
duke@1 226 }
duke@1 227
duke@1 228 /**
duke@1 229 * Print &lt;LI&gt; tag.
duke@1 230 */
duke@1 231 public void li() {
duke@1 232 print("<LI>");
duke@1 233 }
duke@1 234
duke@1 235 /**
duke@1 236 * Print &lt;LI TYPE="type"&gt; tag.
duke@1 237 *
duke@1 238 * @param type Type string.
duke@1 239 */
duke@1 240 public void li(String type) {
duke@1 241 print("<LI TYPE=\"" + type + "\">");
duke@1 242 }
duke@1 243
duke@1 244 /**
duke@1 245 * Print &lt;H1&gt; tag. Add a newline character at the end.
duke@1 246 */
duke@1 247 public void h1() {
duke@1 248 println("<H1>");
duke@1 249 }
duke@1 250
duke@1 251 /**
duke@1 252 * Print &lt;/H1&gt; tag. Add a newline character at the end.
duke@1 253 */
duke@1 254 public void h1End() {
duke@1 255 println("</H1>");
duke@1 256 }
duke@1 257
duke@1 258 /**
duke@1 259 * Print text with &lt;H1&gt; tag. Also adds &lt;/H1&gt; tag. Add a newline character
duke@1 260 * at the end of the text.
duke@1 261 *
duke@1 262 * @param text Text to be printed with &lt;H1&gt; format.
duke@1 263 */
duke@1 264 public void h1(String text) {
duke@1 265 h1();
duke@1 266 println(text);
duke@1 267 h1End();
duke@1 268 }
duke@1 269
duke@1 270 /**
duke@1 271 * Print &lt;H2&gt; tag. Add a newline character at the end.
duke@1 272 */
duke@1 273 public void h2() {
duke@1 274 println("<H2>");
duke@1 275 }
duke@1 276
duke@1 277 /**
duke@1 278 * Print text with &lt;H2&gt; tag. Also adds &lt;/H2&gt; tag. Add a newline character
duke@1 279 * at the end of the text.
duke@1 280 *
duke@1 281 * @param text Text to be printed with &lt;H2&gt; format.
duke@1 282 */
duke@1 283 public void h2(String text) {
duke@1 284 h2();
duke@1 285 println(text);
duke@1 286 h2End();
duke@1 287 }
duke@1 288
duke@1 289 /**
duke@1 290 * Print &lt;/H2&gt; tag. Add a newline character at the end.
duke@1 291 */
duke@1 292 public void h2End() {
duke@1 293 println("</H2>");
duke@1 294 }
duke@1 295
duke@1 296 /**
duke@1 297 * Print &lt;H3&gt; tag. Add a newline character at the end.
duke@1 298 */
duke@1 299 public void h3() {
duke@1 300 println("<H3>");
duke@1 301 }
duke@1 302
duke@1 303 /**
duke@1 304 * Print text with &lt;H3&gt; tag. Also adds &lt;/H3&gt; tag. Add a newline character
duke@1 305 * at the end of the text.
duke@1 306 *
duke@1 307 * @param text Text to be printed with &lt;H3&gt; format.
duke@1 308 */
duke@1 309 public void h3(String text) {
duke@1 310 h3();
duke@1 311 println(text);
duke@1 312 h3End();
duke@1 313 }
duke@1 314
duke@1 315 /**
duke@1 316 * Print &lt;/H3&gt; tag. Add a newline character at the end.
duke@1 317 */
duke@1 318 public void h3End() {
duke@1 319 println("</H3>");
duke@1 320 }
duke@1 321
duke@1 322 /**
duke@1 323 * Print &lt;H4&gt; tag. Add a newline character at the end.
duke@1 324 */
duke@1 325 public void h4() {
duke@1 326 println("<H4>");
duke@1 327 }
duke@1 328
duke@1 329 /**
duke@1 330 * Print &lt;/H4&gt; tag. Add a newline character at the end.
duke@1 331 */
duke@1 332 public void h4End() {
duke@1 333 println("</H4>");
duke@1 334 }
duke@1 335
duke@1 336 /**
duke@1 337 * Print text with &lt;H4&gt; tag. Also adds &lt;/H4&gt; tag. Add a newline character
duke@1 338 * at the end of the text.
duke@1 339 *
duke@1 340 * @param text Text to be printed with &lt;H4&gt; format.
duke@1 341 */
duke@1 342 public void h4(String text) {
duke@1 343 h4();
duke@1 344 println(text);
duke@1 345 h4End();
duke@1 346 }
duke@1 347
duke@1 348 /**
duke@1 349 * Print &lt;H5&gt; tag. Add a newline character at the end.
duke@1 350 */
duke@1 351 public void h5() {
duke@1 352 println("<H5>");
duke@1 353 }
duke@1 354
duke@1 355 /**
duke@1 356 * Print &lt;/H5&gt; tag. Add a newline character at the end.
duke@1 357 */
duke@1 358 public void h5End() {
duke@1 359 println("</H5>");
duke@1 360 }
duke@1 361
duke@1 362 /**
duke@1 363 * Print HTML &lt;IMG SRC="imggif" WIDTH="width" HEIGHT="height" ALT="imgname&gt;
duke@1 364 * tag. It prepends the "images" directory name to the "imggif". This
duke@1 365 * method is used for oneone format generation. Add a newline character
duke@1 366 * at the end.
duke@1 367 *
duke@1 368 * @param imggif Image GIF file.
duke@1 369 * @param imgname Image name.
duke@1 370 * @param width Width of the image.
duke@1 371 * @param height Height of the image.
duke@1 372 */
duke@1 373 public void img(String imggif, String imgname, int width, int height) {
duke@1 374 println("<IMG SRC=\"images/" + imggif + ".gif\""
duke@1 375 + " WIDTH=\"" + width + "\" HEIGHT=\"" + height
duke@1 376 + "\" ALT=\"" + imgname + "\">");
duke@1 377 }
duke@1 378
duke@1 379 /**
duke@1 380 * Print &lt;MENU&gt; tag. Add a newline character at the end.
duke@1 381 */
duke@1 382 public void menu() {
duke@1 383 println("<MENU>");
duke@1 384 }
duke@1 385
duke@1 386 /**
duke@1 387 * Print &lt;/MENU&gt; tag. Add a newline character at the end.
duke@1 388 */
duke@1 389 public void menuEnd() {
duke@1 390 println("</MENU>");
duke@1 391 }
duke@1 392
duke@1 393 /**
duke@1 394 * Print &lt;PRE&gt; tag. Add a newline character at the end.
duke@1 395 */
duke@1 396 public void pre() {
duke@1 397 println("<PRE>");
duke@1 398 }
duke@1 399
duke@1 400 /**
duke@1 401 * Print &lt;PRE&gt; tag without adding new line character at th eend.
duke@1 402 */
duke@1 403 public void preNoNewLine() {
duke@1 404 print("<PRE>");
duke@1 405 }
duke@1 406
duke@1 407 /**
duke@1 408 * Print &lt;/PRE&gt; tag. Add a newline character at the end.
duke@1 409 */
duke@1 410 public void preEnd() {
duke@1 411 println("</PRE>");
duke@1 412 }
duke@1 413
duke@1 414 /**
duke@1 415 * Print &lt;HR&gt; tag. Add a newline character at the end.
duke@1 416 */
duke@1 417 public void hr() {
duke@1 418 println("<HR>");
duke@1 419 }
duke@1 420
duke@1 421 /**
duke@1 422 * Print &lt;HR SIZE="size" WIDTH="widthpercent%"&gt; tag. Add a newline
duke@1 423 * character at the end.
duke@1 424 *
duke@1 425 * @param size Size of the ruler.
duke@1 426 * @param widthPercent Percentage Width of the ruler
duke@1 427 */
duke@1 428 public void hr(int size, int widthPercent) {
duke@1 429 println("<HR SIZE=\"" + size + "\" WIDTH=\"" + widthPercent + "%\">");
duke@1 430 }
duke@1 431
duke@1 432 /**
duke@1 433 * Print &lt;HR SIZE="size" NOSHADE&gt; tag. Add a newline character at the end.
duke@1 434 *
duke@1 435 * @param size Size of the ruler.
duke@1 436 * @param noshade noshade string.
duke@1 437 */
duke@1 438 public void hr(int size, String noshade) {
duke@1 439 println("<HR SIZE=\"" + size + "\" NOSHADE>");
duke@1 440 }
duke@1 441
duke@1 442 /**
bpatel@182 443 * Get the "&lt;STRONG&gt;" string.
duke@1 444 *
bpatel@182 445 * @return String Return String "&lt;STRONG&gt;";
duke@1 446 */
bpatel@182 447 public String getStrong() {
bpatel@182 448 return "<STRONG>";
duke@1 449 }
duke@1 450
duke@1 451 /**
bpatel@182 452 * Get the "&lt;/STRONG&gt;" string.
duke@1 453 *
bpatel@182 454 * @return String Return String "&lt;/STRONG&gt;";
duke@1 455 */
bpatel@182 456 public String getStrongEnd() {
bpatel@182 457 return "</STRONG>";
duke@1 458 }
duke@1 459
duke@1 460 /**
bpatel@182 461 * Print &lt;STRONG&gt; tag.
duke@1 462 */
bpatel@182 463 public void strong() {
bpatel@182 464 print("<STRONG>");
duke@1 465 }
duke@1 466
duke@1 467 /**
bpatel@182 468 * Print &lt;/STRONG&gt; tag.
duke@1 469 */
bpatel@182 470 public void strongEnd() {
bpatel@182 471 print("</STRONG>");
duke@1 472 }
duke@1 473
duke@1 474 /**
bpatel@182 475 * Print text passed, in strong format using &lt;STRONG&gt; and &lt;/STRONG&gt; tags.
duke@1 476 *
bpatel@182 477 * @param text String to be printed in between &lt;STRONG&gt; and &lt;/STRONG&gt; tags.
duke@1 478 */
bpatel@182 479 public void strong(String text) {
bpatel@182 480 strong();
duke@1 481 print(text);
bpatel@182 482 strongEnd();
duke@1 483 }
duke@1 484
duke@1 485 /**
duke@1 486 * Print text passed, in Italics using &lt;I&gt; and &lt;/I&gt; tags.
duke@1 487 *
duke@1 488 * @param text String to be printed in between &lt;I&gt; and &lt;/I&gt; tags.
duke@1 489 */
duke@1 490 public void italics(String text) {
duke@1 491 print("<I>");
duke@1 492 print(text);
duke@1 493 println("</I>");
duke@1 494 }
duke@1 495
duke@1 496 /**
duke@1 497 * Return, text passed, with Italics &lt;I&gt; and &lt;/I&gt; tags, surrounding it.
duke@1 498 * So if the text passed is "Hi", then string returned will be "&lt;I&gt;Hi&lt;/I&gt;".
duke@1 499 *
duke@1 500 * @param text String to be printed in between &lt;I&gt; and &lt;/I&gt; tags.
duke@1 501 */
duke@1 502 public String italicsText(String text) {
duke@1 503 return "<I>" + text + "</I>";
duke@1 504 }
duke@1 505
duke@1 506 public String codeText(String text) {
duke@1 507 return "<CODE>" + text + "</CODE>";
duke@1 508 }
duke@1 509
duke@1 510 /**
duke@1 511 * Print "&#38;nbsp;", non-breaking space.
duke@1 512 */
duke@1 513 public void space() {
duke@1 514 print("&nbsp;");
duke@1 515 }
duke@1 516
duke@1 517 /**
duke@1 518 * Print &lt;DL&gt; tag. Add a newline character at the end.
duke@1 519 */
duke@1 520 public void dl() {
duke@1 521 println("<DL>");
duke@1 522 }
duke@1 523
duke@1 524 /**
duke@1 525 * Print &lt;/DL&gt; tag. Add a newline character at the end.
duke@1 526 */
duke@1 527 public void dlEnd() {
duke@1 528 println("</DL>");
duke@1 529 }
duke@1 530
duke@1 531 /**
duke@1 532 * Print &lt;DT&gt; tag.
duke@1 533 */
duke@1 534 public void dt() {
duke@1 535 print("<DT>");
duke@1 536 }
duke@1 537
duke@1 538 /**
bpatel@233 539 * Print &lt;/DT&gt; tag.
bpatel@233 540 */
bpatel@233 541 public void dtEnd() {
bpatel@233 542 print("</DT>");
bpatel@233 543 }
bpatel@233 544
bpatel@233 545 /**
bpatel@233 546 * Print &lt;DD&gt; tag.
duke@1 547 */
duke@1 548 public void dd() {
duke@1 549 print("<DD>");
duke@1 550 }
duke@1 551
duke@1 552 /**
duke@1 553 * Print &lt;/DD&gt; tag. Add a newline character at the end.
duke@1 554 */
duke@1 555 public void ddEnd() {
duke@1 556 println("</DD>");
duke@1 557 }
duke@1 558
duke@1 559 /**
duke@1 560 * Print &lt;SUP&gt; tag. Add a newline character at the end.
duke@1 561 */
duke@1 562 public void sup() {
duke@1 563 println("<SUP>");
duke@1 564 }
duke@1 565
duke@1 566 /**
duke@1 567 * Print &lt;/SUP&gt; tag. Add a newline character at the end.
duke@1 568 */
duke@1 569 public void supEnd() {
duke@1 570 println("</SUP>");
duke@1 571 }
duke@1 572
duke@1 573 /**
duke@1 574 * Print &lt;FONT SIZE="size"&gt; tag. Add a newline character at the end.
duke@1 575 *
duke@1 576 * @param size String size.
duke@1 577 */
duke@1 578 public void font(String size) {
duke@1 579 println("<FONT SIZE=\"" + size + "\">");
duke@1 580 }
duke@1 581
duke@1 582 /**
duke@1 583 * Print &lt;FONT SIZE="size"&gt; tag.
duke@1 584 *
duke@1 585 * @param size String size.
duke@1 586 */
duke@1 587 public void fontNoNewLine(String size) {
duke@1 588 print("<FONT SIZE=\"" + size + "\">");
duke@1 589 }
duke@1 590
duke@1 591 /**
duke@1 592 * Print &lt;FONT CLASS="stylename"&gt; tag. Add a newline character at the end.
duke@1 593 *
duke@1 594 * @param stylename String stylename.
duke@1 595 */
duke@1 596 public void fontStyle(String stylename) {
duke@1 597 print("<FONT CLASS=\"" + stylename + "\">");
duke@1 598 }
duke@1 599
duke@1 600 /**
duke@1 601 * Print &lt;FONT SIZE="size" CLASS="stylename"&gt; tag. Add a newline character
duke@1 602 * at the end.
duke@1 603 *
duke@1 604 * @param size String size.
duke@1 605 * @param stylename String stylename.
duke@1 606 */
duke@1 607 public void fontSizeStyle(String size, String stylename) {
duke@1 608 println("<FONT size=\"" + size + "\" CLASS=\"" + stylename + "\">");
duke@1 609 }
duke@1 610
duke@1 611 /**
duke@1 612 * Print &lt;/FONT&gt; tag.
duke@1 613 */
duke@1 614 public void fontEnd() {
duke@1 615 print("</FONT>");
duke@1 616 }
duke@1 617
duke@1 618 /**
duke@1 619 * Get the "&lt;FONT COLOR="color"&gt;" string.
duke@1 620 *
duke@1 621 * @param color String color.
duke@1 622 * @return String Return String "&lt;FONT COLOR="color"&gt;".
duke@1 623 */
duke@1 624 public String getFontColor(String color) {
duke@1 625 return "<FONT COLOR=\"" + color + "\">";
duke@1 626 }
duke@1 627
duke@1 628 /**
duke@1 629 * Get the "&lt;/FONT&gt;" string.
duke@1 630 *
duke@1 631 * @return String Return String "&lt;/FONT&gt;";
duke@1 632 */
duke@1 633 public String getFontEnd() {
duke@1 634 return "</FONT>";
duke@1 635 }
duke@1 636
duke@1 637 /**
duke@1 638 * Print &lt;CENTER&gt; tag. Add a newline character at the end.
duke@1 639 */
duke@1 640 public void center() {
duke@1 641 println("<CENTER>");
duke@1 642 }
duke@1 643
duke@1 644 /**
duke@1 645 * Print &lt;/CENTER&gt; tag. Add a newline character at the end.
duke@1 646 */
duke@1 647 public void centerEnd() {
duke@1 648 println("</CENTER>");
duke@1 649 }
duke@1 650
duke@1 651 /**
duke@1 652 * Print anchor &lt;A NAME="name"&gt; tag.
duke@1 653 *
duke@1 654 * @param name Name String.
duke@1 655 */
duke@1 656 public void aName(String name) {
duke@1 657 print("<A NAME=\"" + name + "\">");
duke@1 658 }
duke@1 659
duke@1 660 /**
duke@1 661 * Print &lt;/A&gt; tag.
duke@1 662 */
duke@1 663 public void aEnd() {
duke@1 664 print("</A>");
duke@1 665 }
duke@1 666
duke@1 667 /**
duke@1 668 * Print &lt;I&gt; tag.
duke@1 669 */
duke@1 670 public void italic() {
duke@1 671 print("<I>");
duke@1 672 }
duke@1 673
duke@1 674 /**
duke@1 675 * Print &lt;/I&gt; tag.
duke@1 676 */
duke@1 677 public void italicEnd() {
duke@1 678 print("</I>");
duke@1 679 }
duke@1 680
duke@1 681 /**
duke@1 682 * Print contents within anchor &lt;A NAME="name"&gt; tags.
duke@1 683 *
duke@1 684 * @param name String name.
duke@1 685 * @param content String contents.
duke@1 686 */
duke@1 687 public void anchor(String name, String content) {
duke@1 688 aName(name);
duke@1 689 print(content);
duke@1 690 aEnd();
duke@1 691 }
duke@1 692
duke@1 693 /**
duke@1 694 * Print anchor &lt;A NAME="name"&gt; and &lt;/A&gt;tags. Print comment string
duke@1 695 * "&lt;!-- --&gt;" within those tags.
duke@1 696 *
duke@1 697 * @param name String name.
duke@1 698 */
duke@1 699 public void anchor(String name) {
duke@1 700 anchor(name, "<!-- -->");
duke@1 701 }
duke@1 702
duke@1 703 /**
duke@1 704 * Print newline and then print &lt;P&gt; tag. Add a newline character at the
duke@1 705 * end.
duke@1 706 */
duke@1 707 public void p() {
duke@1 708 println();
duke@1 709 println("<P>");
duke@1 710 }
duke@1 711
duke@1 712 /**
duke@1 713 * Print newline and then print &lt;/P&gt; tag. Add a newline character at the
duke@1 714 * end.
duke@1 715 */
duke@1 716 public void pEnd() {
duke@1 717 println();
duke@1 718 println("</P>");
duke@1 719 }
duke@1 720
duke@1 721 /**
duke@1 722 * Print newline and then print &lt;BR&gt; tag. Add a newline character at the
duke@1 723 * end.
duke@1 724 */
duke@1 725 public void br() {
duke@1 726 println();
duke@1 727 println("<BR>");
duke@1 728 }
duke@1 729
duke@1 730 /**
duke@1 731 * Print &lt;ADDRESS&gt; tag. Add a newline character at the end.
duke@1 732 */
duke@1 733 public void address() {
duke@1 734 println("<ADDRESS>");
duke@1 735 }
duke@1 736
duke@1 737 /**
duke@1 738 * Print &lt;/ADDRESS&gt; tag. Add a newline character at the end.
duke@1 739 */
duke@1 740 public void addressEnd() {
duke@1 741 println("</ADDRESS>");
duke@1 742 }
duke@1 743
duke@1 744 /**
duke@1 745 * Print &lt;HEAD&gt; tag. Add a newline character at the end.
duke@1 746 */
duke@1 747 public void head() {
duke@1 748 println("<HEAD>");
duke@1 749 }
duke@1 750
duke@1 751 /**
duke@1 752 * Print &lt;/HEAD&gt; tag. Add a newline character at the end.
duke@1 753 */
duke@1 754 public void headEnd() {
duke@1 755 println("</HEAD>");
duke@1 756 }
duke@1 757
duke@1 758 /**
duke@1 759 * Print &lt;CODE&gt; tag.
duke@1 760 */
duke@1 761 public void code() {
duke@1 762 print("<CODE>");
duke@1 763 }
duke@1 764
duke@1 765 /**
duke@1 766 * Print &lt;/CODE&gt; tag.
duke@1 767 */
duke@1 768 public void codeEnd() {
duke@1 769 print("</CODE>");
duke@1 770 }
duke@1 771
duke@1 772 /**
duke@1 773 * Print &lt;EM&gt; tag. Add a newline character at the end.
duke@1 774 */
duke@1 775 public void em() {
duke@1 776 println("<EM>");
duke@1 777 }
duke@1 778
duke@1 779 /**
duke@1 780 * Print &lt;/EM&gt; tag. Add a newline character at the end.
duke@1 781 */
duke@1 782 public void emEnd() {
duke@1 783 println("</EM>");
duke@1 784 }
duke@1 785
duke@1 786 /**
duke@1 787 * Print HTML &lt;TABLE BORDER="border" WIDTH="width"
duke@1 788 * CELLPADDING="cellpadding" CELLSPACING="cellspacing"&gt; tag.
duke@1 789 *
duke@1 790 * @param border Border size.
duke@1 791 * @param width Width of the table.
duke@1 792 * @param cellpadding Cellpadding for the table cells.
duke@1 793 * @param cellspacing Cellspacing for the table cells.
duke@1 794 */
duke@1 795 public void table(int border, String width, int cellpadding,
duke@1 796 int cellspacing) {
duke@1 797 println(DocletConstants.NL +
duke@1 798 "<TABLE BORDER=\"" + border +
duke@1 799 "\" WIDTH=\"" + width +
duke@1 800 "\" CELLPADDING=\"" + cellpadding +
duke@1 801 "\" CELLSPACING=\"" + cellspacing +
duke@1 802 "\" SUMMARY=\"\">");
duke@1 803 }
duke@1 804
duke@1 805 /**
duke@1 806 * Print HTML &lt;TABLE BORDER="border" CELLPADDING="cellpadding"
duke@1 807 * CELLSPACING="cellspacing"&gt; tag.
duke@1 808 *
duke@1 809 * @param border Border size.
duke@1 810 * @param cellpadding Cellpadding for the table cells.
duke@1 811 * @param cellspacing Cellspacing for the table cells.
duke@1 812 */
duke@1 813 public void table(int border, int cellpadding, int cellspacing) {
duke@1 814 println(DocletConstants.NL +
duke@1 815 "<TABLE BORDER=\"" + border +
duke@1 816 "\" CELLPADDING=\"" + cellpadding +
duke@1 817 "\" CELLSPACING=\"" + cellspacing +
duke@1 818 "\" SUMMARY=\"\">");
duke@1 819 }
duke@1 820
duke@1 821 /**
duke@1 822 * Print HTML &lt;TABLE BORDER="border" WIDTH="width"&gt;
duke@1 823 *
duke@1 824 * @param border Border size.
duke@1 825 * @param width Width of the table.
duke@1 826 */
duke@1 827 public void table(int border, String width) {
duke@1 828 println(DocletConstants.NL +
duke@1 829 "<TABLE BORDER=\"" + border +
duke@1 830 "\" WIDTH=\"" + width +
duke@1 831 "\" SUMMARY=\"\">");
duke@1 832 }
duke@1 833
duke@1 834 /**
duke@1 835 * Print the HTML table tag with border size 0 and width 100%.
duke@1 836 */
duke@1 837 public void table() {
duke@1 838 table(0, "100%");
duke@1 839 }
duke@1 840
duke@1 841 /**
duke@1 842 * Print &lt;/TABLE&gt; tag. Add a newline character at the end.
duke@1 843 */
duke@1 844 public void tableEnd() {
duke@1 845 println("</TABLE>");
duke@1 846 }
duke@1 847
duke@1 848 /**
duke@1 849 * Print &lt;TR&gt; tag. Add a newline character at the end.
duke@1 850 */
duke@1 851 public void tr() {
duke@1 852 println("<TR>");
duke@1 853 }
duke@1 854
duke@1 855 /**
duke@1 856 * Print &lt;/TR&gt; tag. Add a newline character at the end.
duke@1 857 */
duke@1 858 public void trEnd() {
duke@1 859 println("</TR>");
duke@1 860 }
duke@1 861
duke@1 862 /**
duke@1 863 * Print &lt;TD&gt; tag.
duke@1 864 */
duke@1 865 public void td() {
duke@1 866 print("<TD>");
duke@1 867 }
duke@1 868
duke@1 869 /**
duke@1 870 * Print &lt;TD NOWRAP&gt; tag.
duke@1 871 */
duke@1 872 public void tdNowrap() {
duke@1 873 print("<TD NOWRAP>");
duke@1 874 }
duke@1 875
duke@1 876 /**
duke@1 877 * Print &lt;TD WIDTH="width"&gt; tag.
duke@1 878 *
duke@1 879 * @param width String width.
duke@1 880 */
duke@1 881 public void tdWidth(String width) {
duke@1 882 print("<TD WIDTH=\"" + width + "\">");
duke@1 883 }
duke@1 884
duke@1 885 /**
duke@1 886 * Print &lt;/TD&gt; tag. Add a newline character at the end.
duke@1 887 */
duke@1 888 public void tdEnd() {
duke@1 889 println("</TD>");
duke@1 890 }
duke@1 891
duke@1 892 /**
duke@1 893 * Print &lt;LINK str&gt; tag.
duke@1 894 *
duke@1 895 * @param str String.
duke@1 896 */
duke@1 897 public void link(String str) {
duke@1 898 println("<LINK " + str + ">");
duke@1 899 }
duke@1 900
duke@1 901 /**
duke@1 902 * Print "&lt;!-- " comment start string.
duke@1 903 */
duke@1 904 public void commentStart() {
duke@1 905 print("<!-- ");
duke@1 906 }
duke@1 907
duke@1 908 /**
duke@1 909 * Print "--&gt;" comment end string. Add a newline character at the end.
duke@1 910 */
duke@1 911 public void commentEnd() {
duke@1 912 println("-->");
duke@1 913 }
duke@1 914
duke@1 915 /**
duke@1 916 * Print &lt;TR BGCOLOR="color" CLASS="stylename"&gt; tag. Adds a newline character
duke@1 917 * at the end.
duke@1 918 *
duke@1 919 * @param color String color.
duke@1 920 * @param stylename String stylename.
duke@1 921 */
duke@1 922 public void trBgcolorStyle(String color, String stylename) {
duke@1 923 println("<TR BGCOLOR=\"" + color + "\" CLASS=\"" + stylename + "\">");
duke@1 924 }
duke@1 925
duke@1 926 /**
duke@1 927 * Print &lt;TR BGCOLOR="color"&gt; tag. Adds a newline character at the end.
duke@1 928 *
duke@1 929 * @param color String color.
duke@1 930 */
duke@1 931 public void trBgcolor(String color) {
duke@1 932 println("<TR BGCOLOR=\"" + color + "\">");
duke@1 933 }
duke@1 934
duke@1 935 /**
duke@1 936 * Print &lt;TR ALIGN="align" VALIGN="valign"&gt; tag. Adds a newline character
duke@1 937 * at the end.
duke@1 938 *
duke@1 939 * @param align String align.
duke@1 940 * @param valign String valign.
duke@1 941 */
duke@1 942 public void trAlignVAlign(String align, String valign) {
duke@1 943 println("<TR ALIGN=\"" + align + "\" VALIGN=\"" + valign + "\">");
duke@1 944 }
duke@1 945
duke@1 946 /**
duke@1 947 * Print &lt;TH ALIGN="align"&gt; tag.
duke@1 948 *
duke@1 949 * @param align the align attribute.
duke@1 950 */
duke@1 951 public void thAlign(String align) {
duke@1 952 print("<TH ALIGN=\"" + align + "\">");
duke@1 953 }
duke@1 954
duke@1 955 /**
duke@1 956 * Print &lt;TH align="align" COLSPAN=i&gt; tag.
duke@1 957 *
duke@1 958 * @param align the align attribute.
duke@1 959 * @param i integer.
duke@1 960 */
duke@1 961 public void thAlignColspan(String align, int i) {
duke@1 962 print("<TH ALIGN=\"" + align + "\" COLSPAN=\"" + i + "\">");
duke@1 963 }
duke@1 964
duke@1 965 /**
duke@1 966 * Print &lt;TH align="align" NOWRAP&gt; tag.
duke@1 967 *
duke@1 968 * @param align the align attribute.
duke@1 969 */
duke@1 970 public void thAlignNowrap(String align) {
duke@1 971 print("<TH ALIGN=\"" + align + "\" NOWRAP>");
duke@1 972 }
duke@1 973
duke@1 974 /**
duke@1 975 * Print &lt;/TH&gt; tag. Add a newline character at the end.
duke@1 976 */
duke@1 977 public void thEnd() {
duke@1 978 println("</TH>");
duke@1 979 }
duke@1 980
duke@1 981 /**
duke@1 982 * Print &lt;TD COLSPAN=i&gt; tag.
duke@1 983 *
duke@1 984 * @param i integer.
duke@1 985 */
duke@1 986 public void tdColspan(int i) {
duke@1 987 print("<TD COLSPAN=" + i + ">");
duke@1 988 }
duke@1 989
duke@1 990 /**
duke@1 991 * Print &lt;TD BGCOLOR="color" CLASS="stylename"&gt; tag.
duke@1 992 *
duke@1 993 * @param color String color.
duke@1 994 * @param stylename String stylename.
duke@1 995 */
duke@1 996 public void tdBgcolorStyle(String color, String stylename) {
duke@1 997 print("<TD BGCOLOR=\"" + color + "\" CLASS=\"" + stylename + "\">");
duke@1 998 }
duke@1 999
duke@1 1000 /**
duke@1 1001 * Print &lt;TD COLSPAN=i BGCOLOR="color" CLASS="stylename"&gt; tag.
duke@1 1002 *
duke@1 1003 * @param i integer.
duke@1 1004 * @param color String color.
duke@1 1005 * @param stylename String stylename.
duke@1 1006 */
duke@1 1007 public void tdColspanBgcolorStyle(int i, String color, String stylename) {
duke@1 1008 print("<TD COLSPAN=" + i + " BGCOLOR=\"" + color + "\" CLASS=\"" +
duke@1 1009 stylename + "\">");
duke@1 1010 }
duke@1 1011
duke@1 1012 /**
duke@1 1013 * Print &lt;TD ALIGN="align"&gt; tag. Adds a newline character
duke@1 1014 * at the end.
duke@1 1015 *
duke@1 1016 * @param align String align.
duke@1 1017 */
duke@1 1018 public void tdAlign(String align) {
duke@1 1019 print("<TD ALIGN=\"" + align + "\">");
duke@1 1020 }
duke@1 1021
duke@1 1022 /**
duke@1 1023 * Print &lt;TD ALIGN="align" CLASS="stylename"&gt; tag.
duke@1 1024 *
duke@1 1025 * @param align String align.
duke@1 1026 * @param stylename String stylename.
duke@1 1027 */
duke@1 1028 public void tdVAlignClass(String align, String stylename) {
duke@1 1029 print("<TD VALIGN=\"" + align + "\" CLASS=\"" + stylename + "\">");
duke@1 1030 }
duke@1 1031
duke@1 1032 /**
duke@1 1033 * Print &lt;TD VALIGN="valign"&gt; tag.
duke@1 1034 *
duke@1 1035 * @param valign String valign.
duke@1 1036 */
duke@1 1037 public void tdVAlign(String valign) {
duke@1 1038 print("<TD VALIGN=\"" + valign + "\">");
duke@1 1039 }
duke@1 1040
duke@1 1041 /**
duke@1 1042 * Print &lt;TD ALIGN="align" VALIGN="valign"&gt; tag.
duke@1 1043 *
duke@1 1044 * @param align String align.
duke@1 1045 * @param valign String valign.
duke@1 1046 */
duke@1 1047 public void tdAlignVAlign(String align, String valign) {
duke@1 1048 print("<TD ALIGN=\"" + align + "\" VALIGN=\"" + valign + "\">");
duke@1 1049 }
duke@1 1050
duke@1 1051 /**
duke@1 1052 * Print &lt;TD ALIGN="align" ROWSPAN=rowspan&gt; tag.
duke@1 1053 *
duke@1 1054 * @param align String align.
duke@1 1055 * @param rowspan integer rowspan.
duke@1 1056 */
duke@1 1057 public void tdAlignRowspan(String align, int rowspan) {
duke@1 1058 print("<TD ALIGN=\"" + align + "\" ROWSPAN=" + rowspan + ">");
duke@1 1059 }
duke@1 1060
duke@1 1061 /**
duke@1 1062 * Print &lt;TD ALIGN="align" VALIGN="valign" ROWSPAN=rowspan&gt; tag.
duke@1 1063 *
duke@1 1064 * @param align String align.
duke@1 1065 * @param valign String valign.
duke@1 1066 * @param rowspan integer rowspan.
duke@1 1067 */
duke@1 1068 public void tdAlignVAlignRowspan(String align, String valign,
duke@1 1069 int rowspan) {
duke@1 1070 print("<TD ALIGN=\"" + align + "\" VALIGN=\"" + valign
duke@1 1071 + "\" ROWSPAN=" + rowspan + ">");
duke@1 1072 }
duke@1 1073
duke@1 1074 /**
duke@1 1075 * Print &lt;BLOCKQUOTE&gt; tag. Add a newline character at the end.
duke@1 1076 */
duke@1 1077 public void blockquote() {
duke@1 1078 println("<BLOCKQUOTE>");
duke@1 1079 }
duke@1 1080
duke@1 1081 /**
duke@1 1082 * Print &lt;/BLOCKQUOTE&gt; tag. Add a newline character at the end.
duke@1 1083 */
duke@1 1084 public void blockquoteEnd() {
duke@1 1085 println("</BLOCKQUOTE>");
duke@1 1086 }
duke@1 1087
duke@1 1088 /**
duke@1 1089 * Get the "&lt;CODE&gt;" string.
duke@1 1090 *
duke@1 1091 * @return String Return String "&lt;CODE>";
duke@1 1092 */
duke@1 1093 public String getCode() {
duke@1 1094 return "<CODE>";
duke@1 1095 }
duke@1 1096
duke@1 1097 /**
duke@1 1098 * Get the "&lt;/CODE&gt;" string.
duke@1 1099 *
duke@1 1100 * @return String Return String "&lt;/CODE&gt;";
duke@1 1101 */
duke@1 1102 public String getCodeEnd() {
duke@1 1103 return "</CODE>";
duke@1 1104 }
duke@1 1105
duke@1 1106 /**
duke@1 1107 * Print &lt;NOFRAMES&gt; tag. Add a newline character at the end.
duke@1 1108 */
duke@1 1109 public void noFrames() {
duke@1 1110 println("<NOFRAMES>");
duke@1 1111 }
duke@1 1112
duke@1 1113 /**
duke@1 1114 * Print &lt;/NOFRAMES&gt; tag. Add a newline character at the end.
duke@1 1115 */
duke@1 1116 public void noFramesEnd() {
duke@1 1117 println("</NOFRAMES>");
duke@1 1118 }
duke@1 1119 }

mercurial