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

Tue, 20 Aug 2013 14:55:20 -0700

author
jjg
date
Tue, 20 Aug 2013 14:55:20 -0700
changeset 1964
79e341614c50
parent 1748
051b728cfe90
child 2413
fe033d997ddf
permissions
-rw-r--r--

8022080: javadoc generates invalid HTML in Turkish locale
Reviewed-by: bpatel

bpatel@766 1 /*
jjg@1742 2 * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
bpatel@766 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
bpatel@766 4 *
bpatel@766 5 * This code is free software; you can redistribute it and/or modify it
bpatel@766 6 * under the terms of the GNU General Public License version 2 only, as
bpatel@766 7 * published by the Free Software Foundation. Oracle designates this
bpatel@766 8 * particular file as subject to the "Classpath" exception as provided
bpatel@766 9 * by Oracle in the LICENSE file that accompanied this code.
bpatel@766 10 *
bpatel@766 11 * This code is distributed in the hope that it will be useful, but WITHOUT
bpatel@766 12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
bpatel@766 13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
bpatel@766 14 * version 2 for more details (a copy is included in the LICENSE file that
bpatel@766 15 * accompanied this code).
bpatel@766 16 *
bpatel@766 17 * You should have received a copy of the GNU General Public License version
bpatel@766 18 * 2 along with this work; if not, write to the Free Software Foundation,
bpatel@766 19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
bpatel@766 20 *
bpatel@766 21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
bpatel@766 22 * or visit www.oracle.com if you need additional information or have any
bpatel@766 23 * questions.
bpatel@766 24 */
bpatel@766 25
bpatel@766 26 package com.sun.tools.doclets.formats.html.markup;
bpatel@766 27
jjg@1964 28 import java.util.Locale;
jjg@1964 29
bpatel@766 30 /**
bpatel@766 31 * Enum representing HTML tags.
bpatel@766 32 *
jjg@1359 33 * <p><b>This is NOT part of any supported API.
jjg@1359 34 * If you write code that depends on this, you do so at your own risk.
jjg@1359 35 * This code and its internal interfaces are subject to change or
jjg@1359 36 * deletion without notice.</b>
jjg@1359 37 *
bpatel@766 38 * @author Bhavesh Patel
bpatel@766 39 */
bpatel@766 40 public enum HtmlTag {
bpatel@766 41 A(BlockType.INLINE, EndTag.END),
bpatel@766 42 BLOCKQUOTE,
bpatel@766 43 BODY(BlockType.OTHER, EndTag.END),
bpatel@766 44 BR(BlockType.INLINE, EndTag.NOEND),
bpatel@766 45 CAPTION,
bpatel@766 46 CENTER,
bpatel@766 47 CODE(BlockType.INLINE, EndTag.END),
bpatel@766 48 DD,
jjg@1748 49 DIR,
bpatel@766 50 DIV,
bpatel@766 51 DL,
bpatel@766 52 DT,
bpatel@766 53 EM(BlockType.INLINE, EndTag.END),
bpatel@766 54 FONT(BlockType.INLINE, EndTag.END),
bpatel@766 55 FRAME(BlockType.OTHER, EndTag.NOEND),
bpatel@766 56 FRAMESET(BlockType.OTHER, EndTag.END),
bpatel@766 57 H1,
bpatel@766 58 H2,
bpatel@766 59 H3,
bpatel@766 60 H4,
bpatel@766 61 H5,
bpatel@766 62 H6,
bpatel@766 63 HEAD(BlockType.OTHER, EndTag.END),
bpatel@766 64 HR(BlockType.BLOCK, EndTag.NOEND),
bpatel@766 65 HTML(BlockType.OTHER, EndTag.END),
bpatel@766 66 I(BlockType.INLINE, EndTag.END),
bpatel@766 67 IMG(BlockType.INLINE, EndTag.NOEND),
bpatel@766 68 LI,
jjg@1748 69 LISTING,
bpatel@766 70 LINK(BlockType.OTHER, EndTag.NOEND),
bpatel@766 71 MENU,
bpatel@766 72 META(BlockType.OTHER, EndTag.NOEND),
bpatel@766 73 NOFRAMES(BlockType.OTHER, EndTag.END),
bpatel@766 74 NOSCRIPT(BlockType.OTHER, EndTag.END),
bpatel@766 75 OL,
bpatel@766 76 P,
bpatel@766 77 PRE,
bpatel@766 78 SCRIPT(BlockType.OTHER, EndTag.END),
bpatel@766 79 SMALL(BlockType.INLINE, EndTag.END),
bpatel@766 80 SPAN(BlockType.INLINE, EndTag.END),
bpatel@766 81 STRONG(BlockType.INLINE, EndTag.END),
jjg@1742 82 SUB(BlockType.INLINE, EndTag.END),
bpatel@766 83 TABLE,
bpatel@766 84 TBODY,
bpatel@766 85 TD,
bpatel@766 86 TH,
bpatel@766 87 TITLE(BlockType.OTHER, EndTag.END),
bpatel@766 88 TR,
bpatel@766 89 TT(BlockType.INLINE, EndTag.END),
bpatel@766 90 UL;
bpatel@766 91
jjg@1748 92 public final BlockType blockType;
jjg@1748 93 public final EndTag endTag;
jjg@1748 94 public final String value;
bpatel@766 95
bpatel@766 96 /**
bpatel@766 97 * Enum representing the type of HTML element.
bpatel@766 98 */
jjg@1748 99 public static enum BlockType {
bpatel@766 100 BLOCK,
bpatel@766 101 INLINE,
bpatel@766 102 OTHER;
bpatel@766 103 }
bpatel@766 104
bpatel@766 105 /**
bpatel@766 106 * Enum representing HTML end tag requirement.
bpatel@766 107 */
jjg@1748 108 public static enum EndTag {
bpatel@766 109 END,
bpatel@766 110 NOEND;
bpatel@766 111 }
bpatel@766 112
bpatel@766 113 HtmlTag() {
bpatel@766 114 this(BlockType.BLOCK, EndTag.END);
bpatel@766 115 }
bpatel@766 116
bpatel@766 117 HtmlTag(BlockType blockType, EndTag endTag ) {
bpatel@766 118 this.blockType = blockType;
bpatel@766 119 this.endTag = endTag;
jjg@1964 120 this.value = name().toLowerCase(Locale.US);
bpatel@766 121 }
bpatel@766 122
bpatel@766 123 /**
bpatel@766 124 * Returns true if the end tag is required. This is specific to the standard
bpatel@766 125 * doclet and does not exactly resemble the W3C specifications.
bpatel@766 126 *
bpatel@766 127 * @return true if end tag needs to be displayed else return false
bpatel@766 128 */
bpatel@766 129 public boolean endTagRequired() {
bpatel@766 130 return (endTag == EndTag.END);
bpatel@766 131 }
bpatel@766 132
bpatel@766 133 public String toString() {
bpatel@766 134 return value;
bpatel@766 135 }
bpatel@766 136 }

mercurial