Thu, 10 Jun 2010 17:09:56 -0700
6960407: Potential rebranding issues in openjdk/langtools repository sources
Reviewed-by: darcy
1 /*
2 * Copyright (c) 2003, 2004, 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;
28 import java.io.*;
30 import com.sun.javadoc.*;
31 import com.sun.tools.doclets.internal.toolkit.*;
33 /**
34 * Writes annotation type required member documentation in HTML format.
35 *
36 * @author Jamie Ho
37 * @author Bhavesh Patel (Modified)
38 */
39 public class AnnotationTypeRequiredMemberWriterImpl extends AbstractMemberWriter
40 implements AnnotationTypeRequiredMemberWriter, MemberSummaryWriter {
42 /**
43 * Construct a new AnnotationTypeRequiredMemberWriterImpl.
44 *
45 * @param writer the writer that will write the output.
46 * @param annotationType the AnnotationType that holds this member.
47 */
48 public AnnotationTypeRequiredMemberWriterImpl(SubWriterHolderWriter writer,
49 AnnotationTypeDoc annotationType) {
50 super(writer, annotationType);
51 }
53 /**
54 * Write the annotation type member summary header for the given class.
55 *
56 * @param classDoc the class the summary belongs to.
57 */
58 public void writeMemberSummaryHeader(ClassDoc classDoc) {
59 writer.println("<!-- =========== ANNOTATION TYPE REQUIRED MEMBER SUMMARY =========== -->");
60 writer.println();
61 writer.printSummaryHeader(this, classDoc);
62 }
64 /**
65 * Write the annotation type member summary footer for the given class.
66 *
67 * @param classDoc the class the summary belongs to.
68 */
69 public void writeMemberSummaryFooter(ClassDoc classDoc) {
70 writer.printSummaryFooter(this, classDoc);
71 }
73 /**
74 * {@inheritDoc}
75 */
76 public void writeInheritedMemberSummaryHeader(ClassDoc classDoc) {
77 //Not appliable.
78 }
80 /**
81 * {@inheritDoc}
82 */
83 public void writeInheritedMemberSummary(ClassDoc classDoc,
84 ProgramElementDoc member, boolean isFirst, boolean isLast) {
85 //Not appliable.
86 }
88 /**
89 * {@inheritDoc}
90 */
91 public void writeInheritedMemberSummaryFooter(ClassDoc classDoc) {
92 //Not appliable.
93 }
95 /**
96 * {@inheritDoc}
97 */
98 public void writeHeader(ClassDoc classDoc, String header) {
99 writer.println();
100 writer.println("<!-- ============ ANNOTATION TYPE MEMBER DETAIL =========== -->");
101 writer.println();
102 writer.anchor("annotation_type_element_detail");
103 writer.printTableHeadingBackground(header);
104 writer.println();
105 }
107 /**
108 * {@inheritDoc}
109 */
110 public void writeMemberHeader(MemberDoc member, boolean isFirst) {
111 if (! isFirst) {
112 writer.printMemberHeader();
113 writer.println("");
114 }
115 writer.anchor(member.name() + ((ExecutableMemberDoc) member).signature());
116 writer.h3();
117 writer.print(member.name());
118 writer.h3End();
119 }
121 /**
122 * {@inheritDoc}
123 */
124 public void writeSignature(MemberDoc member) {
125 writer.pre();
126 writer.writeAnnotationInfo(member);
127 printModifiers(member);
128 writer.printLink(new LinkInfoImpl(LinkInfoImpl.CONTEXT_MEMBER,
129 getType(member)));
130 print(' ');
131 if (configuration().linksource) {
132 writer.printSrcLink(member, member.name());
133 } else {
134 strong(member.name());
135 }
136 writer.preEnd();
137 assert !writer.getMemberDetailsListPrinted();
138 }
140 /**
141 * {@inheritDoc}
142 */
143 public void writeComments(MemberDoc member) {
144 printComment(member);
145 }
147 /**
148 * Write the tag output for the given member.
149 *
150 * @param member the member being documented.
151 */
152 public void writeTags(MemberDoc member) {
153 writer.printTags(member);
154 }
156 /**
157 * Write the annotation type member footer.
158 */
159 public void writeMemberFooter() {
160 printMemberFooter();
161 }
163 /**
164 * Write the footer for the annotation type member documentation.
165 *
166 * @param classDoc the class that the annotation type member belong to.
167 */
168 public void writeFooter(ClassDoc classDoc) {
169 //No footer to write for annotation type member documentation
170 }
172 /**
173 * Close the writer.
174 */
175 public void close() throws IOException {
176 writer.close();
177 }
179 /**
180 * {@inheritDoc}
181 */
182 public void printSummaryLabel() {
183 writer.printText("doclet.Annotation_Type_Required_Member_Summary");
184 }
186 /**
187 * {@inheritDoc}
188 */
189 public void printTableSummary() {
190 writer.tableIndexSummary(configuration().getText("doclet.Member_Table_Summary",
191 configuration().getText("doclet.Annotation_Type_Required_Member_Summary"),
192 configuration().getText("doclet.annotation_type_required_members")));
193 }
195 public void printSummaryTableHeader(ProgramElementDoc member) {
196 String[] header = new String[] {
197 writer.getModifierTypeHeader(),
198 configuration().getText("doclet.0_and_1",
199 configuration().getText("doclet.Annotation_Type_Required_Member"),
200 configuration().getText("doclet.Description"))
201 };
202 writer.summaryTableHeader(header, "col");
203 }
205 /**
206 * {@inheritDoc}
207 */
208 public void printSummaryAnchor(ClassDoc cd) {
209 writer.anchor("annotation_type_required_element_summary");
210 }
212 /**
213 * {@inheritDoc}
214 */
215 public void printInheritedSummaryAnchor(ClassDoc cd) {
216 } // no such
218 /**
219 * {@inheritDoc}
220 */
221 public void printInheritedSummaryLabel(ClassDoc cd) {
222 // no such
223 }
225 /**
226 * {@inheritDoc}
227 */
228 protected void writeSummaryLink(int context, ClassDoc cd, ProgramElementDoc member) {
229 writer.strong();
230 writer.printDocLink(context, (MemberDoc) member, member.name(), false);
231 writer.strongEnd();
232 }
234 /**
235 * {@inheritDoc}
236 */
237 protected void writeInheritedSummaryLink(ClassDoc cd,
238 ProgramElementDoc member) {
239 //Not applicable.
240 }
242 /**
243 * {@inheritDoc}
244 */
245 protected void printSummaryType(ProgramElementDoc member) {
246 MemberDoc m = (MemberDoc)member;
247 printModifierAndType(m, getType(m));
248 }
250 /**
251 * {@inheritDoc}
252 */
253 protected void writeDeprecatedLink(ProgramElementDoc member) {
254 writer.printDocLink(LinkInfoImpl.CONTEXT_MEMBER,
255 (MemberDoc) member, ((MemberDoc)member).qualifiedName(), false);
256 }
258 /**
259 * {@inheritDoc}
260 */
261 protected void printNavSummaryLink(ClassDoc cd, boolean link) {
262 if (link) {
263 writer.printHyperLink("", "annotation_type_required_element_summary",
264 configuration().getText("doclet.navAnnotationTypeRequiredMember"));
265 } else {
266 writer.printText("doclet.navAnnotationTypeRequiredMember");
267 }
268 }
270 /**
271 * {@inheritDoc}
272 */
273 protected void printNavDetailLink(boolean link) {
274 if (link) {
275 writer.printHyperLink("", "annotation_type_element_detail",
276 configuration().getText("doclet.navAnnotationTypeMember"));
277 } else {
278 writer.printText("doclet.navAnnotationTypeMember");
279 }
280 }
282 /**
283 * {@inheritDoc}
284 */
285 public void writeDeprecated(MemberDoc member) {
286 printDeprecated(member);
287 }
289 private Type getType(MemberDoc member) {
290 if (member instanceof FieldDoc) {
291 return ((FieldDoc) member).type();
292 } else {
293 return ((MethodDoc) member).returnType();
294 }
295 }
296 }