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.util.DeprecatedAPIListBuilder; |
|
29 |
import com.sun.tools.doclets.internal.toolkit.util.*; |
|
30 |
import java.io.*; |
|
31 |
||
32 |
/** |
|
33 |
* Generate File to list all the deprecated classes and class members with the |
|
34 |
* appropriate links. |
|
35 |
* |
|
36 |
* @see java.util.List |
|
37 |
* @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
|
38 |
* @author Bhavesh Patel (Modified) |
10 | 39 |
*/ |
40 |
public class DeprecatedListWriter extends SubWriterHolderWriter { |
|
41 |
||
42 |
private static final String[] ANCHORS = new String[] { |
|
43 |
"interface", "class", "enum", "exception", "error", "annotation_type", |
|
44 |
"field", "method", "constructor", "enum_constant", |
|
45 |
"annotation_type_member" |
|
46 |
}; |
|
47 |
||
48 |
private static final String[] HEADING_KEYS = new String[] { |
|
49 |
"doclet.Deprecated_Interfaces", "doclet.Deprecated_Classes", |
|
50 |
"doclet.Deprecated_Enums", "doclet.Deprecated_Exceptions", |
|
51 |
"doclet.Deprecated_Errors", |
|
52 |
"doclet.Deprecated_Annotation_Types", |
|
53 |
"doclet.Deprecated_Fields", |
|
54 |
"doclet.Deprecated_Methods", "doclet.Deprecated_Constructors", |
|
55 |
"doclet.Deprecated_Enum_Constants", |
|
56 |
"doclet.Deprecated_Annotation_Type_Members" |
|
57 |
}; |
|
58 |
||
2320
5b8c377175f4
6786688: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - Table must have captions and headers
bpatel
parents:
1787
diff
changeset
|
59 |
private static final String[] SUMMARY_KEYS = new String[] { |
5b8c377175f4
6786688: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - Table must have captions and headers
bpatel
parents:
1787
diff
changeset
|
60 |
"doclet.deprecated_interfaces", "doclet.deprecated_classes", |
5b8c377175f4
6786688: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - Table must have captions and headers
bpatel
parents:
1787
diff
changeset
|
61 |
"doclet.deprecated_enums", "doclet.deprecated_exceptions", |
5b8c377175f4
6786688: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - Table must have captions and headers
bpatel
parents:
1787
diff
changeset
|
62 |
"doclet.deprecated_errors", |
5b8c377175f4
6786688: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - Table must have captions and headers
bpatel
parents:
1787
diff
changeset
|
63 |
"doclet.deprecated_annotation_types", |
5b8c377175f4
6786688: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - Table must have captions and headers
bpatel
parents:
1787
diff
changeset
|
64 |
"doclet.deprecated_fields", |
5b8c377175f4
6786688: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - Table must have captions and headers
bpatel
parents:
1787
diff
changeset
|
65 |
"doclet.deprecated_methods", "doclet.deprecated_constructors", |
5b8c377175f4
6786688: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - Table must have captions and headers
bpatel
parents:
1787
diff
changeset
|
66 |
"doclet.deprecated_enum_constants", |
5b8c377175f4
6786688: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - Table must have captions and headers
bpatel
parents:
1787
diff
changeset
|
67 |
"doclet.deprecated_annotation_type_members" |
5b8c377175f4
6786688: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - Table must have captions and headers
bpatel
parents:
1787
diff
changeset
|
68 |
}; |
5b8c377175f4
6786688: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - Table must have captions and headers
bpatel
parents:
1787
diff
changeset
|
69 |
|
5b8c377175f4
6786688: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - Table must have captions and headers
bpatel
parents:
1787
diff
changeset
|
70 |
private static final String[] HEADER_KEYS = new String[] { |
5b8c377175f4
6786688: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - Table must have captions and headers
bpatel
parents:
1787
diff
changeset
|
71 |
"doclet.Interface", "doclet.Class", |
5b8c377175f4
6786688: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - Table must have captions and headers
bpatel
parents:
1787
diff
changeset
|
72 |
"doclet.Enum", "doclet.Exceptions", |
5b8c377175f4
6786688: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - Table must have captions and headers
bpatel
parents:
1787
diff
changeset
|
73 |
"doclet.Errors", |
5b8c377175f4
6786688: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - Table must have captions and headers
bpatel
parents:
1787
diff
changeset
|
74 |
"doclet.AnnotationType", |
5b8c377175f4
6786688: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - Table must have captions and headers
bpatel
parents:
1787
diff
changeset
|
75 |
"doclet.Field", |
5b8c377175f4
6786688: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - Table must have captions and headers
bpatel
parents:
1787
diff
changeset
|
76 |
"doclet.Method", "doclet.Constructor", |
5b8c377175f4
6786688: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - Table must have captions and headers
bpatel
parents:
1787
diff
changeset
|
77 |
"doclet.Enum_Constant", |
5b8c377175f4
6786688: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - Table must have captions and headers
bpatel
parents:
1787
diff
changeset
|
78 |
"doclet.Annotation_Type_Member" |
5b8c377175f4
6786688: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - Table must have captions and headers
bpatel
parents:
1787
diff
changeset
|
79 |
}; |
5b8c377175f4
6786688: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - Table must have captions and headers
bpatel
parents:
1787
diff
changeset
|
80 |
|
10 | 81 |
private AbstractMemberWriter[] writers; |
82 |
||
83 |
private ConfigurationImpl configuration; |
|
84 |
||
85 |
/** |
|
86 |
* Constructor. |
|
87 |
* |
|
88 |
* @param filename the file to be generated. |
|
89 |
*/ |
|
90 |
public DeprecatedListWriter(ConfigurationImpl configuration, |
|
91 |
String filename) throws IOException { |
|
92 |
super(configuration, filename); |
|
93 |
this.configuration = configuration; |
|
94 |
NestedClassWriterImpl classW = new NestedClassWriterImpl(this); |
|
95 |
writers = new AbstractMemberWriter[] |
|
96 |
{classW, classW, classW, classW, classW, classW, |
|
97 |
new FieldWriterImpl(this), |
|
98 |
new MethodWriterImpl(this), |
|
99 |
new ConstructorWriterImpl(this), |
|
100 |
new EnumConstantWriterImpl(this), |
|
101 |
new AnnotationTypeOptionalMemberWriterImpl(this, null)}; |
|
102 |
} |
|
103 |
||
104 |
/** |
|
105 |
* Get list of all the deprecated classes and members in all the Packages |
|
106 |
* specified on the Command Line. |
|
107 |
* Then instantiate DeprecatedListWriter and generate File. |
|
108 |
* |
|
109 |
* @param configuration the current configuration of the doclet. |
|
110 |
*/ |
|
111 |
public static void generate(ConfigurationImpl configuration) { |
|
112 |
String filename = "deprecated-list.html"; |
|
113 |
try { |
|
114 |
DeprecatedListWriter depr = |
|
115 |
new DeprecatedListWriter(configuration, filename); |
|
116 |
depr.generateDeprecatedListFile( |
|
117 |
new DeprecatedAPIListBuilder(configuration.root)); |
|
118 |
depr.close(); |
|
119 |
} catch (IOException exc) { |
|
120 |
configuration.standardmessage.error( |
|
121 |
"doclet.exception_encountered", |
|
122 |
exc.toString(), filename); |
|
123 |
throw new DocletAbortException(); |
|
124 |
} |
|
125 |
} |
|
126 |
||
127 |
/** |
|
128 |
* Print the deprecated API list. Separately print all class kinds and |
|
129 |
* member kinds. |
|
130 |
* |
|
131 |
* @param deprapi list of deprecated API built already. |
|
132 |
*/ |
|
133 |
protected void generateDeprecatedListFile(DeprecatedAPIListBuilder deprapi) |
|
134 |
throws IOException { |
|
135 |
writeHeader(); |
|
136 |
||
1787
1aa079321cd2
6786028: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - Bold tags should be strong
bpatel
parents:
10
diff
changeset
|
137 |
strong(configuration.getText("doclet.Contents")); |
10 | 138 |
ul(); |
139 |
for (int i = 0; i < DeprecatedAPIListBuilder.NUM_TYPES; i++) { |
|
140 |
writeIndexLink(deprapi, i); |
|
141 |
} |
|
142 |
ulEnd(); |
|
143 |
println(); |
|
144 |
||
2320
5b8c377175f4
6786688: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - Table must have captions and headers
bpatel
parents:
1787
diff
changeset
|
145 |
String memberTableSummary; |
5b8c377175f4
6786688: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - Table must have captions and headers
bpatel
parents:
1787
diff
changeset
|
146 |
String[] memberTableHeader = new String[1]; |
10 | 147 |
for (int i = 0; i < DeprecatedAPIListBuilder.NUM_TYPES; i++) { |
148 |
if (deprapi.hasDocumentation(i)) { |
|
149 |
writeAnchor(deprapi, i); |
|
2320
5b8c377175f4
6786688: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - Table must have captions and headers
bpatel
parents:
1787
diff
changeset
|
150 |
memberTableSummary = |
5b8c377175f4
6786688: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - Table must have captions and headers
bpatel
parents:
1787
diff
changeset
|
151 |
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:
1787
diff
changeset
|
152 |
configuration.getText(HEADING_KEYS[i]), |
5b8c377175f4
6786688: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - Table must have captions and headers
bpatel
parents:
1787
diff
changeset
|
153 |
configuration.getText(SUMMARY_KEYS[i])); |
5b8c377175f4
6786688: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - Table must have captions and headers
bpatel
parents:
1787
diff
changeset
|
154 |
memberTableHeader[0] = 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:
1787
diff
changeset
|
155 |
configuration.getText(HEADER_KEYS[i]), |
5b8c377175f4
6786688: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - Table must have captions and headers
bpatel
parents:
1787
diff
changeset
|
156 |
configuration.getText("doclet.Description")); |
10 | 157 |
writers[i].printDeprecatedAPI(deprapi.getList(i), |
2320
5b8c377175f4
6786688: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - Table must have captions and headers
bpatel
parents:
1787
diff
changeset
|
158 |
HEADING_KEYS[i], memberTableSummary, memberTableHeader); |
10 | 159 |
} |
160 |
} |
|
161 |
printDeprecatedFooter(); |
|
162 |
} |
|
163 |
||
164 |
private void writeIndexLink(DeprecatedAPIListBuilder builder, |
|
165 |
int type) { |
|
166 |
if (builder.hasDocumentation(type)) { |
|
167 |
li(); |
|
168 |
printHyperLink("#" + ANCHORS[type], |
|
169 |
configuration.getText(HEADING_KEYS[type])); |
|
170 |
println(); |
|
171 |
} |
|
172 |
} |
|
173 |
||
174 |
private void writeAnchor(DeprecatedAPIListBuilder builder, int type) { |
|
175 |
if (builder.hasDocumentation(type)) { |
|
176 |
anchor(ANCHORS[type]); |
|
177 |
} |
|
178 |
} |
|
179 |
||
180 |
/** |
|
181 |
* Print the navigation bar and header for the deprecated API Listing. |
|
182 |
*/ |
|
183 |
protected void writeHeader() { |
|
184 |
printHtmlHeader(configuration.getText("doclet.Window_Deprecated_List"), |
|
185 |
null, true); |
|
186 |
printTop(); |
|
187 |
navLinks(true); |
|
188 |
hr(); |
|
189 |
center(); |
|
190 |
h2(); |
|
1787
1aa079321cd2
6786028: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - Bold tags should be strong
bpatel
parents:
10
diff
changeset
|
191 |
strongText("doclet.Deprecated_API"); |
10 | 192 |
h2End(); |
193 |
centerEnd(); |
|
194 |
||
195 |
hr(4, "noshade"); |
|
196 |
} |
|
197 |
||
198 |
/** |
|
199 |
* Print the navigation bar and the footer for the deprecated API Listing. |
|
200 |
*/ |
|
201 |
protected void printDeprecatedFooter() { |
|
202 |
hr(); |
|
203 |
navLinks(false); |
|
204 |
printBottom(); |
|
205 |
printBodyHtmlEnd(); |
|
206 |
} |
|
207 |
||
208 |
/** |
|
209 |
* Highlight the word "Deprecated" in the navigation bar as this is the same |
|
210 |
* page. |
|
211 |
*/ |
|
212 |
protected void navLinkDeprecated() { |
|
213 |
navCellRevStart(); |
|
214 |
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
|
215 |
strongText("doclet.navDeprecated"); |
10 | 216 |
fontEnd(); |
217 |
navCellEnd(); |
|
218 |
} |
|
219 |
} |