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

changeset 0
959103a6100f
child 2525
2eb010b6cb22
equal deleted inserted replaced
-1:000000000000 0:959103a6100f
1 /*
2 * Copyright (c) 1997, 2013, 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 */
25
26 package com.sun.tools.doclets.formats.html;
27
28 import java.io.*;
29
30 import com.sun.javadoc.*;
31 import com.sun.tools.doclets.formats.html.markup.*;
32 import com.sun.tools.doclets.internal.toolkit.*;
33 import com.sun.tools.doclets.internal.toolkit.util.*;
34
35 /**
36 * Writes nested class documentation in HTML format.
37 *
38 * <p><b>This is NOT part of any supported API.
39 * If you write code that depends on this, you do so at your own risk.
40 * This code and its internal interfaces are subject to change or
41 * deletion without notice.</b>
42 *
43 * @author Robert Field
44 * @author Atul M Dambalkar
45 * @author Jamie Ho (rewrite)
46 * @author Bhavesh Patel (Modified)
47 */
48 public class NestedClassWriterImpl extends AbstractMemberWriter
49 implements MemberSummaryWriter {
50
51 public NestedClassWriterImpl(SubWriterHolderWriter writer,
52 ClassDoc classdoc) {
53 super(writer, classdoc);
54 }
55
56 public NestedClassWriterImpl(SubWriterHolderWriter writer) {
57 super(writer);
58 }
59
60 /**
61 * {@inheritDoc}
62 */
63 public Content getMemberSummaryHeader(ClassDoc classDoc,
64 Content memberSummaryTree) {
65 memberSummaryTree.addContent(HtmlConstants.START_OF_NESTED_CLASS_SUMMARY);
66 Content memberTree = writer.getMemberTreeHeader();
67 writer.addSummaryHeader(this, classDoc, memberTree);
68 return memberTree;
69 }
70
71 /**
72 * Close the writer.
73 */
74 public void close() throws IOException {
75 writer.close();
76 }
77
78 public int getMemberKind() {
79 return VisibleMemberMap.INNERCLASSES;
80 }
81
82 /**
83 * {@inheritDoc}
84 */
85 public void addSummaryLabel(Content memberTree) {
86 Content label = HtmlTree.HEADING(HtmlConstants.SUMMARY_HEADING,
87 writer.getResource("doclet.Nested_Class_Summary"));
88 memberTree.addContent(label);
89 }
90
91 /**
92 * {@inheritDoc}
93 */
94 public String getTableSummary() {
95 return configuration.getText("doclet.Member_Table_Summary",
96 configuration.getText("doclet.Nested_Class_Summary"),
97 configuration.getText("doclet.nested_classes"));
98 }
99
100 /**
101 * {@inheritDoc}
102 */
103 public Content getCaption() {
104 return configuration.getResource("doclet.Nested_Classes");
105 }
106
107 /**
108 * {@inheritDoc}
109 */
110 public String[] getSummaryTableHeader(ProgramElementDoc member) {
111 String[] header;
112 if (member.isInterface()) {
113 header = new String[] {
114 writer.getModifierTypeHeader(),
115 configuration.getText("doclet.0_and_1",
116 configuration.getText("doclet.Interface"),
117 configuration.getText("doclet.Description"))
118 };
119 }
120 else {
121 header = new String[] {
122 writer.getModifierTypeHeader(),
123 configuration.getText("doclet.0_and_1",
124 configuration.getText("doclet.Class"),
125 configuration.getText("doclet.Description"))
126 };
127 }
128 return header;
129 }
130
131 /**
132 * {@inheritDoc}
133 */
134 public void addSummaryAnchor(ClassDoc cd, Content memberTree) {
135 memberTree.addContent(writer.getMarkerAnchor(
136 SectionName.NESTED_CLASS_SUMMARY));
137 }
138
139 /**
140 * {@inheritDoc}
141 */
142 public void addInheritedSummaryAnchor(ClassDoc cd, Content inheritedTree) {
143 inheritedTree.addContent(writer.getMarkerAnchor(
144 SectionName.NESTED_CLASSES_INHERITANCE,
145 cd.qualifiedName()));
146 }
147
148 /**
149 * {@inheritDoc}
150 */
151 public void addInheritedSummaryLabel(ClassDoc cd, Content inheritedTree) {
152 Content classLink = writer.getPreQualifiedClassLink(
153 LinkInfoImpl.Kind.MEMBER, cd, false);
154 Content label = new StringContent(cd.isInterface() ?
155 configuration.getText("doclet.Nested_Classes_Interface_Inherited_From_Interface") :
156 configuration.getText("doclet.Nested_Classes_Interfaces_Inherited_From_Class"));
157 Content labelHeading = HtmlTree.HEADING(HtmlConstants.INHERITED_SUMMARY_HEADING,
158 label);
159 labelHeading.addContent(writer.getSpace());
160 labelHeading.addContent(classLink);
161 inheritedTree.addContent(labelHeading);
162 }
163
164 /**
165 * {@inheritDoc}
166 */
167 protected void addSummaryLink(LinkInfoImpl.Kind context, ClassDoc cd, ProgramElementDoc member,
168 Content tdSummary) {
169 Content memberLink = HtmlTree.SPAN(HtmlStyle.memberNameLink,
170 writer.getLink(new LinkInfoImpl(configuration, context, (ClassDoc)member)));
171 Content code = HtmlTree.CODE(memberLink);
172 tdSummary.addContent(code);
173 }
174
175 /**
176 * {@inheritDoc}
177 */
178 protected void addInheritedSummaryLink(ClassDoc cd,
179 ProgramElementDoc member, Content linksTree) {
180 linksTree.addContent(
181 writer.getLink(new LinkInfoImpl(configuration, LinkInfoImpl.Kind.MEMBER,
182 (ClassDoc)member)));
183 }
184
185 /**
186 * {@inheritDoc}
187 */
188 protected void addSummaryType(ProgramElementDoc member,
189 Content tdSummaryType) {
190 ClassDoc cd = (ClassDoc)member;
191 addModifierAndType(cd, null, tdSummaryType);
192 }
193
194 /**
195 * {@inheritDoc}
196 */
197 protected Content getDeprecatedLink(ProgramElementDoc member) {
198 return writer.getQualifiedClassLink(LinkInfoImpl.Kind.MEMBER,
199 (ClassDoc)member);
200 }
201
202 /**
203 * {@inheritDoc}
204 */
205 protected Content getNavSummaryLink(ClassDoc cd, boolean link) {
206 if (link) {
207 if (cd == null) {
208 return writer.getHyperLink(
209 SectionName.NESTED_CLASS_SUMMARY,
210 writer.getResource("doclet.navNested"));
211 } else {
212 return writer.getHyperLink(
213 SectionName.NESTED_CLASSES_INHERITANCE,
214 cd.qualifiedName(), writer.getResource("doclet.navNested"));
215 }
216 } else {
217 return writer.getResource("doclet.navNested");
218 }
219 }
220
221 /**
222 * {@inheritDoc}
223 */
224 protected void addNavDetailLink(boolean link, Content liNav) {
225 }
226 }

mercurial