jdk/src/share/classes/javax/swing/text/html/HTML.java
author darcy
Sun, 23 Mar 2014 13:49:48 -0700
changeset 23697 e556a715949f
parent 23010 6dadb192ad81
child 24269 325ea76ea0e9
permissions -rw-r--r--
8034169: Fix serial lint warnings in javax.swing Reviewed-by: alanb, prr
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     1
/*
23697
e556a715949f 8034169: Fix serial lint warnings in javax.swing
darcy
parents: 23010
diff changeset
     2
 * Copyright (c) 1998, 2014, Oracle and/or its affiliates. All rights reserved.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
90ce3da70b43 Initial load
duke
parents:
diff changeset
     4
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
90ce3da70b43 Initial load
duke
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 1639
diff changeset
     7
 * published by the Free Software Foundation.  Oracle designates this
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     8
 * particular file as subject to the "Classpath" exception as provided
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 1639
diff changeset
     9
 * by Oracle in the LICENSE file that accompanied this code.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    10
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    11
 * This code is distributed in the hope that it will be useful, but WITHOUT
90ce3da70b43 Initial load
duke
parents:
diff changeset
    12
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
90ce3da70b43 Initial load
duke
parents:
diff changeset
    13
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
90ce3da70b43 Initial load
duke
parents:
diff changeset
    14
 * version 2 for more details (a copy is included in the LICENSE file that
90ce3da70b43 Initial load
duke
parents:
diff changeset
    15
 * accompanied this code).
90ce3da70b43 Initial load
duke
parents:
diff changeset
    16
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    17
 * You should have received a copy of the GNU General Public License version
90ce3da70b43 Initial load
duke
parents:
diff changeset
    18
 * 2 along with this work; if not, write to the Free Software Foundation,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    19
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    20
 *
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 1639
diff changeset
    21
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 1639
diff changeset
    22
 * or visit www.oracle.com if you need additional information or have any
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 1639
diff changeset
    23
 * questions.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    24
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    25
package javax.swing.text.html;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    26
90ce3da70b43 Initial load
duke
parents:
diff changeset
    27
import java.io.*;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    28
import java.util.Hashtable;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    29
import javax.swing.text.AttributeSet;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    30
import javax.swing.text.StyleConstants;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    31
import javax.swing.text.StyleContext;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    32
90ce3da70b43 Initial load
duke
parents:
diff changeset
    33
/**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    34
 * Constants used in the <code>HTMLDocument</code>.  These
90ce3da70b43 Initial load
duke
parents:
diff changeset
    35
 * are basically tag and attribute definitions.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    36
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    37
 * @author  Timothy Prinzing
90ce3da70b43 Initial load
duke
parents:
diff changeset
    38
 * @author  Sunita Mani
90ce3da70b43 Initial load
duke
parents:
diff changeset
    39
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    40
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    41
public class HTML {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    42
90ce3da70b43 Initial load
duke
parents:
diff changeset
    43
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    44
     * Typesafe enumeration for an HTML tag.  Although the
90ce3da70b43 Initial load
duke
parents:
diff changeset
    45
     * set of HTML tags is a closed set, we have left the
90ce3da70b43 Initial load
duke
parents:
diff changeset
    46
     * set open so that people can add their own tag types
90ce3da70b43 Initial load
duke
parents:
diff changeset
    47
     * to their custom parser and still communicate to the
90ce3da70b43 Initial load
duke
parents:
diff changeset
    48
     * reader.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    49
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    50
    public static class Tag {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    51
90ce3da70b43 Initial load
duke
parents:
diff changeset
    52
        /** @since 1.3 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    53
        public Tag() {}
90ce3da70b43 Initial load
duke
parents:
diff changeset
    54
90ce3da70b43 Initial load
duke
parents:
diff changeset
    55
        /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    56
         * Creates a new <code>Tag</code> with the specified <code>id</code>,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    57
         * and with <code>causesBreak</code> and <code>isBlock</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    58
         * set to <code>false</code>.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    59
         *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    60
         * @param id  the id of the new tag
90ce3da70b43 Initial load
duke
parents:
diff changeset
    61
         */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    62
        protected Tag(String id) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    63
            this(id, false, false);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    64
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    65
90ce3da70b43 Initial load
duke
parents:
diff changeset
    66
        /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    67
         * Creates a new <code>Tag</code> with the specified <code>id</code>;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    68
         * <code>causesBreak</code> and <code>isBlock</code> are defined
90ce3da70b43 Initial load
duke
parents:
diff changeset
    69
         * by the user.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    70
         *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    71
         * @param id the id of the new tag
90ce3da70b43 Initial load
duke
parents:
diff changeset
    72
         * @param causesBreak  <code>true</code> if this tag
90ce3da70b43 Initial load
duke
parents:
diff changeset
    73
         *    causes a break to the flow of data
90ce3da70b43 Initial load
duke
parents:
diff changeset
    74
         * @param isBlock <code>true</code> if the tag is used
90ce3da70b43 Initial load
duke
parents:
diff changeset
    75
         *    to add structure to a document
90ce3da70b43 Initial load
duke
parents:
diff changeset
    76
         */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    77
        protected Tag(String id, boolean causesBreak, boolean isBlock) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    78
            name = id;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    79
            this.breakTag = causesBreak;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    80
            this.blockTag = isBlock;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    81
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    82
90ce3da70b43 Initial load
duke
parents:
diff changeset
    83
        /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    84
         * Returns <code>true</code> if this tag is a block
90ce3da70b43 Initial load
duke
parents:
diff changeset
    85
         * tag, which is a tag used to add structure to a
90ce3da70b43 Initial load
duke
parents:
diff changeset
    86
         * document.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    87
         *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    88
         * @return <code>true</code> if this tag is a block
90ce3da70b43 Initial load
duke
parents:
diff changeset
    89
         *   tag, otherwise returns <code>false</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    90
         */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    91
        public boolean isBlock() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    92
            return blockTag;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    93
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    94
90ce3da70b43 Initial load
duke
parents:
diff changeset
    95
        /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    96
         * Returns <code>true</code> if this tag causes a
90ce3da70b43 Initial load
duke
parents:
diff changeset
    97
         * line break to the flow of data, otherwise returns
90ce3da70b43 Initial load
duke
parents:
diff changeset
    98
         * <code>false</code>.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    99
         *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   100
         * @return <code>true</code> if this tag causes a
90ce3da70b43 Initial load
duke
parents:
diff changeset
   101
         *   line break to the flow of data, otherwise returns
90ce3da70b43 Initial load
duke
parents:
diff changeset
   102
         *   <code>false</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   103
         */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   104
        public boolean breaksFlow() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   105
            return breakTag;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   106
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   107
90ce3da70b43 Initial load
duke
parents:
diff changeset
   108
        /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   109
         * Returns <code>true</code> if this tag is pre-formatted,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   110
         * which is true if the tag is either <code>PRE</code> or
90ce3da70b43 Initial load
duke
parents:
diff changeset
   111
         * <code>TEXTAREA</code>.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   112
         *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   113
         * @return <code>true</code> if this tag is pre-formatted,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   114
         *   otherwise returns <code>false</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   115
         */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   116
        public boolean isPreformatted() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   117
            return (this == PRE || this == TEXTAREA);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   118
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   119
90ce3da70b43 Initial load
duke
parents:
diff changeset
   120
        /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   121
         * Returns the string representation of the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   122
         * tag.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   123
         *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   124
         * @return the <code>String</code> representation of the tag
90ce3da70b43 Initial load
duke
parents:
diff changeset
   125
         */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   126
        public String toString() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   127
            return name;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   128
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   129
90ce3da70b43 Initial load
duke
parents:
diff changeset
   130
        /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   131
         * Returns <code>true</code> if this tag is considered to be a paragraph
90ce3da70b43 Initial load
duke
parents:
diff changeset
   132
         * in the internal HTML model. <code>false</code> - otherwise.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   133
         *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   134
         * @return <code>true</code> if this tag is considered to be a paragraph
90ce3da70b43 Initial load
duke
parents:
diff changeset
   135
         *         in the internal HTML model. <code>false</code> - otherwise.
1287
a04aca99c77a 6722802: Code improvement and warnings removing from the javax.swing.text package
rupashka
parents: 2
diff changeset
   136
         * @see HTMLDocument.HTMLReader.ParagraphAction
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   137
         */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   138
        boolean isParagraph() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   139
            return (
90ce3da70b43 Initial load
duke
parents:
diff changeset
   140
                this == P
90ce3da70b43 Initial load
duke
parents:
diff changeset
   141
                   || this == IMPLIED
90ce3da70b43 Initial load
duke
parents:
diff changeset
   142
                   || this == DT
90ce3da70b43 Initial load
duke
parents:
diff changeset
   143
                   || this == H1
90ce3da70b43 Initial load
duke
parents:
diff changeset
   144
                   || this == H2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   145
                   || this == H3
90ce3da70b43 Initial load
duke
parents:
diff changeset
   146
                   || this == H4
90ce3da70b43 Initial load
duke
parents:
diff changeset
   147
                   || this == H5
90ce3da70b43 Initial load
duke
parents:
diff changeset
   148
                   || this == H6
90ce3da70b43 Initial load
duke
parents:
diff changeset
   149
            );
90ce3da70b43 Initial load
duke
parents:
diff changeset
   150
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   151
90ce3da70b43 Initial load
duke
parents:
diff changeset
   152
        boolean blockTag;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   153
        boolean breakTag;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   154
        String name;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   155
        boolean unknown;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   156
90ce3da70b43 Initial load
duke
parents:
diff changeset
   157
        // --- Tag Names -----------------------------------
90ce3da70b43 Initial load
duke
parents:
diff changeset
   158
90ce3da70b43 Initial load
duke
parents:
diff changeset
   159
        public static final Tag A = new Tag("a");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   160
        public static final Tag ADDRESS = new Tag("address");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   161
        public static final Tag APPLET = new Tag("applet");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   162
        public static final Tag AREA = new Tag("area");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   163
        public static final Tag B = new Tag("b");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   164
        public static final Tag BASE = new Tag("base");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   165
        public static final Tag BASEFONT = new Tag("basefont");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   166
        public static final Tag BIG = new Tag("big");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   167
        public static final Tag BLOCKQUOTE = new Tag("blockquote", true, true);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   168
        public static final Tag BODY = new Tag("body", true, true);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   169
        public static final Tag BR = new Tag("br", true, false);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   170
        public static final Tag CAPTION = new Tag("caption");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   171
        public static final Tag CENTER = new Tag("center", true, false);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   172
        public static final Tag CITE = new Tag("cite");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   173
        public static final Tag CODE = new Tag("code");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   174
        public static final Tag DD = new Tag("dd", true, true);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   175
        public static final Tag DFN = new Tag("dfn");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   176
        public static final Tag DIR = new Tag("dir", true, true);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   177
        public static final Tag DIV = new Tag("div", true, true);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   178
        public static final Tag DL = new Tag("dl", true, true);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   179
        public static final Tag DT = new Tag("dt", true, true);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   180
        public static final Tag EM = new Tag("em");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   181
        public static final Tag FONT = new Tag("font");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   182
        public static final Tag FORM = new Tag("form", true, false);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   183
        public static final Tag FRAME = new Tag("frame");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   184
        public static final Tag FRAMESET = new Tag("frameset");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   185
        public static final Tag H1 = new Tag("h1", true, true);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   186
        public static final Tag H2 = new Tag("h2", true, true);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   187
        public static final Tag H3 = new Tag("h3", true, true);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   188
        public static final Tag H4 = new Tag("h4", true, true);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   189
        public static final Tag H5 = new Tag("h5", true, true);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   190
        public static final Tag H6 = new Tag("h6", true, true);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   191
        public static final Tag HEAD = new Tag("head", true, true);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   192
        public static final Tag HR = new Tag("hr", true, false);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   193
        public static final Tag HTML = new Tag("html", true, false);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   194
        public static final Tag I = new Tag("i");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   195
        public static final Tag IMG = new Tag("img");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   196
        public static final Tag INPUT = new Tag("input");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   197
        public static final Tag ISINDEX = new Tag("isindex", true, false);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   198
        public static final Tag KBD = new Tag("kbd");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   199
        public static final Tag LI = new Tag("li", true, true);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   200
        public static final Tag LINK = new Tag("link");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   201
        public static final Tag MAP = new Tag("map");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   202
        public static final Tag MENU = new Tag("menu", true, true);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   203
        public static final Tag META = new Tag("meta");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   204
        /*public*/ static final Tag NOBR = new Tag("nobr");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   205
        public static final Tag NOFRAMES = new Tag("noframes", true, true);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   206
        public static final Tag OBJECT = new Tag("object");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   207
        public static final Tag OL = new Tag("ol", true, true);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   208
        public static final Tag OPTION = new Tag("option");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   209
        public static final Tag P = new Tag("p", true, true);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   210
        public static final Tag PARAM = new Tag("param");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   211
        public static final Tag PRE = new Tag("pre", true, true);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   212
        public static final Tag SAMP = new Tag("samp");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   213
        public static final Tag SCRIPT = new Tag("script");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   214
        public static final Tag SELECT = new Tag("select");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   215
        public static final Tag SMALL = new Tag("small");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   216
        public static final Tag SPAN = new Tag("span");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   217
        public static final Tag STRIKE = new Tag("strike");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   218
        public static final Tag S = new Tag("s");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   219
        public static final Tag STRONG = new Tag("strong");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   220
        public static final Tag STYLE = new Tag("style");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   221
        public static final Tag SUB = new Tag("sub");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   222
        public static final Tag SUP = new Tag("sup");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   223
        public static final Tag TABLE = new Tag("table", false, true);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   224
        public static final Tag TD = new Tag("td", true, true);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   225
        public static final Tag TEXTAREA = new Tag("textarea");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   226
        public static final Tag TH = new Tag("th", true, true);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   227
        public static final Tag TITLE = new Tag("title", true, true);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   228
        public static final Tag TR = new Tag("tr", false, true);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   229
        public static final Tag TT = new Tag("tt");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   230
        public static final Tag U = new Tag("u");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   231
        public static final Tag UL = new Tag("ul", true, true);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   232
        public static final Tag VAR = new Tag("var");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   233
90ce3da70b43 Initial load
duke
parents:
diff changeset
   234
        /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   235
         * All text content must be in a paragraph element.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   236
         * If a paragraph didn't exist when content was
90ce3da70b43 Initial load
duke
parents:
diff changeset
   237
         * encountered, a paragraph is manufactured.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   238
         * <p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   239
         * This is a tag synthesized by the HTML reader.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   240
         * Since elements are identified by their tag type,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   241
         * we create a some fake tag types to mark the elements
90ce3da70b43 Initial load
duke
parents:
diff changeset
   242
         * that were manufactured.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   243
         */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   244
        public static final Tag IMPLIED = new Tag("p-implied");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   245
90ce3da70b43 Initial load
duke
parents:
diff changeset
   246
        /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   247
         * All text content is labeled with this tag.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   248
         * <p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   249
         * This is a tag synthesized by the HTML reader.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   250
         * Since elements are identified by their tag type,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   251
         * we create a some fake tag types to mark the elements
90ce3da70b43 Initial load
duke
parents:
diff changeset
   252
         * that were manufactured.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   253
         */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   254
        public static final Tag CONTENT = new Tag("content");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   255
90ce3da70b43 Initial load
duke
parents:
diff changeset
   256
        /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   257
         * All comments are labeled with this tag.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   258
         * <p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   259
         * This is a tag synthesized by the HTML reader.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   260
         * Since elements are identified by their tag type,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   261
         * we create a some fake tag types to mark the elements
90ce3da70b43 Initial load
duke
parents:
diff changeset
   262
         * that were manufactured.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   263
         */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   264
        public static final Tag COMMENT = new Tag("comment");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   265
90ce3da70b43 Initial load
duke
parents:
diff changeset
   266
        static final Tag allTags[]  = {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   267
            A, ADDRESS, APPLET, AREA, B, BASE, BASEFONT, BIG,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   268
            BLOCKQUOTE, BODY, BR, CAPTION, CENTER, CITE, CODE,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   269
            DD, DFN, DIR, DIV, DL, DT, EM, FONT, FORM, FRAME,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   270
            FRAMESET, H1, H2, H3, H4, H5, H6, HEAD, HR, HTML,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   271
            I, IMG, INPUT, ISINDEX, KBD, LI, LINK, MAP, MENU,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   272
            META, NOBR, NOFRAMES, OBJECT, OL, OPTION, P, PARAM,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   273
            PRE, SAMP, SCRIPT, SELECT, SMALL, SPAN, STRIKE, S,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   274
            STRONG, STYLE, SUB, SUP, TABLE, TD, TEXTAREA,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   275
            TH, TITLE, TR, TT, U, UL, VAR
90ce3da70b43 Initial load
duke
parents:
diff changeset
   276
        };
90ce3da70b43 Initial load
duke
parents:
diff changeset
   277
90ce3da70b43 Initial load
duke
parents:
diff changeset
   278
        static {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   279
            // Force HTMLs static initialize to be loaded.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   280
            getTag("html");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   281
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   282
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   283
90ce3da70b43 Initial load
duke
parents:
diff changeset
   284
    // There is no unique instance of UnknownTag, so we allow it to be
90ce3da70b43 Initial load
duke
parents:
diff changeset
   285
    // Serializable.
23697
e556a715949f 8034169: Fix serial lint warnings in javax.swing
darcy
parents: 23010
diff changeset
   286
    @SuppressWarnings("serial") // Same-version serialization only
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   287
    public static class UnknownTag extends Tag implements Serializable {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   288
90ce3da70b43 Initial load
duke
parents:
diff changeset
   289
        /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   290
         * Creates a new <code>UnknownTag</code> with the specified
90ce3da70b43 Initial load
duke
parents:
diff changeset
   291
         * <code>id</code>.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   292
         * @param id the id of the new tag
90ce3da70b43 Initial load
duke
parents:
diff changeset
   293
         */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   294
        public UnknownTag(String id) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   295
            super(id);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   296
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   297
90ce3da70b43 Initial load
duke
parents:
diff changeset
   298
        /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   299
         * Returns the hash code which corresponds to the string
90ce3da70b43 Initial load
duke
parents:
diff changeset
   300
         * for this tag.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   301
         */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   302
        public int hashCode() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   303
            return toString().hashCode();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   304
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   305
90ce3da70b43 Initial load
duke
parents:
diff changeset
   306
        /**
21278
ef8a3a2a72f2 8022746: List of spelling errors in API doc
malenkov
parents: 5506
diff changeset
   307
         * Compares this object to the specified object.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   308
         * The result is <code>true</code> if and only if the argument is not
90ce3da70b43 Initial load
duke
parents:
diff changeset
   309
         * <code>null</code> and is an <code>UnknownTag</code> object
90ce3da70b43 Initial load
duke
parents:
diff changeset
   310
         * with the same name.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   311
         *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   312
         * @param     obj   the object to compare this tag with
90ce3da70b43 Initial load
duke
parents:
diff changeset
   313
         * @return    <code>true</code> if the objects are equal;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   314
         *            <code>false</code> otherwise
90ce3da70b43 Initial load
duke
parents:
diff changeset
   315
         */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   316
        public boolean equals(Object obj) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   317
            if (obj instanceof UnknownTag) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   318
                return toString().equals(obj.toString());
90ce3da70b43 Initial load
duke
parents:
diff changeset
   319
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   320
            return false;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   321
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   322
90ce3da70b43 Initial load
duke
parents:
diff changeset
   323
        private void writeObject(java.io.ObjectOutputStream s)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   324
                     throws IOException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   325
            s.defaultWriteObject();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   326
            s.writeBoolean(blockTag);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   327
            s.writeBoolean(breakTag);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   328
            s.writeBoolean(unknown);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   329
            s.writeObject(name);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   330
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   331
90ce3da70b43 Initial load
duke
parents:
diff changeset
   332
        private void readObject(ObjectInputStream s)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   333
            throws ClassNotFoundException, IOException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   334
            s.defaultReadObject();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   335
            blockTag = s.readBoolean();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   336
            breakTag = s.readBoolean();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   337
            unknown = s.readBoolean();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   338
            name = (String)s.readObject();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   339
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   340
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   341
90ce3da70b43 Initial load
duke
parents:
diff changeset
   342
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   343
     * Typesafe enumeration representing an HTML
90ce3da70b43 Initial load
duke
parents:
diff changeset
   344
     * attribute.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   345
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   346
    public static final class Attribute {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   347
90ce3da70b43 Initial load
duke
parents:
diff changeset
   348
        /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   349
         * Creates a new <code>Attribute</code> with the specified
90ce3da70b43 Initial load
duke
parents:
diff changeset
   350
         * <code>id</code>.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   351
         *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   352
         * @param id the id of the new <code>Attribute</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   353
         */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   354
        Attribute(String id) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   355
            name = id;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   356
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   357
90ce3da70b43 Initial load
duke
parents:
diff changeset
   358
        /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   359
         * Returns the string representation of this attribute.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   360
         * @return the string representation of this attribute
90ce3da70b43 Initial load
duke
parents:
diff changeset
   361
         */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   362
        public String toString() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   363
            return name;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   364
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   365
90ce3da70b43 Initial load
duke
parents:
diff changeset
   366
        private String name;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   367
90ce3da70b43 Initial load
duke
parents:
diff changeset
   368
        public static final Attribute SIZE = new Attribute("size");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   369
        public static final Attribute COLOR = new Attribute("color");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   370
        public static final Attribute CLEAR = new Attribute("clear");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   371
        public static final Attribute BACKGROUND = new Attribute("background");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   372
        public static final Attribute BGCOLOR = new Attribute("bgcolor");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   373
        public static final Attribute TEXT = new Attribute("text");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   374
        public static final Attribute LINK = new Attribute("link");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   375
        public static final Attribute VLINK = new Attribute("vlink");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   376
        public static final Attribute ALINK = new Attribute("alink");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   377
        public static final Attribute WIDTH = new Attribute("width");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   378
        public static final Attribute HEIGHT = new Attribute("height");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   379
        public static final Attribute ALIGN = new Attribute("align");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   380
        public static final Attribute NAME = new Attribute("name");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   381
        public static final Attribute HREF = new Attribute("href");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   382
        public static final Attribute REL = new Attribute("rel");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   383
        public static final Attribute REV = new Attribute("rev");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   384
        public static final Attribute TITLE = new Attribute("title");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   385
        public static final Attribute TARGET = new Attribute("target");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   386
        public static final Attribute SHAPE = new Attribute("shape");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   387
        public static final Attribute COORDS = new Attribute("coords");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   388
        public static final Attribute ISMAP = new Attribute("ismap");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   389
        public static final Attribute NOHREF = new Attribute("nohref");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   390
        public static final Attribute ALT = new Attribute("alt");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   391
        public static final Attribute ID = new Attribute("id");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   392
        public static final Attribute SRC = new Attribute("src");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   393
        public static final Attribute HSPACE = new Attribute("hspace");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   394
        public static final Attribute VSPACE = new Attribute("vspace");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   395
        public static final Attribute USEMAP = new Attribute("usemap");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   396
        public static final Attribute LOWSRC = new Attribute("lowsrc");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   397
        public static final Attribute CODEBASE = new Attribute("codebase");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   398
        public static final Attribute CODE = new Attribute("code");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   399
        public static final Attribute ARCHIVE = new Attribute("archive");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   400
        public static final Attribute VALUE = new Attribute("value");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   401
        public static final Attribute VALUETYPE = new Attribute("valuetype");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   402
        public static final Attribute TYPE = new Attribute("type");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   403
        public static final Attribute CLASS = new Attribute("class");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   404
        public static final Attribute STYLE = new Attribute("style");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   405
        public static final Attribute LANG = new Attribute("lang");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   406
        public static final Attribute FACE = new Attribute("face");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   407
        public static final Attribute DIR = new Attribute("dir");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   408
        public static final Attribute DECLARE = new Attribute("declare");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   409
        public static final Attribute CLASSID = new Attribute("classid");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   410
        public static final Attribute DATA = new Attribute("data");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   411
        public static final Attribute CODETYPE = new Attribute("codetype");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   412
        public static final Attribute STANDBY = new Attribute("standby");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   413
        public static final Attribute BORDER = new Attribute("border");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   414
        public static final Attribute SHAPES = new Attribute("shapes");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   415
        public static final Attribute NOSHADE = new Attribute("noshade");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   416
        public static final Attribute COMPACT = new Attribute("compact");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   417
        public static final Attribute START = new Attribute("start");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   418
        public static final Attribute ACTION = new Attribute("action");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   419
        public static final Attribute METHOD = new Attribute("method");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   420
        public static final Attribute ENCTYPE = new Attribute("enctype");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   421
        public static final Attribute CHECKED = new Attribute("checked");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   422
        public static final Attribute MAXLENGTH = new Attribute("maxlength");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   423
        public static final Attribute MULTIPLE = new Attribute("multiple");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   424
        public static final Attribute SELECTED = new Attribute("selected");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   425
        public static final Attribute ROWS = new Attribute("rows");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   426
        public static final Attribute COLS = new Attribute("cols");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   427
        public static final Attribute DUMMY = new Attribute("dummy");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   428
        public static final Attribute CELLSPACING = new Attribute("cellspacing");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   429
        public static final Attribute CELLPADDING = new Attribute("cellpadding");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   430
        public static final Attribute VALIGN = new Attribute("valign");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   431
        public static final Attribute HALIGN = new Attribute("halign");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   432
        public static final Attribute NOWRAP = new Attribute("nowrap");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   433
        public static final Attribute ROWSPAN = new Attribute("rowspan");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   434
        public static final Attribute COLSPAN = new Attribute("colspan");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   435
        public static final Attribute PROMPT = new Attribute("prompt");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   436
        public static final Attribute HTTPEQUIV = new Attribute("http-equiv");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   437
        public static final Attribute CONTENT = new Attribute("content");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   438
        public static final Attribute LANGUAGE = new Attribute("language");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   439
        public static final Attribute VERSION = new Attribute("version");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   440
        public static final Attribute N = new Attribute("n");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   441
        public static final Attribute FRAMEBORDER = new Attribute("frameborder");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   442
        public static final Attribute MARGINWIDTH = new Attribute("marginwidth");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   443
        public static final Attribute MARGINHEIGHT = new Attribute("marginheight");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   444
        public static final Attribute SCROLLING = new Attribute("scrolling");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   445
        public static final Attribute NORESIZE = new Attribute("noresize");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   446
        public static final Attribute ENDTAG = new Attribute("endtag");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   447
        public static final Attribute COMMENT = new Attribute("comment");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   448
        static final Attribute MEDIA = new Attribute("media");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   449
90ce3da70b43 Initial load
duke
parents:
diff changeset
   450
        static final Attribute allAttributes[] = {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   451
            FACE,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   452
            COMMENT,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   453
            SIZE,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   454
            COLOR,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   455
            CLEAR,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   456
            BACKGROUND,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   457
            BGCOLOR,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   458
            TEXT,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   459
            LINK,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   460
            VLINK,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   461
            ALINK,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   462
            WIDTH,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   463
            HEIGHT,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   464
            ALIGN,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   465
            NAME,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   466
            HREF,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   467
            REL,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   468
            REV,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   469
            TITLE,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   470
            TARGET,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   471
            SHAPE,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   472
            COORDS,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   473
            ISMAP,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   474
            NOHREF,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   475
            ALT,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   476
            ID,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   477
            SRC,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   478
            HSPACE,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   479
            VSPACE,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   480
            USEMAP,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   481
            LOWSRC,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   482
            CODEBASE,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   483
            CODE,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   484
            ARCHIVE,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   485
            VALUE,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   486
            VALUETYPE,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   487
            TYPE,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   488
            CLASS,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   489
            STYLE,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   490
            LANG,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   491
            DIR,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   492
            DECLARE,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   493
            CLASSID,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   494
            DATA,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   495
            CODETYPE,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   496
            STANDBY,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   497
            BORDER,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   498
            SHAPES,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   499
            NOSHADE,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   500
            COMPACT,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   501
            START,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   502
            ACTION,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   503
            METHOD,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   504
            ENCTYPE,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   505
            CHECKED,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   506
            MAXLENGTH,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   507
            MULTIPLE,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   508
            SELECTED,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   509
            ROWS,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   510
            COLS,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   511
            DUMMY,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   512
            CELLSPACING,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   513
            CELLPADDING,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   514
            VALIGN,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   515
            HALIGN,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   516
            NOWRAP,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   517
            ROWSPAN,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   518
            COLSPAN,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   519
            PROMPT,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   520
            HTTPEQUIV,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   521
            CONTENT,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   522
            LANGUAGE,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   523
            VERSION,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   524
            N,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   525
            FRAMEBORDER,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   526
            MARGINWIDTH,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   527
            MARGINHEIGHT,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   528
            SCROLLING,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   529
            NORESIZE,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   530
            MEDIA,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   531
            ENDTAG
90ce3da70b43 Initial load
duke
parents:
diff changeset
   532
        };
90ce3da70b43 Initial load
duke
parents:
diff changeset
   533
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   534
90ce3da70b43 Initial load
duke
parents:
diff changeset
   535
    // The secret to 73, is that, given that the Hashtable contents
90ce3da70b43 Initial load
duke
parents:
diff changeset
   536
    // never change once the static initialization happens, the initial size
90ce3da70b43 Initial load
duke
parents:
diff changeset
   537
    // that the hashtable grew to was determined, and then that very size
90ce3da70b43 Initial load
duke
parents:
diff changeset
   538
    // is used.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   539
    //
1287
a04aca99c77a 6722802: Code improvement and warnings removing from the javax.swing.text package
rupashka
parents: 2
diff changeset
   540
    private static final Hashtable<String, Tag> tagHashtable = new Hashtable<String, Tag>(73);
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   541
90ce3da70b43 Initial load
duke
parents:
diff changeset
   542
    /** Maps from StyleConstant key to HTML.Tag. */
1287
a04aca99c77a 6722802: Code improvement and warnings removing from the javax.swing.text package
rupashka
parents: 2
diff changeset
   543
    private static final Hashtable<Object, Tag> scMapping = new Hashtable<Object, Tag>(8);
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   544
90ce3da70b43 Initial load
duke
parents:
diff changeset
   545
    static {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   546
90ce3da70b43 Initial load
duke
parents:
diff changeset
   547
        for (int i = 0; i < Tag.allTags.length; i++ ) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   548
            tagHashtable.put(Tag.allTags[i].toString(), Tag.allTags[i]);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   549
            StyleContext.registerStaticAttributeKey(Tag.allTags[i]);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   550
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   551
        StyleContext.registerStaticAttributeKey(Tag.IMPLIED);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   552
        StyleContext.registerStaticAttributeKey(Tag.CONTENT);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   553
        StyleContext.registerStaticAttributeKey(Tag.COMMENT);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   554
        for (int i = 0; i < Attribute.allAttributes.length; i++) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   555
            StyleContext.registerStaticAttributeKey(Attribute.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   556
                                                    allAttributes[i]);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   557
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   558
        StyleContext.registerStaticAttributeKey(HTML.NULL_ATTRIBUTE_VALUE);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   559
        scMapping.put(StyleConstants.Bold, Tag.B);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   560
        scMapping.put(StyleConstants.Italic, Tag.I);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   561
        scMapping.put(StyleConstants.Underline, Tag.U);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   562
        scMapping.put(StyleConstants.StrikeThrough, Tag.STRIKE);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   563
        scMapping.put(StyleConstants.Superscript, Tag.SUP);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   564
        scMapping.put(StyleConstants.Subscript, Tag.SUB);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   565
        scMapping.put(StyleConstants.FontFamily, Tag.FONT);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   566
        scMapping.put(StyleConstants.FontSize, Tag.FONT);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   567
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   568
90ce3da70b43 Initial load
duke
parents:
diff changeset
   569
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   570
     * Returns the set of actual HTML tags that
90ce3da70b43 Initial load
duke
parents:
diff changeset
   571
     * are recognized by the default HTML reader.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   572
     * This set does not include tags that are
90ce3da70b43 Initial load
duke
parents:
diff changeset
   573
     * manufactured by the reader.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   574
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   575
    public static Tag[] getAllTags() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   576
        Tag[] tags = new Tag[Tag.allTags.length];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   577
        System.arraycopy(Tag.allTags, 0, tags, 0, Tag.allTags.length);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   578
        return tags;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   579
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   580
90ce3da70b43 Initial load
duke
parents:
diff changeset
   581
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   582
     * Fetches a tag constant for a well-known tag name (i.e. one of
90ce3da70b43 Initial load
duke
parents:
diff changeset
   583
     * the tags in the set {A, ADDRESS, APPLET, AREA, B,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   584
     * BASE, BASEFONT, BIG,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   585
     * BLOCKQUOTE, BODY, BR, CAPTION, CENTER, CITE, CODE,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   586
     * DD, DFN, DIR, DIV, DL, DT, EM, FONT, FORM, FRAME,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   587
     * FRAMESET, H1, H2, H3, H4, H5, H6, HEAD, HR, HTML,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   588
     * I, IMG, INPUT, ISINDEX, KBD, LI, LINK, MAP, MENU,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   589
     * META, NOBR, NOFRAMES, OBJECT, OL, OPTION, P, PARAM,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   590
     * PRE, SAMP, SCRIPT, SELECT, SMALL, SPAN, STRIKE, S,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   591
     * STRONG, STYLE, SUB, SUP, TABLE, TD, TEXTAREA,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   592
     * TH, TITLE, TR, TT, U, UL, VAR}.  If the given
90ce3da70b43 Initial load
duke
parents:
diff changeset
   593
     * name does not represent one of the well-known tags, then
90ce3da70b43 Initial load
duke
parents:
diff changeset
   594
     * <code>null</code> will be returned.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   595
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   596
     * @param tagName the <code>String</code> name requested
90ce3da70b43 Initial load
duke
parents:
diff changeset
   597
     * @return a tag constant corresponding to the <code>tagName</code>,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   598
     *    or <code>null</code> if not found
90ce3da70b43 Initial load
duke
parents:
diff changeset
   599
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   600
    public static Tag getTag(String tagName) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   601
1287
a04aca99c77a 6722802: Code improvement and warnings removing from the javax.swing.text package
rupashka
parents: 2
diff changeset
   602
        Tag t =  tagHashtable.get(tagName);
a04aca99c77a 6722802: Code improvement and warnings removing from the javax.swing.text package
rupashka
parents: 2
diff changeset
   603
        return (t == null ? null : t);
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   604
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   605
90ce3da70b43 Initial load
duke
parents:
diff changeset
   606
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   607
     * Returns the HTML <code>Tag</code> associated with the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   608
     * <code>StyleConstants</code> key <code>sc</code>.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   609
     * If no matching <code>Tag</code> is found, returns
90ce3da70b43 Initial load
duke
parents:
diff changeset
   610
     * <code>null</code>.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   611
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   612
     * @param sc the <code>StyleConstants</code> key
90ce3da70b43 Initial load
duke
parents:
diff changeset
   613
     * @return tag which corresponds to <code>sc</code>, or
90ce3da70b43 Initial load
duke
parents:
diff changeset
   614
     *   <code>null</code> if not found
90ce3da70b43 Initial load
duke
parents:
diff changeset
   615
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   616
    static Tag getTagForStyleConstantsKey(StyleConstants sc) {
1287
a04aca99c77a 6722802: Code improvement and warnings removing from the javax.swing.text package
rupashka
parents: 2
diff changeset
   617
        return scMapping.get(sc);
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   618
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   619
90ce3da70b43 Initial load
duke
parents:
diff changeset
   620
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   621
     * Fetches an integer attribute value.  Attribute values
90ce3da70b43 Initial load
duke
parents:
diff changeset
   622
     * are stored as a string, and this is a convenience method
90ce3da70b43 Initial load
duke
parents:
diff changeset
   623
     * to convert to an actual integer.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   624
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   625
     * @param attr the set of attributes to use to try to fetch a value
90ce3da70b43 Initial load
duke
parents:
diff changeset
   626
     * @param key the key to use to fetch the value
90ce3da70b43 Initial load
duke
parents:
diff changeset
   627
     * @param def the default value to use if the attribute isn't
90ce3da70b43 Initial load
duke
parents:
diff changeset
   628
     *  defined or there is an error converting to an integer
90ce3da70b43 Initial load
duke
parents:
diff changeset
   629
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   630
    public static int getIntegerAttributeValue(AttributeSet attr,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   631
                                               Attribute key, int def) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   632
        int value = def;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   633
        String istr = (String) attr.getAttribute(key);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   634
        if (istr != null) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   635
            try {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   636
                value = Integer.valueOf(istr).intValue();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   637
            } catch (NumberFormatException e) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   638
                value = def;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   639
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   640
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   641
        return value;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   642
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   643
90ce3da70b43 Initial load
duke
parents:
diff changeset
   644
    //  This is used in cases where the value for the attribute has not
90ce3da70b43 Initial load
duke
parents:
diff changeset
   645
    //  been specified.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   646
    //
90ce3da70b43 Initial load
duke
parents:
diff changeset
   647
    public static final String NULL_ATTRIBUTE_VALUE = "#DEFAULT";
90ce3da70b43 Initial load
duke
parents:
diff changeset
   648
90ce3da70b43 Initial load
duke
parents:
diff changeset
   649
    // size determined similar to size of tagHashtable
1287
a04aca99c77a 6722802: Code improvement and warnings removing from the javax.swing.text package
rupashka
parents: 2
diff changeset
   650
    private static final Hashtable<String, Attribute> attHashtable = new Hashtable<String, Attribute>(77);
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   651
90ce3da70b43 Initial load
duke
parents:
diff changeset
   652
    static {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   653
90ce3da70b43 Initial load
duke
parents:
diff changeset
   654
        for (int i = 0; i < Attribute.allAttributes.length; i++ ) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   655
            attHashtable.put(Attribute.allAttributes[i].toString(), Attribute.allAttributes[i]);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   656
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   657
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   658
90ce3da70b43 Initial load
duke
parents:
diff changeset
   659
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   660
     * Returns the set of HTML attributes recognized.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   661
     * @return the set of HTML attributes recognized
90ce3da70b43 Initial load
duke
parents:
diff changeset
   662
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   663
    public static Attribute[] getAllAttributeKeys() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   664
        Attribute[] attributes = new Attribute[Attribute.allAttributes.length];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   665
        System.arraycopy(Attribute.allAttributes, 0,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   666
                         attributes, 0, Attribute.allAttributes.length);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   667
        return attributes;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   668
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   669
90ce3da70b43 Initial load
duke
parents:
diff changeset
   670
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   671
     * Fetches an attribute constant for a well-known attribute name
90ce3da70b43 Initial load
duke
parents:
diff changeset
   672
     * (i.e. one of the attributes in the set {FACE, COMMENT, SIZE,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   673
     * COLOR, CLEAR, BACKGROUND, BGCOLOR, TEXT, LINK, VLINK, ALINK,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   674
     * WIDTH, HEIGHT, ALIGN, NAME, HREF, REL, REV, TITLE, TARGET,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   675
     * SHAPE, COORDS, ISMAP, NOHREF, ALT, ID, SRC, HSPACE, VSPACE,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   676
     * USEMAP, LOWSRC, CODEBASE, CODE, ARCHIVE, VALUE, VALUETYPE,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   677
     * TYPE, CLASS, STYLE, LANG, DIR, DECLARE, CLASSID, DATA, CODETYPE,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   678
     * STANDBY, BORDER, SHAPES, NOSHADE, COMPACT, START, ACTION, METHOD,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   679
     * ENCTYPE, CHECKED, MAXLENGTH, MULTIPLE, SELECTED, ROWS, COLS,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   680
     * DUMMY, CELLSPACING, CELLPADDING, VALIGN, HALIGN, NOWRAP, ROWSPAN,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   681
     * COLSPAN, PROMPT, HTTPEQUIV, CONTENT, LANGUAGE, VERSION, N,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   682
     * FRAMEBORDER, MARGINWIDTH, MARGINHEIGHT, SCROLLING, NORESIZE,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   683
     * MEDIA, ENDTAG}).
90ce3da70b43 Initial load
duke
parents:
diff changeset
   684
     * If the given name does not represent one of the well-known attributes,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   685
     * then <code>null</code> will be returned.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   686
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   687
     * @param attName the <code>String</code> requested
90ce3da70b43 Initial load
duke
parents:
diff changeset
   688
     * @return the <code>Attribute</code> corresponding to <code>attName</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   689
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   690
    public static Attribute getAttributeKey(String attName) {
1287
a04aca99c77a 6722802: Code improvement and warnings removing from the javax.swing.text package
rupashka
parents: 2
diff changeset
   691
        Attribute a = attHashtable.get(attName);
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   692
        if (a == null) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   693
          return null;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   694
        }
1287
a04aca99c77a 6722802: Code improvement and warnings removing from the javax.swing.text package
rupashka
parents: 2
diff changeset
   695
        return a;
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   696
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   697
90ce3da70b43 Initial load
duke
parents:
diff changeset
   698
}