author | bpatel |
Thu, 08 Jan 2009 16:26:59 -0800 | |
changeset 1787 | 1aa079321cd2 |
parent 10 | 06bc494ca11e |
child 2320 | 5b8c377175f4 |
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 |
|
38 |
*/ |
|
39 |
public class DeprecatedListWriter extends SubWriterHolderWriter { |
|
40 |
||
41 |
private static final String[] ANCHORS = new String[] { |
|
42 |
"interface", "class", "enum", "exception", "error", "annotation_type", |
|
43 |
"field", "method", "constructor", "enum_constant", |
|
44 |
"annotation_type_member" |
|
45 |
}; |
|
46 |
||
47 |
private static final String[] HEADING_KEYS = new String[] { |
|
48 |
"doclet.Deprecated_Interfaces", "doclet.Deprecated_Classes", |
|
49 |
"doclet.Deprecated_Enums", "doclet.Deprecated_Exceptions", |
|
50 |
"doclet.Deprecated_Errors", |
|
51 |
"doclet.Deprecated_Annotation_Types", |
|
52 |
"doclet.Deprecated_Fields", |
|
53 |
"doclet.Deprecated_Methods", "doclet.Deprecated_Constructors", |
|
54 |
"doclet.Deprecated_Enum_Constants", |
|
55 |
"doclet.Deprecated_Annotation_Type_Members" |
|
56 |
}; |
|
57 |
||
58 |
private AbstractMemberWriter[] writers; |
|
59 |
||
60 |
private ConfigurationImpl configuration; |
|
61 |
||
62 |
/** |
|
63 |
* Constructor. |
|
64 |
* |
|
65 |
* @param filename the file to be generated. |
|
66 |
*/ |
|
67 |
public DeprecatedListWriter(ConfigurationImpl configuration, |
|
68 |
String filename) throws IOException { |
|
69 |
super(configuration, filename); |
|
70 |
this.configuration = configuration; |
|
71 |
NestedClassWriterImpl classW = new NestedClassWriterImpl(this); |
|
72 |
writers = new AbstractMemberWriter[] |
|
73 |
{classW, classW, classW, classW, classW, classW, |
|
74 |
new FieldWriterImpl(this), |
|
75 |
new MethodWriterImpl(this), |
|
76 |
new ConstructorWriterImpl(this), |
|
77 |
new EnumConstantWriterImpl(this), |
|
78 |
new AnnotationTypeOptionalMemberWriterImpl(this, null)}; |
|
79 |
} |
|
80 |
||
81 |
/** |
|
82 |
* Get list of all the deprecated classes and members in all the Packages |
|
83 |
* specified on the Command Line. |
|
84 |
* Then instantiate DeprecatedListWriter and generate File. |
|
85 |
* |
|
86 |
* @param configuration the current configuration of the doclet. |
|
87 |
*/ |
|
88 |
public static void generate(ConfigurationImpl configuration) { |
|
89 |
String filename = "deprecated-list.html"; |
|
90 |
try { |
|
91 |
DeprecatedListWriter depr = |
|
92 |
new DeprecatedListWriter(configuration, filename); |
|
93 |
depr.generateDeprecatedListFile( |
|
94 |
new DeprecatedAPIListBuilder(configuration.root)); |
|
95 |
depr.close(); |
|
96 |
} catch (IOException exc) { |
|
97 |
configuration.standardmessage.error( |
|
98 |
"doclet.exception_encountered", |
|
99 |
exc.toString(), filename); |
|
100 |
throw new DocletAbortException(); |
|
101 |
} |
|
102 |
} |
|
103 |
||
104 |
/** |
|
105 |
* Print the deprecated API list. Separately print all class kinds and |
|
106 |
* member kinds. |
|
107 |
* |
|
108 |
* @param deprapi list of deprecated API built already. |
|
109 |
*/ |
|
110 |
protected void generateDeprecatedListFile(DeprecatedAPIListBuilder deprapi) |
|
111 |
throws IOException { |
|
112 |
writeHeader(); |
|
113 |
||
1787
1aa079321cd2
6786028: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - Bold tags should be strong
bpatel
parents:
10
diff
changeset
|
114 |
strong(configuration.getText("doclet.Contents")); |
10 | 115 |
ul(); |
116 |
for (int i = 0; i < DeprecatedAPIListBuilder.NUM_TYPES; i++) { |
|
117 |
writeIndexLink(deprapi, i); |
|
118 |
} |
|
119 |
ulEnd(); |
|
120 |
println(); |
|
121 |
||
122 |
for (int i = 0; i < DeprecatedAPIListBuilder.NUM_TYPES; i++) { |
|
123 |
if (deprapi.hasDocumentation(i)) { |
|
124 |
writeAnchor(deprapi, i); |
|
125 |
writers[i].printDeprecatedAPI(deprapi.getList(i), |
|
126 |
HEADING_KEYS[i]); |
|
127 |
} |
|
128 |
} |
|
129 |
printDeprecatedFooter(); |
|
130 |
} |
|
131 |
||
132 |
private void writeIndexLink(DeprecatedAPIListBuilder builder, |
|
133 |
int type) { |
|
134 |
if (builder.hasDocumentation(type)) { |
|
135 |
li(); |
|
136 |
printHyperLink("#" + ANCHORS[type], |
|
137 |
configuration.getText(HEADING_KEYS[type])); |
|
138 |
println(); |
|
139 |
} |
|
140 |
} |
|
141 |
||
142 |
private void writeAnchor(DeprecatedAPIListBuilder builder, int type) { |
|
143 |
if (builder.hasDocumentation(type)) { |
|
144 |
anchor(ANCHORS[type]); |
|
145 |
} |
|
146 |
} |
|
147 |
||
148 |
/** |
|
149 |
* Print the navigation bar and header for the deprecated API Listing. |
|
150 |
*/ |
|
151 |
protected void writeHeader() { |
|
152 |
printHtmlHeader(configuration.getText("doclet.Window_Deprecated_List"), |
|
153 |
null, true); |
|
154 |
printTop(); |
|
155 |
navLinks(true); |
|
156 |
hr(); |
|
157 |
center(); |
|
158 |
h2(); |
|
1787
1aa079321cd2
6786028: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - Bold tags should be strong
bpatel
parents:
10
diff
changeset
|
159 |
strongText("doclet.Deprecated_API"); |
10 | 160 |
h2End(); |
161 |
centerEnd(); |
|
162 |
||
163 |
hr(4, "noshade"); |
|
164 |
} |
|
165 |
||
166 |
/** |
|
167 |
* Print the navigation bar and the footer for the deprecated API Listing. |
|
168 |
*/ |
|
169 |
protected void printDeprecatedFooter() { |
|
170 |
hr(); |
|
171 |
navLinks(false); |
|
172 |
printBottom(); |
|
173 |
printBodyHtmlEnd(); |
|
174 |
} |
|
175 |
||
176 |
/** |
|
177 |
* Highlight the word "Deprecated" in the navigation bar as this is the same |
|
178 |
* page. |
|
179 |
*/ |
|
180 |
protected void navLinkDeprecated() { |
|
181 |
navCellRevStart(); |
|
182 |
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
|
183 |
strongText("doclet.navDeprecated"); |
10 | 184 |
fontEnd(); |
185 |
navCellEnd(); |
|
186 |
} |
|
187 |
} |