author | bpatel |
Thu, 19 Mar 2009 19:00:54 -0700 | |
changeset 2320 | 5b8c377175f4 |
parent 1787 | 1aa079321cd2 |
child 5520 | 86e4b9a9da40 |
permissions | -rw-r--r-- |
10 | 1 |
/* |
2 |
* Copyright 1997-2005 Sun Microsystems, Inc. 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. Sun designates this |
|
8 |
* particular file as subject to the "Classpath" exception as provided |
|
9 |
* by Sun 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, |
|
22 |
* CA 95054 USA or visit www.sun.com if you need additional information or |
|
23 |
* have any questions. |
|
24 |
*/ |
|
25 |
||
26 |
package com.sun.tools.doclets.formats.html; |
|
27 |
||
28 |
import com.sun.tools.doclets.internal.toolkit.*; |
|
29 |
import com.sun.tools.doclets.internal.toolkit.util.*; |
|
30 |
||
31 |
import com.sun.javadoc.*; |
|
32 |
import java.io.*; |
|
33 |
import java.util.*; |
|
34 |
||
35 |
/** |
|
36 |
* Class to generate file for each package contents in the right-hand |
|
37 |
* frame. This will list all the Class Kinds in the package. A click on any |
|
38 |
* class-kind will update the frame with the clicked class-kind page. |
|
39 |
* |
|
40 |
* @author Atul M Dambalkar |
|
2320
5b8c377175f4
6786688: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - Table must have captions and headers
bpatel
parents:
1787
diff
changeset
|
41 |
* @author Bhavesh Patel (Modified) |
10 | 42 |
*/ |
43 |
public class PackageWriterImpl extends HtmlDocletWriter |
|
44 |
implements PackageSummaryWriter { |
|
45 |
||
46 |
/** |
|
47 |
* The prev package name in the alpha-order list. |
|
48 |
*/ |
|
49 |
protected PackageDoc prev; |
|
50 |
||
51 |
/** |
|
52 |
* The next package name in the alpha-order list. |
|
53 |
*/ |
|
54 |
protected PackageDoc next; |
|
55 |
||
56 |
/** |
|
57 |
* The package being documented. |
|
58 |
*/ |
|
59 |
protected PackageDoc packageDoc; |
|
60 |
||
61 |
/** |
|
62 |
* The name of the output file. |
|
63 |
*/ |
|
64 |
private static final String OUTPUT_FILE_NAME = "package-summary.html"; |
|
65 |
||
66 |
/** |
|
67 |
* Constructor to construct PackageWriter object and to generate |
|
68 |
* "package-summary.html" file in the respective package directory. |
|
69 |
* For example for package "java.lang" this will generate file |
|
70 |
* "package-summary.html" file in the "java/lang" directory. It will also |
|
71 |
* create "java/lang" directory in the current or the destination directory |
|
72 |
* if it doesen't exist. |
|
73 |
* |
|
74 |
* @param configuration the configuration of the doclet. |
|
75 |
* @param packageDoc PackageDoc under consideration. |
|
76 |
* @param prev Previous package in the sorted array. |
|
77 |
* @param next Next package in the sorted array. |
|
78 |
*/ |
|
79 |
public PackageWriterImpl(ConfigurationImpl configuration, |
|
80 |
PackageDoc packageDoc, PackageDoc prev, PackageDoc next) |
|
81 |
throws IOException { |
|
82 |
super(configuration, DirectoryManager.getDirectoryPath(packageDoc), OUTPUT_FILE_NAME, |
|
83 |
DirectoryManager.getRelativePath(packageDoc.name())); |
|
84 |
this.prev = prev; |
|
85 |
this.next = next; |
|
86 |
this.packageDoc = packageDoc; |
|
87 |
} |
|
88 |
||
89 |
/** |
|
90 |
* Return the name of the output file. |
|
91 |
* |
|
92 |
* @return the name of the output file. |
|
93 |
*/ |
|
94 |
public String getOutputFileName() { |
|
95 |
return OUTPUT_FILE_NAME; |
|
96 |
} |
|
97 |
||
98 |
/** |
|
99 |
* {@inheritDoc} |
|
100 |
*/ |
|
101 |
public void writeSummaryHeader() {} |
|
102 |
||
103 |
/** |
|
104 |
* {@inheritDoc} |
|
105 |
*/ |
|
106 |
public void writeSummaryFooter() {} |
|
107 |
||
108 |
/** |
|
109 |
* {@inheritDoc} |
|
110 |
*/ |
|
2320
5b8c377175f4
6786688: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - Table must have captions and headers
bpatel
parents:
1787
diff
changeset
|
111 |
public void writeClassesSummary(ClassDoc[] classes, String label, String tableSummary, String[] tableHeader) { |
10 | 112 |
if(classes.length > 0) { |
113 |
Arrays.sort(classes); |
|
2320
5b8c377175f4
6786688: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - Table must have captions and headers
bpatel
parents:
1787
diff
changeset
|
114 |
tableIndexSummary(tableSummary); |
10 | 115 |
boolean printedHeading = false; |
116 |
for (int i = 0; i < classes.length; i++) { |
|
117 |
if (!printedHeading) { |
|
2320
5b8c377175f4
6786688: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - Table must have captions and headers
bpatel
parents:
1787
diff
changeset
|
118 |
printTableCaption(label); |
5b8c377175f4
6786688: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - Table must have captions and headers
bpatel
parents:
1787
diff
changeset
|
119 |
printFirstRow(tableHeader); |
10 | 120 |
printedHeading = true; |
121 |
} |
|
122 |
if (!Util.isCoreClass(classes[i]) || |
|
123 |
!configuration.isGeneratedDoc(classes[i])) { |
|
124 |
continue; |
|
125 |
} |
|
126 |
trBgcolorStyle("white", "TableRowColor"); |
|
127 |
summaryRow(15); |
|
1787
1aa079321cd2
6786028: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - Bold tags should be strong
bpatel
parents:
10
diff
changeset
|
128 |
strong(); |
10 | 129 |
printLink(new LinkInfoImpl(LinkInfoImpl.CONTEXT_PACKAGE, |
130 |
classes[i], false)); |
|
1787
1aa079321cd2
6786028: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - Bold tags should be strong
bpatel
parents:
10
diff
changeset
|
131 |
strongEnd(); |
10 | 132 |
summaryRowEnd(); |
133 |
summaryRow(0); |
|
134 |
if (Util.isDeprecated(classes[i])) { |
|
1787
1aa079321cd2
6786028: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - Bold tags should be strong
bpatel
parents:
10
diff
changeset
|
135 |
strongText("doclet.Deprecated"); |
10 | 136 |
if (classes[i].tags("deprecated").length > 0) { |
137 |
space(); |
|
138 |
printSummaryDeprecatedComment(classes[i], |
|
139 |
classes[i].tags("deprecated")[0]); |
|
140 |
} |
|
141 |
} else { |
|
142 |
printSummaryComment(classes[i]); |
|
143 |
} |
|
144 |
summaryRowEnd(); |
|
145 |
trEnd(); |
|
146 |
} |
|
147 |
tableEnd(); |
|
148 |
println(" "); |
|
149 |
p(); |
|
150 |
} |
|
151 |
} |
|
152 |
||
153 |
/** |
|
2320
5b8c377175f4
6786688: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - Table must have captions and headers
bpatel
parents:
1787
diff
changeset
|
154 |
* Print the table caption for the class-listing. |
5b8c377175f4
6786688: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - Table must have captions and headers
bpatel
parents:
1787
diff
changeset
|
155 |
* |
5b8c377175f4
6786688: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - Table must have captions and headers
bpatel
parents:
1787
diff
changeset
|
156 |
* @param label label for the Class kind listing. |
5b8c377175f4
6786688: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - Table must have captions and headers
bpatel
parents:
1787
diff
changeset
|
157 |
*/ |
5b8c377175f4
6786688: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - Table must have captions and headers
bpatel
parents:
1787
diff
changeset
|
158 |
protected void printTableCaption(String label) { |
5b8c377175f4
6786688: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - Table must have captions and headers
bpatel
parents:
1787
diff
changeset
|
159 |
tableCaptionStart(); |
5b8c377175f4
6786688: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - Table must have captions and headers
bpatel
parents:
1787
diff
changeset
|
160 |
print(label); |
5b8c377175f4
6786688: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - Table must have captions and headers
bpatel
parents:
1787
diff
changeset
|
161 |
tableCaptionEnd(); |
5b8c377175f4
6786688: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - Table must have captions and headers
bpatel
parents:
1787
diff
changeset
|
162 |
} |
5b8c377175f4
6786688: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - Table must have captions and headers
bpatel
parents:
1787
diff
changeset
|
163 |
|
5b8c377175f4
6786688: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - Table must have captions and headers
bpatel
parents:
1787
diff
changeset
|
164 |
/** |
10 | 165 |
* Print the table heading for the class-listing. |
166 |
* |
|
2320
5b8c377175f4
6786688: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - Table must have captions and headers
bpatel
parents:
1787
diff
changeset
|
167 |
* @param tableHeader table header string for the Class listing. |
10 | 168 |
*/ |
2320
5b8c377175f4
6786688: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - Table must have captions and headers
bpatel
parents:
1787
diff
changeset
|
169 |
protected void printFirstRow(String[] tableHeader) { |
5b8c377175f4
6786688: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - Table must have captions and headers
bpatel
parents:
1787
diff
changeset
|
170 |
summaryTableHeader(tableHeader, "col"); |
10 | 171 |
} |
172 |
||
173 |
/** |
|
174 |
* {@inheritDoc} |
|
175 |
*/ |
|
176 |
public void writePackageDescription() { |
|
177 |
if (packageDoc.inlineTags().length > 0) { |
|
178 |
anchor("package_description"); |
|
179 |
h2(configuration.getText("doclet.Package_Description", packageDoc.name())); |
|
180 |
p(); |
|
181 |
printInlineComment(packageDoc); |
|
182 |
p(); |
|
183 |
} |
|
184 |
} |
|
185 |
||
186 |
/** |
|
187 |
* {@inheritDoc} |
|
188 |
*/ |
|
189 |
public void writePackageTags() { |
|
190 |
printTags(packageDoc); |
|
191 |
} |
|
192 |
||
193 |
/** |
|
194 |
* {@inheritDoc} |
|
195 |
*/ |
|
196 |
public void writePackageHeader(String heading) { |
|
197 |
String pkgName = packageDoc.name(); |
|
198 |
printHtmlHeader(pkgName, |
|
199 |
configuration.metakeywords.getMetaKeywords(packageDoc), true); |
|
200 |
printTop(); |
|
201 |
navLinks(true); |
|
202 |
hr(); |
|
203 |
writeAnnotationInfo(packageDoc); |
|
204 |
h2(configuration.getText("doclet.Package") + " " + heading); |
|
205 |
if (packageDoc.inlineTags().length > 0 && ! configuration.nocomment) { |
|
206 |
printSummaryComment(packageDoc); |
|
207 |
p(); |
|
1787
1aa079321cd2
6786028: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - Bold tags should be strong
bpatel
parents:
10
diff
changeset
|
208 |
strong(configuration.getText("doclet.See")); |
10 | 209 |
br(); |
210 |
printNbsps(); |
|
211 |
printHyperLink("", "package_description", |
|
212 |
configuration.getText("doclet.Description"), true); |
|
213 |
p(); |
|
214 |
} |
|
215 |
} |
|
216 |
||
217 |
/** |
|
218 |
* {@inheritDoc} |
|
219 |
*/ |
|
220 |
public void writePackageFooter() { |
|
221 |
hr(); |
|
222 |
navLinks(false); |
|
223 |
printBottom(); |
|
224 |
printBodyHtmlEnd(); |
|
225 |
} |
|
226 |
||
227 |
/** |
|
228 |
* Print "Use" link for this pacakge in the navigation bar. |
|
229 |
*/ |
|
230 |
protected void navLinkClassUse() { |
|
231 |
navCellStart(); |
|
232 |
printHyperLink("package-use.html", "", configuration.getText("doclet.navClassUse"), |
|
233 |
true, "NavBarFont1"); |
|
234 |
navCellEnd(); |
|
235 |
} |
|
236 |
||
237 |
/** |
|
238 |
* Print "PREV PACKAGE" link in the navigation bar. |
|
239 |
*/ |
|
240 |
protected void navLinkPrevious() { |
|
241 |
if (prev == null) { |
|
242 |
printText("doclet.Prev_Package"); |
|
243 |
} else { |
|
244 |
String path = DirectoryManager.getRelativePath(packageDoc.name(), |
|
245 |
prev.name()); |
|
246 |
printHyperLink(path + "package-summary.html", "", |
|
247 |
configuration.getText("doclet.Prev_Package"), true); |
|
248 |
} |
|
249 |
} |
|
250 |
||
251 |
/** |
|
252 |
* Print "NEXT PACKAGE" link in the navigation bar. |
|
253 |
*/ |
|
254 |
protected void navLinkNext() { |
|
255 |
if (next == null) { |
|
256 |
printText("doclet.Next_Package"); |
|
257 |
} else { |
|
258 |
String path = DirectoryManager.getRelativePath(packageDoc.name(), |
|
259 |
next.name()); |
|
260 |
printHyperLink(path + "package-summary.html", "", |
|
261 |
configuration.getText("doclet.Next_Package"), true); |
|
262 |
} |
|
263 |
} |
|
264 |
||
265 |
/** |
|
266 |
* Print "Tree" link in the navigation bar. This will be link to the package |
|
267 |
* tree file. |
|
268 |
*/ |
|
269 |
protected void navLinkTree() { |
|
270 |
navCellStart(); |
|
271 |
printHyperLink("package-tree.html", "", configuration.getText("doclet.Tree"), |
|
272 |
true, "NavBarFont1"); |
|
273 |
navCellEnd(); |
|
274 |
} |
|
275 |
||
276 |
/** |
|
277 |
* Highlight "Package" in the navigation bar, as this is the package page. |
|
278 |
*/ |
|
279 |
protected void navLinkPackage() { |
|
280 |
navCellRevStart(); |
|
281 |
fontStyle("NavBarFont1Rev"); |
|
1787
1aa079321cd2
6786028: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - Bold tags should be strong
bpatel
parents:
10
diff
changeset
|
282 |
strongText("doclet.Package"); |
10 | 283 |
fontEnd(); |
284 |
navCellEnd(); |
|
285 |
} |
|
286 |
} |