author | bpatel |
Thu, 19 Mar 2009 19:00:54 -0700 | |
changeset 2320 | 5b8c377175f4 |
parent 2223 | 95e3c21b2919 |
child 2321 | 57fc341671c4 |
permissions | -rw-r--r-- |
10 | 1 |
/* |
2212 | 2 |
* Copyright 1998-2009 Sun Microsystems, Inc. All Rights Reserved. |
10 | 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 java.io.*; |
|
29 |
import java.text.SimpleDateFormat; |
|
30 |
import java.util.*; |
|
31 |
||
2216
b124d5c924eb
6786690: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - DL tag and nesting issue
bpatel
parents:
2086
diff
changeset
|
32 |
import com.sun.javadoc.*; |
b124d5c924eb
6786690: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - DL tag and nesting issue
bpatel
parents:
2086
diff
changeset
|
33 |
import com.sun.tools.doclets.formats.html.markup.*; |
b124d5c924eb
6786690: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - DL tag and nesting issue
bpatel
parents:
2086
diff
changeset
|
34 |
import com.sun.tools.doclets.internal.toolkit.*; |
b124d5c924eb
6786690: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - DL tag and nesting issue
bpatel
parents:
2086
diff
changeset
|
35 |
import com.sun.tools.doclets.internal.toolkit.util.*; |
b124d5c924eb
6786690: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - DL tag and nesting issue
bpatel
parents:
2086
diff
changeset
|
36 |
import com.sun.tools.doclets.internal.toolkit.taglets.*; |
10 | 37 |
|
38 |
/** |
|
39 |
* Class for the Html Format Code Generation specific to JavaDoc. |
|
40 |
* This Class contains methods related to the Html Code Generation which |
|
41 |
* are used extensively while generating the entire documentation. |
|
42 |
* |
|
43 |
* @since 1.2 |
|
44 |
* @author Atul M Dambalkar |
|
45 |
* @author Robert Field |
|
2216
b124d5c924eb
6786690: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - DL tag and nesting issue
bpatel
parents:
2086
diff
changeset
|
46 |
* @author Bhavesh Patel (Modified) |
10 | 47 |
*/ |
48 |
public class HtmlDocletWriter extends HtmlDocWriter { |
|
49 |
||
50 |
/** |
|
51 |
* Relative path from the file getting generated to the destination |
|
52 |
* directory. For example, if the file getting generated is |
|
53 |
* "java/lang/Object.html", then the relative path string is "../../". |
|
54 |
* This string can be empty if the file getting generated is in |
|
55 |
* the destination directory. |
|
56 |
*/ |
|
57 |
public String relativePath = ""; |
|
58 |
||
59 |
/** |
|
60 |
* Same as relativepath, but normalized to never be empty or |
|
61 |
* end with a slash. |
|
62 |
*/ |
|
63 |
public String relativepathNoSlash = ""; |
|
64 |
||
65 |
/** |
|
66 |
* Platform-dependent directory path from the current or the |
|
67 |
* destination directory to the file getting generated. |
|
68 |
* Used when creating the file. |
|
69 |
* For example, if the file getting generated is |
|
70 |
* "java/lang/Object.html", then the path string is "java/lang". |
|
71 |
*/ |
|
72 |
public String path = ""; |
|
73 |
||
74 |
/** |
|
75 |
* Name of the file getting generated. If the file getting generated is |
|
76 |
* "java/lang/Object.html", then the filename is "Object.html". |
|
77 |
*/ |
|
78 |
public String filename = ""; |
|
79 |
||
80 |
/** |
|
81 |
* The display length used for indentation while generating the class page. |
|
82 |
*/ |
|
83 |
public int displayLength = 0; |
|
84 |
||
85 |
/** |
|
86 |
* The global configuration information for this run. |
|
87 |
*/ |
|
88 |
public ConfigurationImpl configuration; |
|
89 |
||
90 |
/** |
|
91 |
* Constructor to construct the HtmlStandardWriter object. |
|
92 |
* |
|
93 |
* @param filename File to be generated. |
|
94 |
*/ |
|
95 |
public HtmlDocletWriter(ConfigurationImpl configuration, |
|
96 |
String filename) throws IOException { |
|
97 |
super(configuration, filename); |
|
98 |
this.configuration = configuration; |
|
99 |
this.filename = filename; |
|
100 |
} |
|
101 |
||
102 |
/** |
|
103 |
* Constructor to construct the HtmlStandardWriter object. |
|
104 |
* |
|
105 |
* @param path Platform-dependent {@link #path} used when |
|
106 |
* creating file. |
|
107 |
* @param filename Name of file to be generated. |
|
108 |
* @param relativePath Value for the variable {@link #relativePath}. |
|
109 |
*/ |
|
110 |
public HtmlDocletWriter(ConfigurationImpl configuration, |
|
111 |
String path, String filename, |
|
112 |
String relativePath) throws IOException { |
|
113 |
super(configuration, path, filename); |
|
114 |
this.configuration = configuration; |
|
115 |
this.path = path; |
|
116 |
this.relativePath = relativePath; |
|
117 |
this.relativepathNoSlash = |
|
118 |
DirectoryManager.getPathNoTrailingSlash(this.relativePath); |
|
119 |
this.filename = filename; |
|
120 |
} |
|
121 |
||
122 |
/** |
|
123 |
* Replace {@docRoot} tag used in options that accept HTML text, such |
|
124 |
* as -header, -footer, -top and -bottom, and when converting a relative |
|
125 |
* HREF where commentTagsToString inserts a {@docRoot} where one was |
|
126 |
* missing. (Also see DocRootTaglet for {@docRoot} tags in doc |
|
127 |
* comments.) |
|
128 |
* <p> |
|
129 |
* Replace {@docRoot} tag in htmlstr with the relative path to the |
|
130 |
* destination directory from the directory where the file is being |
|
131 |
* written, looping to handle all such tags in htmlstr. |
|
132 |
* <p> |
|
133 |
* For example, for "-d docs" and -header containing {@docRoot}, when |
|
134 |
* the HTML page for source file p/C1.java is being generated, the |
|
135 |
* {@docRoot} tag would be inserted into the header as "../", |
|
136 |
* the relative path from docs/p/ to docs/ (the document root). |
|
137 |
* <p> |
|
138 |
* Note: This doc comment was written with '&#064;' representing '@' |
|
139 |
* to prevent the inline tag from being interpreted. |
|
140 |
*/ |
|
141 |
public String replaceDocRootDir(String htmlstr) { |
|
142 |
// Return if no inline tags exist |
|
143 |
int index = htmlstr.indexOf("{@"); |
|
144 |
if (index < 0) { |
|
145 |
return htmlstr; |
|
146 |
} |
|
147 |
String lowerHtml = htmlstr.toLowerCase(); |
|
148 |
// Return index of first occurrence of {@docroot} |
|
149 |
// Note: {@docRoot} is not case sensitive when passed in w/command line option |
|
150 |
index = lowerHtml.indexOf("{@docroot}", index); |
|
151 |
if (index < 0) { |
|
152 |
return htmlstr; |
|
153 |
} |
|
154 |
StringBuffer buf = new StringBuffer(); |
|
155 |
int previndex = 0; |
|
156 |
while (true) { |
|
157 |
// Search for lowercase version of {@docRoot} |
|
158 |
index = lowerHtml.indexOf("{@docroot}", previndex); |
|
159 |
// If next {@docRoot} tag not found, append rest of htmlstr and exit loop |
|
160 |
if (index < 0) { |
|
161 |
buf.append(htmlstr.substring(previndex)); |
|
162 |
break; |
|
163 |
} |
|
164 |
// If next {@docroot} tag found, append htmlstr up to start of tag |
|
165 |
buf.append(htmlstr.substring(previndex, index)); |
|
166 |
previndex = index + 10; // length for {@docroot} string |
|
167 |
// Insert relative path where {@docRoot} was located |
|
168 |
buf.append(relativepathNoSlash); |
|
169 |
// Append slash if next character is not a slash |
|
170 |
if (relativepathNoSlash.length() > 0 && previndex < htmlstr.length() |
|
171 |
&& htmlstr.charAt(previndex) != '/') { |
|
172 |
buf.append(DirectoryManager.URL_FILE_SEPERATOR); |
|
173 |
} |
|
174 |
} |
|
175 |
return buf.toString(); |
|
176 |
} |
|
177 |
||
178 |
/** |
|
179 |
* Print Html Hyper Link, with target frame. This |
|
180 |
* link will only appear if page is not in a frame. |
|
181 |
* |
|
182 |
* @param link String name of the file. |
|
183 |
* @param where Position in the file |
|
184 |
* @param target Name of the target frame. |
|
185 |
* @param label Tag for the link. |
|
1787
1aa079321cd2
6786028: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - Bold tags should be strong
bpatel
parents:
1264
diff
changeset
|
186 |
* @param strong Whether the label should be strong or not? |
10 | 187 |
*/ |
188 |
public void printNoFramesTargetHyperLink(String link, String where, |
|
189 |
String target, String label, |
|
1787
1aa079321cd2
6786028: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - Bold tags should be strong
bpatel
parents:
1264
diff
changeset
|
190 |
boolean strong) { |
10 | 191 |
script(); |
192 |
println(" <!--"); |
|
193 |
println(" if(window==top) {"); |
|
194 |
println(" document.writeln('" |
|
1787
1aa079321cd2
6786028: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - Bold tags should be strong
bpatel
parents:
1264
diff
changeset
|
195 |
+ getHyperLink(link, where, label, strong, "", "", target) + "');"); |
10 | 196 |
println(" }"); |
197 |
println(" //-->"); |
|
198 |
scriptEnd(); |
|
199 |
noScript(); |
|
1787
1aa079321cd2
6786028: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - Bold tags should be strong
bpatel
parents:
1264
diff
changeset
|
200 |
println(" " + getHyperLink(link, where, label, strong, "", "", target)); |
10 | 201 |
noScriptEnd(); |
202 |
println(DocletConstants.NL); |
|
203 |
} |
|
204 |
||
205 |
private void printMethodInfo(MethodDoc method) { |
|
206 |
ClassDoc[] intfacs = method.containingClass().interfaces(); |
|
207 |
MethodDoc overriddenMethod = method.overriddenMethod(); |
|
2216
b124d5c924eb
6786690: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - DL tag and nesting issue
bpatel
parents:
2086
diff
changeset
|
208 |
// Check whether there is any implementation or overridden info to be |
b124d5c924eb
6786690: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - DL tag and nesting issue
bpatel
parents:
2086
diff
changeset
|
209 |
// printed. If no overridden or implementation info needs to be |
b124d5c924eb
6786690: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - DL tag and nesting issue
bpatel
parents:
2086
diff
changeset
|
210 |
// printed, do not print this section. |
b124d5c924eb
6786690: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - DL tag and nesting issue
bpatel
parents:
2086
diff
changeset
|
211 |
if ((intfacs.length > 0 && |
b124d5c924eb
6786690: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - DL tag and nesting issue
bpatel
parents:
2086
diff
changeset
|
212 |
new ImplementedMethods(method, this.configuration).build().length > 0) || |
b124d5c924eb
6786690: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - DL tag and nesting issue
bpatel
parents:
2086
diff
changeset
|
213 |
overriddenMethod != null) { |
b124d5c924eb
6786690: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - DL tag and nesting issue
bpatel
parents:
2086
diff
changeset
|
214 |
printMemberDetailsListStartTag(); |
10 | 215 |
dd(); |
216 |
printTagsInfoHeader(); |
|
217 |
MethodWriterImpl.printImplementsInfo(this, method); |
|
218 |
if (overriddenMethod != null) { |
|
219 |
MethodWriterImpl.printOverridden(this, |
|
220 |
method.overriddenType(), overriddenMethod); |
|
221 |
} |
|
222 |
printTagsInfoFooter(); |
|
223 |
ddEnd(); |
|
224 |
} |
|
225 |
} |
|
226 |
||
227 |
protected void printTags(Doc doc) { |
|
228 |
if(configuration.nocomment){ |
|
229 |
return; |
|
230 |
} |
|
231 |
if (doc instanceof MethodDoc) { |
|
232 |
printMethodInfo((MethodDoc) doc); |
|
233 |
} |
|
234 |
TagletOutputImpl output = new TagletOutputImpl(""); |
|
235 |
TagletWriter.genTagOuput(configuration.tagletManager, doc, |
|
236 |
configuration.tagletManager.getCustomTags(doc), |
|
237 |
getTagletWriterInstance(false), output); |
|
2216
b124d5c924eb
6786690: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - DL tag and nesting issue
bpatel
parents:
2086
diff
changeset
|
238 |
String outputString = output.toString().trim(); |
b124d5c924eb
6786690: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - DL tag and nesting issue
bpatel
parents:
2086
diff
changeset
|
239 |
// For RootDoc and ClassDoc, this section is not the definition description |
b124d5c924eb
6786690: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - DL tag and nesting issue
bpatel
parents:
2086
diff
changeset
|
240 |
// but the start of definition list. |
b124d5c924eb
6786690: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - DL tag and nesting issue
bpatel
parents:
2086
diff
changeset
|
241 |
if (!outputString.isEmpty()) { |
b124d5c924eb
6786690: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - DL tag and nesting issue
bpatel
parents:
2086
diff
changeset
|
242 |
if (!(doc instanceof RootDoc || doc instanceof ClassDoc)) { |
b124d5c924eb
6786690: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - DL tag and nesting issue
bpatel
parents:
2086
diff
changeset
|
243 |
printMemberDetailsListStartTag(); |
b124d5c924eb
6786690: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - DL tag and nesting issue
bpatel
parents:
2086
diff
changeset
|
244 |
dd(); |
b124d5c924eb
6786690: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - DL tag and nesting issue
bpatel
parents:
2086
diff
changeset
|
245 |
} |
10 | 246 |
printTagsInfoHeader(); |
2216
b124d5c924eb
6786690: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - DL tag and nesting issue
bpatel
parents:
2086
diff
changeset
|
247 |
print(outputString); |
10 | 248 |
printTagsInfoFooter(); |
2216
b124d5c924eb
6786690: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - DL tag and nesting issue
bpatel
parents:
2086
diff
changeset
|
249 |
if (!(doc instanceof RootDoc || doc instanceof ClassDoc)) |
b124d5c924eb
6786690: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - DL tag and nesting issue
bpatel
parents:
2086
diff
changeset
|
250 |
ddEnd(); |
10 | 251 |
} |
252 |
} |
|
253 |
||
254 |
/** |
|
2216
b124d5c924eb
6786690: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - DL tag and nesting issue
bpatel
parents:
2086
diff
changeset
|
255 |
* Check whether there are any tags for Serialization Overview |
b124d5c924eb
6786690: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - DL tag and nesting issue
bpatel
parents:
2086
diff
changeset
|
256 |
* section to be printed. |
2086
cca2603eab0b
6802694: Javadoc doclet does not display deprecated information with -nocomment option for serialized form
bpatel
parents:
1789
diff
changeset
|
257 |
* |
2216
b124d5c924eb
6786690: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - DL tag and nesting issue
bpatel
parents:
2086
diff
changeset
|
258 |
* @param field the FieldDoc object to check for tags. |
2086
cca2603eab0b
6802694: Javadoc doclet does not display deprecated information with -nocomment option for serialized form
bpatel
parents:
1789
diff
changeset
|
259 |
* @return true if there are tags to be printed else return false. |
cca2603eab0b
6802694: Javadoc doclet does not display deprecated information with -nocomment option for serialized form
bpatel
parents:
1789
diff
changeset
|
260 |
*/ |
2216
b124d5c924eb
6786690: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - DL tag and nesting issue
bpatel
parents:
2086
diff
changeset
|
261 |
protected boolean hasSerializationOverviewTags(FieldDoc field) { |
2086
cca2603eab0b
6802694: Javadoc doclet does not display deprecated information with -nocomment option for serialized form
bpatel
parents:
1789
diff
changeset
|
262 |
TagletOutputImpl output = new TagletOutputImpl(""); |
2216
b124d5c924eb
6786690: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - DL tag and nesting issue
bpatel
parents:
2086
diff
changeset
|
263 |
TagletWriter.genTagOuput(configuration.tagletManager, field, |
b124d5c924eb
6786690: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - DL tag and nesting issue
bpatel
parents:
2086
diff
changeset
|
264 |
configuration.tagletManager.getCustomTags(field), |
2086
cca2603eab0b
6802694: Javadoc doclet does not display deprecated information with -nocomment option for serialized form
bpatel
parents:
1789
diff
changeset
|
265 |
getTagletWriterInstance(false), output); |
2216
b124d5c924eb
6786690: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - DL tag and nesting issue
bpatel
parents:
2086
diff
changeset
|
266 |
return (!output.toString().trim().isEmpty()); |
2086
cca2603eab0b
6802694: Javadoc doclet does not display deprecated information with -nocomment option for serialized form
bpatel
parents:
1789
diff
changeset
|
267 |
} |
cca2603eab0b
6802694: Javadoc doclet does not display deprecated information with -nocomment option for serialized form
bpatel
parents:
1789
diff
changeset
|
268 |
|
cca2603eab0b
6802694: Javadoc doclet does not display deprecated information with -nocomment option for serialized form
bpatel
parents:
1789
diff
changeset
|
269 |
/** |
10 | 270 |
* Returns a TagletWriter that knows how to write HTML. |
271 |
* |
|
272 |
* @return a TagletWriter that knows how to write HTML. |
|
273 |
*/ |
|
274 |
public TagletWriter getTagletWriterInstance(boolean isFirstSentence) { |
|
275 |
return new TagletWriterImpl(this, isFirstSentence); |
|
276 |
} |
|
277 |
||
278 |
protected void printTagsInfoHeader() { |
|
279 |
dl(); |
|
280 |
} |
|
281 |
||
282 |
protected void printTagsInfoFooter() { |
|
283 |
dlEnd(); |
|
284 |
} |
|
285 |
||
286 |
/** |
|
287 |
* Print Package link, with target frame. |
|
288 |
* |
|
289 |
* @param pd The link will be to the "package-summary.html" page for this |
|
290 |
* package. |
|
291 |
* @param target Name of the target frame. |
|
292 |
* @param label Tag for the link. |
|
293 |
*/ |
|
294 |
public void printTargetPackageLink(PackageDoc pd, String target, |
|
295 |
String label) { |
|
296 |
print(getHyperLink(pathString(pd, "package-summary.html"), "", label, |
|
297 |
false, "", "", target)); |
|
298 |
} |
|
299 |
||
300 |
/** |
|
301 |
* Print the html file header. Also print Html page title and stylesheet |
|
302 |
* default properties. |
|
303 |
* |
|
304 |
* @param title String window title to go in the <TITLE> tag |
|
305 |
* @param metakeywords Array of String keywords for META tag. Each element |
|
306 |
* of the array is assigned to a separate META tag. |
|
307 |
* Pass in null for no array. |
|
308 |
* @param includeScript boolean true if printing windowtitle script. |
|
309 |
* False for files that appear in the left-hand frames. |
|
310 |
*/ |
|
311 |
public void printHtmlHeader(String title, String[] metakeywords, |
|
312 |
boolean includeScript) { |
|
313 |
println("<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 " + |
|
314 |
"Transitional//EN\" " + |
|
315 |
"\"http://www.w3.org/TR/html4/loose.dtd\">"); |
|
316 |
println("<!--NewPage-->"); |
|
317 |
html(); |
|
318 |
head(); |
|
319 |
if (! configuration.notimestamp) { |
|
320 |
print("<!-- Generated by javadoc (build " + ConfigurationImpl.BUILD_DATE + ") on "); |
|
321 |
print(today()); |
|
322 |
println(" -->"); |
|
323 |
} |
|
324 |
if (configuration.charset.length() > 0) { |
|
325 |
println("<META http-equiv=\"Content-Type\" content=\"text/html; " |
|
326 |
+ "charset=" + configuration.charset + "\">"); |
|
327 |
} |
|
328 |
if ( configuration.windowtitle.length() > 0 ) { |
|
329 |
title += " (" + configuration.windowtitle + ")"; |
|
330 |
} |
|
331 |
title(title); |
|
332 |
println(title); |
|
333 |
titleEnd(); |
|
334 |
println(""); |
|
335 |
if (! configuration.notimestamp) { |
|
336 |
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd"); |
|
337 |
println("<META NAME=\"date\" " |
|
338 |
+ "CONTENT=\"" + dateFormat.format(new Date()) + "\">"); |
|
339 |
} |
|
340 |
if ( metakeywords != null ) { |
|
341 |
for ( int i=0; i < metakeywords.length; i++ ) { |
|
342 |
println("<META NAME=\"keywords\" " |
|
343 |
+ "CONTENT=\"" + metakeywords[i] + "\">"); |
|
344 |
} |
|
345 |
} |
|
346 |
println(""); |
|
347 |
printStyleSheetProperties(); |
|
348 |
println(""); |
|
349 |
// Don't print windowtitle script for overview-frame, allclasses-frame |
|
350 |
// and package-frame |
|
351 |
if (includeScript) { |
|
352 |
printWinTitleScript(title); |
|
353 |
} |
|
354 |
println(""); |
|
355 |
headEnd(); |
|
356 |
println(""); |
|
357 |
body("white", includeScript); |
|
358 |
} |
|
359 |
||
360 |
/** |
|
361 |
* Print user specified header and the footer. |
|
362 |
* |
|
363 |
* @param header if true print the user provided header else print the |
|
364 |
* user provided footer. |
|
365 |
*/ |
|
366 |
public void printUserHeaderFooter(boolean header) { |
|
367 |
em(); |
|
368 |
if (header) { |
|
369 |
print(replaceDocRootDir(configuration.header)); |
|
370 |
} else { |
|
371 |
if (configuration.footer.length() != 0) { |
|
372 |
print(replaceDocRootDir(configuration.footer)); |
|
373 |
} else { |
|
374 |
print(replaceDocRootDir(configuration.header)); |
|
375 |
} |
|
376 |
} |
|
377 |
emEnd(); |
|
378 |
} |
|
379 |
||
380 |
/** |
|
381 |
* Print the user specified top. |
|
382 |
*/ |
|
383 |
public void printTop() { |
|
384 |
print(replaceDocRootDir(configuration.top)); |
|
385 |
hr(); |
|
386 |
} |
|
387 |
||
388 |
/** |
|
389 |
* Print the user specified bottom. |
|
390 |
*/ |
|
391 |
public void printBottom() { |
|
392 |
hr(); |
|
393 |
print(replaceDocRootDir(configuration.bottom)); |
|
394 |
} |
|
395 |
||
396 |
/** |
|
397 |
* Print the navigation bar for the Html page at the top and and the bottom. |
|
398 |
* |
|
399 |
* @param header If true print navigation bar at the top of the page else |
|
400 |
* print the nevigation bar at the bottom. |
|
401 |
*/ |
|
402 |
protected void navLinks(boolean header) { |
|
403 |
println(""); |
|
404 |
if (!configuration.nonavbar) { |
|
405 |
if (header) { |
|
406 |
println(DocletConstants.NL + "<!-- ========= START OF TOP NAVBAR ======= -->"); |
|
407 |
anchor("navbar_top"); |
|
408 |
println(); |
|
409 |
print(getHyperLink("", "skip-navbar_top", "", false, "", |
|
410 |
configuration.getText("doclet.Skip_navigation_links"), "")); |
|
411 |
} else { |
|
412 |
println(DocletConstants.NL + "<!-- ======= START OF BOTTOM NAVBAR ====== -->"); |
|
413 |
anchor("navbar_bottom"); |
|
414 |
println(); |
|
415 |
print(getHyperLink("", "skip-navbar_bottom", "", false, "", |
|
416 |
configuration.getText("doclet.Skip_navigation_links"), "")); |
|
417 |
} |
|
418 |
table(0, "100%", 1, 0); |
|
419 |
tr(); |
|
420 |
tdColspanBgcolorStyle(2, "#EEEEFF", "NavBarCell1"); |
|
421 |
println(""); |
|
422 |
if (header) { |
|
423 |
anchor("navbar_top_firstrow"); |
|
424 |
} else { |
|
425 |
anchor("navbar_bottom_firstrow"); |
|
426 |
} |
|
427 |
table(0, 0, 3); |
|
428 |
print(" "); |
|
429 |
trAlignVAlign("center", "top"); |
|
430 |
||
431 |
if (configuration.createoverview) { |
|
432 |
navLinkContents(); |
|
433 |
} |
|
434 |
||
435 |
if (configuration.packages.length == 1) { |
|
436 |
navLinkPackage(configuration.packages[0]); |
|
437 |
} else if (configuration.packages.length > 1) { |
|
438 |
navLinkPackage(); |
|
439 |
} |
|
440 |
||
441 |
navLinkClass(); |
|
442 |
||
443 |
if(configuration.classuse) { |
|
444 |
navLinkClassUse(); |
|
445 |
} |
|
446 |
if(configuration.createtree) { |
|
447 |
navLinkTree(); |
|
448 |
} |
|
449 |
if(!(configuration.nodeprecated || |
|
450 |
configuration.nodeprecatedlist)) { |
|
451 |
navLinkDeprecated(); |
|
452 |
} |
|
453 |
if(configuration.createindex) { |
|
454 |
navLinkIndex(); |
|
455 |
} |
|
456 |
if (!configuration.nohelp) { |
|
457 |
navLinkHelp(); |
|
458 |
} |
|
459 |
print(" "); |
|
460 |
trEnd(); |
|
461 |
tableEnd(); |
|
462 |
tdEnd(); |
|
463 |
||
464 |
tdAlignVAlignRowspan("right", "top", 3); |
|
465 |
||
466 |
printUserHeaderFooter(header); |
|
467 |
tdEnd(); |
|
468 |
trEnd(); |
|
469 |
println(""); |
|
470 |
||
471 |
tr(); |
|
472 |
tdBgcolorStyle("white", "NavBarCell2"); |
|
473 |
font("-2"); |
|
474 |
space(); |
|
475 |
navLinkPrevious(); |
|
476 |
space(); |
|
477 |
println(""); |
|
478 |
space(); |
|
479 |
navLinkNext(); |
|
480 |
fontEnd(); |
|
481 |
tdEnd(); |
|
482 |
||
483 |
tdBgcolorStyle("white", "NavBarCell2"); |
|
484 |
font("-2"); |
|
485 |
print(" "); |
|
486 |
navShowLists(); |
|
487 |
print(" "); |
|
488 |
space(); |
|
489 |
println(""); |
|
490 |
space(); |
|
491 |
navHideLists(filename); |
|
492 |
print(" "); |
|
493 |
space(); |
|
494 |
println(""); |
|
495 |
space(); |
|
496 |
navLinkClassIndex(); |
|
497 |
fontEnd(); |
|
498 |
tdEnd(); |
|
499 |
||
500 |
trEnd(); |
|
501 |
||
502 |
printSummaryDetailLinks(); |
|
503 |
||
504 |
tableEnd(); |
|
505 |
if (header) { |
|
506 |
aName("skip-navbar_top"); |
|
507 |
aEnd(); |
|
508 |
println(DocletConstants.NL + "<!-- ========= END OF TOP NAVBAR ========= -->"); |
|
509 |
} else { |
|
510 |
aName("skip-navbar_bottom"); |
|
511 |
aEnd(); |
|
512 |
println(DocletConstants.NL + "<!-- ======== END OF BOTTOM NAVBAR ======= -->"); |
|
513 |
} |
|
514 |
println(""); |
|
515 |
} |
|
516 |
} |
|
517 |
||
518 |
/** |
|
519 |
* Print the word "NEXT" to indicate that no link is available. Override |
|
520 |
* this method to customize next link. |
|
521 |
*/ |
|
522 |
protected void navLinkNext() { |
|
523 |
navLinkNext(null); |
|
524 |
} |
|
525 |
||
526 |
/** |
|
527 |
* Print the word "PREV" to indicate that no link is available. Override |
|
528 |
* this method to customize prev link. |
|
529 |
*/ |
|
530 |
protected void navLinkPrevious() { |
|
531 |
navLinkPrevious(null); |
|
532 |
} |
|
533 |
||
534 |
/** |
|
535 |
* Do nothing. This is the default method. |
|
536 |
*/ |
|
537 |
protected void printSummaryDetailLinks() { |
|
538 |
} |
|
539 |
||
540 |
/** |
|
541 |
* Print link to the "overview-summary.html" page. |
|
542 |
*/ |
|
543 |
protected void navLinkContents() { |
|
544 |
navCellStart(); |
|
545 |
printHyperLink(relativePath + "overview-summary.html", "", |
|
546 |
configuration.getText("doclet.Overview"), true, "NavBarFont1"); |
|
547 |
navCellEnd(); |
|
548 |
} |
|
549 |
||
550 |
/** |
|
551 |
* Description for a cell in the navigation bar. |
|
552 |
*/ |
|
553 |
protected void navCellStart() { |
|
554 |
print(" "); |
|
555 |
tdBgcolorStyle("#EEEEFF", "NavBarCell1"); |
|
556 |
print(" "); |
|
557 |
} |
|
558 |
||
559 |
/** |
|
560 |
* Description for a cell in the navigation bar, but with reverse |
|
561 |
* high-light effect. |
|
562 |
*/ |
|
563 |
protected void navCellRevStart() { |
|
564 |
print(" "); |
|
565 |
tdBgcolorStyle("#FFFFFF", "NavBarCell1Rev"); |
|
566 |
print(" "); |
|
567 |
space(); |
|
568 |
} |
|
569 |
||
570 |
/** |
|
571 |
* Closing tag for navigation bar cell. |
|
572 |
*/ |
|
573 |
protected void navCellEnd() { |
|
574 |
space(); |
|
575 |
tdEnd(); |
|
576 |
} |
|
577 |
||
578 |
/** |
|
579 |
* Print link to the "package-summary.html" page for the package passed. |
|
580 |
* |
|
581 |
* @param pkg Package to which link will be generated. |
|
582 |
*/ |
|
583 |
protected void navLinkPackage(PackageDoc pkg) { |
|
584 |
navCellStart(); |
|
585 |
printPackageLink(pkg, configuration.getText("doclet.Package"), true, |
|
586 |
"NavBarFont1"); |
|
587 |
navCellEnd(); |
|
588 |
} |
|
589 |
||
590 |
/** |
|
591 |
* Print the word "Package" in the navigation bar cell, to indicate that |
|
592 |
* link is not available here. |
|
593 |
*/ |
|
594 |
protected void navLinkPackage() { |
|
595 |
navCellStart(); |
|
596 |
fontStyle("NavBarFont1"); |
|
597 |
printText("doclet.Package"); |
|
598 |
fontEnd(); |
|
599 |
navCellEnd(); |
|
600 |
} |
|
601 |
||
602 |
/** |
|
603 |
* Print the word "Use" in the navigation bar cell, to indicate that link |
|
604 |
* is not available. |
|
605 |
*/ |
|
606 |
protected void navLinkClassUse() { |
|
607 |
navCellStart(); |
|
608 |
fontStyle("NavBarFont1"); |
|
609 |
printText("doclet.navClassUse"); |
|
610 |
fontEnd(); |
|
611 |
navCellEnd(); |
|
612 |
} |
|
613 |
||
614 |
/** |
|
615 |
* Print link for previous file. |
|
616 |
* |
|
617 |
* @param prev File name for the prev link. |
|
618 |
*/ |
|
619 |
public void navLinkPrevious(String prev) { |
|
620 |
String tag = configuration.getText("doclet.Prev"); |
|
621 |
if (prev != null) { |
|
622 |
printHyperLink(prev, "", tag, true) ; |
|
623 |
} else { |
|
624 |
print(tag); |
|
625 |
} |
|
626 |
} |
|
627 |
||
628 |
/** |
|
629 |
* Print link for next file. If next is null, just print the label |
|
630 |
* without linking it anywhere. |
|
631 |
* |
|
632 |
* @param next File name for the next link. |
|
633 |
*/ |
|
634 |
public void navLinkNext(String next) { |
|
635 |
String tag = configuration.getText("doclet.Next"); |
|
636 |
if (next != null) { |
|
637 |
printHyperLink(next, "", tag, true); |
|
638 |
} else { |
|
639 |
print(tag); |
|
640 |
} |
|
641 |
} |
|
642 |
||
643 |
/** |
|
644 |
* Print "FRAMES" link, to switch to the frame version of the output. |
|
645 |
* |
|
646 |
* @param link File to be linked, "index.html". |
|
647 |
*/ |
|
648 |
protected void navShowLists(String link) { |
|
649 |
print(getHyperLink(link + "?" + path + filename, "", |
|
650 |
configuration.getText("doclet.FRAMES"), true, "", "", "_top")); |
|
651 |
} |
|
652 |
||
653 |
/** |
|
654 |
* Print "FRAMES" link, to switch to the frame version of the output. |
|
655 |
*/ |
|
656 |
protected void navShowLists() { |
|
657 |
navShowLists(relativePath + "index.html"); |
|
658 |
} |
|
659 |
||
660 |
/** |
|
661 |
* Print "NO FRAMES" link, to switch to the non-frame version of the output. |
|
662 |
* |
|
663 |
* @param link File to be linked. |
|
664 |
*/ |
|
665 |
protected void navHideLists(String link) { |
|
666 |
print(getHyperLink(link, "", configuration.getText("doclet.NO_FRAMES"), |
|
667 |
true, "", "", "_top")); |
|
668 |
} |
|
669 |
||
670 |
/** |
|
671 |
* Print "Tree" link in the navigation bar. If there is only one package |
|
672 |
* specified on the command line, then the "Tree" link will be to the |
|
673 |
* only "package-tree.html" file otherwise it will be to the |
|
674 |
* "overview-tree.html" file. |
|
675 |
*/ |
|
676 |
protected void navLinkTree() { |
|
677 |
navCellStart(); |
|
678 |
PackageDoc[] packages = configuration.root.specifiedPackages(); |
|
679 |
if (packages.length == 1 && configuration.root.specifiedClasses().length == 0) { |
|
680 |
printHyperLink(pathString(packages[0], "package-tree.html"), "", |
|
681 |
configuration.getText("doclet.Tree"), true, "NavBarFont1"); |
|
682 |
} else { |
|
683 |
printHyperLink(relativePath + "overview-tree.html", "", |
|
684 |
configuration.getText("doclet.Tree"), true, "NavBarFont1"); |
|
685 |
} |
|
686 |
navCellEnd(); |
|
687 |
} |
|
688 |
||
689 |
/** |
|
690 |
* Print "Tree" link to the "overview-tree.html" file. |
|
691 |
*/ |
|
692 |
protected void navLinkMainTree(String label) { |
|
693 |
printHyperLink(relativePath + "overview-tree.html", label); |
|
694 |
} |
|
695 |
||
696 |
/** |
|
697 |
* Print the word "Class" in the navigation bar cell, to indicate that |
|
698 |
* class link is not available. |
|
699 |
*/ |
|
700 |
protected void navLinkClass() { |
|
701 |
navCellStart(); |
|
702 |
fontStyle("NavBarFont1"); |
|
703 |
printText("doclet.Class"); |
|
704 |
fontEnd(); |
|
705 |
navCellEnd(); |
|
706 |
} |
|
707 |
||
708 |
/** |
|
709 |
* Print "Deprecated" API link in the navigation bar. |
|
710 |
*/ |
|
711 |
protected void navLinkDeprecated() { |
|
712 |
navCellStart(); |
|
713 |
printHyperLink(relativePath + "deprecated-list.html", "", |
|
714 |
configuration.getText("doclet.navDeprecated"), true, "NavBarFont1"); |
|
715 |
navCellEnd(); |
|
716 |
} |
|
717 |
||
718 |
/** |
|
719 |
* Print link for generated index. If the user has used "-splitindex" |
|
720 |
* command line option, then link to file "index-files/index-1.html" is |
|
721 |
* generated otherwise link to file "index-all.html" is generated. |
|
722 |
*/ |
|
723 |
protected void navLinkClassIndex() { |
|
724 |
printNoFramesTargetHyperLink(relativePath + |
|
725 |
AllClassesFrameWriter.OUTPUT_FILE_NAME_NOFRAMES, |
|
726 |
"", "", configuration.getText("doclet.All_Classes"), true); |
|
727 |
} |
|
728 |
/** |
|
729 |
* Print link for generated class index. |
|
730 |
*/ |
|
731 |
protected void navLinkIndex() { |
|
732 |
navCellStart(); |
|
733 |
printHyperLink(relativePath + |
|
734 |
(configuration.splitindex? |
|
735 |
DirectoryManager.getPath("index-files") + |
|
736 |
fileseparator: "") + |
|
737 |
(configuration.splitindex? |
|
738 |
"index-1.html" : "index-all.html"), "", |
|
739 |
configuration.getText("doclet.Index"), true, "NavBarFont1"); |
|
740 |
navCellEnd(); |
|
741 |
} |
|
742 |
||
743 |
/** |
|
744 |
* Print help file link. If user has provided a help file, then generate a |
|
745 |
* link to the user given file, which is already copied to current or |
|
746 |
* destination directory. |
|
747 |
*/ |
|
748 |
protected void navLinkHelp() { |
|
749 |
String helpfilenm = configuration.helpfile; |
|
750 |
if (helpfilenm.equals("")) { |
|
751 |
helpfilenm = "help-doc.html"; |
|
752 |
} else { |
|
753 |
int lastsep; |
|
754 |
if ((lastsep = helpfilenm.lastIndexOf(File.separatorChar)) != -1) { |
|
755 |
helpfilenm = helpfilenm.substring(lastsep + 1); |
|
756 |
} |
|
757 |
} |
|
758 |
navCellStart(); |
|
759 |
printHyperLink(relativePath + helpfilenm, "", |
|
760 |
configuration.getText("doclet.Help"), true, "NavBarFont1"); |
|
761 |
navCellEnd(); |
|
762 |
} |
|
763 |
||
764 |
/** |
|
765 |
* Print the word "Detail" in the navigation bar. No link is available. |
|
766 |
*/ |
|
767 |
protected void navDetail() { |
|
768 |
printText("doclet.Detail"); |
|
769 |
} |
|
770 |
||
771 |
/** |
|
772 |
* Print the word "Summary" in the navigation bar. No link is available. |
|
773 |
*/ |
|
774 |
protected void navSummary() { |
|
775 |
printText("doclet.Summary"); |
|
776 |
} |
|
777 |
||
778 |
/** |
|
779 |
* Print the Html table tag for the index summary tables. The table tag |
|
780 |
* printed is |
|
781 |
* <TABLE BORDER="1" CELLPADDING="3" CELLSPACING="0" WIDTH="100%"> |
|
782 |
*/ |
|
783 |
public void tableIndexSummary() { |
|
784 |
table(1, "100%", 3, 0); |
|
785 |
} |
|
786 |
||
787 |
/** |
|
2320
5b8c377175f4
6786688: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - Table must have captions and headers
bpatel
parents:
2223
diff
changeset
|
788 |
* Print the Html table tag for the index summary tables. |
5b8c377175f4
6786688: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - Table must have captions and headers
bpatel
parents:
2223
diff
changeset
|
789 |
* |
5b8c377175f4
6786688: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - Table must have captions and headers
bpatel
parents:
2223
diff
changeset
|
790 |
* @param summary the summary for the table tag summary attribute. |
5b8c377175f4
6786688: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - Table must have captions and headers
bpatel
parents:
2223
diff
changeset
|
791 |
*/ |
5b8c377175f4
6786688: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - Table must have captions and headers
bpatel
parents:
2223
diff
changeset
|
792 |
public void tableIndexSummary(String summary) { |
5b8c377175f4
6786688: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - Table must have captions and headers
bpatel
parents:
2223
diff
changeset
|
793 |
table(1, "100%", 3, 0, summary); |
5b8c377175f4
6786688: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - Table must have captions and headers
bpatel
parents:
2223
diff
changeset
|
794 |
} |
5b8c377175f4
6786688: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - Table must have captions and headers
bpatel
parents:
2223
diff
changeset
|
795 |
|
5b8c377175f4
6786688: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - Table must have captions and headers
bpatel
parents:
2223
diff
changeset
|
796 |
/** |
10 | 797 |
* Same as {@link #tableIndexSummary()}. |
798 |
*/ |
|
799 |
public void tableIndexDetail() { |
|
800 |
table(1, "100%", 3, 0); |
|
801 |
} |
|
802 |
||
803 |
/** |
|
804 |
* Print Html tag for table elements. The tag printed is |
|
805 |
* <TD ALIGN="right" VALIGN="top" WIDTH="1%">. |
|
806 |
*/ |
|
807 |
public void tdIndex() { |
|
808 |
print("<TD ALIGN=\"right\" VALIGN=\"top\" WIDTH=\"1%\">"); |
|
809 |
} |
|
810 |
||
811 |
/** |
|
2320
5b8c377175f4
6786688: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - Table must have captions and headers
bpatel
parents:
2223
diff
changeset
|
812 |
* Print table caption. |
5b8c377175f4
6786688: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - Table must have captions and headers
bpatel
parents:
2223
diff
changeset
|
813 |
*/ |
5b8c377175f4
6786688: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - Table must have captions and headers
bpatel
parents:
2223
diff
changeset
|
814 |
public void tableCaptionStart() { |
5b8c377175f4
6786688: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - Table must have captions and headers
bpatel
parents:
2223
diff
changeset
|
815 |
captionStyle("TableCaption"); |
5b8c377175f4
6786688: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - Table must have captions and headers
bpatel
parents:
2223
diff
changeset
|
816 |
} |
5b8c377175f4
6786688: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - Table must have captions and headers
bpatel
parents:
2223
diff
changeset
|
817 |
|
5b8c377175f4
6786688: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - Table must have captions and headers
bpatel
parents:
2223
diff
changeset
|
818 |
/** |
5b8c377175f4
6786688: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - Table must have captions and headers
bpatel
parents:
2223
diff
changeset
|
819 |
* Print table sub-caption. |
5b8c377175f4
6786688: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - Table must have captions and headers
bpatel
parents:
2223
diff
changeset
|
820 |
*/ |
5b8c377175f4
6786688: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - Table must have captions and headers
bpatel
parents:
2223
diff
changeset
|
821 |
public void tableSubCaptionStart() { |
5b8c377175f4
6786688: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - Table must have captions and headers
bpatel
parents:
2223
diff
changeset
|
822 |
captionStyle("TableSubCaption"); |
5b8c377175f4
6786688: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - Table must have captions and headers
bpatel
parents:
2223
diff
changeset
|
823 |
} |
5b8c377175f4
6786688: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - Table must have captions and headers
bpatel
parents:
2223
diff
changeset
|
824 |
|
5b8c377175f4
6786688: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - Table must have captions and headers
bpatel
parents:
2223
diff
changeset
|
825 |
/** |
5b8c377175f4
6786688: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - Table must have captions and headers
bpatel
parents:
2223
diff
changeset
|
826 |
* Print table caption end tags. |
5b8c377175f4
6786688: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - Table must have captions and headers
bpatel
parents:
2223
diff
changeset
|
827 |
*/ |
5b8c377175f4
6786688: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - Table must have captions and headers
bpatel
parents:
2223
diff
changeset
|
828 |
public void tableCaptionEnd() { |
5b8c377175f4
6786688: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - Table must have captions and headers
bpatel
parents:
2223
diff
changeset
|
829 |
captionEnd(); |
5b8c377175f4
6786688: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - Table must have captions and headers
bpatel
parents:
2223
diff
changeset
|
830 |
} |
5b8c377175f4
6786688: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - Table must have captions and headers
bpatel
parents:
2223
diff
changeset
|
831 |
|
5b8c377175f4
6786688: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - Table must have captions and headers
bpatel
parents:
2223
diff
changeset
|
832 |
/** |
5b8c377175f4
6786688: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - Table must have captions and headers
bpatel
parents:
2223
diff
changeset
|
833 |
* Print summary table header. |
5b8c377175f4
6786688: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - Table must have captions and headers
bpatel
parents:
2223
diff
changeset
|
834 |
*/ |
5b8c377175f4
6786688: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - Table must have captions and headers
bpatel
parents:
2223
diff
changeset
|
835 |
public void summaryTableHeader(String[] header, String scope) { |
5b8c377175f4
6786688: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - Table must have captions and headers
bpatel
parents:
2223
diff
changeset
|
836 |
tr(); |
5b8c377175f4
6786688: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - Table must have captions and headers
bpatel
parents:
2223
diff
changeset
|
837 |
for ( int i=0; i < header.length; i++ ) { |
5b8c377175f4
6786688: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - Table must have captions and headers
bpatel
parents:
2223
diff
changeset
|
838 |
thScopeNoWrap("TableHeader", scope); |
5b8c377175f4
6786688: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - Table must have captions and headers
bpatel
parents:
2223
diff
changeset
|
839 |
print(header[i]); |
5b8c377175f4
6786688: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - Table must have captions and headers
bpatel
parents:
2223
diff
changeset
|
840 |
thEnd(); |
5b8c377175f4
6786688: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - Table must have captions and headers
bpatel
parents:
2223
diff
changeset
|
841 |
} |
5b8c377175f4
6786688: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - Table must have captions and headers
bpatel
parents:
2223
diff
changeset
|
842 |
trEnd(); |
5b8c377175f4
6786688: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - Table must have captions and headers
bpatel
parents:
2223
diff
changeset
|
843 |
} |
5b8c377175f4
6786688: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - Table must have captions and headers
bpatel
parents:
2223
diff
changeset
|
844 |
|
5b8c377175f4
6786688: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - Table must have captions and headers
bpatel
parents:
2223
diff
changeset
|
845 |
/** |
10 | 846 |
* Prine table header information about color, column span and the font. |
847 |
* |
|
848 |
* @param color Background color. |
|
849 |
* @param span Column span. |
|
850 |
*/ |
|
851 |
public void tableHeaderStart(String color, int span) { |
|
852 |
trBgcolorStyle(color, "TableHeadingColor"); |
|
853 |
thAlignColspan("left", span); |
|
854 |
font("+2"); |
|
855 |
} |
|
856 |
||
857 |
/** |
|
858 |
* Print table header for the inherited members summary tables. Print the |
|
859 |
* background color information. |
|
860 |
* |
|
861 |
* @param color Background color. |
|
862 |
*/ |
|
863 |
public void tableInheritedHeaderStart(String color) { |
|
864 |
trBgcolorStyle(color, "TableSubHeadingColor"); |
|
865 |
thAlign("left"); |
|
866 |
} |
|
867 |
||
868 |
/** |
|
869 |
* Print "Use" table header. Print the background color and the column span. |
|
870 |
* |
|
871 |
* @param color Background color. |
|
872 |
*/ |
|
873 |
public void tableUseInfoHeaderStart(String color) { |
|
874 |
trBgcolorStyle(color, "TableSubHeadingColor"); |
|
875 |
thAlignColspan("left", 2); |
|
876 |
} |
|
877 |
||
878 |
/** |
|
879 |
* Print table header with the background color with default column span 2. |
|
880 |
* |
|
881 |
* @param color Background color. |
|
882 |
*/ |
|
883 |
public void tableHeaderStart(String color) { |
|
884 |
tableHeaderStart(color, 2); |
|
885 |
} |
|
886 |
||
887 |
/** |
|
888 |
* Print table header with the column span, with the default color #CCCCFF. |
|
889 |
* |
|
890 |
* @param span Column span. |
|
891 |
*/ |
|
892 |
public void tableHeaderStart(int span) { |
|
893 |
tableHeaderStart("#CCCCFF", span); |
|
894 |
} |
|
895 |
||
896 |
/** |
|
897 |
* Print table header with default column span 2 and default color #CCCCFF. |
|
898 |
*/ |
|
899 |
public void tableHeaderStart() { |
|
900 |
tableHeaderStart(2); |
|
901 |
} |
|
902 |
||
903 |
/** |
|
904 |
* Print table header end tags for font, column and row. |
|
905 |
*/ |
|
906 |
public void tableHeaderEnd() { |
|
907 |
fontEnd(); |
|
908 |
thEnd(); |
|
909 |
trEnd(); |
|
910 |
} |
|
911 |
||
912 |
/** |
|
913 |
* Print table header end tags in inherited tables for column and row. |
|
914 |
*/ |
|
915 |
public void tableInheritedHeaderEnd() { |
|
916 |
thEnd(); |
|
917 |
trEnd(); |
|
918 |
} |
|
919 |
||
920 |
/** |
|
921 |
* Print the summary table row cell attribute width. |
|
922 |
* |
|
923 |
* @param width Width of the table cell. |
|
924 |
*/ |
|
925 |
public void summaryRow(int width) { |
|
926 |
if (width != 0) { |
|
927 |
tdWidth(width + "%"); |
|
928 |
} else { |
|
929 |
td(); |
|
930 |
} |
|
931 |
} |
|
932 |
||
933 |
/** |
|
934 |
* Print the summary table row cell end tag. |
|
935 |
*/ |
|
936 |
public void summaryRowEnd() { |
|
937 |
tdEnd(); |
|
938 |
} |
|
939 |
||
940 |
/** |
|
941 |
* Print the heading in Html <H2> format. |
|
942 |
* |
|
943 |
* @param str The Header string. |
|
944 |
*/ |
|
945 |
public void printIndexHeading(String str) { |
|
946 |
h2(); |
|
947 |
print(str); |
|
948 |
h2End(); |
|
949 |
} |
|
950 |
||
951 |
/** |
|
952 |
* Print Html tag <FRAMESET=arg>. |
|
953 |
* |
|
954 |
* @param arg Argument for the tag. |
|
955 |
*/ |
|
956 |
public void frameSet(String arg) { |
|
957 |
println("<FRAMESET " + arg + ">"); |
|
958 |
} |
|
959 |
||
960 |
/** |
|
961 |
* Print Html closing tag </FRAMESET>. |
|
962 |
*/ |
|
963 |
public void frameSetEnd() { |
|
964 |
println("</FRAMESET>"); |
|
965 |
} |
|
966 |
||
967 |
/** |
|
968 |
* Print Html tag <FRAME=arg>. |
|
969 |
* |
|
970 |
* @param arg Argument for the tag. |
|
971 |
*/ |
|
972 |
public void frame(String arg) { |
|
973 |
println("<FRAME " + arg + ">"); |
|
974 |
} |
|
975 |
||
976 |
/** |
|
977 |
* Print Html closing tag </FRAME>. |
|
978 |
*/ |
|
979 |
public void frameEnd() { |
|
980 |
println("</FRAME>"); |
|
981 |
} |
|
982 |
||
983 |
/** |
|
984 |
* Return path to the class page for a classdoc. For example, the class |
|
985 |
* name is "java.lang.Object" and if the current file getting generated is |
|
986 |
* "java/io/File.html", then the path string to the class, returned is |
|
987 |
* "../../java/lang.Object.html". |
|
988 |
* |
|
989 |
* @param cd Class to which the path is requested. |
|
990 |
*/ |
|
991 |
protected String pathToClass(ClassDoc cd) { |
|
992 |
return pathString(cd.containingPackage(), cd.name() + ".html"); |
|
993 |
} |
|
994 |
||
995 |
/** |
|
996 |
* Return the path to the class page for a classdoc. Works same as |
|
997 |
* {@link #pathToClass(ClassDoc)}. |
|
998 |
* |
|
999 |
* @param cd Class to which the path is requested. |
|
1000 |
* @param name Name of the file(doesn't include path). |
|
1001 |
*/ |
|
1002 |
protected String pathString(ClassDoc cd, String name) { |
|
1003 |
return pathString(cd.containingPackage(), name); |
|
1004 |
} |
|
1005 |
||
1006 |
/** |
|
1007 |
* Return path to the given file name in the given package. So if the name |
|
1008 |
* passed is "Object.html" and the name of the package is "java.lang", and |
|
1009 |
* if the relative path is "../.." then returned string will be |
|
1010 |
* "../../java/lang/Object.html" |
|
1011 |
* |
|
1012 |
* @param pd Package in which the file name is assumed to be. |
|
1013 |
* @param name File name, to which path string is. |
|
1014 |
*/ |
|
1015 |
protected String pathString(PackageDoc pd, String name) { |
|
1016 |
StringBuffer buf = new StringBuffer(relativePath); |
|
1017 |
buf.append(DirectoryManager.getPathToPackage(pd, name)); |
|
1018 |
return buf.toString(); |
|
1019 |
} |
|
1020 |
||
1021 |
/** |
|
1022 |
* Print the link to the given package. |
|
1023 |
* |
|
1024 |
* @param pkg the package to link to. |
|
1025 |
* @param label the label for the link. |
|
1787
1aa079321cd2
6786028: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - Bold tags should be strong
bpatel
parents:
1264
diff
changeset
|
1026 |
* @param isStrong true if the label should be strong. |
10 | 1027 |
*/ |
1787
1aa079321cd2
6786028: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - Bold tags should be strong
bpatel
parents:
1264
diff
changeset
|
1028 |
public void printPackageLink(PackageDoc pkg, String label, boolean isStrong) { |
1aa079321cd2
6786028: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - Bold tags should be strong
bpatel
parents:
1264
diff
changeset
|
1029 |
print(getPackageLink(pkg, label, isStrong)); |
10 | 1030 |
} |
1031 |
||
1032 |
/** |
|
1033 |
* Print the link to the given package. |
|
1034 |
* |
|
1035 |
* @param pkg the package to link to. |
|
1036 |
* @param label the label for the link. |
|
1787
1aa079321cd2
6786028: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - Bold tags should be strong
bpatel
parents:
1264
diff
changeset
|
1037 |
* @param isStrong true if the label should be strong. |
10 | 1038 |
* @param style the font of the package link label. |
1039 |
*/ |
|
1787
1aa079321cd2
6786028: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - Bold tags should be strong
bpatel
parents:
1264
diff
changeset
|
1040 |
public void printPackageLink(PackageDoc pkg, String label, boolean isStrong, |
10 | 1041 |
String style) { |
1787
1aa079321cd2
6786028: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - Bold tags should be strong
bpatel
parents:
1264
diff
changeset
|
1042 |
print(getPackageLink(pkg, label, isStrong, style)); |
10 | 1043 |
} |
1044 |
||
1045 |
/** |
|
1046 |
* Return the link to the given package. |
|
1047 |
* |
|
1048 |
* @param pkg the package to link to. |
|
1049 |
* @param label the label for the link. |
|
1787
1aa079321cd2
6786028: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - Bold tags should be strong
bpatel
parents:
1264
diff
changeset
|
1050 |
* @param isStrong true if the label should be strong. |
10 | 1051 |
* @return the link to the given package. |
1052 |
*/ |
|
1053 |
public String getPackageLink(PackageDoc pkg, String label, |
|
1787
1aa079321cd2
6786028: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - Bold tags should be strong
bpatel
parents:
1264
diff
changeset
|
1054 |
boolean isStrong) { |
1aa079321cd2
6786028: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - Bold tags should be strong
bpatel
parents:
1264
diff
changeset
|
1055 |
return getPackageLink(pkg, label, isStrong, ""); |
10 | 1056 |
} |
1057 |
||
1058 |
/** |
|
1059 |
* Return the link to the given package. |
|
1060 |
* |
|
1061 |
* @param pkg the package to link to. |
|
1062 |
* @param label the label for the link. |
|
1787
1aa079321cd2
6786028: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - Bold tags should be strong
bpatel
parents:
1264
diff
changeset
|
1063 |
* @param isStrong true if the label should be strong. |
10 | 1064 |
* @param style the font of the package link label. |
1065 |
* @return the link to the given package. |
|
1066 |
*/ |
|
1787
1aa079321cd2
6786028: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - Bold tags should be strong
bpatel
parents:
1264
diff
changeset
|
1067 |
public String getPackageLink(PackageDoc pkg, String label, boolean isStrong, |
10 | 1068 |
String style) { |
1069 |
boolean included = pkg != null && pkg.isIncluded(); |
|
1070 |
if (! included) { |
|
1071 |
PackageDoc[] packages = configuration.packages; |
|
1072 |
for (int i = 0; i < packages.length; i++) { |
|
1073 |
if (packages[i].equals(pkg)) { |
|
1074 |
included = true; |
|
1075 |
break; |
|
1076 |
} |
|
1077 |
} |
|
1078 |
} |
|
1079 |
if (included || pkg == null) { |
|
1080 |
return getHyperLink(pathString(pkg, "package-summary.html"), |
|
1787
1aa079321cd2
6786028: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - Bold tags should be strong
bpatel
parents:
1264
diff
changeset
|
1081 |
"", label, isStrong, style); |
10 | 1082 |
} else { |
1083 |
String crossPkgLink = getCrossPackageLink(Util.getPackageName(pkg)); |
|
1084 |
if (crossPkgLink != null) { |
|
1787
1aa079321cd2
6786028: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - Bold tags should be strong
bpatel
parents:
1264
diff
changeset
|
1085 |
return getHyperLink(crossPkgLink, "", label, isStrong, style); |
10 | 1086 |
} else { |
1087 |
return label; |
|
1088 |
} |
|
1089 |
} |
|
1090 |
} |
|
1091 |
||
1092 |
public String italicsClassName(ClassDoc cd, boolean qual) { |
|
1093 |
String name = (qual)? cd.qualifiedName(): cd.name(); |
|
1094 |
return (cd.isInterface())? italicsText(name): name; |
|
1095 |
} |
|
1096 |
||
1097 |
public void printSrcLink(ProgramElementDoc d, String label) { |
|
1098 |
if (d == null) { |
|
1099 |
return; |
|
1100 |
} |
|
1101 |
ClassDoc cd = d.containingClass(); |
|
1102 |
if (cd == null) { |
|
1103 |
//d must be a class doc since in has no containing class. |
|
1104 |
cd = (ClassDoc) d; |
|
1105 |
} |
|
1106 |
String href = relativePath + DocletConstants.SOURCE_OUTPUT_DIR_NAME |
|
1107 |
+ DirectoryManager.getDirectoryPath(cd.containingPackage()) |
|
1108 |
+ cd.name() + ".html#" + SourceToHTMLConverter.getAnchorName(d); |
|
1109 |
printHyperLink(href, "", label, true); |
|
1110 |
} |
|
1111 |
||
1112 |
/** |
|
1113 |
* Return the link to the given class. |
|
1114 |
* |
|
1115 |
* @param linkInfo the information about the link. |
|
1116 |
* |
|
1117 |
* @return the link for the given class. |
|
1118 |
*/ |
|
1119 |
public String getLink(LinkInfoImpl linkInfo) { |
|
1120 |
LinkFactoryImpl factory = new LinkFactoryImpl(this); |
|
1121 |
String link = ((LinkOutputImpl) factory.getLinkOutput(linkInfo)).toString(); |
|
1122 |
displayLength += linkInfo.displayLength; |
|
1123 |
return link; |
|
1124 |
} |
|
1125 |
||
1126 |
/** |
|
1127 |
* Return the type parameters for the given class. |
|
1128 |
* |
|
1129 |
* @param linkInfo the information about the link. |
|
1130 |
* @return the type for the given class. |
|
1131 |
*/ |
|
1132 |
public String getTypeParameterLinks(LinkInfoImpl linkInfo) { |
|
1133 |
LinkFactoryImpl factory = new LinkFactoryImpl(this); |
|
1134 |
return ((LinkOutputImpl) |
|
1135 |
factory.getTypeParameterLinks(linkInfo, false)).toString(); |
|
1136 |
} |
|
1137 |
||
1138 |
/** |
|
1139 |
* Print the link to the given class. |
|
1140 |
*/ |
|
1141 |
public void printLink(LinkInfoImpl linkInfo) { |
|
1142 |
print(getLink(linkInfo)); |
|
1143 |
} |
|
1144 |
||
1145 |
/************************************************************* |
|
1146 |
* Return a class cross link to external class documentation. |
|
1147 |
* The name must be fully qualified to determine which package |
|
1148 |
* the class is in. The -link option does not allow users to |
|
1149 |
* link to external classes in the "default" package. |
|
1150 |
* |
|
1151 |
* @param qualifiedClassName the qualified name of the external class. |
|
1152 |
* @param refMemName the name of the member being referenced. This should |
|
1153 |
* be null or empty string if no member is being referenced. |
|
1154 |
* @param label the label for the external link. |
|
1787
1aa079321cd2
6786028: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - Bold tags should be strong
bpatel
parents:
1264
diff
changeset
|
1155 |
* @param strong true if the link should be strong. |
10 | 1156 |
* @param style the style of the link. |
1157 |
* @param code true if the label should be code font. |
|
1158 |
*/ |
|
1159 |
public String getCrossClassLink(String qualifiedClassName, String refMemName, |
|
1787
1aa079321cd2
6786028: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - Bold tags should be strong
bpatel
parents:
1264
diff
changeset
|
1160 |
String label, boolean strong, String style, |
10 | 1161 |
boolean code) { |
1162 |
String className = "", |
|
1163 |
packageName = qualifiedClassName == null ? "" : qualifiedClassName; |
|
1164 |
int periodIndex; |
|
1165 |
while((periodIndex = packageName.lastIndexOf('.')) != -1) { |
|
1166 |
className = packageName.substring(periodIndex + 1, packageName.length()) + |
|
1167 |
(className.length() > 0 ? "." + className : ""); |
|
1168 |
String defaultLabel = code ? getCode() + className + getCodeEnd() : className; |
|
1169 |
packageName = packageName.substring(0, periodIndex); |
|
1170 |
if (getCrossPackageLink(packageName) != null) { |
|
1171 |
//The package exists in external documentation, so link to the external |
|
1172 |
//class (assuming that it exists). This is definitely a limitation of |
|
1173 |
//the -link option. There are ways to determine if an external package |
|
1174 |
//exists, but no way to determine if the external class exists. We just |
|
1175 |
//have to assume that it does. |
|
1176 |
return getHyperLink( |
|
1177 |
configuration.extern.getExternalLink(packageName, relativePath, |
|
1178 |
className + ".html?is-external=true"), |
|
1179 |
refMemName == null ? "" : refMemName, |
|
1180 |
label == null || label.length() == 0 ? defaultLabel : label, |
|
1787
1aa079321cd2
6786028: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - Bold tags should be strong
bpatel
parents:
1264
diff
changeset
|
1181 |
strong, style, |
10 | 1182 |
configuration.getText("doclet.Href_Class_Or_Interface_Title", packageName), |
1183 |
""); |
|
1184 |
} |
|
1185 |
} |
|
1186 |
return null; |
|
1187 |
} |
|
1188 |
||
1189 |
public boolean isClassLinkable(ClassDoc cd) { |
|
1190 |
if (cd.isIncluded()) { |
|
1191 |
return configuration.isGeneratedDoc(cd); |
|
1192 |
} |
|
1193 |
return configuration.extern.isExternal(cd); |
|
1194 |
} |
|
1195 |
||
1196 |
public String getCrossPackageLink(String pkgName) { |
|
1197 |
return configuration.extern.getExternalLink(pkgName, relativePath, |
|
1198 |
"package-summary.html?is-external=true"); |
|
1199 |
} |
|
1200 |
||
1201 |
public void printQualifiedClassLink(int context, ClassDoc cd) { |
|
1202 |
printLink(new LinkInfoImpl(context, cd, |
|
1203 |
configuration.getClassName(cd), "")); |
|
1204 |
} |
|
1205 |
||
1206 |
/** |
|
1207 |
* Print Class link, with only class name as the link and prefixing |
|
1208 |
* plain package name. |
|
1209 |
*/ |
|
1210 |
public void printPreQualifiedClassLink(int context, ClassDoc cd) { |
|
1211 |
print(getPreQualifiedClassLink(context, cd, false)); |
|
1212 |
} |
|
1213 |
||
1214 |
/** |
|
1215 |
* Retrieve the class link with the package portion of the label in |
|
1216 |
* plain text. If the qualifier is excluded, it willnot be included in the |
|
1217 |
* link label. |
|
1218 |
* |
|
1219 |
* @param cd the class to link to. |
|
1787
1aa079321cd2
6786028: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - Bold tags should be strong
bpatel
parents:
1264
diff
changeset
|
1220 |
* @param isStrong true if the link should be strong. |
10 | 1221 |
* @return the link with the package portion of the label in plain text. |
1222 |
*/ |
|
1223 |
public String getPreQualifiedClassLink(int context, |
|
1787
1aa079321cd2
6786028: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - Bold tags should be strong
bpatel
parents:
1264
diff
changeset
|
1224 |
ClassDoc cd, boolean isStrong) { |
10 | 1225 |
String classlink = ""; |
1226 |
PackageDoc pd = cd.containingPackage(); |
|
1227 |
if(pd != null && ! configuration.shouldExcludeQualifier(pd.name())) { |
|
1228 |
classlink = getPkgName(cd); |
|
1229 |
} |
|
1787
1aa079321cd2
6786028: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - Bold tags should be strong
bpatel
parents:
1264
diff
changeset
|
1230 |
classlink += getLink(new LinkInfoImpl(context, cd, cd.name(), isStrong)); |
10 | 1231 |
return classlink; |
1232 |
} |
|
1233 |
||
1234 |
||
1235 |
/** |
|
1787
1aa079321cd2
6786028: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - Bold tags should be strong
bpatel
parents:
1264
diff
changeset
|
1236 |
* Print Class link, with only class name as the strong link and prefixing |
10 | 1237 |
* plain package name. |
1238 |
*/ |
|
1787
1aa079321cd2
6786028: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - Bold tags should be strong
bpatel
parents:
1264
diff
changeset
|
1239 |
public void printPreQualifiedStrongClassLink(int context, ClassDoc cd) { |
10 | 1240 |
print(getPreQualifiedClassLink(context, cd, true)); |
1241 |
} |
|
1242 |
||
1243 |
public void printText(String key) { |
|
1244 |
print(configuration.getText(key)); |
|
1245 |
} |
|
1246 |
||
1247 |
public void printText(String key, String a1) { |
|
1248 |
print(configuration.getText(key, a1)); |
|
1249 |
} |
|
1250 |
||
1251 |
public void printText(String key, String a1, String a2) { |
|
1252 |
print(configuration.getText(key, a1, a2)); |
|
1253 |
} |
|
1254 |
||
1787
1aa079321cd2
6786028: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - Bold tags should be strong
bpatel
parents:
1264
diff
changeset
|
1255 |
public void strongText(String key) { |
1aa079321cd2
6786028: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - Bold tags should be strong
bpatel
parents:
1264
diff
changeset
|
1256 |
strong(configuration.getText(key)); |
10 | 1257 |
} |
1258 |
||
1787
1aa079321cd2
6786028: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - Bold tags should be strong
bpatel
parents:
1264
diff
changeset
|
1259 |
public void strongText(String key, String a1) { |
1aa079321cd2
6786028: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - Bold tags should be strong
bpatel
parents:
1264
diff
changeset
|
1260 |
strong(configuration.getText(key, a1)); |
10 | 1261 |
} |
1262 |
||
1787
1aa079321cd2
6786028: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - Bold tags should be strong
bpatel
parents:
1264
diff
changeset
|
1263 |
public void strongText(String key, String a1, String a2) { |
1aa079321cd2
6786028: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - Bold tags should be strong
bpatel
parents:
1264
diff
changeset
|
1264 |
strong(configuration.getText(key, a1, a2)); |
10 | 1265 |
} |
1266 |
||
1267 |
/** |
|
1268 |
* Print the link for the given member. |
|
1269 |
* |
|
1270 |
* @param context the id of the context where the link will be printed. |
|
1271 |
* @param doc the member being linked to. |
|
1272 |
* @param label the label for the link. |
|
1787
1aa079321cd2
6786028: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - Bold tags should be strong
bpatel
parents:
1264
diff
changeset
|
1273 |
* @param strong true if the link should be strong. |
10 | 1274 |
*/ |
1275 |
public void printDocLink(int context, MemberDoc doc, String label, |
|
1787
1aa079321cd2
6786028: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - Bold tags should be strong
bpatel
parents:
1264
diff
changeset
|
1276 |
boolean strong) { |
1aa079321cd2
6786028: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - Bold tags should be strong
bpatel
parents:
1264
diff
changeset
|
1277 |
print(getDocLink(context, doc, label, strong)); |
10 | 1278 |
} |
1279 |
||
1280 |
/** |
|
1281 |
* Print the link for the given member. |
|
1282 |
* |
|
1283 |
* @param context the id of the context where the link will be printed. |
|
1284 |
* @param classDoc the classDoc that we should link to. This is not |
|
1285 |
* necessarily equal to doc.containingClass(). We may be |
|
1286 |
* inheriting comments. |
|
1287 |
* @param doc the member being linked to. |
|
1288 |
* @param label the label for the link. |
|
1787
1aa079321cd2
6786028: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - Bold tags should be strong
bpatel
parents:
1264
diff
changeset
|
1289 |
* @param strong true if the link should be strong. |
10 | 1290 |
*/ |
1291 |
public void printDocLink(int context, ClassDoc classDoc, MemberDoc doc, |
|
1787
1aa079321cd2
6786028: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - Bold tags should be strong
bpatel
parents:
1264
diff
changeset
|
1292 |
String label, boolean strong) { |
1aa079321cd2
6786028: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - Bold tags should be strong
bpatel
parents:
1264
diff
changeset
|
1293 |
print(getDocLink(context, classDoc, doc, label, strong)); |
10 | 1294 |
} |
1295 |
||
1296 |
/** |
|
1297 |
* Return the link for the given member. |
|
1298 |
* |
|
1299 |
* @param context the id of the context where the link will be printed. |
|
1300 |
* @param doc the member being linked to. |
|
1301 |
* @param label the label for the link. |
|
1787
1aa079321cd2
6786028: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - Bold tags should be strong
bpatel
parents:
1264
diff
changeset
|
1302 |
* @param strong true if the link should be strong. |
10 | 1303 |
* @return the link for the given member. |
1304 |
*/ |
|
1305 |
public String getDocLink(int context, MemberDoc doc, String label, |
|
1787
1aa079321cd2
6786028: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - Bold tags should be strong
bpatel
parents:
1264
diff
changeset
|
1306 |
boolean strong) { |
1aa079321cd2
6786028: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - Bold tags should be strong
bpatel
parents:
1264
diff
changeset
|
1307 |
return getDocLink(context, doc.containingClass(), doc, label, strong); |
10 | 1308 |
} |
1309 |
||
1310 |
/** |
|
1311 |
* Return the link for the given member. |
|
1312 |
* |
|
1313 |
* @param context the id of the context where the link will be printed. |
|
1314 |
* @param classDoc the classDoc that we should link to. This is not |
|
1315 |
* necessarily equal to doc.containingClass(). We may be |
|
1316 |
* inheriting comments. |
|
1317 |
* @param doc the member being linked to. |
|
1318 |
* @param label the label for the link. |
|
1787
1aa079321cd2
6786028: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - Bold tags should be strong
bpatel
parents:
1264
diff
changeset
|
1319 |
* @param strong true if the link should be strong. |
10 | 1320 |
* @return the link for the given member. |
1321 |
*/ |
|
1322 |
public String getDocLink(int context, ClassDoc classDoc, MemberDoc doc, |
|
1787
1aa079321cd2
6786028: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - Bold tags should be strong
bpatel
parents:
1264
diff
changeset
|
1323 |
String label, boolean strong) { |
10 | 1324 |
if (! (doc.isIncluded() || |
1325 |
Util.isLinkable(classDoc, configuration()))) { |
|
1326 |
return label; |
|
1327 |
} else if (doc instanceof ExecutableMemberDoc) { |
|
1328 |
ExecutableMemberDoc emd = (ExecutableMemberDoc)doc; |
|
1329 |
return getLink(new LinkInfoImpl(context, classDoc, |
|
1787
1aa079321cd2
6786028: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - Bold tags should be strong
bpatel
parents:
1264
diff
changeset
|
1330 |
getAnchor(emd), label, strong)); |
10 | 1331 |
} else if (doc instanceof MemberDoc) { |
1332 |
return getLink(new LinkInfoImpl(context, classDoc, |
|
1787
1aa079321cd2
6786028: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - Bold tags should be strong
bpatel
parents:
1264
diff
changeset
|
1333 |
doc.name(), label, strong)); |
10 | 1334 |
} else { |
1335 |
return label; |
|
1336 |
} |
|
1337 |
} |
|
1338 |
||
1339 |
public void anchor(ExecutableMemberDoc emd) { |
|
1340 |
anchor(getAnchor(emd)); |
|
1341 |
} |
|
1342 |
||
1343 |
public String getAnchor(ExecutableMemberDoc emd) { |
|
1344 |
StringBuilder signature = new StringBuilder(emd.signature()); |
|
1345 |
StringBuilder signatureParsed = new StringBuilder(); |
|
1346 |
int counter = 0; |
|
1347 |
for (int i = 0; i < signature.length(); i++) { |
|
1348 |
char c = signature.charAt(i); |
|
1349 |
if (c == '<') { |
|
1350 |
counter++; |
|
1351 |
} else if (c == '>') { |
|
1352 |
counter--; |
|
1353 |
} else if (counter == 0) { |
|
1354 |
signatureParsed.append(c); |
|
1355 |
} |
|
1356 |
} |
|
1357 |
return emd.name() + signatureParsed.toString(); |
|
1358 |
} |
|
1359 |
||
1360 |
public String seeTagToString(SeeTag see) { |
|
1361 |
String tagName = see.name(); |
|
1362 |
if (! (tagName.startsWith("@link") || tagName.equals("@see"))) { |
|
1363 |
return ""; |
|
1364 |
} |
|
1365 |
StringBuffer result = new StringBuffer(); |
|
1366 |
boolean isplaintext = tagName.toLowerCase().equals("@linkplain"); |
|
1367 |
String label = see.label(); |
|
1368 |
label = (label.length() > 0)? |
|
1369 |
((isplaintext) ? label : |
|
1370 |
getCode() + label + getCodeEnd()):""; |
|
1371 |
String seetext = replaceDocRootDir(see.text()); |
|
1372 |
||
1373 |
//Check if @see is an href or "string" |
|
1374 |
if (seetext.startsWith("<") || seetext.startsWith("\"")) { |
|
1375 |
result.append(seetext); |
|
1376 |
return result.toString(); |
|
1377 |
} |
|
1378 |
||
1379 |
//The text from the @see tag. We will output this text when a label is not specified. |
|
1380 |
String text = (isplaintext) ? seetext : getCode() + seetext + getCodeEnd(); |
|
1381 |
||
1382 |
ClassDoc refClass = see.referencedClass(); |
|
1383 |
String refClassName = see.referencedClassName(); |
|
1384 |
MemberDoc refMem = see.referencedMember(); |
|
1385 |
String refMemName = see.referencedMemberName(); |
|
1386 |
if (refClass == null) { |
|
1387 |
//@see is not referencing an included class |
|
1388 |
PackageDoc refPackage = see.referencedPackage(); |
|
1389 |
if (refPackage != null && refPackage.isIncluded()) { |
|
1390 |
//@see is referencing an included package |
|
1391 |
String packageName = isplaintext ? refPackage.name() : |
|
1392 |
getCode() + refPackage.name() + getCodeEnd(); |
|
1393 |
result.append(getPackageLink(refPackage, |
|
1394 |
label.length() == 0 ? packageName : label, false)); |
|
1395 |
} else { |
|
1396 |
//@see is not referencing an included class or package. Check for cross links. |
|
1397 |
String classCrossLink, packageCrossLink = getCrossPackageLink(refClassName); |
|
1398 |
if (packageCrossLink != null) { |
|
1399 |
//Package cross link found |
|
1400 |
result.append(getHyperLink(packageCrossLink, "", |
|
1401 |
(label.length() == 0)? text : label, false)); |
|
1402 |
} else if ((classCrossLink = getCrossClassLink(refClassName, |
|
1403 |
refMemName, label, false, "", ! isplaintext)) != null) { |
|
1404 |
//Class cross link found (possiblly to a member in the class) |
|
1405 |
result.append(classCrossLink); |
|
1406 |
} else { |
|
1407 |
//No cross link found so print warning |
|
1408 |
configuration.getDocletSpecificMsg().warning(see.position(), "doclet.see.class_or_package_not_found", |
|
1409 |
tagName, seetext); |
|
1410 |
result.append((label.length() == 0)? text: label); |
|
1411 |
} |
|
1412 |
} |
|
1413 |
} else if (refMemName == null) { |
|
1414 |
// Must be a class reference since refClass is not null and refMemName is null. |
|
1415 |
if (label.length() == 0) { |
|
1416 |
label = (isplaintext) ? refClass.name() : getCode() + refClass.name() + getCodeEnd(); |
|
1417 |
result.append(getLink(new LinkInfoImpl(refClass, label))); |
|
1418 |
} else { |
|
1419 |
result.append(getLink(new LinkInfoImpl(refClass, label))); |
|
1420 |
} |
|
1421 |
} else if (refMem == null) { |
|
1422 |
// Must be a member reference since refClass is not null and refMemName is not null. |
|
1423 |
// However, refMem is null, so this referenced member does not exist. |
|
1424 |
result.append((label.length() == 0)? text: label); |
|
1425 |
} else { |
|
1426 |
// Must be a member reference since refClass is not null and refMemName is not null. |
|
1427 |
// refMem is not null, so this @see tag must be referencing a valid member. |
|
1428 |
ClassDoc containing = refMem.containingClass(); |
|
1429 |
if (see.text().trim().startsWith("#") && |
|
1430 |
! (containing.isPublic() || |
|
1431 |
Util.isLinkable(containing, configuration()))) { |
|
1432 |
// Since the link is relative and the holder is not even being |
|
1433 |
// documented, this must be an inherited link. Redirect it. |
|
1434 |
// The current class either overrides the referenced member or |
|
1435 |
// inherits it automatically. |
|
1436 |
containing = ((ClassWriterImpl) this).getClassDoc(); |
|
1437 |
} |
|
1438 |
if (configuration.currentcd != containing) { |
|
1439 |
refMemName = containing.name() + "." + refMemName; |
|
1440 |
} |
|
1441 |
if (refMem instanceof ExecutableMemberDoc) { |
|
1442 |
if (refMemName.indexOf('(') < 0) { |
|
1443 |
refMemName += ((ExecutableMemberDoc)refMem).signature(); |
|
1444 |
} |
|
1445 |
} |
|
1446 |
text = (isplaintext) ? |
|
1447 |
refMemName : getCode() + refMemName + getCodeEnd(); |
|
1448 |
||
1449 |
result.append(getDocLink(LinkInfoImpl.CONTEXT_SEE_TAG, containing, |
|
1450 |
refMem, (label.length() == 0)? text: label, false)); |
|
1451 |
} |
|
1452 |
return result.toString(); |
|
1453 |
} |
|
1454 |
||
1455 |
public void printInlineComment(Doc doc, Tag tag) { |
|
1456 |
printCommentTags(doc, tag.inlineTags(), false, false); |
|
1457 |
} |
|
1458 |
||
1459 |
public void printInlineDeprecatedComment(Doc doc, Tag tag) { |
|
1460 |
printCommentTags(doc, tag.inlineTags(), true, false); |
|
1461 |
} |
|
1462 |
||
1463 |
public void printSummaryComment(Doc doc) { |
|
1464 |
printSummaryComment(doc, doc.firstSentenceTags()); |
|
1465 |
} |
|
1466 |
||
1467 |
public void printSummaryComment(Doc doc, Tag[] firstSentenceTags) { |
|
1468 |
printCommentTags(doc, firstSentenceTags, false, true); |
|
1469 |
} |
|
1470 |
||
1471 |
public void printSummaryDeprecatedComment(Doc doc) { |
|
1472 |
printCommentTags(doc, doc.firstSentenceTags(), true, true); |
|
1473 |
} |
|
1474 |
||
1475 |
public void printSummaryDeprecatedComment(Doc doc, Tag tag) { |
|
1476 |
printCommentTags(doc, tag.firstSentenceTags(), true, true); |
|
1477 |
} |
|
1478 |
||
1479 |
public void printInlineComment(Doc doc) { |
|
1480 |
printCommentTags(doc, doc.inlineTags(), false, false); |
|
1481 |
p(); |
|
1482 |
} |
|
1483 |
||
1484 |
public void printInlineDeprecatedComment(Doc doc) { |
|
1485 |
printCommentTags(doc, doc.inlineTags(), true, false); |
|
1486 |
} |
|
1487 |
||
1488 |
private void printCommentTags(Doc doc, Tag[] tags, boolean depr, boolean first) { |
|
1489 |
if(configuration.nocomment){ |
|
1490 |
return; |
|
1491 |
} |
|
1492 |
if (depr) { |
|
1493 |
italic(); |
|
1494 |
} |
|
1495 |
String result = commentTagsToString(null, doc, tags, first); |
|
1496 |
print(result); |
|
1497 |
if (depr) { |
|
1498 |
italicEnd(); |
|
1499 |
} |
|
1500 |
if (tags.length == 0) { |
|
1501 |
space(); |
|
1502 |
} |
|
1503 |
} |
|
1504 |
||
1505 |
/** |
|
1506 |
* Converts inline tags and text to text strings, expanding the |
|
1507 |
* inline tags along the way. Called wherever text can contain |
|
1508 |
* an inline tag, such as in comments or in free-form text arguments |
|
1509 |
* to non-inline tags. |
|
1510 |
* |
|
1511 |
* @param holderTag specific tag where comment resides |
|
1512 |
* @param doc specific doc where comment resides |
|
1513 |
* @param tags array of text tags and inline tags (often alternating) |
|
1514 |
* present in the text of interest for this doc |
|
1515 |
* @param isFirstSentence true if text is first sentence |
|
1516 |
*/ |
|
1517 |
public String commentTagsToString(Tag holderTag, Doc doc, Tag[] tags, |
|
1518 |
boolean isFirstSentence) { |
|
1519 |
StringBuffer result = new StringBuffer(); |
|
1520 |
// Array of all possible inline tags for this javadoc run |
|
1521 |
configuration.tagletManager.checkTags(doc, tags, true); |
|
1522 |
for (int i = 0; i < tags.length; i++) { |
|
1523 |
Tag tagelem = tags[i]; |
|
1524 |
String tagName = tagelem.name(); |
|
1525 |
if (tagelem instanceof SeeTag) { |
|
1526 |
result.append(seeTagToString((SeeTag)tagelem)); |
|
1527 |
} else if (! tagName.equals("Text")) { |
|
1528 |
int originalLength = result.length(); |
|
1529 |
TagletOutput output = TagletWriter.getInlineTagOuput( |
|
1530 |
configuration.tagletManager, holderTag, |
|
868 | 1531 |
tagelem, getTagletWriterInstance(isFirstSentence)); |
10 | 1532 |
result.append(output == null ? "" : output.toString()); |
1533 |
if (originalLength == 0 && isFirstSentence && tagelem.name().equals("@inheritDoc") && result.length() > 0) { |
|
1534 |
break; |
|
1535 |
} else { |
|
1536 |
continue; |
|
1537 |
} |
|
1538 |
} else { |
|
1539 |
//This is just a regular text tag. The text may contain html links (<a>) |
|
1540 |
//or inline tag {@docRoot}, which will be handled as special cases. |
|
1541 |
String text = redirectRelativeLinks(tagelem.holder(), tagelem.text()); |
|
1542 |
||
1543 |
// Replace @docRoot only if not represented by an instance of DocRootTaglet, |
|
1544 |
// that is, only if it was not present in a source file doc comment. |
|
1545 |
// This happens when inserted by the doclet (a few lines |
|
1546 |
// above in this method). [It might also happen when passed in on the command |
|
1547 |
// line as a text argument to an option (like -header).] |
|
1548 |
text = replaceDocRootDir(text); |
|
1549 |
if (isFirstSentence) { |
|
1550 |
text = removeNonInlineHtmlTags(text); |
|
1551 |
} |
|
1552 |
StringTokenizer lines = new StringTokenizer(text, "\r\n", true); |
|
1553 |
StringBuffer textBuff = new StringBuffer(); |
|
1554 |
while (lines.hasMoreTokens()) { |
|
1555 |
StringBuffer line = new StringBuffer(lines.nextToken()); |
|
1556 |
Util.replaceTabs(configuration.sourcetab, line); |
|
1557 |
textBuff.append(line.toString()); |
|
1558 |
} |
|
1559 |
result.append(textBuff); |
|
1560 |
} |
|
1561 |
} |
|
1562 |
return result.toString(); |
|
1563 |
} |
|
1564 |
||
1565 |
/** |
|
1566 |
* Return true if relative links should not be redirected. |
|
1567 |
* |
|
1568 |
* @return Return true if a relative link should not be redirected. |
|
1569 |
*/ |
|
1570 |
private boolean shouldNotRedirectRelativeLinks() { |
|
1571 |
return this instanceof AnnotationTypeWriter || |
|
1572 |
this instanceof ClassWriter || |
|
1573 |
this instanceof PackageSummaryWriter; |
|
1574 |
} |
|
1575 |
||
1576 |
/** |
|
1577 |
* Suppose a piece of documentation has a relative link. When you copy |
|
1578 |
* that documetation to another place such as the index or class-use page, |
|
1579 |
* that relative link will no longer work. We should redirect those links |
|
1580 |
* so that they will work again. |
|
1581 |
* <p> |
|
1582 |
* Here is the algorithm used to fix the link: |
|
1583 |
* <p> |
|
1584 |
* <relative link> => docRoot + <relative path to file> + <relative link> |
|
1585 |
* <p> |
|
1586 |
* For example, suppose com.sun.javadoc.RootDoc has this link: |
|
1587 |
* <a href="package-summary.html">The package Page</a> |
|
1588 |
* <p> |
|
1589 |
* If this link appeared in the index, we would redirect |
|
1590 |
* the link like this: |
|
1591 |
* |
|
1592 |
* <a href="./com/sun/javadoc/package-summary.html">The package Page</a> |
|
1593 |
* |
|
1594 |
* @param doc the Doc object whose documentation is being written. |
|
1595 |
* @param text the text being written. |
|
1596 |
* |
|
1597 |
* @return the text, with all the relative links redirected to work. |
|
1598 |
*/ |
|
1599 |
private String redirectRelativeLinks(Doc doc, String text) { |
|
1600 |
if (doc == null || shouldNotRedirectRelativeLinks()) { |
|
1601 |
return text; |
|
1602 |
} |
|
1603 |
||
1604 |
String redirectPathFromRoot; |
|
1605 |
if (doc instanceof ClassDoc) { |
|
1606 |
redirectPathFromRoot = DirectoryManager.getDirectoryPath(((ClassDoc) doc).containingPackage()); |
|
1607 |
} else if (doc instanceof MemberDoc) { |
|
1608 |
redirectPathFromRoot = DirectoryManager.getDirectoryPath(((MemberDoc) doc).containingPackage()); |
|
1609 |
} else if (doc instanceof PackageDoc) { |
|
1610 |
redirectPathFromRoot = DirectoryManager.getDirectoryPath((PackageDoc) doc); |
|
1611 |
} else { |
|
1612 |
return text; |
|
1613 |
} |
|
1614 |
||
1615 |
if (! redirectPathFromRoot.endsWith(DirectoryManager.URL_FILE_SEPERATOR)) { |
|
1616 |
redirectPathFromRoot += DirectoryManager.URL_FILE_SEPERATOR; |
|
1617 |
} |
|
1618 |
||
1619 |
//Redirect all relative links. |
|
1620 |
int end, begin = text.toLowerCase().indexOf("<a"); |
|
1621 |
if(begin >= 0){ |
|
1622 |
StringBuffer textBuff = new StringBuffer(text); |
|
1623 |
||
1624 |
while(begin >=0){ |
|
1625 |
if (textBuff.length() > begin + 2 && ! Character.isWhitespace(textBuff.charAt(begin+2))) { |
|
1626 |
begin = textBuff.toString().toLowerCase().indexOf("<a", begin + 1); |
|
1627 |
continue; |
|
1628 |
} |
|
1629 |
||
1630 |
begin = textBuff.indexOf("=", begin) + 1; |
|
1631 |
end = textBuff.indexOf(">", begin +1); |
|
1632 |
if(begin == 0){ |
|
1633 |
//Link has no equal symbol. |
|
1634 |
configuration.root.printWarning( |
|
1635 |
doc.position(), |
|
1636 |
configuration.getText("doclet.malformed_html_link_tag", text)); |
|
1637 |
break; |
|
1638 |
} |
|
1639 |
if (end == -1) { |
|
1640 |
//Break without warning. This <a> tag is not necessarily malformed. The text |
|
1641 |
//might be missing '>' character because the href has an inline tag. |
|
1642 |
break; |
|
1643 |
} |
|
1644 |
if(textBuff.substring(begin, end).indexOf("\"") != -1){ |
|
1645 |
begin = textBuff.indexOf("\"", begin) + 1; |
|
1646 |
end = textBuff.indexOf("\"", begin +1); |
|
1647 |
if(begin == 0 || end == -1){ |
|
1648 |
//Link is missing a quote. |
|
1649 |
break; |
|
1650 |
} |
|
1651 |
} |
|
1652 |
String relativeLink = textBuff.substring(begin, end); |
|
1653 |
if(!(relativeLink.toLowerCase().startsWith("mailto:") || |
|
1654 |
relativeLink.toLowerCase().startsWith("http:") || |
|
1655 |
relativeLink.toLowerCase().startsWith("https:") || |
|
1656 |
relativeLink.toLowerCase().startsWith("file:"))){ |
|
1657 |
relativeLink = "{@"+(new DocRootTaglet()).getName() + "}" |
|
1658 |
+ redirectPathFromRoot |
|
1659 |
+ relativeLink; |
|
1660 |
textBuff.replace(begin, end, relativeLink); |
|
1661 |
} |
|
1662 |
begin = textBuff.toString().toLowerCase().indexOf("<a", begin + 1); |
|
1663 |
} |
|
1664 |
return textBuff.toString(); |
|
1665 |
} |
|
1666 |
return text; |
|
1667 |
} |
|
1668 |
||
1669 |
public String removeNonInlineHtmlTags(String text) { |
|
1670 |
if (text.indexOf('<') < 0) { |
|
1671 |
return text; |
|
1672 |
} |
|
1673 |
String noninlinetags[] = { "<ul>", "</ul>", "<ol>", "</ol>", |
|
1674 |
"<dl>", "</dl>", "<table>", "</table>", |
|
1675 |
"<tr>", "</tr>", "<td>", "</td>", |
|
1676 |
"<th>", "</th>", "<p>", "</p>", |
|
1677 |
"<li>", "</li>", "<dd>", "</dd>", |
|
1678 |
"<dir>", "</dir>", "<dt>", "</dt>", |
|
1679 |
"<h1>", "</h1>", "<h2>", "</h2>", |
|
1680 |
"<h3>", "</h3>", "<h4>", "</h4>", |
|
1681 |
"<h5>", "</h5>", "<h6>", "</h6>", |
|
1682 |
"<pre>", "</pre>", "<menu>", "</menu>", |
|
1683 |
"<listing>", "</listing>", "<hr>", |
|
1684 |
"<blockquote>", "</blockquote>", |
|
1685 |
"<center>", "</center>", |
|
1686 |
"<UL>", "</UL>", "<OL>", "</OL>", |
|
1687 |
"<DL>", "</DL>", "<TABLE>", "</TABLE>", |
|
1688 |
"<TR>", "</TR>", "<TD>", "</TD>", |
|
1689 |
"<TH>", "</TH>", "<P>", "</P>", |
|
1690 |
"<LI>", "</LI>", "<DD>", "</DD>", |
|
1691 |
"<DIR>", "</DIR>", "<DT>", "</DT>", |
|
1692 |
"<H1>", "</H1>", "<H2>", "</H2>", |
|
1693 |
"<H3>", "</H3>", "<H4>", "</H4>", |
|
1694 |
"<H5>", "</H5>", "<H6>", "</H6>", |
|
1695 |
"<PRE>", "</PRE>", "<MENU>", "</MENU>", |
|
1696 |
"<LISTING>", "</LISTING>", "<HR>", |
|
1697 |
"<BLOCKQUOTE>", "</BLOCKQUOTE>", |
|
1698 |
"<CENTER>", "</CENTER>" |
|
1699 |
}; |
|
1700 |
for (int i = 0; i < noninlinetags.length; i++) { |
|
1701 |
text = replace(text, noninlinetags[i], ""); |
|
1702 |
} |
|
1703 |
return text; |
|
1704 |
} |
|
1705 |
||
1706 |
public String replace(String text, String tobe, String by) { |
|
1707 |
while (true) { |
|
1708 |
int startindex = text.indexOf(tobe); |
|
1709 |
if (startindex < 0) { |
|
1710 |
return text; |
|
1711 |
} |
|
1712 |
int endindex = startindex + tobe.length(); |
|
1713 |
StringBuffer replaced = new StringBuffer(); |
|
1714 |
if (startindex > 0) { |
|
1715 |
replaced.append(text.substring(0, startindex)); |
|
1716 |
} |
|
1717 |
replaced.append(by); |
|
1718 |
if (text.length() > endindex) { |
|
1719 |
replaced.append(text.substring(endindex)); |
|
1720 |
} |
|
1721 |
text = replaced.toString(); |
|
1722 |
} |
|
1723 |
} |
|
1724 |
||
1725 |
public void printStyleSheetProperties() { |
|
1726 |
String filename = configuration.stylesheetfile; |
|
1727 |
if (filename.length() > 0) { |
|
1728 |
File stylefile = new File(filename); |
|
1729 |
String parent = stylefile.getParent(); |
|
1730 |
filename = (parent == null)? |
|
1731 |
filename: |
|
1732 |
filename.substring(parent.length() + 1); |
|
1733 |
} else { |
|
1734 |
filename = "stylesheet.css"; |
|
1735 |
} |
|
1736 |
filename = relativePath + filename; |
|
1737 |
link("REL =\"stylesheet\" TYPE=\"text/css\" HREF=\"" + |
|
1738 |
filename + "\" " + "TITLE=\"Style\""); |
|
1739 |
} |
|
1740 |
||
1741 |
/** |
|
1742 |
* According to the Java Language Specifications, all the outer classes |
|
1743 |
* and static nested classes are core classes. |
|
1744 |
*/ |
|
1745 |
public boolean isCoreClass(ClassDoc cd) { |
|
1746 |
return cd.containingClass() == null || cd.isStatic(); |
|
1747 |
} |
|
1748 |
||
1749 |
/** |
|
1750 |
* Write the annotatation types for the given packageDoc. |
|
1751 |
* |
|
1752 |
* @param packageDoc the package to write annotations for. |
|
1753 |
*/ |
|
1754 |
public void writeAnnotationInfo(PackageDoc packageDoc) { |
|
1755 |
writeAnnotationInfo(packageDoc, packageDoc.annotations()); |
|
1756 |
} |
|
1757 |
||
1758 |
/** |
|
1759 |
* Write the annotatation types for the given doc. |
|
1760 |
* |
|
1761 |
* @param doc the doc to write annotations for. |
|
1762 |
*/ |
|
1763 |
public void writeAnnotationInfo(ProgramElementDoc doc) { |
|
1764 |
writeAnnotationInfo(doc, doc.annotations()); |
|
1765 |
} |
|
1766 |
||
1767 |
/** |
|
1768 |
* Write the annotatation types for the given doc and parameter. |
|
1769 |
* |
|
1770 |
* @param indent the number of spaced to indent the parameters. |
|
1771 |
* @param doc the doc to write annotations for. |
|
1772 |
* @param param the parameter to write annotations for. |
|
1773 |
*/ |
|
1774 |
public boolean writeAnnotationInfo(int indent, Doc doc, Parameter param) { |
|
1775 |
return writeAnnotationInfo(indent, doc, param.annotations(), false); |
|
1776 |
} |
|
1777 |
||
1778 |
/** |
|
1779 |
* Write the annotatation types for the given doc. |
|
1780 |
* |
|
1781 |
* @param doc the doc to write annotations for. |
|
1782 |
* @param descList the array of {@link AnnotationDesc}. |
|
1783 |
*/ |
|
1784 |
private void writeAnnotationInfo(Doc doc, AnnotationDesc[] descList) { |
|
1785 |
writeAnnotationInfo(0, doc, descList, true); |
|
1786 |
} |
|
1787 |
||
1788 |
/** |
|
1789 |
* Write the annotatation types for the given doc. |
|
1790 |
* |
|
1791 |
* @param indent the number of extra spaces to indent the annotations. |
|
1792 |
* @param doc the doc to write annotations for. |
|
1793 |
* @param descList the array of {@link AnnotationDesc}. |
|
1794 |
*/ |
|
1795 |
private boolean writeAnnotationInfo(int indent, Doc doc, AnnotationDesc[] descList, boolean lineBreak) { |
|
1789
7ac8c0815000
6765045: Remove rawtypes warnings from langtools
mcimadamore
parents:
1787
diff
changeset
|
1796 |
List<String> annotations = getAnnotations(indent, descList, lineBreak); |
10 | 1797 |
if (annotations.size() == 0) { |
1798 |
return false; |
|
1799 |
} |
|
1800 |
fontNoNewLine("-1"); |
|
1789
7ac8c0815000
6765045: Remove rawtypes warnings from langtools
mcimadamore
parents:
1787
diff
changeset
|
1801 |
for (Iterator<String> iter = annotations.iterator(); iter.hasNext();) { |
7ac8c0815000
6765045: Remove rawtypes warnings from langtools
mcimadamore
parents:
1787
diff
changeset
|
1802 |
print(iter.next()); |
10 | 1803 |
} |
1804 |
fontEnd(); |
|
1805 |
return true; |
|
1806 |
} |
|
1807 |
||
1808 |
/** |
|
1809 |
* Return the string representations of the annotation types for |
|
1810 |
* the given doc. |
|
1811 |
* |
|
1812 |
* @param indent the number of extra spaces to indent the annotations. |
|
1813 |
* @param descList the array of {@link AnnotationDesc}. |
|
1814 |
* @param linkBreak if true, add new line between each member value. |
|
1815 |
* @return an array of strings representing the annotations being |
|
1816 |
* documented. |
|
1817 |
*/ |
|
868 | 1818 |
private List<String> getAnnotations(int indent, AnnotationDesc[] descList, boolean linkBreak) { |
1819 |
List<String> results = new ArrayList<String>(); |
|
10 | 1820 |
StringBuffer annotation; |
1821 |
for (int i = 0; i < descList.length; i++) { |
|
1822 |
AnnotationTypeDoc annotationDoc = descList[i].annotationType(); |
|
1823 |
if (! Util.isDocumentedAnnotation(annotationDoc)){ |
|
1824 |
continue; |
|
1825 |
} |
|
1826 |
annotation = new StringBuffer(); |
|
1827 |
LinkInfoImpl linkInfo = new LinkInfoImpl( |
|
1828 |
LinkInfoImpl.CONTEXT_ANNOTATION, annotationDoc); |
|
1829 |
linkInfo.label = "@" + annotationDoc.name(); |
|
1830 |
annotation.append(getLink(linkInfo)); |
|
1831 |
AnnotationDesc.ElementValuePair[] pairs = descList[i].elementValues(); |
|
1832 |
if (pairs.length > 0) { |
|
1833 |
annotation.append('('); |
|
1834 |
for (int j = 0; j < pairs.length; j++) { |
|
1835 |
if (j > 0) { |
|
1836 |
annotation.append(","); |
|
1837 |
if (linkBreak) { |
|
1838 |
annotation.append(DocletConstants.NL); |
|
1839 |
int spaces = annotationDoc.name().length() + 2; |
|
1840 |
for (int k = 0; k < (spaces + indent); k++) { |
|
1841 |
annotation.append(' '); |
|
1842 |
} |
|
1843 |
} |
|
1844 |
} |
|
1845 |
annotation.append(getDocLink(LinkInfoImpl.CONTEXT_ANNOTATION, |
|
1846 |
pairs[j].element(), pairs[j].element().name(), false)); |
|
1847 |
annotation.append('='); |
|
1848 |
AnnotationValue annotationValue = pairs[j].value(); |
|
868 | 1849 |
List<AnnotationValue> annotationTypeValues = new ArrayList<AnnotationValue>(); |
10 | 1850 |
if (annotationValue.value() instanceof AnnotationValue[]) { |
1851 |
AnnotationValue[] annotationArray = |
|
1852 |
(AnnotationValue[]) annotationValue.value(); |
|
1853 |
for (int k = 0; k < annotationArray.length; k++) { |
|
1854 |
annotationTypeValues.add(annotationArray[k]); |
|
1855 |
} |
|
1856 |
} else { |
|
1857 |
annotationTypeValues.add(annotationValue); |
|
1858 |
} |
|
1859 |
annotation.append(annotationTypeValues.size() == 1 ? "" : "{"); |
|
1789
7ac8c0815000
6765045: Remove rawtypes warnings from langtools
mcimadamore
parents:
1787
diff
changeset
|
1860 |
for (Iterator<AnnotationValue> iter = annotationTypeValues.iterator(); iter.hasNext(); ) { |
7ac8c0815000
6765045: Remove rawtypes warnings from langtools
mcimadamore
parents:
1787
diff
changeset
|
1861 |
annotation.append(annotationValueToString(iter.next())); |
10 | 1862 |
annotation.append(iter.hasNext() ? "," : ""); |
1863 |
} |
|
1864 |
annotation.append(annotationTypeValues.size() == 1 ? "" : "}"); |
|
1865 |
} |
|
1866 |
annotation.append(")"); |
|
1867 |
} |
|
1868 |
annotation.append(linkBreak ? DocletConstants.NL : ""); |
|
1869 |
results.add(annotation.toString()); |
|
1870 |
} |
|
1871 |
return results; |
|
1872 |
} |
|
1873 |
||
1874 |
private String annotationValueToString(AnnotationValue annotationValue) { |
|
1875 |
if (annotationValue.value() instanceof Type) { |
|
1876 |
Type type = (Type) annotationValue.value(); |
|
1877 |
if (type.asClassDoc() != null) { |
|
1878 |
LinkInfoImpl linkInfo = new LinkInfoImpl( |
|
1879 |
LinkInfoImpl.CONTEXT_ANNOTATION, type); |
|
1880 |
linkInfo.label = (type.asClassDoc().isIncluded() ? |
|
1881 |
type.typeName() : |
|
1882 |
type.qualifiedTypeName()) + type.dimension() + ".class"; |
|
1883 |
return getLink(linkInfo); |
|
1884 |
} else { |
|
1885 |
return type.typeName() + type.dimension() + ".class"; |
|
1886 |
} |
|
1887 |
} else if (annotationValue.value() instanceof AnnotationDesc) { |
|
1789
7ac8c0815000
6765045: Remove rawtypes warnings from langtools
mcimadamore
parents:
1787
diff
changeset
|
1888 |
List<String> list = getAnnotations(0, |
10 | 1889 |
new AnnotationDesc[]{(AnnotationDesc) annotationValue.value()}, |
1890 |
false); |
|
1891 |
StringBuffer buf = new StringBuffer(); |
|
1789
7ac8c0815000
6765045: Remove rawtypes warnings from langtools
mcimadamore
parents:
1787
diff
changeset
|
1892 |
for (Iterator<String> iter = list.iterator(); iter.hasNext(); ) { |
10 | 1893 |
buf.append(iter.next()); |
1894 |
} |
|
1895 |
return buf.toString(); |
|
1896 |
} else if (annotationValue.value() instanceof MemberDoc) { |
|
1897 |
return getDocLink(LinkInfoImpl.CONTEXT_ANNOTATION, |
|
1898 |
(MemberDoc) annotationValue.value(), |
|
1899 |
((MemberDoc) annotationValue.value()).name(), false); |
|
1900 |
} else { |
|
1901 |
return annotationValue.toString(); |
|
1902 |
} |
|
1903 |
} |
|
1904 |
||
1905 |
/** |
|
1906 |
* Return the configuation for this doclet. |
|
1907 |
* |
|
1908 |
* @return the configuration for this doclet. |
|
1909 |
*/ |
|
1910 |
public Configuration configuration() { |
|
1911 |
return configuration; |
|
1912 |
} |
|
1913 |
} |