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

Mon, 09 Mar 2009 13:29:06 -0700

author
xdono
date
Mon, 09 Mar 2009 13:29:06 -0700
changeset 229
03bcd66bd8e7
parent 191
d79ad96ce47c
child 240
8c55d5b0ed71
permissions
-rw-r--r--

6814575: Update copyright year
Summary: Update copyright for files that have been modified in 2009, up to 03/09
Reviewed-by: katleman, tbell, ohair

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

mercurial