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