author | jjg |
Thu, 10 Jun 2010 17:09:56 -0700 | |
changeset 5848 | c5a4ce47e780 |
parent 5520 | 86e4b9a9da40 |
child 7614 | cfadc977ca75 |
permissions | -rw-r--r-- |
10 | 1 |
/* |
5520 | 2 |
* Copyright (c) 2003, 2004, Oracle and/or its affiliates. All rights reserved. |
10 | 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 |
|
5520 | 7 |
* published by the Free Software Foundation. Oracle designates this |
10 | 8 |
* particular file as subject to the "Classpath" exception as provided |
5520 | 9 |
* by Oracle in the LICENSE file that accompanied this code. |
10 | 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 |
* |
|
5520 | 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. |
|
10 | 24 |
*/ |
25 |
||
26 |
package com.sun.tools.doclets.formats.html; |
|
27 |
||
2216
b124d5c924eb
6786690: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - DL tag and nesting issue
bpatel
parents:
1787
diff
changeset
|
28 |
import java.io.*; |
b124d5c924eb
6786690: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - DL tag and nesting issue
bpatel
parents:
1787
diff
changeset
|
29 |
|
b124d5c924eb
6786690: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - DL tag and nesting issue
bpatel
parents:
1787
diff
changeset
|
30 |
import com.sun.javadoc.*; |
10 | 31 |
import com.sun.tools.doclets.internal.toolkit.*; |
32 |
import com.sun.tools.doclets.internal.toolkit.util.*; |
|
33 |
||
34 |
/** |
|
35 |
* Writes enum constant documentation in HTML format. |
|
36 |
* |
|
37 |
* @author Jamie Ho |
|
2320
5b8c377175f4
6786688: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - Table must have captions and headers
bpatel
parents:
2216
diff
changeset
|
38 |
* @author Bhavesh Patel (Modified) |
10 | 39 |
*/ |
40 |
public class EnumConstantWriterImpl extends AbstractMemberWriter |
|
41 |
implements EnumConstantWriter, MemberSummaryWriter { |
|
42 |
||
43 |
private boolean printedSummaryHeader = false; |
|
44 |
||
45 |
public EnumConstantWriterImpl(SubWriterHolderWriter writer, |
|
46 |
ClassDoc classdoc) { |
|
47 |
super(writer, classdoc); |
|
48 |
} |
|
49 |
||
50 |
public EnumConstantWriterImpl(SubWriterHolderWriter writer) { |
|
51 |
super(writer); |
|
52 |
} |
|
53 |
||
54 |
/** |
|
55 |
* Write the enum constant summary header for the given class. |
|
56 |
* |
|
57 |
* @param classDoc the class the summary belongs to. |
|
58 |
*/ |
|
59 |
public void writeMemberSummaryHeader(ClassDoc classDoc) { |
|
60 |
printedSummaryHeader = true; |
|
61 |
writer.println("<!-- =========== ENUM CONSTANT SUMMARY =========== -->"); |
|
62 |
writer.println(); |
|
63 |
writer.printSummaryHeader(this, classDoc); |
|
64 |
} |
|
65 |
||
66 |
/** |
|
67 |
* Write the enum constant summary footer for the given class. |
|
68 |
* |
|
69 |
* @param classDoc the class the summary belongs to. |
|
70 |
*/ |
|
71 |
public void writeMemberSummaryFooter(ClassDoc classDoc) { |
|
72 |
writer.printSummaryFooter(this, classDoc); |
|
73 |
} |
|
74 |
||
75 |
/** |
|
76 |
* Write the inherited enum constant summary header for the given class. |
|
77 |
* |
|
78 |
* @param classDoc the class the summary belongs to. |
|
79 |
*/ |
|
80 |
public void writeInheritedMemberSummaryHeader(ClassDoc classDoc) { |
|
81 |
if(! printedSummaryHeader){ |
|
82 |
//We don't want inherited summary to not be under heading. |
|
83 |
writeMemberSummaryHeader(classDoc); |
|
84 |
writeMemberSummaryFooter(classDoc); |
|
85 |
printedSummaryHeader = true; |
|
86 |
} |
|
87 |
writer.printInheritedSummaryHeader(this, classDoc); |
|
88 |
} |
|
89 |
||
90 |
/** |
|
91 |
* {@inheritDoc} |
|
92 |
*/ |
|
93 |
public void writeInheritedMemberSummary(ClassDoc classDoc, |
|
94 |
ProgramElementDoc enumConstant, boolean isFirst, boolean isLast) { |
|
95 |
writer.printInheritedSummaryMember(this, classDoc, enumConstant, isFirst); |
|
96 |
} |
|
97 |
||
98 |
/** |
|
99 |
* Write the inherited enum constant summary footer for the given class. |
|
100 |
* |
|
101 |
* @param classDoc the class the summary belongs to. |
|
102 |
*/ |
|
103 |
public void writeInheritedMemberSummaryFooter(ClassDoc classDoc) { |
|
104 |
writer.printInheritedSummaryFooter(this, classDoc); |
|
105 |
} |
|
106 |
||
107 |
/** |
|
108 |
* {@inheritDoc} |
|
109 |
*/ |
|
110 |
public void writeHeader(ClassDoc classDoc, String header) { |
|
111 |
writer.println(); |
|
112 |
writer.println("<!-- ============ ENUM CONSTANT DETAIL =========== -->"); |
|
113 |
writer.println(); |
|
114 |
writer.anchor("enum_constant_detail"); |
|
115 |
writer.printTableHeadingBackground(header); |
|
116 |
writer.println(); |
|
117 |
} |
|
118 |
||
119 |
/** |
|
120 |
* {@inheritDoc} |
|
121 |
*/ |
|
122 |
public void writeEnumConstantHeader(FieldDoc enumConstant, boolean isFirst) { |
|
123 |
if (! isFirst) { |
|
124 |
writer.printMemberHeader(); |
|
125 |
writer.println(""); |
|
126 |
} |
|
127 |
writer.anchor(enumConstant.name()); |
|
128 |
writer.h3(); |
|
129 |
writer.print(enumConstant.name()); |
|
130 |
writer.h3End(); |
|
131 |
} |
|
132 |
||
133 |
/** |
|
134 |
* {@inheritDoc} |
|
135 |
*/ |
|
136 |
public void writeSignature(FieldDoc enumConstant) { |
|
137 |
writer.pre(); |
|
138 |
writer.writeAnnotationInfo(enumConstant); |
|
139 |
printModifiers(enumConstant); |
|
140 |
writer.printLink(new LinkInfoImpl(LinkInfoImpl.CONTEXT_MEMBER, |
|
141 |
enumConstant.type())); |
|
142 |
print(' '); |
|
143 |
if (configuration().linksource) { |
|
144 |
writer.printSrcLink(enumConstant, enumConstant.name()); |
|
145 |
} else { |
|
1787
1aa079321cd2
6786028: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - Bold tags should be strong
bpatel
parents:
10
diff
changeset
|
146 |
strong(enumConstant.name()); |
10 | 147 |
} |
148 |
writer.preEnd(); |
|
2216
b124d5c924eb
6786690: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - DL tag and nesting issue
bpatel
parents:
1787
diff
changeset
|
149 |
assert !writer.getMemberDetailsListPrinted(); |
10 | 150 |
} |
151 |
||
152 |
/** |
|
153 |
* {@inheritDoc} |
|
154 |
*/ |
|
155 |
public void writeDeprecated(FieldDoc enumConstant) { |
|
2216
b124d5c924eb
6786690: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - DL tag and nesting issue
bpatel
parents:
1787
diff
changeset
|
156 |
printDeprecated(enumConstant); |
10 | 157 |
} |
158 |
||
159 |
/** |
|
160 |
* {@inheritDoc} |
|
161 |
*/ |
|
162 |
public void writeComments(FieldDoc enumConstant) { |
|
2216
b124d5c924eb
6786690: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - DL tag and nesting issue
bpatel
parents:
1787
diff
changeset
|
163 |
printComment(enumConstant); |
10 | 164 |
} |
165 |
||
166 |
/** |
|
167 |
* {@inheritDoc} |
|
168 |
*/ |
|
169 |
public void writeTags(FieldDoc enumConstant) { |
|
170 |
writer.printTags(enumConstant); |
|
171 |
} |
|
172 |
||
173 |
/** |
|
174 |
* {@inheritDoc} |
|
175 |
*/ |
|
176 |
public void writeEnumConstantFooter() { |
|
2216
b124d5c924eb
6786690: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - DL tag and nesting issue
bpatel
parents:
1787
diff
changeset
|
177 |
printMemberFooter(); |
10 | 178 |
} |
179 |
||
180 |
/** |
|
181 |
* {@inheritDoc} |
|
182 |
*/ |
|
183 |
public void writeFooter(ClassDoc classDoc) { |
|
184 |
//No footer to write for enum constant documentation |
|
185 |
} |
|
186 |
||
187 |
/** |
|
188 |
* {@inheritDoc} |
|
189 |
*/ |
|
190 |
public void close() throws IOException { |
|
191 |
writer.close(); |
|
192 |
} |
|
193 |
||
194 |
public int getMemberKind() { |
|
195 |
return VisibleMemberMap.ENUM_CONSTANTS; |
|
196 |
} |
|
197 |
||
2320
5b8c377175f4
6786688: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - Table must have captions and headers
bpatel
parents:
2216
diff
changeset
|
198 |
public void printSummaryLabel() { |
5b8c377175f4
6786688: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - Table must have captions and headers
bpatel
parents:
2216
diff
changeset
|
199 |
writer.printText("doclet.Enum_Constant_Summary"); |
5b8c377175f4
6786688: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - Table must have captions and headers
bpatel
parents:
2216
diff
changeset
|
200 |
} |
5b8c377175f4
6786688: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - Table must have captions and headers
bpatel
parents:
2216
diff
changeset
|
201 |
|
5b8c377175f4
6786688: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - Table must have captions and headers
bpatel
parents:
2216
diff
changeset
|
202 |
public void printTableSummary() { |
5b8c377175f4
6786688: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - Table must have captions and headers
bpatel
parents:
2216
diff
changeset
|
203 |
writer.tableIndexSummary(configuration().getText("doclet.Member_Table_Summary", |
5b8c377175f4
6786688: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - Table must have captions and headers
bpatel
parents:
2216
diff
changeset
|
204 |
configuration().getText("doclet.Enum_Constant_Summary"), |
5b8c377175f4
6786688: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - Table must have captions and headers
bpatel
parents:
2216
diff
changeset
|
205 |
configuration().getText("doclet.enum_constants"))); |
5b8c377175f4
6786688: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - Table must have captions and headers
bpatel
parents:
2216
diff
changeset
|
206 |
} |
5b8c377175f4
6786688: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - Table must have captions and headers
bpatel
parents:
2216
diff
changeset
|
207 |
|
5b8c377175f4
6786688: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - Table must have captions and headers
bpatel
parents:
2216
diff
changeset
|
208 |
public void printSummaryTableHeader(ProgramElementDoc member) { |
5b8c377175f4
6786688: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - Table must have captions and headers
bpatel
parents:
2216
diff
changeset
|
209 |
String[] header = new String[] { |
5b8c377175f4
6786688: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - Table must have captions and headers
bpatel
parents:
2216
diff
changeset
|
210 |
configuration().getText("doclet.0_and_1", |
5b8c377175f4
6786688: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - Table must have captions and headers
bpatel
parents:
2216
diff
changeset
|
211 |
configuration().getText("doclet.Enum_Constant"), |
5b8c377175f4
6786688: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - Table must have captions and headers
bpatel
parents:
2216
diff
changeset
|
212 |
configuration().getText("doclet.Description")) |
5b8c377175f4
6786688: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - Table must have captions and headers
bpatel
parents:
2216
diff
changeset
|
213 |
}; |
5b8c377175f4
6786688: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - Table must have captions and headers
bpatel
parents:
2216
diff
changeset
|
214 |
writer.summaryTableHeader(header, "col"); |
10 | 215 |
} |
216 |
||
217 |
public void printSummaryAnchor(ClassDoc cd) { |
|
218 |
writer.anchor("enum_constant_summary"); |
|
219 |
} |
|
220 |
||
221 |
public void printInheritedSummaryAnchor(ClassDoc cd) { |
|
222 |
} // no such |
|
223 |
||
224 |
public void printInheritedSummaryLabel(ClassDoc cd) { |
|
225 |
// no such |
|
226 |
} |
|
227 |
||
228 |
protected void writeSummaryLink(int context, ClassDoc cd, ProgramElementDoc member) { |
|
1787
1aa079321cd2
6786028: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - Bold tags should be strong
bpatel
parents:
10
diff
changeset
|
229 |
writer.strong(); |
10 | 230 |
writer.printDocLink(context, (MemberDoc) member, member.name(), false); |
1787
1aa079321cd2
6786028: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - Bold tags should be strong
bpatel
parents:
10
diff
changeset
|
231 |
writer.strongEnd(); |
10 | 232 |
} |
233 |
||
234 |
protected void writeInheritedSummaryLink(ClassDoc cd, |
|
235 |
ProgramElementDoc member) { |
|
236 |
writer.printDocLink(LinkInfoImpl.CONTEXT_MEMBER, (MemberDoc)member, |
|
237 |
member.name(), false); |
|
238 |
} |
|
239 |
||
240 |
protected void printSummaryType(ProgramElementDoc member) { |
|
241 |
//Not applicable. |
|
242 |
} |
|
243 |
||
244 |
protected void writeDeprecatedLink(ProgramElementDoc member) { |
|
245 |
writer.printDocLink(LinkInfoImpl.CONTEXT_MEMBER, |
|
246 |
(MemberDoc) member, ((FieldDoc)member).qualifiedName(), false); |
|
247 |
} |
|
248 |
||
249 |
protected void printNavSummaryLink(ClassDoc cd, boolean link) { |
|
250 |
if (link) { |
|
251 |
writer.printHyperLink("", (cd == null)? |
|
252 |
"enum_constant_summary": |
|
253 |
"enum_constants_inherited_from_class_" + |
|
254 |
configuration().getClassName(cd), |
|
255 |
configuration().getText("doclet.navEnum")); |
|
256 |
} else { |
|
257 |
writer.printText("doclet.navEnum"); |
|
258 |
} |
|
259 |
} |
|
260 |
||
261 |
protected void printNavDetailLink(boolean link) { |
|
262 |
if (link) { |
|
263 |
writer.printHyperLink("", "enum_constant_detail", |
|
264 |
configuration().getText("doclet.navEnum")); |
|
265 |
} else { |
|
266 |
writer.printText("doclet.navEnum"); |
|
267 |
} |
|
268 |
} |
|
269 |
} |