langtools/test/tools/javac/diags/HTMLWriter.java
author jjg
Mon, 20 Jun 2016 13:21:09 -0700
changeset 39176 eef1aa371e87
parent 34752 9c262a013456
permissions -rw-r--r--
8159537: create build file to generate diags reports for all locales Reviewed-by: mcimadamore
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
6149
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
     1
/*
39176
eef1aa371e87 8159537: create build file to generate diags reports for all locales
jjg
parents: 34752
diff changeset
     2
 * Copyright (c) 1996, 2016, Oracle and/or its affiliates. All rights reserved.
6149
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
     4
 *
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
     7
 * published by the Free Software Foundation.
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
     8
 *
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
    13
 * accompanied this code).
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
    14
 *
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
    18
 *
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
    20
 * or visit www.oracle.com if you need additional information or have any
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
    21
 * questions.
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
    22
 */
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
    23
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
    24
import java.io.BufferedWriter;
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
    25
import java.io.File;
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
    26
import java.io.IOException;
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
    27
import java.io.Writer;
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
    28
import java.net.URL;
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
    29
import java.text.MessageFormat;
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
    30
import java.util.ResourceBundle;
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
    31
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
    32
/**
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
    33
 * A class to facilitate writing HTML via a stream.
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
    34
 */
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
    35
public class HTMLWriter
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
    36
{
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
    37
    /**
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
    38
     * Create an HTMLWriter object, using a default doctype for HTML 3.2.
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
    39
     * @param out a Writer to which to write the generated HTML
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
    40
     * @throws IOException if there is a problem writing to the underlying stream
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
    41
     */
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
    42
    public HTMLWriter(Writer out) throws IOException {
39176
eef1aa371e87 8159537: create build file to generate diags reports for all locales
jjg
parents: 34752
diff changeset
    43
        this(out, "<!DOCTYPE html\">");
6149
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
    44
    }
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
    45
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
    46
    /**
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
    47
     * Create an HTMLWriter object, using a specifed doctype header.
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
    48
     * @param out a Writer to which to write the generated HTML
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
    49
     * @param docType a string containing a doctype header for the HTML to be generetaed
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
    50
     * @throws IOException if there is a problem writing to the underlying stream
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
    51
     */
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
    52
    public HTMLWriter(Writer out, String docType) throws IOException {
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
    53
        if (out instanceof BufferedWriter)
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
    54
            this.out = (BufferedWriter) out;
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
    55
        else
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
    56
            this.out = new BufferedWriter(out);
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
    57
        this.out.write(docType);
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
    58
        this.out.newLine();
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
    59
    }
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
    60
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
    61
    /**
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
    62
     * Create an HTMLWriter object, using a specified bundle for localizing messages.
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
    63
     * @param out a Writer to which to write the generated HTML
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
    64
     * @param i18n a resource bundle to use to localize messages
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
    65
     * @throws IOException if there is a problem writing to the underlying stream
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
    66
     */
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
    67
    public HTMLWriter(Writer out, ResourceBundle i18n) throws IOException {
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
    68
        this(out);
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
    69
        this.i18n = i18n;
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
    70
    }
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
    71
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
    72
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
    73
    /**
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
    74
     * Create an HTMLWriter object, using a specifed doctype header and
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
    75
     * using a specified bundle for l0calizing messages.
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
    76
     * @param out a Writer to which to write the generated HTML
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
    77
     * @param docType a string containing a doctype header for the HTML to be generetaed
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
    78
     * @param i18n a resource bundle to use to localize messages
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
    79
     * @throws IOException if there is a problem writing to the underlying stream
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
    80
     */
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
    81
    public HTMLWriter(Writer out, String docType, ResourceBundle i18n) throws IOException {
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
    82
        this(out, docType);
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
    83
        this.i18n = i18n;
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
    84
    }
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
    85
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
    86
    /**
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
    87
     * Set the reource bundle to be used for localizing messages.
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
    88
     * @param i18n the resource bundle to be used for localizing messages
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
    89
     */
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
    90
    public void setResourceBundle(ResourceBundle i18n) {
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
    91
        this.i18n = i18n;
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
    92
    }
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
    93
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
    94
    /**
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
    95
     * Flush the stream, and the underlying output stream.
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
    96
     * @throws IOException if there is a problem writing to the underlying stream
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
    97
     */
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
    98
    public void flush() throws IOException {
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
    99
        out.flush();
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
   100
    }
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
   101
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
   102
    /**
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
   103
     * Close the stream, and the underlying output stream.
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
   104
     * @throws IOException if there is a problem closing the underlying stream
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
   105
     */
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
   106
    public void close() throws IOException {
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
   107
        out.close();
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
   108
    }
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
   109
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
   110
    /**
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
   111
     * Write a newline to the underlying output stream.
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
   112
     * @throws IOException if there is a problem writing to the underlying stream
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
   113
     */
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
   114
    public void newLine() throws IOException {
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
   115
        out.newLine();
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
   116
    }
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
   117
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
   118
    /**
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
   119
     * Start an HTML tag.  If a prior tag has been started, it will
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
   120
     * be closed first. Once a tag has been opened, attributes for the
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
   121
     * tag may be written out, followed by body content before finally
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
   122
     * ending the tag.
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
   123
     * @param tag the tag to be started
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
   124
     * @throws IOException if there is a problem writing to the underlying stream
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
   125
     * @see #writeAttr
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
   126
     * @see #write
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
   127
     * @see #endTag
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
   128
     */
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
   129
    public void startTag(String tag) throws IOException {
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
   130
        if (state == IN_TAG) {
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
   131
            out.write(">");
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
   132
            state = IN_BODY;
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
   133
        }
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
   134
        //newLine();
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
   135
        out.write("<");
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
   136
        out.write(tag);
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
   137
        state = IN_TAG;
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
   138
    }
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
   139
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
   140
    /**
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
   141
     * Finish an HTML tag. It is expected that a call to endTag will match
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
   142
     * a corresponding earlier call to startTag, but there is no formal check
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
   143
     * for this.
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
   144
     * @param tag the tag to be closed.
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
   145
     * @throws IOException if there is a problem writing to the underlying stream
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
   146
     */
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
   147
    public void endTag(String tag) throws IOException {
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
   148
        if (state == IN_TAG) {
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
   149
            out.write(">");
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
   150
            state = IN_BODY;
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
   151
            out.newLine();
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
   152
        }
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
   153
        out.write("</");
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
   154
        out.write(tag);
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
   155
        out.write(">");
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
   156
        //out.newLine();   // PATCHED, jjg
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
   157
        state = IN_BODY;
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
   158
    }
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
   159
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
   160
    /**
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
   161
     * Finish an empty element tag, such as a META, BASE or LINK tag.
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
   162
     * This is expected to correspond with a startTag.
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
   163
     * @param tag the tag which is being closed.  this is only useful for
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
   164
     *        validation, it is not written out
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
   165
     * @throws IllegalStateException if this call does not follow startTag
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
   166
     *         (stream is not currently inside a tag)
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
   167
     * @throws IOException if there is a problem writing to the underlying stream
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
   168
     */
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
   169
    public void endEmptyTag(String tag) throws IOException {
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
   170
        if (state != IN_TAG)
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
   171
            throw new IllegalStateException();
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
   172
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
   173
        out.write(">");
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
   174
        state = IN_BODY;
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
   175
        out.newLine();
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
   176
    }
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
   177
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
   178
    /**
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
   179
     * Write an attribute for a tag. A tag must previously have been started.
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
   180
     * All tag attributes must be written before any body text is written.
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
   181
     * The value will be quoted if necessary when writing it to the underlying
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
   182
     * stream. No check is made that the attribute is valid for the current tag.
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
   183
     * @param name the name of the attribute to be written
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
   184
     * @param value the value of the attribute to be written
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
   185
     * @throws IllegalStateException if the stream is not in a state to
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
   186
     * write attributes -- e.g. if this call does not follow startTag or other
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
   187
     * calls of writteAttr
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
   188
     * @throws IOException if there is a problem writing to the underlying stream
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
   189
     */
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
   190
    public void writeAttr(String name, String value) throws IOException {
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
   191
        if (state != IN_TAG)
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
   192
            throw new IllegalStateException();
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
   193
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
   194
        out.write(" ");
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
   195
        out.write(name);
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
   196
        out.write("=");
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
   197
        boolean alpha = true;
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
   198
        for (int i = 0; i < value.length() && alpha; i++)
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
   199
            alpha = Character.isLetter(value.charAt(i));
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
   200
        if (!alpha)
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
   201
            out.write("\"");
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
   202
        out.write(value);
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
   203
        if (!alpha)
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
   204
            out.write("\"");
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
   205
    }
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
   206
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
   207
    /**
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
   208
     * Write an attribute for a tag. A tag must previously have been started.
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
   209
     * All tag attributes must be written before any body text is written.
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
   210
     * The value will be quoted if necessary when writing it to the underlying
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
   211
     * stream. No check is made that the attribute is valid for the current tag.
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
   212
     * @param name the name of the attribute to be written
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
   213
     * @param value the value of the attribute to be written
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
   214
     * @throws IllegalStateException if the stream is not in a state to
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
   215
     * write attributes -- e.g. if this call does not follow startTag or other
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
   216
     * calls of writteAttr
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
   217
     * @throws IOException if there is a problem writing to the underlying stream
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
   218
     */
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
   219
    public void writeAttr(String name, int value) throws IOException {
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
   220
        writeAttr(name, Integer.toString(value));
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
   221
    }
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
   222
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
   223
    /**
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
   224
     * Write a line of text, followed by a newline.
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
   225
     * The text will be escaped as necessary.
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
   226
     * @param text the text to be written.
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
   227
     * @throws IOException if there is a problem closing the underlying stream
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
   228
     */
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
   229
    public void writeLine(String text) throws IOException {
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
   230
        write(text);
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
   231
        out.newLine();
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
   232
    }
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
   233
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
   234
    /**
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
   235
     * Write body text, escaping it as necessary.
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
   236
     * If this call follows a call of startTag, the open tag will be
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
   237
     * closed -- meaning that no more attributes can be written until another
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
   238
     * tag is started.  If the text value is null, the current tag will still
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
   239
     * be closed, but no other text will be written.
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
   240
     * @param text the text to be written, may be null or zero length.
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
   241
     * @throws IOException if there is a problem writing to the underlying stream
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
   242
     */
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
   243
    public void write(String text) throws IOException {
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
   244
        if (state == IN_TAG) {
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
   245
            out.write(">");
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
   246
            state = IN_BODY;
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
   247
        }
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
   248
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
   249
        if (text == null)
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
   250
            return;
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
   251
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
   252
        // check to see if there are any special characters
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
   253
        boolean specialChars = false;
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
   254
        for (int i = 0; i < text.length() && !specialChars; i++) {
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
   255
            switch (text.charAt(i)) {
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
   256
            case '<': case '>': case '&':
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
   257
                specialChars = true;
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
   258
            }
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
   259
        }
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
   260
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
   261
        // if there are special characters write the string character at a time;
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
   262
        // otherwise, write it out as is
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
   263
        if (specialChars) {
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
   264
            for (int i = 0; i < text.length(); i++) {
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
   265
                char c = text.charAt(i);
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
   266
                switch (c) {
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
   267
                case '<': out.write("&lt;"); break;
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
   268
                case '>': out.write("&gt;"); break;
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
   269
                case '&': out.write("&amp;"); break;
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
   270
                default: out.write(c);
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
   271
                }
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
   272
            }
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
   273
        }
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
   274
        else
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
   275
            out.write(text);
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
   276
    }
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
   277
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
   278
    /**
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
   279
     * Write a basic HTML entity, such as &nbsp; or &#123; .
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
   280
     * @param entity the entity to write
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
   281
     * @throws IOException if there is a problem writing to the underlying stream
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
   282
     */
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
   283
    public void writeEntity(String entity) throws IOException {
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
   284
        if (state == IN_TAG) {
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
   285
            out.write(">");
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
   286
            state = IN_BODY;
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
   287
        }
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
   288
        out.write(entity);
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
   289
    }
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
   290
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
   291
    /**
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
   292
     * Write an image tag, using a specified path for the image source attribute.
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
   293
     * @param imagePath the path for the image source
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
   294
     * @throws IOException if there is a problem closing the underlying stream
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
   295
     */
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
   296
    public void writeImage(String imagePath) throws IOException {
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
   297
        startTag(IMAGE);
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
   298
        writeAttr(SRC, imagePath);
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
   299
    }
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
   300
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
   301
    /**
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
   302
     * Write an image tag, using a specified path for the image source attribute.
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
   303
     * @param imageURL the url for the image source
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
   304
     * @throws IOException if there is a problem closing the underlying stream
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
   305
     */
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
   306
    public void writeImage(URL imageURL) throws IOException {
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
   307
        writeImage(imageURL.toString());
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
   308
    }
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
   309
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
   310
    /**
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
   311
     * Write a hypertext link.
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
   312
     * @param anchor the target for the link
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
   313
     * @param body the body text for the link
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
   314
     * @throws IOException if there is a problem closing the underlying stream
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
   315
     */
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
   316
    public void writeLink(String anchor, String body) throws IOException {
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
   317
        startTag(A);
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
   318
        writeAttr(HREF, anchor);
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
   319
        write(body);
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
   320
        endTag(A);
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
   321
    }
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
   322
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
   323
    /**
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
   324
     * Write a hypertext link.
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
   325
     * @param file the target for the link
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
   326
     * @param body the body text for the link
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
   327
     * @throws IOException if there is a problem closing the underlying stream
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
   328
     */
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
   329
    public void writeLink(File file, String body) throws IOException {
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
   330
        startTag(A);
39176
eef1aa371e87 8159537: create build file to generate diags reports for all locales
jjg
parents: 34752
diff changeset
   331
        StringBuilder sb = new StringBuilder();
6149
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
   332
        String path = file.getPath().replace(File.separatorChar, '/');
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
   333
        if (file.isAbsolute() && !path.startsWith("/"))
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
   334
            sb.append('/');
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
   335
        sb.append(path);
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
   336
        writeAttr(HREF, sb.toString());
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
   337
        write(body);
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
   338
        endTag(A);
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
   339
    }
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
   340
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
   341
    /**
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
   342
     * Write a hypertext link.
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
   343
     * @param file the target and body for the link
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
   344
     * @throws IOException if there is a problem closing the underlying stream
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
   345
     */
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
   346
    public void writeLink(File file) throws IOException {
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
   347
        writeLink(file, file.getPath());
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
   348
    }
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
   349
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
   350
    /**
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
   351
     * Write a hypertext link.
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
   352
     * @param url the target for the link
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
   353
     * @param body the body text for the link
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
   354
     * @throws IOException if there is a problem closing the underlying stream
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
   355
     */
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
   356
    public void writeLink(URL url, String body) throws IOException {
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
   357
        startTag(A);
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
   358
        writeAttr(HREF, url.toString());
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
   359
        write(body);
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
   360
        endTag(A);
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
   361
    }
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
   362
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
   363
    /**
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
   364
     * Write the destination marker for a hypertext link.
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
   365
     * @param anchor the destination marker for hypertext links
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
   366
     * @param body the body text for the marker
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
   367
     * @throws IOException if there is a problem closing the underlying stream
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
   368
     */
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
   369
    public void writeLinkDestination(String anchor, String body) throws IOException {
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
   370
        startTag(A);
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
   371
        writeAttr(NAME, anchor);
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
   372
        write(body);
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
   373
        endTag(A);
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
   374
    }
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
   375
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
   376
    /**
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
   377
     * Write a parameter tag.
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
   378
     * @param name the name of the parameter
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
   379
     * @param value the value of the parameter
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
   380
     * @throws IOException if there is a problem closing the underlying stream
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
   381
     */
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
   382
    public void writeParam(String name, String value) throws IOException {
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
   383
        startTag(PARAM);
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
   384
        writeAttr(NAME, name);
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
   385
        writeAttr(VALUE, value);
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
   386
    }
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
   387
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
   388
    /**
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
   389
     * Write a style attribute.
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
   390
     * @param value the value for the style atrtribute
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
   391
     * @throws IOException if there is a problem closing the underlying stream
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
   392
     */
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
   393
    public void writeStyleAttr(String value) throws IOException {
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
   394
        writeAttr(STYLE, value);
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
   395
    }
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
   396
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
   397
    /**
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
   398
     * Write a localized message, using a specified resource bundle.
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
   399
     * @param i18n the resource bundle used to localize the message
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
   400
     * @param key the key for the message to be localized
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
   401
     * @throws IOException if there is a problem closing the underlying stream
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
   402
     */
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
   403
    public void write(ResourceBundle i18n, String key) throws IOException {
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
   404
        write(getString(i18n, key));
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
   405
    }
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
   406
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
   407
    /**
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
   408
     * Write a localized message, using a specified resource bundle.
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
   409
     * @param i18n the resource bundle used to localize the message
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
   410
     * @param key the key for the message to be localized
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
   411
     * @param arg an argument to be formatted into the localized message
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
   412
     * @throws IOException if there is a problem closing the underlying stream
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
   413
     */
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
   414
    public void write(ResourceBundle i18n, String key, Object arg) throws IOException {
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
   415
        write(getString(i18n, key, arg));
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
   416
    }
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
   417
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
   418
    /**
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
   419
     * Write a localized message, using a specified resource bundle.
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
   420
     * @param i18n the resource bundle used to localize the message
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
   421
     * @param key the key for the message to be localized
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
   422
     * @param args arguments to be formatted into the localized message
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
   423
     * @throws IOException if there is a problem closing the underlying stream
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
   424
     */
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
   425
    public void write(ResourceBundle i18n, String key, Object[] args) throws IOException {
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
   426
        write(getString(i18n, key, args));
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
   427
    }
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
   428
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
   429
    /**
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
   430
     * Write a localized message, using the default resource bundle.
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
   431
     * @param key the key for the message to be localized
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
   432
     * @throws IOException if there is a problem closing the underlying stream
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
   433
     */
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
   434
    public void writeI18N(String key) throws IOException {
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
   435
        write(getString(i18n, key));
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
   436
    }
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
   437
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
   438
    /**
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
   439
     * Write a localized message, using the default resource bundle.
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
   440
     * @param key the key for the message to be localized
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
   441
     * @param arg an argument to be formatted into the localized message
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
   442
     * @throws IOException if there is a problem closing the underlying stream
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
   443
     */
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
   444
    public void writeI18N(String key, Object arg) throws IOException {
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
   445
        write(getString(i18n, key, arg));
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
   446
    }
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
   447
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
   448
    /**
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
   449
     * Write a localized message, using the default resource bundle.
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
   450
     * @param key the key for the message to be localized
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
   451
     * @param args arguments to be formatted into the localized message
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
   452
     * @throws IOException if there is a problem closing the underlying stream
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
   453
     */
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
   454
    public void writeI18N(String key, Object[] args) throws IOException {
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
   455
        write(getString(i18n, key, args));
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
   456
    }
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
   457
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
   458
    private String getString(ResourceBundle rb, String key, Object... args) {
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
   459
        String s = rb.getString(key);
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
   460
        return MessageFormat.format(s, args);
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
   461
    }
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
   462
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
   463
    /** The HTML "a" tag. */
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
   464
    public static final String A = "a";
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
   465
    /** The HTML "align" attribute. */
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
   466
    public static final String ALIGN = "align";
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
   467
    /** The HTML "b" tag. */
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
   468
    public static final String B = "b";
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
   469
    /** The HTML "body" tag. */
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
   470
    public static final String BODY = "body";
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
   471
    /** The HTML "border" attribute. */
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
   472
    public static final String BORDER = "border";
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
   473
    /** The HTML "br" tag. */
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
   474
    public static final String BR = "br";
39176
eef1aa371e87 8159537: create build file to generate diags reports for all locales
jjg
parents: 34752
diff changeset
   475
    /** The HTML "charset" attribute. */
eef1aa371e87 8159537: create build file to generate diags reports for all locales
jjg
parents: 34752
diff changeset
   476
    public static final String CHARSET  = "charset";
6149
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
   477
    /** The HTML "class" attribute. */
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
   478
    public static final String CLASS  = "class";
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
   479
    /** The HTML "classid" attribute. */
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
   480
    public static final String CLASSID  = "classid";
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
   481
    /** The HTML "code" tag. */
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
   482
    public static final String CODE  = "code";
39176
eef1aa371e87 8159537: create build file to generate diags reports for all locales
jjg
parents: 34752
diff changeset
   483
    /** The HTML "color" attribute. */
6149
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
   484
    public static final String COLOR  = "color";
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
   485
    /** The HTML "col" attribute value. */
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
   486
    public static final String COL = "col";
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
   487
    /** The HTML "dd" tag. */
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
   488
    public static final String DD = "dd";
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
   489
    /** The HTML "div" tag. */
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
   490
    public static final String DIV = "div";
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
   491
    /** The HTML "dl" tag. */
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
   492
    public static final String DL = "dl";
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
   493
    /** The HTML "dt" tag. */
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
   494
    public static final String DT = "dt";
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
   495
    /** The HTML "font" tag. */
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
   496
    public static final String FONT = "font";
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
   497
    /** The HTML "h1" tag. */
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
   498
    public static final String H1 = "h1";
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
   499
    /** The HTML "h2" tag. */
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
   500
    public static final String H2 = "h2";
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
   501
    /** The HTML "h3" tag. */
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
   502
    public static final String H3 = "h3";
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
   503
    /** The HTML "h4" tag. */
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
   504
    public static final String H4 = "h4";
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
   505
    /** The HTML "h5" tag. */
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
   506
    public static final String H5 = "h5";
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
   507
    /** The HTML "head" tag. */
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
   508
    public static final String HEAD = "head";
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
   509
    /** The HTML "href" attribute. */
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
   510
    public static final String HREF = "href";
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
   511
    /** The HTML "html" tag. */
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
   512
    public static final String HTML = "html";
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
   513
    /** The HTML "hr" tag. */
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
   514
    public static final String HR = "hr";
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
   515
    /** The HTML "i" tag. */
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
   516
    public static final String I = "i";
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
   517
    /** The HTML "id" tag. */
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
   518
    public static final String ID = "id";
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
   519
    /** The HTML "image" tag. */
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
   520
    public static final String IMAGE = "image";
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
   521
    /** The HTML "left" attribute value. */
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
   522
    public static final String LEFT = "left";
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
   523
    /** The HTML "li" tag. */
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
   524
    public static final String LI = "li";
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
   525
    /** The HTML "link" tag. */
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
   526
    public static final String LINK = "link";
39176
eef1aa371e87 8159537: create build file to generate diags reports for all locales
jjg
parents: 34752
diff changeset
   527
    /** The HTML "meta" attribute. */
eef1aa371e87 8159537: create build file to generate diags reports for all locales
jjg
parents: 34752
diff changeset
   528
    public static final String META = "meta";
6149
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
   529
    /** The HTML "name" attribute. */
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
   530
    public static final String NAME = "name";
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
   531
    /** The HTML "object" tag. */
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
   532
    public static final String OBJECT = "object";
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
   533
    /** The HTML "p" tag. */
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
   534
    public static final String PARAM = "param";
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
   535
    /** The HTML "param" tag. */
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
   536
    public static final String P = "p";
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
   537
    /** The HTML "rel" attribute value. */
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
   538
    public static final String REL = "rel";
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
   539
    /** The HTML "right" attribute value. */
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
   540
    public static final String RIGHT = "right";
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
   541
    /** The HTML "row" attribute value. */
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
   542
    public static final String ROW = "row";
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
   543
    /** The HTML "script" tag. */
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
   544
    public static final String SCRIPT = "script";
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
   545
    /** The HTML "small" tag. */
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
   546
    public static final String SMALL = "small";
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
   547
    /** The HTML "span" tag. */
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
   548
    public static final String SPAN = "span";
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
   549
    /** The HTML "src" attribute. */
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
   550
    public static final String SRC = "src";
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
   551
    /** The HTML "scope" attribute. */
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
   552
    public static final String SCOPE = "scope";
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
   553
    /** The HTML "style" attribute. */
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
   554
    public static final String STYLE = "style";
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
   555
    /** The HTML "table" tag. */
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
   556
    public static final String TABLE = "table";
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
   557
    /** The HTML "td" tag. */
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
   558
    public static final String TD = "td";
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
   559
    /** The HTML type for JavaScript. */
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
   560
    public static final String TEXT_JAVASCRIPT = "text/javascript";
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
   561
    /** The HTML "title"attribute. */
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
   562
    public static final String TITLE = "title";
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
   563
    /** The HTML "th" tag. */
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
   564
    public static final String TH = "th";
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
   565
    /** The HTML "top" attribute value. */
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
   566
    public static final String TOP = "top";
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
   567
    /** The HTML "tr" tag. */
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
   568
    public static final String TR = "tr";
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
   569
    /** The HTML "type" attribute. */
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
   570
    public static final String TYPE = "type";
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
   571
    /** The HTML "ul" tag. */
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
   572
    public static final String UL = "ul";
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
   573
    /** The HTML "valign" attribute. */
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
   574
    public static final String VALIGN = "valign";
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
   575
    /** The HTML "value" attribute. */
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
   576
    public static final String VALUE = "value";
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
   577
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
   578
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
   579
    private BufferedWriter out;
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
   580
    private int state;
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
   581
    private ResourceBundle i18n;
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
   582
    private static final int IN_TAG = 1;
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
   583
    private static final int IN_BODY = 2;
48de3564aa13 6968063: provide examples of code that generate diagnostics
jjg
parents:
diff changeset
   584
}