author | bpatel |
Sat, 05 Jan 2013 00:55:53 -0800 | |
changeset 15035 | d03c311f44e6 |
parent 14549 | 0599d73bf1da |
child 15385 | ee1eebe7e210 |
child 15723 | 58a73dac9ee4 |
permissions | -rw-r--r-- |
10 | 1 |
/* |
13844 | 2 |
* Copyright (c) 1998, 2012, Oracle and/or its affiliates. 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 |
|
5520 | 7 |
* published by the Free Software Foundation. Oracle designates this |
10 | 8 |
* particular file as subject to the "Classpath" exception as provided |
5520 | 9 |
* by Oracle in the LICENSE file that accompanied this code. |
10 | 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 |
* |
|
5520 | 21 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
22 |
* or visit www.oracle.com if you need additional information or have any |
|
23 |
* questions. |
|
10 | 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.*; |
14258 | 35 |
import com.sun.tools.doclets.internal.toolkit.taglets.*; |
2216
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.util.*; |
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 |
* |
|
14260
727a84636f12
8000665: fix "internal API" comments on javadoc files
jjg
parents:
14259
diff
changeset
|
43 |
* <p><b>This is NOT part of any supported API. |
727a84636f12
8000665: fix "internal API" comments on javadoc files
jjg
parents:
14259
diff
changeset
|
44 |
* If you write code that depends on this, you do so at your own risk. |
727a84636f12
8000665: fix "internal API" comments on javadoc files
jjg
parents:
14259
diff
changeset
|
45 |
* This code and its internal interfaces are subject to change or |
727a84636f12
8000665: fix "internal API" comments on javadoc files
jjg
parents:
14259
diff
changeset
|
46 |
* deletion without notice.</b> |
727a84636f12
8000665: fix "internal API" comments on javadoc files
jjg
parents:
14259
diff
changeset
|
47 |
* |
10 | 48 |
* @since 1.2 |
49 |
* @author Atul M Dambalkar |
|
50 |
* @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
|
51 |
* @author Bhavesh Patel (Modified) |
10 | 52 |
*/ |
53 |
public class HtmlDocletWriter extends HtmlDocWriter { |
|
54 |
||
55 |
/** |
|
56 |
* Relative path from the file getting generated to the destination |
|
57 |
* directory. For example, if the file getting generated is |
|
14357
faf9cde2817b
8000741: refactor javadoc to use abstraction to handle relative paths
jjg
parents:
14266
diff
changeset
|
58 |
* "java/lang/Object.html", then the path to the root is "../..". |
10 | 59 |
* This string can be empty if the file getting generated is in |
60 |
* the destination directory. |
|
61 |
*/ |
|
14357
faf9cde2817b
8000741: refactor javadoc to use abstraction to handle relative paths
jjg
parents:
14266
diff
changeset
|
62 |
public final DocPath pathToRoot; |
10 | 63 |
|
64 |
/** |
|
14357
faf9cde2817b
8000741: refactor javadoc to use abstraction to handle relative paths
jjg
parents:
14266
diff
changeset
|
65 |
* Platform-independent path from the current or the |
10 | 66 |
* destination directory to the file getting generated. |
67 |
* Used when creating the file. |
|
68 |
*/ |
|
14357
faf9cde2817b
8000741: refactor javadoc to use abstraction to handle relative paths
jjg
parents:
14266
diff
changeset
|
69 |
public final DocPath path; |
10 | 70 |
|
71 |
/** |
|
72 |
* Name of the file getting generated. If the file getting generated is |
|
73 |
* "java/lang/Object.html", then the filename is "Object.html". |
|
74 |
*/ |
|
14357
faf9cde2817b
8000741: refactor javadoc to use abstraction to handle relative paths
jjg
parents:
14266
diff
changeset
|
75 |
public final DocPath filename; |
10 | 76 |
|
77 |
/** |
|
78 |
* The display length used for indentation while generating the class page. |
|
79 |
*/ |
|
80 |
public int displayLength = 0; |
|
81 |
||
82 |
/** |
|
83 |
* The global configuration information for this run. |
|
84 |
*/ |
|
14542 | 85 |
public final ConfigurationImpl configuration; |
10 | 86 |
|
87 |
/** |
|
7614
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
88 |
* To check whether annotation heading is printed or not. |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
89 |
*/ |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
90 |
protected boolean printedAnnotationHeading = false; |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
91 |
|
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
92 |
/** |
15035
d03c311f44e6
8005092: javadoc should check for synthesized bit on an annotation
bpatel
parents:
14549
diff
changeset
|
93 |
* To check whether the repeated annotations is documented or not. |
d03c311f44e6
8005092: javadoc should check for synthesized bit on an annotation
bpatel
parents:
14549
diff
changeset
|
94 |
*/ |
d03c311f44e6
8005092: javadoc should check for synthesized bit on an annotation
bpatel
parents:
14549
diff
changeset
|
95 |
private boolean isAnnotationDocumented = false; |
d03c311f44e6
8005092: javadoc should check for synthesized bit on an annotation
bpatel
parents:
14549
diff
changeset
|
96 |
|
d03c311f44e6
8005092: javadoc should check for synthesized bit on an annotation
bpatel
parents:
14549
diff
changeset
|
97 |
/** |
d03c311f44e6
8005092: javadoc should check for synthesized bit on an annotation
bpatel
parents:
14549
diff
changeset
|
98 |
* To check whether the container annotations is documented or not. |
d03c311f44e6
8005092: javadoc should check for synthesized bit on an annotation
bpatel
parents:
14549
diff
changeset
|
99 |
*/ |
d03c311f44e6
8005092: javadoc should check for synthesized bit on an annotation
bpatel
parents:
14549
diff
changeset
|
100 |
private boolean isContainerDocumented = false; |
d03c311f44e6
8005092: javadoc should check for synthesized bit on an annotation
bpatel
parents:
14549
diff
changeset
|
101 |
|
d03c311f44e6
8005092: javadoc should check for synthesized bit on an annotation
bpatel
parents:
14549
diff
changeset
|
102 |
/** |
10 | 103 |
* Constructor to construct the HtmlStandardWriter object. |
104 |
* |
|
14357
faf9cde2817b
8000741: refactor javadoc to use abstraction to handle relative paths
jjg
parents:
14266
diff
changeset
|
105 |
* @param path File to be generated. |
10 | 106 |
*/ |
14357
faf9cde2817b
8000741: refactor javadoc to use abstraction to handle relative paths
jjg
parents:
14266
diff
changeset
|
107 |
public HtmlDocletWriter(ConfigurationImpl configuration, DocPath path) |
faf9cde2817b
8000741: refactor javadoc to use abstraction to handle relative paths
jjg
parents:
14266
diff
changeset
|
108 |
throws IOException { |
faf9cde2817b
8000741: refactor javadoc to use abstraction to handle relative paths
jjg
parents:
14266
diff
changeset
|
109 |
super(configuration, path); |
10 | 110 |
this.configuration = configuration; |
111 |
this.path = path; |
|
14357
faf9cde2817b
8000741: refactor javadoc to use abstraction to handle relative paths
jjg
parents:
14266
diff
changeset
|
112 |
this.pathToRoot = path.parent().invert(); |
faf9cde2817b
8000741: refactor javadoc to use abstraction to handle relative paths
jjg
parents:
14266
diff
changeset
|
113 |
this.filename = path.basename(); |
10 | 114 |
} |
115 |
||
116 |
/** |
|
117 |
* Replace {@docRoot} tag used in options that accept HTML text, such |
|
118 |
* as -header, -footer, -top and -bottom, and when converting a relative |
|
119 |
* HREF where commentTagsToString inserts a {@docRoot} where one was |
|
120 |
* missing. (Also see DocRootTaglet for {@docRoot} tags in doc |
|
121 |
* comments.) |
|
122 |
* <p> |
|
123 |
* Replace {@docRoot} tag in htmlstr with the relative path to the |
|
124 |
* destination directory from the directory where the file is being |
|
125 |
* written, looping to handle all such tags in htmlstr. |
|
126 |
* <p> |
|
127 |
* For example, for "-d docs" and -header containing {@docRoot}, when |
|
128 |
* the HTML page for source file p/C1.java is being generated, the |
|
129 |
* {@docRoot} tag would be inserted into the header as "../", |
|
130 |
* the relative path from docs/p/ to docs/ (the document root). |
|
131 |
* <p> |
|
132 |
* Note: This doc comment was written with '&#064;' representing '@' |
|
133 |
* to prevent the inline tag from being interpreted. |
|
134 |
*/ |
|
135 |
public String replaceDocRootDir(String htmlstr) { |
|
136 |
// Return if no inline tags exist |
|
137 |
int index = htmlstr.indexOf("{@"); |
|
138 |
if (index < 0) { |
|
139 |
return htmlstr; |
|
140 |
} |
|
141 |
String lowerHtml = htmlstr.toLowerCase(); |
|
142 |
// Return index of first occurrence of {@docroot} |
|
143 |
// Note: {@docRoot} is not case sensitive when passed in w/command line option |
|
144 |
index = lowerHtml.indexOf("{@docroot}", index); |
|
145 |
if (index < 0) { |
|
146 |
return htmlstr; |
|
147 |
} |
|
8631
664f84942e74
6866185: Util.getPackageSourcePath should use lastIndexOf not indexOf and related cleanup
jjg
parents:
7681
diff
changeset
|
148 |
StringBuilder buf = new StringBuilder(); |
10 | 149 |
int previndex = 0; |
150 |
while (true) { |
|
9608 | 151 |
if (configuration.docrootparent.length() > 0) { |
14357
faf9cde2817b
8000741: refactor javadoc to use abstraction to handle relative paths
jjg
parents:
14266
diff
changeset
|
152 |
final String docroot_parent = "{@docroot}/.."; |
9608 | 153 |
// Search for lowercase version of {@docRoot}/.. |
14357
faf9cde2817b
8000741: refactor javadoc to use abstraction to handle relative paths
jjg
parents:
14266
diff
changeset
|
154 |
index = lowerHtml.indexOf(docroot_parent, previndex); |
9608 | 155 |
// If next {@docRoot}/.. pattern not found, append rest of htmlstr and exit loop |
156 |
if (index < 0) { |
|
157 |
buf.append(htmlstr.substring(previndex)); |
|
158 |
break; |
|
159 |
} |
|
160 |
// If next {@docroot}/.. pattern found, append htmlstr up to start of tag |
|
161 |
buf.append(htmlstr.substring(previndex, index)); |
|
14357
faf9cde2817b
8000741: refactor javadoc to use abstraction to handle relative paths
jjg
parents:
14266
diff
changeset
|
162 |
previndex = index + docroot_parent.length(); |
9608 | 163 |
// Insert docrootparent absolute path where {@docRoot}/.. was located |
164 |
||
165 |
buf.append(configuration.docrootparent); |
|
166 |
// Append slash if next character is not a slash |
|
167 |
if (previndex < htmlstr.length() && htmlstr.charAt(previndex) != '/') { |
|
14357
faf9cde2817b
8000741: refactor javadoc to use abstraction to handle relative paths
jjg
parents:
14266
diff
changeset
|
168 |
buf.append('/'); |
9608 | 169 |
} |
170 |
} else { |
|
14357
faf9cde2817b
8000741: refactor javadoc to use abstraction to handle relative paths
jjg
parents:
14266
diff
changeset
|
171 |
final String docroot = "{@docroot}"; |
9608 | 172 |
// Search for lowercase version of {@docRoot} |
14357
faf9cde2817b
8000741: refactor javadoc to use abstraction to handle relative paths
jjg
parents:
14266
diff
changeset
|
173 |
index = lowerHtml.indexOf(docroot, previndex); |
9608 | 174 |
// If next {@docRoot} tag not found, append rest of htmlstr and exit loop |
175 |
if (index < 0) { |
|
176 |
buf.append(htmlstr.substring(previndex)); |
|
177 |
break; |
|
178 |
} |
|
179 |
// If next {@docroot} tag found, append htmlstr up to start of tag |
|
180 |
buf.append(htmlstr.substring(previndex, index)); |
|
14357
faf9cde2817b
8000741: refactor javadoc to use abstraction to handle relative paths
jjg
parents:
14266
diff
changeset
|
181 |
previndex = index + docroot.length(); |
9608 | 182 |
// Insert relative path where {@docRoot} was located |
14357
faf9cde2817b
8000741: refactor javadoc to use abstraction to handle relative paths
jjg
parents:
14266
diff
changeset
|
183 |
buf.append(pathToRoot.isEmpty() ? "." : pathToRoot.getPath()); |
9608 | 184 |
// Append slash if next character is not a slash |
14357
faf9cde2817b
8000741: refactor javadoc to use abstraction to handle relative paths
jjg
parents:
14266
diff
changeset
|
185 |
if (previndex < htmlstr.length() && htmlstr.charAt(previndex) != '/') { |
faf9cde2817b
8000741: refactor javadoc to use abstraction to handle relative paths
jjg
parents:
14266
diff
changeset
|
186 |
buf.append('/'); |
9608 | 187 |
} |
10 | 188 |
} |
189 |
} |
|
190 |
return buf.toString(); |
|
191 |
} |
|
192 |
||
193 |
/** |
|
7614
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
194 |
* Get the script to show or hide the All classes link. |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
195 |
* |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
196 |
* @param id id of the element to show or hide |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
197 |
* @return a content tree for the script |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
198 |
*/ |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
199 |
public Content getAllClassesLinkScript(String id) { |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
200 |
HtmlTree script = new HtmlTree(HtmlTag.SCRIPT); |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
201 |
script.addAttr(HtmlAttr.TYPE, "text/javascript"); |
7641
8b552db25f99
7006270: Several javadoc regression tests are failing on windows
bpatel
parents:
7614
diff
changeset
|
202 |
String scriptCode = "<!--" + DocletConstants.NL + |
8b552db25f99
7006270: Several javadoc regression tests are failing on windows
bpatel
parents:
7614
diff
changeset
|
203 |
" allClassesLink = document.getElementById(\"" + id + "\");" + DocletConstants.NL + |
8b552db25f99
7006270: Several javadoc regression tests are failing on windows
bpatel
parents:
7614
diff
changeset
|
204 |
" if(window==top) {" + DocletConstants.NL + |
8b552db25f99
7006270: Several javadoc regression tests are failing on windows
bpatel
parents:
7614
diff
changeset
|
205 |
" allClassesLink.style.display = \"block\";" + DocletConstants.NL + |
8b552db25f99
7006270: Several javadoc regression tests are failing on windows
bpatel
parents:
7614
diff
changeset
|
206 |
" }" + DocletConstants.NL + |
8b552db25f99
7006270: Several javadoc regression tests are failing on windows
bpatel
parents:
7614
diff
changeset
|
207 |
" else {" + DocletConstants.NL + |
8b552db25f99
7006270: Several javadoc regression tests are failing on windows
bpatel
parents:
7614
diff
changeset
|
208 |
" allClassesLink.style.display = \"none\";" + DocletConstants.NL + |
8b552db25f99
7006270: Several javadoc regression tests are failing on windows
bpatel
parents:
7614
diff
changeset
|
209 |
" }" + DocletConstants.NL + |
8b552db25f99
7006270: Several javadoc regression tests are failing on windows
bpatel
parents:
7614
diff
changeset
|
210 |
" //-->" + DocletConstants.NL; |
7614
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
211 |
Content scriptContent = new RawHtml(scriptCode); |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
212 |
script.addContent(scriptContent); |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
213 |
Content div = HtmlTree.DIV(script); |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
214 |
return div; |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
215 |
} |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
216 |
|
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
217 |
/** |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
218 |
* Add method information. |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
219 |
* |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
220 |
* @param method the method to be documented |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
221 |
* @param dl the content tree to which the method information will be added |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
222 |
*/ |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
223 |
private void addMethodInfo(MethodDoc method, Content dl) { |
10 | 224 |
ClassDoc[] intfacs = method.containingClass().interfaces(); |
225 |
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
|
226 |
// 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
|
227 |
// 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
|
228 |
// 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
|
229 |
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
|
230 |
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
|
231 |
overriddenMethod != null) { |
7614
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
232 |
MethodWriterImpl.addImplementsInfo(this, method, dl); |
10 | 233 |
if (overriddenMethod != null) { |
7614
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
234 |
MethodWriterImpl.addOverridden(this, |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
235 |
method.overriddenType(), overriddenMethod, dl); |
10 | 236 |
} |
237 |
} |
|
238 |
} |
|
239 |
||
7614
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
240 |
/** |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
241 |
* Adds the tags information. |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
242 |
* |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
243 |
* @param doc the doc for which the tags will be generated |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
244 |
* @param htmltree the documentation tree to which the tags will be added |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
245 |
*/ |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
246 |
protected void addTagsInfo(Doc doc, Content htmltree) { |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
247 |
if (configuration.nocomment) { |
10 | 248 |
return; |
249 |
} |
|
7614
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
250 |
Content dl = new HtmlTree(HtmlTag.DL); |
10 | 251 |
if (doc instanceof MethodDoc) { |
7614
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
252 |
addMethodInfo((MethodDoc) doc, dl); |
10 | 253 |
} |
254 |
TagletOutputImpl output = new TagletOutputImpl(""); |
|
255 |
TagletWriter.genTagOuput(configuration.tagletManager, doc, |
|
256 |
configuration.tagletManager.getCustomTags(doc), |
|
257 |
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
|
258 |
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
|
259 |
if (!outputString.isEmpty()) { |
7614
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
260 |
Content resultString = new RawHtml(outputString); |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
261 |
dl.addContent(resultString); |
10 | 262 |
} |
7614
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
263 |
htmltree.addContent(dl); |
10 | 264 |
} |
265 |
||
266 |
/** |
|
2216
b124d5c924eb
6786690: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - DL tag and nesting issue
bpatel
parents:
2086
diff
changeset
|
267 |
* 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
|
268 |
* 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
|
269 |
* |
2216
b124d5c924eb
6786690: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - DL tag and nesting issue
bpatel
parents:
2086
diff
changeset
|
270 |
* @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
|
271 |
* @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
|
272 |
*/ |
2216
b124d5c924eb
6786690: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - DL tag and nesting issue
bpatel
parents:
2086
diff
changeset
|
273 |
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
|
274 |
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
|
275 |
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
|
276 |
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
|
277 |
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
|
278 |
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
|
279 |
} |
cca2603eab0b
6802694: Javadoc doclet does not display deprecated information with -nocomment option for serialized form
bpatel
parents:
1789
diff
changeset
|
280 |
|
cca2603eab0b
6802694: Javadoc doclet does not display deprecated information with -nocomment option for serialized form
bpatel
parents:
1789
diff
changeset
|
281 |
/** |
10 | 282 |
* Returns a TagletWriter that knows how to write HTML. |
283 |
* |
|
284 |
* @return a TagletWriter that knows how to write HTML. |
|
285 |
*/ |
|
286 |
public TagletWriter getTagletWriterInstance(boolean isFirstSentence) { |
|
287 |
return new TagletWriterImpl(this, isFirstSentence); |
|
288 |
} |
|
289 |
||
290 |
/** |
|
7614
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
291 |
* Get Package link, with target frame. |
10 | 292 |
* |
7614
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
293 |
* @param pd The link will be to the "package-summary.html" page for this package |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
294 |
* @param target name of the target frame |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
295 |
* @param label tag for the link |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
296 |
* @return a content for the target package link |
10 | 297 |
*/ |
7614
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
298 |
public Content getTargetPackageLink(PackageDoc pd, String target, |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
299 |
Content label) { |
14358
9eda9239cba0
8000416: refactor javadoc to provide and use an abstraction for relative URIs
jjg
parents:
14357
diff
changeset
|
300 |
return getHyperLink(pathString(pd, DocPaths.PACKAGE_SUMMARY), label, "", target); |
10 | 301 |
} |
302 |
||
303 |
/** |
|
7614
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
304 |
* Generates the HTML document tree and prints it out. |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
305 |
* |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
306 |
* @param metakeywords Array of String keywords for META tag. Each element |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
307 |
* of the array is assigned to a separate META tag. |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
308 |
* Pass in null for no array |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
309 |
* @param includeScript true if printing windowtitle script |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
310 |
* false for files that appear in the left-hand frames |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
311 |
* @param body the body htmltree to be included in the document |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
312 |
*/ |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
313 |
public void printHtmlDocument(String[] metakeywords, boolean includeScript, |
14265
4e8e488eeae0
8000666: javadoc should write directly to Writer instead of composing strings
jjg
parents:
14263
diff
changeset
|
314 |
Content body) throws IOException { |
14542 | 315 |
Content htmlDocType = DocType.TRANSITIONAL; |
7614
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
316 |
Content htmlComment = new Comment(configuration.getText("doclet.New_Page")); |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
317 |
Content head = new HtmlTree(HtmlTag.HEAD); |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
318 |
if (!configuration.notimestamp) { |
14262
058238ba531e
8000418: javadoc should used a standard "generated by javadoc" string
jjg
parents:
14260
diff
changeset
|
319 |
Content headComment = new Comment(getGeneratedByString()); |
7614
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
320 |
head.addContent(headComment); |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
321 |
} |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
322 |
if (configuration.charset.length() > 0) { |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
323 |
Content meta = HtmlTree.META("Content-Type", "text/html", |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
324 |
configuration.charset); |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
325 |
head.addContent(meta); |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
326 |
} |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
327 |
head.addContent(getTitle()); |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
328 |
if (!configuration.notimestamp) { |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
329 |
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd"); |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
330 |
Content meta = HtmlTree.META("date", dateFormat.format(new Date())); |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
331 |
head.addContent(meta); |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
332 |
} |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
333 |
if (metakeywords != null) { |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
334 |
for (int i=0; i < metakeywords.length; i++) { |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
335 |
Content meta = HtmlTree.META("keywords", metakeywords[i]); |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
336 |
head.addContent(meta); |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
337 |
} |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
338 |
} |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
339 |
head.addContent(getStyleSheetProperties()); |
14549
0599d73bf1da
8002304: Group methods by types in methods summary section
bpatel
parents:
14542
diff
changeset
|
340 |
head.addContent(getScriptProperties()); |
7614
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
341 |
Content htmlTree = HtmlTree.HTML(configuration.getLocale().getLanguage(), |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
342 |
head, body); |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
343 |
Content htmlDocument = new HtmlDocument(htmlDocType, |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
344 |
htmlComment, htmlTree); |
14266
69453558960d
8000673: remove dead code from HtmlWriter and subtypes
jjg
parents:
14265
diff
changeset
|
345 |
write(htmlDocument); |
7614
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
346 |
} |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
347 |
|
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
348 |
/** |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
349 |
* Get the window title. |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
350 |
* |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
351 |
* @param title the title string to construct the complete window title |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
352 |
* @return the window title string |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
353 |
*/ |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
354 |
public String getWindowTitle(String title) { |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
355 |
if (configuration.windowtitle.length() > 0) { |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
356 |
title += " (" + configuration.windowtitle + ")"; |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
357 |
} |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
358 |
return title; |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
359 |
} |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
360 |
|
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
361 |
/** |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
362 |
* Get user specified header and the footer. |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
363 |
* |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
364 |
* @param header if true print the user provided header else print the |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
365 |
* user provided footer. |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
366 |
*/ |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
367 |
public Content getUserHeaderFooter(boolean header) { |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
368 |
String content; |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
369 |
if (header) { |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
370 |
content = replaceDocRootDir(configuration.header); |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
371 |
} else { |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
372 |
if (configuration.footer.length() != 0) { |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
373 |
content = replaceDocRootDir(configuration.footer); |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
374 |
} else { |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
375 |
content = replaceDocRootDir(configuration.header); |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
376 |
} |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
377 |
} |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
378 |
Content rawContent = new RawHtml(content); |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
379 |
Content em = HtmlTree.EM(rawContent); |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
380 |
return em; |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
381 |
} |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
382 |
|
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
383 |
/** |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
384 |
* Adds the user specified top. |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
385 |
* |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
386 |
* @param body the content tree to which user specified top will be added |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
387 |
*/ |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
388 |
public void addTop(Content body) { |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
389 |
Content top = new RawHtml(replaceDocRootDir(configuration.top)); |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
390 |
body.addContent(top); |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
391 |
} |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
392 |
|
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
393 |
/** |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
394 |
* Adds the user specified bottom. |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
395 |
* |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
396 |
* @param body the content tree to which user specified bottom will be added |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
397 |
*/ |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
398 |
public void addBottom(Content body) { |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
399 |
Content bottom = new RawHtml(replaceDocRootDir(configuration.bottom)); |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
400 |
Content small = HtmlTree.SMALL(bottom); |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
401 |
Content p = HtmlTree.P(HtmlStyle.legalCopy, small); |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
402 |
body.addContent(p); |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
403 |
} |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
404 |
|
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
405 |
/** |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
406 |
* Adds the navigation bar for the Html page at the top and and the bottom. |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
407 |
* |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
408 |
* @param header If true print navigation bar at the top of the page else |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
409 |
* @param body the HtmlTree to which the nav links will be added |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
410 |
*/ |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
411 |
protected void addNavLinks(boolean header, Content body) { |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
412 |
if (!configuration.nonavbar) { |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
413 |
String allClassesId = "allclasses_"; |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
414 |
HtmlTree navDiv = new HtmlTree(HtmlTag.DIV); |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
415 |
if (header) { |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
416 |
body.addContent(HtmlConstants.START_OF_TOP_NAVBAR); |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
417 |
navDiv.addStyle(HtmlStyle.topNav); |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
418 |
allClassesId += "navbar_top"; |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
419 |
Content a = getMarkerAnchor("navbar_top"); |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
420 |
navDiv.addContent(a); |
14358
9eda9239cba0
8000416: refactor javadoc to provide and use an abstraction for relative URIs
jjg
parents:
14357
diff
changeset
|
421 |
Content skipLinkContent = getHyperLink(DocLink.fragment("skip-navbar_top"), |
9eda9239cba0
8000416: refactor javadoc to provide and use an abstraction for relative URIs
jjg
parents:
14357
diff
changeset
|
422 |
HtmlTree.EMPTY, |
9eda9239cba0
8000416: refactor javadoc to provide and use an abstraction for relative URIs
jjg
parents:
14357
diff
changeset
|
423 |
configuration.getText("doclet.Skip_navigation_links"), |
9eda9239cba0
8000416: refactor javadoc to provide and use an abstraction for relative URIs
jjg
parents:
14357
diff
changeset
|
424 |
""); |
7614
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
425 |
navDiv.addContent(skipLinkContent); |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
426 |
} else { |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
427 |
body.addContent(HtmlConstants.START_OF_BOTTOM_NAVBAR); |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
428 |
navDiv.addStyle(HtmlStyle.bottomNav); |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
429 |
allClassesId += "navbar_bottom"; |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
430 |
Content a = getMarkerAnchor("navbar_bottom"); |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
431 |
navDiv.addContent(a); |
14358
9eda9239cba0
8000416: refactor javadoc to provide and use an abstraction for relative URIs
jjg
parents:
14357
diff
changeset
|
432 |
Content skipLinkContent = getHyperLink(DocLink.fragment("skip-navbar_bottom"), |
9eda9239cba0
8000416: refactor javadoc to provide and use an abstraction for relative URIs
jjg
parents:
14357
diff
changeset
|
433 |
HtmlTree.EMPTY, |
9eda9239cba0
8000416: refactor javadoc to provide and use an abstraction for relative URIs
jjg
parents:
14357
diff
changeset
|
434 |
configuration.getText("doclet.Skip_navigation_links"), |
9eda9239cba0
8000416: refactor javadoc to provide and use an abstraction for relative URIs
jjg
parents:
14357
diff
changeset
|
435 |
""); |
7614
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
436 |
navDiv.addContent(skipLinkContent); |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
437 |
} |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
438 |
if (header) { |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
439 |
navDiv.addContent(getMarkerAnchor("navbar_top_firstrow")); |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
440 |
} else { |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
441 |
navDiv.addContent(getMarkerAnchor("navbar_bottom_firstrow")); |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
442 |
} |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
443 |
HtmlTree navList = new HtmlTree(HtmlTag.UL); |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
444 |
navList.addStyle(HtmlStyle.navList); |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
445 |
navList.addAttr(HtmlAttr.TITLE, "Navigation"); |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
446 |
if (configuration.createoverview) { |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
447 |
navList.addContent(getNavLinkContents()); |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
448 |
} |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
449 |
if (configuration.packages.length == 1) { |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
450 |
navList.addContent(getNavLinkPackage(configuration.packages[0])); |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
451 |
} else if (configuration.packages.length > 1) { |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
452 |
navList.addContent(getNavLinkPackage()); |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
453 |
} |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
454 |
navList.addContent(getNavLinkClass()); |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
455 |
if(configuration.classuse) { |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
456 |
navList.addContent(getNavLinkClassUse()); |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
457 |
} |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
458 |
if(configuration.createtree) { |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
459 |
navList.addContent(getNavLinkTree()); |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
460 |
} |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
461 |
if(!(configuration.nodeprecated || |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
462 |
configuration.nodeprecatedlist)) { |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
463 |
navList.addContent(getNavLinkDeprecated()); |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
464 |
} |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
465 |
if(configuration.createindex) { |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
466 |
navList.addContent(getNavLinkIndex()); |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
467 |
} |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
468 |
if (!configuration.nohelp) { |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
469 |
navList.addContent(getNavLinkHelp()); |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
470 |
} |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
471 |
navDiv.addContent(navList); |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
472 |
Content aboutDiv = HtmlTree.DIV(HtmlStyle.aboutLanguage, getUserHeaderFooter(header)); |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
473 |
navDiv.addContent(aboutDiv); |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
474 |
body.addContent(navDiv); |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
475 |
Content ulNav = HtmlTree.UL(HtmlStyle.navList, getNavLinkPrevious()); |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
476 |
ulNav.addContent(getNavLinkNext()); |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
477 |
Content subDiv = HtmlTree.DIV(HtmlStyle.subNav, ulNav); |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
478 |
Content ulFrames = HtmlTree.UL(HtmlStyle.navList, getNavShowLists()); |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
479 |
ulFrames.addContent(getNavHideLists(filename)); |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
480 |
subDiv.addContent(ulFrames); |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
481 |
HtmlTree ulAllClasses = HtmlTree.UL(HtmlStyle.navList, getNavLinkClassIndex()); |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
482 |
ulAllClasses.addAttr(HtmlAttr.ID, allClassesId.toString()); |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
483 |
subDiv.addContent(ulAllClasses); |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
484 |
subDiv.addContent(getAllClassesLinkScript(allClassesId.toString())); |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
485 |
addSummaryDetailLinks(subDiv); |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
486 |
if (header) { |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
487 |
subDiv.addContent(getMarkerAnchor("skip-navbar_top")); |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
488 |
body.addContent(subDiv); |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
489 |
body.addContent(HtmlConstants.END_OF_TOP_NAVBAR); |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
490 |
} else { |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
491 |
subDiv.addContent(getMarkerAnchor("skip-navbar_bottom")); |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
492 |
body.addContent(subDiv); |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
493 |
body.addContent(HtmlConstants.END_OF_BOTTOM_NAVBAR); |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
494 |
} |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
495 |
} |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
496 |
} |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
497 |
|
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
498 |
/** |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
499 |
* Get the word "NEXT" to indicate that no link is available. Override |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
500 |
* this method to customize next link. |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
501 |
* |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
502 |
* @return a content tree for the link |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
503 |
*/ |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
504 |
protected Content getNavLinkNext() { |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
505 |
return getNavLinkNext(null); |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
506 |
} |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
507 |
|
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
508 |
/** |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
509 |
* Get the word "PREV" to indicate that no link is available. Override |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
510 |
* this method to customize prev link. |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
511 |
* |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
512 |
* @return a content tree for the link |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
513 |
*/ |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
514 |
protected Content getNavLinkPrevious() { |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
515 |
return getNavLinkPrevious(null); |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
516 |
} |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
517 |
|
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
518 |
/** |
10 | 519 |
* Do nothing. This is the default method. |
520 |
*/ |
|
7614
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
521 |
protected void addSummaryDetailLinks(Content navDiv) { |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
522 |
} |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
523 |
|
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
524 |
/** |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
525 |
* Get link to the "overview-summary.html" page. |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
526 |
* |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
527 |
* @return a content tree for the link |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
528 |
*/ |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
529 |
protected Content getNavLinkContents() { |
14357
faf9cde2817b
8000741: refactor javadoc to use abstraction to handle relative paths
jjg
parents:
14266
diff
changeset
|
530 |
Content linkContent = getHyperLink(pathToRoot.resolve(DocPaths.OVERVIEW_SUMMARY), |
14358
9eda9239cba0
8000416: refactor javadoc to provide and use an abstraction for relative URIs
jjg
parents:
14357
diff
changeset
|
531 |
overviewLabel, "", ""); |
7614
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
532 |
Content li = HtmlTree.LI(linkContent); |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
533 |
return li; |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
534 |
} |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
535 |
|
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
536 |
/** |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
537 |
* Get link to the "package-summary.html" page for the package passed. |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
538 |
* |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
539 |
* @param pkg Package to which link will be generated |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
540 |
* @return a content tree for the link |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
541 |
*/ |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
542 |
protected Content getNavLinkPackage(PackageDoc pkg) { |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
543 |
Content linkContent = getPackageLink(pkg, |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
544 |
packageLabel); |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
545 |
Content li = HtmlTree.LI(linkContent); |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
546 |
return li; |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
547 |
} |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
548 |
|
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
549 |
/** |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
550 |
* Get the word "Package" , to indicate that link is not available here. |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
551 |
* |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
552 |
* @return a content tree for the link |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
553 |
*/ |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
554 |
protected Content getNavLinkPackage() { |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
555 |
Content li = HtmlTree.LI(packageLabel); |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
556 |
return li; |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
557 |
} |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
558 |
|
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
559 |
/** |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
560 |
* Get the word "Use", to indicate that link is not available. |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
561 |
* |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
562 |
* @return a content tree for the link |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
563 |
*/ |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
564 |
protected Content getNavLinkClassUse() { |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
565 |
Content li = HtmlTree.LI(useLabel); |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
566 |
return li; |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
567 |
} |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
568 |
|
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
569 |
/** |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
570 |
* Get link for previous file. |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
571 |
* |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
572 |
* @param prev File name for the prev link |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
573 |
* @return a content tree for the link |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
574 |
*/ |
14357
faf9cde2817b
8000741: refactor javadoc to use abstraction to handle relative paths
jjg
parents:
14266
diff
changeset
|
575 |
public Content getNavLinkPrevious(DocPath prev) { |
7614
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
576 |
Content li; |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
577 |
if (prev != null) { |
14358
9eda9239cba0
8000416: refactor javadoc to provide and use an abstraction for relative URIs
jjg
parents:
14357
diff
changeset
|
578 |
li = HtmlTree.LI(getHyperLink(prev, prevLabel, "", "")); |
7614
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
579 |
} |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
580 |
else |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
581 |
li = HtmlTree.LI(prevLabel); |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
582 |
return li; |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
583 |
} |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
584 |
|
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
585 |
/** |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
586 |
* Get link for next file. If next is null, just print the label |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
587 |
* without linking it anywhere. |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
588 |
* |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
589 |
* @param next File name for the next link |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
590 |
* @return a content tree for the link |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
591 |
*/ |
14357
faf9cde2817b
8000741: refactor javadoc to use abstraction to handle relative paths
jjg
parents:
14266
diff
changeset
|
592 |
public Content getNavLinkNext(DocPath next) { |
7614
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
593 |
Content li; |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
594 |
if (next != null) { |
14358
9eda9239cba0
8000416: refactor javadoc to provide and use an abstraction for relative URIs
jjg
parents:
14357
diff
changeset
|
595 |
li = HtmlTree.LI(getHyperLink(next, nextLabel, "", "")); |
7614
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
596 |
} |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
597 |
else |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
598 |
li = HtmlTree.LI(nextLabel); |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
599 |
return li; |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
600 |
} |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
601 |
|
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
602 |
/** |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
603 |
* Get "FRAMES" link, to switch to the frame version of the output. |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
604 |
* |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
605 |
* @param link File to be linked, "index.html" |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
606 |
* @return a content tree for the link |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
607 |
*/ |
14357
faf9cde2817b
8000741: refactor javadoc to use abstraction to handle relative paths
jjg
parents:
14266
diff
changeset
|
608 |
protected Content getNavShowLists(DocPath link) { |
14358
9eda9239cba0
8000416: refactor javadoc to provide and use an abstraction for relative URIs
jjg
parents:
14357
diff
changeset
|
609 |
DocLink dl = new DocLink(link, path.getPath(), null); |
9eda9239cba0
8000416: refactor javadoc to provide and use an abstraction for relative URIs
jjg
parents:
14357
diff
changeset
|
610 |
Content framesContent = getHyperLink(dl, framesLabel, "", "_top"); |
7614
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
611 |
Content li = HtmlTree.LI(framesContent); |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
612 |
return li; |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
613 |
} |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
614 |
|
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
615 |
/** |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
616 |
* Get "FRAMES" link, to switch to the frame version of the output. |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
617 |
* |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
618 |
* @return a content tree for the link |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
619 |
*/ |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
620 |
protected Content getNavShowLists() { |
14357
faf9cde2817b
8000741: refactor javadoc to use abstraction to handle relative paths
jjg
parents:
14266
diff
changeset
|
621 |
return getNavShowLists(pathToRoot.resolve(DocPaths.INDEX)); |
7614
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
622 |
} |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
623 |
|
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
624 |
/** |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
625 |
* Get "NO FRAMES" link, to switch to the non-frame version of the output. |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
626 |
* |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
627 |
* @param link File to be linked |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
628 |
* @return a content tree for the link |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
629 |
*/ |
14357
faf9cde2817b
8000741: refactor javadoc to use abstraction to handle relative paths
jjg
parents:
14266
diff
changeset
|
630 |
protected Content getNavHideLists(DocPath link) { |
14358
9eda9239cba0
8000416: refactor javadoc to provide and use an abstraction for relative URIs
jjg
parents:
14357
diff
changeset
|
631 |
Content noFramesContent = getHyperLink(link, noframesLabel, "", "_top"); |
7614
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
632 |
Content li = HtmlTree.LI(noFramesContent); |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
633 |
return li; |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
634 |
} |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
635 |
|
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
636 |
/** |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
637 |
* Get "Tree" link in the navigation bar. If there is only one package |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
638 |
* specified on the command line, then the "Tree" link will be to the |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
639 |
* only "package-tree.html" file otherwise it will be to the |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
640 |
* "overview-tree.html" file. |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
641 |
* |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
642 |
* @return a content tree for the link |
10 | 643 |
*/ |
7614
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
644 |
protected Content getNavLinkTree() { |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
645 |
Content treeLinkContent; |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
646 |
PackageDoc[] packages = configuration.root.specifiedPackages(); |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
647 |
if (packages.length == 1 && configuration.root.specifiedClasses().length == 0) { |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
648 |
treeLinkContent = getHyperLink(pathString(packages[0], |
14358
9eda9239cba0
8000416: refactor javadoc to provide and use an abstraction for relative URIs
jjg
parents:
14357
diff
changeset
|
649 |
DocPaths.PACKAGE_TREE), treeLabel, |
7614
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
650 |
"", ""); |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
651 |
} else { |
14357
faf9cde2817b
8000741: refactor javadoc to use abstraction to handle relative paths
jjg
parents:
14266
diff
changeset
|
652 |
treeLinkContent = getHyperLink(pathToRoot.resolve(DocPaths.OVERVIEW_TREE), |
14358
9eda9239cba0
8000416: refactor javadoc to provide and use an abstraction for relative URIs
jjg
parents:
14357
diff
changeset
|
653 |
treeLabel, "", ""); |
7614
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
654 |
} |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
655 |
Content li = HtmlTree.LI(treeLinkContent); |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
656 |
return li; |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
657 |
} |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
658 |
|
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
659 |
/** |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
660 |
* Get the overview tree link for the main tree. |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
661 |
* |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
662 |
* @param label the label for the link |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
663 |
* @return a content tree for the link |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
664 |
*/ |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
665 |
protected Content getNavLinkMainTree(String label) { |
14357
faf9cde2817b
8000741: refactor javadoc to use abstraction to handle relative paths
jjg
parents:
14266
diff
changeset
|
666 |
Content mainTreeContent = getHyperLink(pathToRoot.resolve(DocPaths.OVERVIEW_TREE), |
7614
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
667 |
new StringContent(label)); |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
668 |
Content li = HtmlTree.LI(mainTreeContent); |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
669 |
return li; |
10 | 670 |
} |
671 |
||
672 |
/** |
|
7614
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
673 |
* Get the word "Class", to indicate that class link is not available. |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
674 |
* |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
675 |
* @return a content tree for the link |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
676 |
*/ |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
677 |
protected Content getNavLinkClass() { |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
678 |
Content li = HtmlTree.LI(classLabel); |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
679 |
return li; |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
680 |
} |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
681 |
|
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
682 |
/** |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
683 |
* Get "Deprecated" API link in the navigation bar. |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
684 |
* |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
685 |
* @return a content tree for the link |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
686 |
*/ |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
687 |
protected Content getNavLinkDeprecated() { |
14357
faf9cde2817b
8000741: refactor javadoc to use abstraction to handle relative paths
jjg
parents:
14266
diff
changeset
|
688 |
Content linkContent = getHyperLink(pathToRoot.resolve(DocPaths.DEPRECATED_LIST), |
14358
9eda9239cba0
8000416: refactor javadoc to provide and use an abstraction for relative URIs
jjg
parents:
14357
diff
changeset
|
689 |
deprecatedLabel, "", ""); |
7614
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
690 |
Content li = HtmlTree.LI(linkContent); |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
691 |
return li; |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
692 |
} |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
693 |
|
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
694 |
/** |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
695 |
* Get link for generated index. If the user has used "-splitindex" |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
696 |
* command line option, then link to file "index-files/index-1.html" is |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
697 |
* generated otherwise link to file "index-all.html" is generated. |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
698 |
* |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
699 |
* @return a content tree for the link |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
700 |
*/ |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
701 |
protected Content getNavLinkClassIndex() { |
14357
faf9cde2817b
8000741: refactor javadoc to use abstraction to handle relative paths
jjg
parents:
14266
diff
changeset
|
702 |
Content allClassesContent = getHyperLink(pathToRoot.resolve( |
14358
9eda9239cba0
8000416: refactor javadoc to provide and use an abstraction for relative URIs
jjg
parents:
14357
diff
changeset
|
703 |
DocPaths.ALLCLASSES_NOFRAME), |
7614
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
704 |
allclassesLabel, "", ""); |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
705 |
Content li = HtmlTree.LI(allClassesContent); |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
706 |
return li; |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
707 |
} |
10 | 708 |
|
709 |
/** |
|
7614
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
710 |
* Get link for generated class index. |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
711 |
* |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
712 |
* @return a content tree for the link |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
713 |
*/ |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
714 |
protected Content getNavLinkIndex() { |
14357
faf9cde2817b
8000741: refactor javadoc to use abstraction to handle relative paths
jjg
parents:
14266
diff
changeset
|
715 |
Content linkContent = getHyperLink(pathToRoot.resolve( |
faf9cde2817b
8000741: refactor javadoc to use abstraction to handle relative paths
jjg
parents:
14266
diff
changeset
|
716 |
(configuration.splitindex |
faf9cde2817b
8000741: refactor javadoc to use abstraction to handle relative paths
jjg
parents:
14266
diff
changeset
|
717 |
? DocPaths.INDEX_FILES.resolve(DocPaths.indexN(1)) |
14358
9eda9239cba0
8000416: refactor javadoc to provide and use an abstraction for relative URIs
jjg
parents:
14357
diff
changeset
|
718 |
: DocPaths.INDEX_ALL)), |
7614
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
719 |
indexLabel, "", ""); |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
720 |
Content li = HtmlTree.LI(linkContent); |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
721 |
return li; |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
722 |
} |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
723 |
|
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
724 |
/** |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
725 |
* Get help file link. If user has provided a help file, then generate a |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
726 |
* link to the user given file, which is already copied to current or |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
727 |
* destination directory. |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
728 |
* |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
729 |
* @return a content tree for the link |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
730 |
*/ |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
731 |
protected Content getNavLinkHelp() { |
14357
faf9cde2817b
8000741: refactor javadoc to use abstraction to handle relative paths
jjg
parents:
14266
diff
changeset
|
732 |
String helpfile = configuration.helpfile; |
faf9cde2817b
8000741: refactor javadoc to use abstraction to handle relative paths
jjg
parents:
14266
diff
changeset
|
733 |
DocPath helpfilenm; |
faf9cde2817b
8000741: refactor javadoc to use abstraction to handle relative paths
jjg
parents:
14266
diff
changeset
|
734 |
if (helpfile.isEmpty()) { |
faf9cde2817b
8000741: refactor javadoc to use abstraction to handle relative paths
jjg
parents:
14266
diff
changeset
|
735 |
helpfilenm = DocPaths.HELP_DOC; |
7614
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
736 |
} else { |
14368
6f4c62de6985
8001664: refactor javadoc to use abstraction to handle files
jjg
parents:
14366
diff
changeset
|
737 |
DocFile file = DocFile.createFileForInput(configuration, helpfile); |
6f4c62de6985
8001664: refactor javadoc to use abstraction to handle files
jjg
parents:
14366
diff
changeset
|
738 |
helpfilenm = DocPath.create(file.getName()); |
7614
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
739 |
} |
14358
9eda9239cba0
8000416: refactor javadoc to provide and use an abstraction for relative URIs
jjg
parents:
14357
diff
changeset
|
740 |
Content linkContent = getHyperLink(pathToRoot.resolve(helpfilenm), |
7614
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
741 |
helpLabel, "", ""); |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
742 |
Content li = HtmlTree.LI(linkContent); |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
743 |
return li; |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
744 |
} |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
745 |
|
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
746 |
/** |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
747 |
* Get summary table header. |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
748 |
* |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
749 |
* @param header the header for the table |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
750 |
* @param scope the scope of the headers |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
751 |
* @return a content tree for the header |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
752 |
*/ |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
753 |
public Content getSummaryTableHeader(String[] header, String scope) { |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
754 |
Content tr = new HtmlTree(HtmlTag.TR); |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
755 |
int size = header.length; |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
756 |
Content tableHeader; |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
757 |
if (size == 1) { |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
758 |
tableHeader = new StringContent(header[0]); |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
759 |
tr.addContent(HtmlTree.TH(HtmlStyle.colOne, scope, tableHeader)); |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
760 |
return tr; |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
761 |
} |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
762 |
for (int i = 0; i < size; i++) { |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
763 |
tableHeader = new StringContent(header[i]); |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
764 |
if(i == 0) |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
765 |
tr.addContent(HtmlTree.TH(HtmlStyle.colFirst, scope, tableHeader)); |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
766 |
else if(i == (size - 1)) |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
767 |
tr.addContent(HtmlTree.TH(HtmlStyle.colLast, scope, tableHeader)); |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
768 |
else |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
769 |
tr.addContent(HtmlTree.TH(scope, tableHeader)); |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
770 |
} |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
771 |
return tr; |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
772 |
} |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
773 |
|
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
774 |
/** |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
775 |
* Get table caption. |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
776 |
* |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
777 |
* @param rawText the caption for the table which could be raw Html |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
778 |
* @return a content tree for the caption |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
779 |
*/ |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
780 |
public Content getTableCaption(String rawText) { |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
781 |
Content title = new RawHtml(rawText); |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
782 |
Content captionSpan = HtmlTree.SPAN(title); |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
783 |
Content space = getSpace(); |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
784 |
Content tabSpan = HtmlTree.SPAN(HtmlStyle.tabEnd, space); |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
785 |
Content caption = HtmlTree.CAPTION(captionSpan); |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
786 |
caption.addContent(tabSpan); |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
787 |
return caption; |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
788 |
} |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
789 |
|
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
790 |
/** |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
791 |
* Get the marker anchor which will be added to the documentation tree. |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
792 |
* |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
793 |
* @param anchorName the anchor name attribute |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
794 |
* @return a content tree for the marker anchor |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
795 |
*/ |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
796 |
public Content getMarkerAnchor(String anchorName) { |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
797 |
return getMarkerAnchor(anchorName, null); |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
798 |
} |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
799 |
|
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
800 |
/** |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
801 |
* Get the marker anchor which will be added to the documentation tree. |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
802 |
* |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
803 |
* @param anchorName the anchor name attribute |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
804 |
* @param anchorContent the content that should be added to the anchor |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
805 |
* @return a content tree for the marker anchor |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
806 |
*/ |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
807 |
public Content getMarkerAnchor(String anchorName, Content anchorContent) { |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
808 |
if (anchorContent == null) |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
809 |
anchorContent = new Comment(" "); |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
810 |
Content markerAnchor = HtmlTree.A_NAME(anchorName, anchorContent); |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
811 |
return markerAnchor; |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
812 |
} |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
813 |
|
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
814 |
/** |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
815 |
* Returns a packagename content. |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
816 |
* |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
817 |
* @param packageDoc the package to check |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
818 |
* @return package name content |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
819 |
*/ |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
820 |
public Content getPackageName(PackageDoc packageDoc) { |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
821 |
return packageDoc == null || packageDoc.name().length() == 0 ? |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
822 |
defaultPackageLabel : |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
823 |
getPackageLabel(packageDoc.name()); |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
824 |
} |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
825 |
|
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
826 |
/** |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
827 |
* Returns a package name label. |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
828 |
* |
14259 | 829 |
* @param packageName the package name |
7614
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
830 |
* @return the package name content |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
831 |
*/ |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
832 |
public Content getPackageLabel(String packageName) { |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
833 |
return new StringContent(packageName); |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
834 |
} |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
835 |
|
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
836 |
/** |
9606
e5a619cb5dd3
6492694: @deprecated tag doesn't work in package-info files.
bpatel
parents:
9592
diff
changeset
|
837 |
* Add package deprecation information to the documentation tree |
e5a619cb5dd3
6492694: @deprecated tag doesn't work in package-info files.
bpatel
parents:
9592
diff
changeset
|
838 |
* |
e5a619cb5dd3
6492694: @deprecated tag doesn't work in package-info files.
bpatel
parents:
9592
diff
changeset
|
839 |
* @param deprPkgs list of deprecated packages |
e5a619cb5dd3
6492694: @deprecated tag doesn't work in package-info files.
bpatel
parents:
9592
diff
changeset
|
840 |
* @param headingKey the caption for the deprecated package table |
e5a619cb5dd3
6492694: @deprecated tag doesn't work in package-info files.
bpatel
parents:
9592
diff
changeset
|
841 |
* @param tableSummary the summary for the deprecated package table |
e5a619cb5dd3
6492694: @deprecated tag doesn't work in package-info files.
bpatel
parents:
9592
diff
changeset
|
842 |
* @param tableHeader table headers for the deprecated package table |
e5a619cb5dd3
6492694: @deprecated tag doesn't work in package-info files.
bpatel
parents:
9592
diff
changeset
|
843 |
* @param contentTree the content tree to which the deprecated package table will be added |
e5a619cb5dd3
6492694: @deprecated tag doesn't work in package-info files.
bpatel
parents:
9592
diff
changeset
|
844 |
*/ |
e5a619cb5dd3
6492694: @deprecated tag doesn't work in package-info files.
bpatel
parents:
9592
diff
changeset
|
845 |
protected void addPackageDeprecatedAPI(List<Doc> deprPkgs, String headingKey, |
e5a619cb5dd3
6492694: @deprecated tag doesn't work in package-info files.
bpatel
parents:
9592
diff
changeset
|
846 |
String tableSummary, String[] tableHeader, Content contentTree) { |
e5a619cb5dd3
6492694: @deprecated tag doesn't work in package-info files.
bpatel
parents:
9592
diff
changeset
|
847 |
if (deprPkgs.size() > 0) { |
e5a619cb5dd3
6492694: @deprecated tag doesn't work in package-info files.
bpatel
parents:
9592
diff
changeset
|
848 |
Content table = HtmlTree.TABLE(0, 3, 0, tableSummary, |
14542 | 849 |
getTableCaption(configuration.getText(headingKey))); |
9606
e5a619cb5dd3
6492694: @deprecated tag doesn't work in package-info files.
bpatel
parents:
9592
diff
changeset
|
850 |
table.addContent(getSummaryTableHeader(tableHeader, "col")); |
e5a619cb5dd3
6492694: @deprecated tag doesn't work in package-info files.
bpatel
parents:
9592
diff
changeset
|
851 |
Content tbody = new HtmlTree(HtmlTag.TBODY); |
e5a619cb5dd3
6492694: @deprecated tag doesn't work in package-info files.
bpatel
parents:
9592
diff
changeset
|
852 |
for (int i = 0; i < deprPkgs.size(); i++) { |
e5a619cb5dd3
6492694: @deprecated tag doesn't work in package-info files.
bpatel
parents:
9592
diff
changeset
|
853 |
PackageDoc pkg = (PackageDoc) deprPkgs.get(i); |
e5a619cb5dd3
6492694: @deprecated tag doesn't work in package-info files.
bpatel
parents:
9592
diff
changeset
|
854 |
HtmlTree td = HtmlTree.TD(HtmlStyle.colOne, |
e5a619cb5dd3
6492694: @deprecated tag doesn't work in package-info files.
bpatel
parents:
9592
diff
changeset
|
855 |
getPackageLink(pkg, getPackageName(pkg))); |
e5a619cb5dd3
6492694: @deprecated tag doesn't work in package-info files.
bpatel
parents:
9592
diff
changeset
|
856 |
if (pkg.tags("deprecated").length > 0) { |
e5a619cb5dd3
6492694: @deprecated tag doesn't work in package-info files.
bpatel
parents:
9592
diff
changeset
|
857 |
addInlineDeprecatedComment(pkg, pkg.tags("deprecated")[0], td); |
e5a619cb5dd3
6492694: @deprecated tag doesn't work in package-info files.
bpatel
parents:
9592
diff
changeset
|
858 |
} |
e5a619cb5dd3
6492694: @deprecated tag doesn't work in package-info files.
bpatel
parents:
9592
diff
changeset
|
859 |
HtmlTree tr = HtmlTree.TR(td); |
e5a619cb5dd3
6492694: @deprecated tag doesn't work in package-info files.
bpatel
parents:
9592
diff
changeset
|
860 |
if (i % 2 == 0) { |
e5a619cb5dd3
6492694: @deprecated tag doesn't work in package-info files.
bpatel
parents:
9592
diff
changeset
|
861 |
tr.addStyle(HtmlStyle.altColor); |
e5a619cb5dd3
6492694: @deprecated tag doesn't work in package-info files.
bpatel
parents:
9592
diff
changeset
|
862 |
} else { |
e5a619cb5dd3
6492694: @deprecated tag doesn't work in package-info files.
bpatel
parents:
9592
diff
changeset
|
863 |
tr.addStyle(HtmlStyle.rowColor); |
e5a619cb5dd3
6492694: @deprecated tag doesn't work in package-info files.
bpatel
parents:
9592
diff
changeset
|
864 |
} |
e5a619cb5dd3
6492694: @deprecated tag doesn't work in package-info files.
bpatel
parents:
9592
diff
changeset
|
865 |
tbody.addContent(tr); |
e5a619cb5dd3
6492694: @deprecated tag doesn't work in package-info files.
bpatel
parents:
9592
diff
changeset
|
866 |
} |
e5a619cb5dd3
6492694: @deprecated tag doesn't work in package-info files.
bpatel
parents:
9592
diff
changeset
|
867 |
table.addContent(tbody); |
e5a619cb5dd3
6492694: @deprecated tag doesn't work in package-info files.
bpatel
parents:
9592
diff
changeset
|
868 |
Content li = HtmlTree.LI(HtmlStyle.blockList, table); |
e5a619cb5dd3
6492694: @deprecated tag doesn't work in package-info files.
bpatel
parents:
9592
diff
changeset
|
869 |
Content ul = HtmlTree.UL(HtmlStyle.blockList, li); |
e5a619cb5dd3
6492694: @deprecated tag doesn't work in package-info files.
bpatel
parents:
9592
diff
changeset
|
870 |
contentTree.addContent(ul); |
e5a619cb5dd3
6492694: @deprecated tag doesn't work in package-info files.
bpatel
parents:
9592
diff
changeset
|
871 |
} |
e5a619cb5dd3
6492694: @deprecated tag doesn't work in package-info files.
bpatel
parents:
9592
diff
changeset
|
872 |
} |
e5a619cb5dd3
6492694: @deprecated tag doesn't work in package-info files.
bpatel
parents:
9592
diff
changeset
|
873 |
|
e5a619cb5dd3
6492694: @deprecated tag doesn't work in package-info files.
bpatel
parents:
9592
diff
changeset
|
874 |
/** |
14366
af625e568667
8001929: fix doclint errors in langtools doc comments
jjg
parents:
14358
diff
changeset
|
875 |
* Return the path to the class page for a classdoc. |
10 | 876 |
* |
877 |
* @param cd Class to which the path is requested. |
|
878 |
* @param name Name of the file(doesn't include path). |
|
879 |
*/ |
|
14357
faf9cde2817b
8000741: refactor javadoc to use abstraction to handle relative paths
jjg
parents:
14266
diff
changeset
|
880 |
protected DocPath pathString(ClassDoc cd, DocPath name) { |
10 | 881 |
return pathString(cd.containingPackage(), name); |
882 |
} |
|
883 |
||
884 |
/** |
|
885 |
* Return path to the given file name in the given package. So if the name |
|
886 |
* passed is "Object.html" and the name of the package is "java.lang", and |
|
887 |
* if the relative path is "../.." then returned string will be |
|
888 |
* "../../java/lang/Object.html" |
|
889 |
* |
|
890 |
* @param pd Package in which the file name is assumed to be. |
|
891 |
* @param name File name, to which path string is. |
|
892 |
*/ |
|
14357
faf9cde2817b
8000741: refactor javadoc to use abstraction to handle relative paths
jjg
parents:
14266
diff
changeset
|
893 |
protected DocPath pathString(PackageDoc pd, DocPath name) { |
faf9cde2817b
8000741: refactor javadoc to use abstraction to handle relative paths
jjg
parents:
14266
diff
changeset
|
894 |
return pathToRoot.resolve(DocPath.forPackage(pd).resolve(name)); |
10 | 895 |
} |
896 |
||
897 |
/** |
|
898 |
* Return the link to the given package. |
|
899 |
* |
|
900 |
* @param pkg the package to link to. |
|
901 |
* @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
|
902 |
* @param isStrong true if the label should be strong. |
10 | 903 |
* @return the link to the given package. |
904 |
*/ |
|
7614
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
905 |
public String getPackageLinkString(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
|
906 |
boolean isStrong) { |
7614
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
907 |
return getPackageLinkString(pkg, label, isStrong, ""); |
10 | 908 |
} |
909 |
||
910 |
/** |
|
911 |
* Return the link to the given package. |
|
912 |
* |
|
913 |
* @param pkg the package to link to. |
|
914 |
* @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
|
915 |
* @param isStrong true if the label should be strong. |
10 | 916 |
* @param style the font of the package link label. |
917 |
* @return the link to the given package. |
|
918 |
*/ |
|
7614
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
919 |
public String getPackageLinkString(PackageDoc pkg, String label, boolean isStrong, |
10 | 920 |
String style) { |
921 |
boolean included = pkg != null && pkg.isIncluded(); |
|
922 |
if (! included) { |
|
923 |
PackageDoc[] packages = configuration.packages; |
|
924 |
for (int i = 0; i < packages.length; i++) { |
|
925 |
if (packages[i].equals(pkg)) { |
|
926 |
included = true; |
|
927 |
break; |
|
928 |
} |
|
929 |
} |
|
930 |
} |
|
931 |
if (included || pkg == null) { |
|
14357
faf9cde2817b
8000741: refactor javadoc to use abstraction to handle relative paths
jjg
parents:
14266
diff
changeset
|
932 |
return getHyperLinkString(pathString(pkg, DocPaths.PACKAGE_SUMMARY), |
14358
9eda9239cba0
8000416: refactor javadoc to provide and use an abstraction for relative URIs
jjg
parents:
14357
diff
changeset
|
933 |
label, isStrong, style); |
10 | 934 |
} else { |
14358
9eda9239cba0
8000416: refactor javadoc to provide and use an abstraction for relative URIs
jjg
parents:
14357
diff
changeset
|
935 |
DocLink crossPkgLink = getCrossPackageLink(Util.getPackageName(pkg)); |
10 | 936 |
if (crossPkgLink != null) { |
14358
9eda9239cba0
8000416: refactor javadoc to provide and use an abstraction for relative URIs
jjg
parents:
14357
diff
changeset
|
937 |
return getHyperLinkString(crossPkgLink, label, isStrong, style); |
7614
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
938 |
} else { |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
939 |
return label; |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
940 |
} |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
941 |
} |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
942 |
} |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
943 |
|
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
944 |
/** |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
945 |
* Return the link to the given package. |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
946 |
* |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
947 |
* @param pkg the package to link to. |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
948 |
* @param label the label for the link. |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
949 |
* @return a content tree for the package link. |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
950 |
*/ |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
951 |
public Content getPackageLink(PackageDoc pkg, Content label) { |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
952 |
boolean included = pkg != null && pkg.isIncluded(); |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
953 |
if (! included) { |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
954 |
PackageDoc[] packages = configuration.packages; |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
955 |
for (int i = 0; i < packages.length; i++) { |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
956 |
if (packages[i].equals(pkg)) { |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
957 |
included = true; |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
958 |
break; |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
959 |
} |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
960 |
} |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
961 |
} |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
962 |
if (included || pkg == null) { |
14357
faf9cde2817b
8000741: refactor javadoc to use abstraction to handle relative paths
jjg
parents:
14266
diff
changeset
|
963 |
return getHyperLink(pathString(pkg, DocPaths.PACKAGE_SUMMARY), |
14358
9eda9239cba0
8000416: refactor javadoc to provide and use an abstraction for relative URIs
jjg
parents:
14357
diff
changeset
|
964 |
label); |
7614
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
965 |
} else { |
14358
9eda9239cba0
8000416: refactor javadoc to provide and use an abstraction for relative URIs
jjg
parents:
14357
diff
changeset
|
966 |
DocLink crossPkgLink = getCrossPackageLink(Util.getPackageName(pkg)); |
7614
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
967 |
if (crossPkgLink != null) { |
14358
9eda9239cba0
8000416: refactor javadoc to provide and use an abstraction for relative URIs
jjg
parents:
14357
diff
changeset
|
968 |
return getHyperLink(crossPkgLink, label); |
10 | 969 |
} else { |
970 |
return label; |
|
971 |
} |
|
972 |
} |
|
973 |
} |
|
974 |
||
975 |
public String italicsClassName(ClassDoc cd, boolean qual) { |
|
976 |
String name = (qual)? cd.qualifiedName(): cd.name(); |
|
977 |
return (cd.isInterface())? italicsText(name): name; |
|
978 |
} |
|
979 |
||
980 |
/** |
|
7614
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
981 |
* Add the link to the content tree. |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
982 |
* |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
983 |
* @param doc program element doc for which the link will be added |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
984 |
* @param label label for the link |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
985 |
* @param htmltree the content tree to which the link will be added |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
986 |
*/ |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
987 |
public void addSrcLink(ProgramElementDoc doc, Content label, Content htmltree) { |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
988 |
if (doc == null) { |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
989 |
return; |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
990 |
} |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
991 |
ClassDoc cd = doc.containingClass(); |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
992 |
if (cd == null) { |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
993 |
//d must be a class doc since in has no containing class. |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
994 |
cd = (ClassDoc) doc; |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
995 |
} |
14357
faf9cde2817b
8000741: refactor javadoc to use abstraction to handle relative paths
jjg
parents:
14266
diff
changeset
|
996 |
DocPath href = pathToRoot |
faf9cde2817b
8000741: refactor javadoc to use abstraction to handle relative paths
jjg
parents:
14266
diff
changeset
|
997 |
.resolve(DocPaths.SOURCE_OUTPUT) |
faf9cde2817b
8000741: refactor javadoc to use abstraction to handle relative paths
jjg
parents:
14266
diff
changeset
|
998 |
.resolve(DocPath.forClass(cd)); |
14358
9eda9239cba0
8000416: refactor javadoc to provide and use an abstraction for relative URIs
jjg
parents:
14357
diff
changeset
|
999 |
Content linkContent = getHyperLink(href.fragment(SourceToHTMLConverter.getAnchorName(doc)), label, "", ""); |
7614
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
1000 |
htmltree.addContent(linkContent); |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
1001 |
} |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
1002 |
|
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
1003 |
/** |
10 | 1004 |
* Return the link to the given class. |
1005 |
* |
|
1006 |
* @param linkInfo the information about the link. |
|
1007 |
* |
|
1008 |
* @return the link for the given class. |
|
1009 |
*/ |
|
1010 |
public String getLink(LinkInfoImpl linkInfo) { |
|
1011 |
LinkFactoryImpl factory = new LinkFactoryImpl(this); |
|
14358
9eda9239cba0
8000416: refactor javadoc to provide and use an abstraction for relative URIs
jjg
parents:
14357
diff
changeset
|
1012 |
String link = factory.getLinkOutput(linkInfo).toString(); |
10 | 1013 |
displayLength += linkInfo.displayLength; |
1014 |
return link; |
|
1015 |
} |
|
1016 |
||
1017 |
/** |
|
1018 |
* Return the type parameters for the given class. |
|
1019 |
* |
|
1020 |
* @param linkInfo the information about the link. |
|
1021 |
* @return the type for the given class. |
|
1022 |
*/ |
|
1023 |
public String getTypeParameterLinks(LinkInfoImpl linkInfo) { |
|
1024 |
LinkFactoryImpl factory = new LinkFactoryImpl(this); |
|
14358
9eda9239cba0
8000416: refactor javadoc to provide and use an abstraction for relative URIs
jjg
parents:
14357
diff
changeset
|
1025 |
return factory.getTypeParameterLinks(linkInfo, false).toString(); |
10 | 1026 |
} |
1027 |
||
1028 |
/************************************************************* |
|
1029 |
* Return a class cross link to external class documentation. |
|
1030 |
* The name must be fully qualified to determine which package |
|
1031 |
* the class is in. The -link option does not allow users to |
|
1032 |
* link to external classes in the "default" package. |
|
1033 |
* |
|
1034 |
* @param qualifiedClassName the qualified name of the external class. |
|
1035 |
* @param refMemName the name of the member being referenced. This should |
|
1036 |
* be null or empty string if no member is being referenced. |
|
1037 |
* @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
|
1038 |
* @param strong true if the link should be strong. |
10 | 1039 |
* @param style the style of the link. |
1040 |
* @param code true if the label should be code font. |
|
1041 |
*/ |
|
1042 |
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
|
1043 |
String label, boolean strong, String style, |
10 | 1044 |
boolean code) { |
14358
9eda9239cba0
8000416: refactor javadoc to provide and use an abstraction for relative URIs
jjg
parents:
14357
diff
changeset
|
1045 |
String className = ""; |
9eda9239cba0
8000416: refactor javadoc to provide and use an abstraction for relative URIs
jjg
parents:
14357
diff
changeset
|
1046 |
String packageName = qualifiedClassName == null ? "" : qualifiedClassName; |
10 | 1047 |
int periodIndex; |
14358
9eda9239cba0
8000416: refactor javadoc to provide and use an abstraction for relative URIs
jjg
parents:
14357
diff
changeset
|
1048 |
while ((periodIndex = packageName.lastIndexOf('.')) != -1) { |
10 | 1049 |
className = packageName.substring(periodIndex + 1, packageName.length()) + |
1050 |
(className.length() > 0 ? "." + className : ""); |
|
14266
69453558960d
8000673: remove dead code from HtmlWriter and subtypes
jjg
parents:
14265
diff
changeset
|
1051 |
String defaultLabel = code ? codeText(className) : className; |
10 | 1052 |
packageName = packageName.substring(0, periodIndex); |
1053 |
if (getCrossPackageLink(packageName) != null) { |
|
1054 |
//The package exists in external documentation, so link to the external |
|
1055 |
//class (assuming that it exists). This is definitely a limitation of |
|
1056 |
//the -link option. There are ways to determine if an external package |
|
1057 |
//exists, but no way to determine if the external class exists. We just |
|
1058 |
//have to assume that it does. |
|
14358
9eda9239cba0
8000416: refactor javadoc to provide and use an abstraction for relative URIs
jjg
parents:
14357
diff
changeset
|
1059 |
DocLink link = configuration.extern.getExternalLink(packageName, pathToRoot, |
9eda9239cba0
8000416: refactor javadoc to provide and use an abstraction for relative URIs
jjg
parents:
14357
diff
changeset
|
1060 |
className + ".html", refMemName); |
9eda9239cba0
8000416: refactor javadoc to provide and use an abstraction for relative URIs
jjg
parents:
14357
diff
changeset
|
1061 |
return getHyperLinkString(link, |
9eda9239cba0
8000416: refactor javadoc to provide and use an abstraction for relative URIs
jjg
parents:
14357
diff
changeset
|
1062 |
(label == null) || label.length() == 0 ? defaultLabel : label, |
9eda9239cba0
8000416: refactor javadoc to provide and use an abstraction for relative URIs
jjg
parents:
14357
diff
changeset
|
1063 |
|
9eda9239cba0
8000416: refactor javadoc to provide and use an abstraction for relative URIs
jjg
parents:
14357
diff
changeset
|
1064 |
|
1787
1aa079321cd2
6786028: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - Bold tags should be strong
bpatel
parents:
1264
diff
changeset
|
1065 |
strong, style, |
10 | 1066 |
configuration.getText("doclet.Href_Class_Or_Interface_Title", packageName), |
1067 |
""); |
|
1068 |
} |
|
1069 |
} |
|
1070 |
return null; |
|
1071 |
} |
|
1072 |
||
1073 |
public boolean isClassLinkable(ClassDoc cd) { |
|
1074 |
if (cd.isIncluded()) { |
|
1075 |
return configuration.isGeneratedDoc(cd); |
|
1076 |
} |
|
1077 |
return configuration.extern.isExternal(cd); |
|
1078 |
} |
|
1079 |
||
14358
9eda9239cba0
8000416: refactor javadoc to provide and use an abstraction for relative URIs
jjg
parents:
14357
diff
changeset
|
1080 |
public DocLink getCrossPackageLink(String pkgName) { |
14357
faf9cde2817b
8000741: refactor javadoc to use abstraction to handle relative paths
jjg
parents:
14266
diff
changeset
|
1081 |
return configuration.extern.getExternalLink(pkgName, pathToRoot, |
14358
9eda9239cba0
8000416: refactor javadoc to provide and use an abstraction for relative URIs
jjg
parents:
14357
diff
changeset
|
1082 |
DocPaths.PACKAGE_SUMMARY.getPath()); |
10 | 1083 |
} |
1084 |
||
7614
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
1085 |
/** |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
1086 |
* Get the class link. |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
1087 |
* |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
1088 |
* @param context the id of the context where the link will be added |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
1089 |
* @param cd the class doc to link to |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
1090 |
* @return a content tree for the link |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
1091 |
*/ |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
1092 |
public Content getQualifiedClassLink(int context, ClassDoc cd) { |
14542 | 1093 |
return new RawHtml(getLink(new LinkInfoImpl(configuration, context, cd, |
7614
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
1094 |
configuration.getClassName(cd), ""))); |
10 | 1095 |
} |
1096 |
||
1097 |
/** |
|
7614
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
1098 |
* Add the class link. |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
1099 |
* |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
1100 |
* @param context the id of the context where the link will be added |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
1101 |
* @param cd the class doc to link to |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
1102 |
* @param contentTree the content tree to which the link will be added |
10 | 1103 |
*/ |
7614
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
1104 |
public void addPreQualifiedClassLink(int context, ClassDoc cd, Content contentTree) { |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
1105 |
addPreQualifiedClassLink(context, cd, false, contentTree); |
10 | 1106 |
} |
1107 |
||
1108 |
/** |
|
1109 |
* Retrieve the class link with the package portion of the label in |
|
14358
9eda9239cba0
8000416: refactor javadoc to provide and use an abstraction for relative URIs
jjg
parents:
14357
diff
changeset
|
1110 |
* plain text. If the qualifier is excluded, it will not be included in the |
10 | 1111 |
* link label. |
1112 |
* |
|
1113 |
* @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
|
1114 |
* @param isStrong true if the link should be strong. |
10 | 1115 |
* @return the link with the package portion of the label in plain text. |
1116 |
*/ |
|
1117 |
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
|
1118 |
ClassDoc cd, boolean isStrong) { |
10 | 1119 |
String classlink = ""; |
1120 |
PackageDoc pd = cd.containingPackage(); |
|
1121 |
if(pd != null && ! configuration.shouldExcludeQualifier(pd.name())) { |
|
1122 |
classlink = getPkgName(cd); |
|
1123 |
} |
|
14542 | 1124 |
classlink += getLink(new LinkInfoImpl(configuration, |
1125 |
context, cd, cd.name(), isStrong)); |
|
10 | 1126 |
return classlink; |
1127 |
} |
|
1128 |
||
7614
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
1129 |
/** |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
1130 |
* Add the class link with the package portion of the label in |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
1131 |
* plain text. If the qualifier is excluded, it will not be included in the |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
1132 |
* link label. |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
1133 |
* |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
1134 |
* @param context the id of the context where the link will be added |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
1135 |
* @param cd the class to link to |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
1136 |
* @param isStrong true if the link should be strong |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
1137 |
* @param contentTree the content tree to which the link with be added |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
1138 |
*/ |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
1139 |
public void addPreQualifiedClassLink(int context, |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
1140 |
ClassDoc cd, boolean isStrong, Content contentTree) { |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
1141 |
PackageDoc pd = cd.containingPackage(); |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
1142 |
if(pd != null && ! configuration.shouldExcludeQualifier(pd.name())) { |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
1143 |
contentTree.addContent(getPkgName(cd)); |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
1144 |
} |
14542 | 1145 |
contentTree.addContent(new RawHtml(getLink(new LinkInfoImpl(configuration, |
7614
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
1146 |
context, cd, cd.name(), isStrong)))); |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
1147 |
} |
10 | 1148 |
|
1149 |
/** |
|
7614
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
1150 |
* Add the class link, with only class name as the strong link and prefixing |
10 | 1151 |
* plain package name. |
7614
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
1152 |
* |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
1153 |
* @param context the id of the context where the link will be added |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
1154 |
* @param cd the class to link to |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
1155 |
* @param contentTree the content tree to which the link with be added |
10 | 1156 |
*/ |
7614
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
1157 |
public void addPreQualifiedStrongClassLink(int context, ClassDoc cd, Content contentTree) { |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
1158 |
addPreQualifiedClassLink(context, cd, true, contentTree); |
10 | 1159 |
} |
1160 |
||
1161 |
/** |
|
7614
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
1162 |
* Get the link for the given member. |
10 | 1163 |
* |
7614
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
1164 |
* @param context the id of the context where the link will be added |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
1165 |
* @param doc the member being linked to |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
1166 |
* @param label the label for the link |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
1167 |
* @return a content tree for the doc link |
10 | 1168 |
*/ |
7614
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
1169 |
public Content getDocLink(int context, MemberDoc doc, String label) { |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
1170 |
return getDocLink(context, doc.containingClass(), doc, label); |
10 | 1171 |
} |
1172 |
||
1173 |
/** |
|
1174 |
* Return the link for the given member. |
|
1175 |
* |
|
1176 |
* @param context the id of the context where the link will be printed. |
|
1177 |
* @param doc the member being linked to. |
|
1178 |
* @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
|
1179 |
* @param strong true if the link should be strong. |
10 | 1180 |
* @return the link for the given member. |
1181 |
*/ |
|
1182 |
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
|
1183 |
boolean strong) { |
1aa079321cd2
6786028: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - Bold tags should be strong
bpatel
parents:
1264
diff
changeset
|
1184 |
return getDocLink(context, doc.containingClass(), doc, label, strong); |
10 | 1185 |
} |
1186 |
||
1187 |
/** |
|
1188 |
* Return the link for the given member. |
|
1189 |
* |
|
1190 |
* @param context the id of the context where the link will be printed. |
|
1191 |
* @param classDoc the classDoc that we should link to. This is not |
|
1192 |
* necessarily equal to doc.containingClass(). We may be |
|
1193 |
* inheriting comments. |
|
1194 |
* @param doc the member being linked to. |
|
1195 |
* @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
|
1196 |
* @param strong true if the link should be strong. |
10 | 1197 |
* @return the link for the given member. |
1198 |
*/ |
|
1199 |
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
|
1200 |
String label, boolean strong) { |
10 | 1201 |
if (! (doc.isIncluded() || |
14542 | 1202 |
Util.isLinkable(classDoc, configuration))) { |
10 | 1203 |
return label; |
1204 |
} else if (doc instanceof ExecutableMemberDoc) { |
|
1205 |
ExecutableMemberDoc emd = (ExecutableMemberDoc)doc; |
|
14542 | 1206 |
return getLink(new LinkInfoImpl(configuration, 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
|
1207 |
getAnchor(emd), label, strong)); |
10 | 1208 |
} else if (doc instanceof MemberDoc) { |
14542 | 1209 |
return getLink(new LinkInfoImpl(configuration, 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
|
1210 |
doc.name(), label, strong)); |
10 | 1211 |
} else { |
1212 |
return label; |
|
1213 |
} |
|
1214 |
} |
|
1215 |
||
7614
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
1216 |
/** |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
1217 |
* Return the link for the given member. |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
1218 |
* |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
1219 |
* @param context the id of the context where the link will be added |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
1220 |
* @param classDoc the classDoc that we should link to. This is not |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
1221 |
* necessarily equal to doc.containingClass(). We may be |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
1222 |
* inheriting comments |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
1223 |
* @param doc the member being linked to |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
1224 |
* @param label the label for the link |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
1225 |
* @return the link for the given member |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
1226 |
*/ |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
1227 |
public Content getDocLink(int context, ClassDoc classDoc, MemberDoc doc, |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
1228 |
String label) { |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
1229 |
if (! (doc.isIncluded() || |
14542 | 1230 |
Util.isLinkable(classDoc, configuration))) { |
7614
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
1231 |
return new StringContent(label); |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
1232 |
} else if (doc instanceof ExecutableMemberDoc) { |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
1233 |
ExecutableMemberDoc emd = (ExecutableMemberDoc)doc; |
14542 | 1234 |
return new RawHtml(getLink(new LinkInfoImpl(configuration, context, classDoc, |
7614
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
1235 |
getAnchor(emd), label, false))); |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
1236 |
} else if (doc instanceof MemberDoc) { |
14542 | 1237 |
return new RawHtml(getLink(new LinkInfoImpl(configuration, context, classDoc, |
7614
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
1238 |
doc.name(), label, false))); |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
1239 |
} else { |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
1240 |
return new StringContent(label); |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
1241 |
} |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
1242 |
} |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
1243 |
|
10 | 1244 |
public String getAnchor(ExecutableMemberDoc emd) { |
1245 |
StringBuilder signature = new StringBuilder(emd.signature()); |
|
1246 |
StringBuilder signatureParsed = new StringBuilder(); |
|
1247 |
int counter = 0; |
|
1248 |
for (int i = 0; i < signature.length(); i++) { |
|
1249 |
char c = signature.charAt(i); |
|
1250 |
if (c == '<') { |
|
1251 |
counter++; |
|
1252 |
} else if (c == '>') { |
|
1253 |
counter--; |
|
1254 |
} else if (counter == 0) { |
|
1255 |
signatureParsed.append(c); |
|
1256 |
} |
|
1257 |
} |
|
1258 |
return emd.name() + signatureParsed.toString(); |
|
1259 |
} |
|
1260 |
||
1261 |
public String seeTagToString(SeeTag see) { |
|
1262 |
String tagName = see.name(); |
|
1263 |
if (! (tagName.startsWith("@link") || tagName.equals("@see"))) { |
|
1264 |
return ""; |
|
1265 |
} |
|
14266
69453558960d
8000673: remove dead code from HtmlWriter and subtypes
jjg
parents:
14265
diff
changeset
|
1266 |
|
10 | 1267 |
String seetext = replaceDocRootDir(see.text()); |
1268 |
||
1269 |
//Check if @see is an href or "string" |
|
1270 |
if (seetext.startsWith("<") || seetext.startsWith("\"")) { |
|
14266
69453558960d
8000673: remove dead code from HtmlWriter and subtypes
jjg
parents:
14265
diff
changeset
|
1271 |
return seetext; |
10 | 1272 |
} |
1273 |
||
14266
69453558960d
8000673: remove dead code from HtmlWriter and subtypes
jjg
parents:
14265
diff
changeset
|
1274 |
boolean plain = tagName.equalsIgnoreCase("@linkplain"); |
69453558960d
8000673: remove dead code from HtmlWriter and subtypes
jjg
parents:
14265
diff
changeset
|
1275 |
String label = plainOrCodeText(plain, see.label()); |
69453558960d
8000673: remove dead code from HtmlWriter and subtypes
jjg
parents:
14265
diff
changeset
|
1276 |
|
10 | 1277 |
//The text from the @see tag. We will output this text when a label is not specified. |
14266
69453558960d
8000673: remove dead code from HtmlWriter and subtypes
jjg
parents:
14265
diff
changeset
|
1278 |
String text = plainOrCodeText(plain, seetext); |
10 | 1279 |
|
1280 |
ClassDoc refClass = see.referencedClass(); |
|
1281 |
String refClassName = see.referencedClassName(); |
|
1282 |
MemberDoc refMem = see.referencedMember(); |
|
1283 |
String refMemName = see.referencedMemberName(); |
|
14266
69453558960d
8000673: remove dead code from HtmlWriter and subtypes
jjg
parents:
14265
diff
changeset
|
1284 |
|
10 | 1285 |
if (refClass == null) { |
1286 |
//@see is not referencing an included class |
|
1287 |
PackageDoc refPackage = see.referencedPackage(); |
|
1288 |
if (refPackage != null && refPackage.isIncluded()) { |
|
1289 |
//@see is referencing an included package |
|
14266
69453558960d
8000673: remove dead code from HtmlWriter and subtypes
jjg
parents:
14265
diff
changeset
|
1290 |
if (label.isEmpty()) |
69453558960d
8000673: remove dead code from HtmlWriter and subtypes
jjg
parents:
14265
diff
changeset
|
1291 |
label = plainOrCodeText(plain, refPackage.name()); |
69453558960d
8000673: remove dead code from HtmlWriter and subtypes
jjg
parents:
14265
diff
changeset
|
1292 |
return getPackageLinkString(refPackage, label, false); |
10 | 1293 |
} else { |
1294 |
//@see is not referencing an included class or package. Check for cross links. |
|
14358
9eda9239cba0
8000416: refactor javadoc to provide and use an abstraction for relative URIs
jjg
parents:
14357
diff
changeset
|
1295 |
String classCrossLink; |
9eda9239cba0
8000416: refactor javadoc to provide and use an abstraction for relative URIs
jjg
parents:
14357
diff
changeset
|
1296 |
DocLink packageCrossLink = getCrossPackageLink(refClassName); |
10 | 1297 |
if (packageCrossLink != null) { |
1298 |
//Package cross link found |
|
14358
9eda9239cba0
8000416: refactor javadoc to provide and use an abstraction for relative URIs
jjg
parents:
14357
diff
changeset
|
1299 |
return getHyperLinkString(packageCrossLink, |
14266
69453558960d
8000673: remove dead code from HtmlWriter and subtypes
jjg
parents:
14265
diff
changeset
|
1300 |
(label.isEmpty() ? text : label), false); |
10 | 1301 |
} else if ((classCrossLink = getCrossClassLink(refClassName, |
14266
69453558960d
8000673: remove dead code from HtmlWriter and subtypes
jjg
parents:
14265
diff
changeset
|
1302 |
refMemName, label, false, "", !plain)) != null) { |
69453558960d
8000673: remove dead code from HtmlWriter and subtypes
jjg
parents:
14265
diff
changeset
|
1303 |
//Class cross link found (possibly to a member in the class) |
69453558960d
8000673: remove dead code from HtmlWriter and subtypes
jjg
parents:
14265
diff
changeset
|
1304 |
return classCrossLink; |
10 | 1305 |
} else { |
1306 |
//No cross link found so print warning |
|
1307 |
configuration.getDocletSpecificMsg().warning(see.position(), "doclet.see.class_or_package_not_found", |
|
1308 |
tagName, seetext); |
|
14266
69453558960d
8000673: remove dead code from HtmlWriter and subtypes
jjg
parents:
14265
diff
changeset
|
1309 |
return (label.isEmpty() ? text: label); |
10 | 1310 |
} |
1311 |
} |
|
1312 |
} else if (refMemName == null) { |
|
1313 |
// Must be a class reference since refClass is not null and refMemName is null. |
|
14266
69453558960d
8000673: remove dead code from HtmlWriter and subtypes
jjg
parents:
14265
diff
changeset
|
1314 |
if (label.isEmpty()) { |
69453558960d
8000673: remove dead code from HtmlWriter and subtypes
jjg
parents:
14265
diff
changeset
|
1315 |
label = plainOrCodeText(plain, refClass.name()); |
10 | 1316 |
} |
14542 | 1317 |
return getLink(new LinkInfoImpl(configuration, refClass, label)); |
10 | 1318 |
} else if (refMem == null) { |
1319 |
// Must be a member reference since refClass is not null and refMemName is not null. |
|
1320 |
// However, refMem is null, so this referenced member does not exist. |
|
14266
69453558960d
8000673: remove dead code from HtmlWriter and subtypes
jjg
parents:
14265
diff
changeset
|
1321 |
return (label.isEmpty() ? text: label); |
10 | 1322 |
} else { |
1323 |
// Must be a member reference since refClass is not null and refMemName is not null. |
|
1324 |
// refMem is not null, so this @see tag must be referencing a valid member. |
|
1325 |
ClassDoc containing = refMem.containingClass(); |
|
1326 |
if (see.text().trim().startsWith("#") && |
|
1327 |
! (containing.isPublic() || |
|
14542 | 1328 |
Util.isLinkable(containing, configuration))) { |
10 | 1329 |
// Since the link is relative and the holder is not even being |
1330 |
// documented, this must be an inherited link. Redirect it. |
|
1331 |
// The current class either overrides the referenced member or |
|
1332 |
// inherits it automatically. |
|
3891
69ac41cb327b
5093723: REGRESSION: ClassCastException in SingleIndexWriter
jjg
parents:
2321
diff
changeset
|
1333 |
if (this instanceof ClassWriterImpl) { |
69ac41cb327b
5093723: REGRESSION: ClassCastException in SingleIndexWriter
jjg
parents:
2321
diff
changeset
|
1334 |
containing = ((ClassWriterImpl) this).getClassDoc(); |
69ac41cb327b
5093723: REGRESSION: ClassCastException in SingleIndexWriter
jjg
parents:
2321
diff
changeset
|
1335 |
} else if (!containing.isPublic()){ |
69ac41cb327b
5093723: REGRESSION: ClassCastException in SingleIndexWriter
jjg
parents:
2321
diff
changeset
|
1336 |
configuration.getDocletSpecificMsg().warning( |
69ac41cb327b
5093723: REGRESSION: ClassCastException in SingleIndexWriter
jjg
parents:
2321
diff
changeset
|
1337 |
see.position(), "doclet.see.class_or_package_not_accessible", |
69ac41cb327b
5093723: REGRESSION: ClassCastException in SingleIndexWriter
jjg
parents:
2321
diff
changeset
|
1338 |
tagName, containing.qualifiedName()); |
69ac41cb327b
5093723: REGRESSION: ClassCastException in SingleIndexWriter
jjg
parents:
2321
diff
changeset
|
1339 |
} else { |
69ac41cb327b
5093723: REGRESSION: ClassCastException in SingleIndexWriter
jjg
parents:
2321
diff
changeset
|
1340 |
configuration.getDocletSpecificMsg().warning( |
69ac41cb327b
5093723: REGRESSION: ClassCastException in SingleIndexWriter
jjg
parents:
2321
diff
changeset
|
1341 |
see.position(), "doclet.see.class_or_package_not_found", |
69ac41cb327b
5093723: REGRESSION: ClassCastException in SingleIndexWriter
jjg
parents:
2321
diff
changeset
|
1342 |
tagName, seetext); |
69ac41cb327b
5093723: REGRESSION: ClassCastException in SingleIndexWriter
jjg
parents:
2321
diff
changeset
|
1343 |
} |
10 | 1344 |
} |
1345 |
if (configuration.currentcd != containing) { |
|
1346 |
refMemName = containing.name() + "." + refMemName; |
|
1347 |
} |
|
1348 |
if (refMem instanceof ExecutableMemberDoc) { |
|
1349 |
if (refMemName.indexOf('(') < 0) { |
|
1350 |
refMemName += ((ExecutableMemberDoc)refMem).signature(); |
|
1351 |
} |
|
1352 |
} |
|
14266
69453558960d
8000673: remove dead code from HtmlWriter and subtypes
jjg
parents:
14265
diff
changeset
|
1353 |
|
69453558960d
8000673: remove dead code from HtmlWriter and subtypes
jjg
parents:
14265
diff
changeset
|
1354 |
text = plainOrCodeText(plain, Util.escapeHtmlChars(refMemName)); |
10 | 1355 |
|
14266
69453558960d
8000673: remove dead code from HtmlWriter and subtypes
jjg
parents:
14265
diff
changeset
|
1356 |
return getDocLink(LinkInfoImpl.CONTEXT_SEE_TAG, containing, |
69453558960d
8000673: remove dead code from HtmlWriter and subtypes
jjg
parents:
14265
diff
changeset
|
1357 |
refMem, (label.isEmpty() ? text: label), false); |
10 | 1358 |
} |
1359 |
} |
|
1360 |
||
14266
69453558960d
8000673: remove dead code from HtmlWriter and subtypes
jjg
parents:
14265
diff
changeset
|
1361 |
private String plainOrCodeText(boolean plain, String text) { |
69453558960d
8000673: remove dead code from HtmlWriter and subtypes
jjg
parents:
14265
diff
changeset
|
1362 |
return (plain || text.isEmpty()) ? text : codeText(text); |
10 | 1363 |
} |
1364 |
||
7614
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
1365 |
/** |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
1366 |
* Add the inline comment. |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
1367 |
* |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
1368 |
* @param doc the doc for which the inline comment will be added |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
1369 |
* @param tag the inline tag to be added |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
1370 |
* @param htmltree the content tree to which the comment will be added |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
1371 |
*/ |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
1372 |
public void addInlineComment(Doc doc, Tag tag, Content htmltree) { |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
1373 |
addCommentTags(doc, tag.inlineTags(), false, false, htmltree); |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
1374 |
} |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
1375 |
|
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
1376 |
/** |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
1377 |
* Add the inline deprecated comment. |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
1378 |
* |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
1379 |
* @param doc the doc for which the inline deprecated comment will be added |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
1380 |
* @param tag the inline tag to be added |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
1381 |
* @param htmltree the content tree to which the comment will be added |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
1382 |
*/ |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
1383 |
public void addInlineDeprecatedComment(Doc doc, Tag tag, Content htmltree) { |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
1384 |
addCommentTags(doc, tag.inlineTags(), true, false, htmltree); |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
1385 |
} |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
1386 |
|
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
1387 |
/** |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
1388 |
* Adds the summary content. |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
1389 |
* |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
1390 |
* @param doc the doc for which the summary will be generated |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
1391 |
* @param htmltree the documentation tree to which the summary will be added |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
1392 |
*/ |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
1393 |
public void addSummaryComment(Doc doc, Content htmltree) { |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
1394 |
addSummaryComment(doc, doc.firstSentenceTags(), htmltree); |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
1395 |
} |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
1396 |
|
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
1397 |
/** |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
1398 |
* Adds the summary content. |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
1399 |
* |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
1400 |
* @param doc the doc for which the summary will be generated |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
1401 |
* @param firstSentenceTags the first sentence tags for the doc |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
1402 |
* @param htmltree the documentation tree to which the summary will be added |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
1403 |
*/ |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
1404 |
public void addSummaryComment(Doc doc, Tag[] firstSentenceTags, Content htmltree) { |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
1405 |
addCommentTags(doc, firstSentenceTags, false, true, htmltree); |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
1406 |
} |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
1407 |
|
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
1408 |
public void addSummaryDeprecatedComment(Doc doc, Tag tag, Content htmltree) { |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
1409 |
addCommentTags(doc, tag.firstSentenceTags(), true, true, htmltree); |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
1410 |
} |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
1411 |
|
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
1412 |
/** |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
1413 |
* Adds the inline comment. |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
1414 |
* |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
1415 |
* @param doc the doc for which the inline comments will be generated |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
1416 |
* @param htmltree the documentation tree to which the inline comments will be added |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
1417 |
*/ |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
1418 |
public void addInlineComment(Doc doc, Content htmltree) { |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
1419 |
addCommentTags(doc, doc.inlineTags(), false, false, htmltree); |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
1420 |
} |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
1421 |
|
10 | 1422 |
/** |
7614
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
1423 |
* Adds the comment tags. |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
1424 |
* |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
1425 |
* @param doc the doc for which the comment tags will be generated |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
1426 |
* @param tags the first sentence tags for the doc |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
1427 |
* @param depr true if it is deprecated |
14357
faf9cde2817b
8000741: refactor javadoc to use abstraction to handle relative paths
jjg
parents:
14266
diff
changeset
|
1428 |
* @param first true if the first sentence tags should be added |
7614
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
1429 |
* @param htmltree the documentation tree to which the comment tags will be added |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
1430 |
*/ |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
1431 |
private void addCommentTags(Doc doc, Tag[] tags, boolean depr, |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
1432 |
boolean first, Content htmltree) { |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
1433 |
if(configuration.nocomment){ |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
1434 |
return; |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
1435 |
} |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
1436 |
Content div; |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
1437 |
Content result = new RawHtml(commentTagsToString(null, doc, tags, first)); |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
1438 |
if (depr) { |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
1439 |
Content italic = HtmlTree.I(result); |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
1440 |
div = HtmlTree.DIV(HtmlStyle.block, italic); |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
1441 |
htmltree.addContent(div); |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
1442 |
} |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
1443 |
else { |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
1444 |
div = HtmlTree.DIV(HtmlStyle.block, result); |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
1445 |
htmltree.addContent(div); |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
1446 |
} |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
1447 |
if (tags.length == 0) { |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
1448 |
htmltree.addContent(getSpace()); |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
1449 |
} |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
1450 |
} |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
1451 |
|
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
1452 |
/** |
10 | 1453 |
* Converts inline tags and text to text strings, expanding the |
1454 |
* inline tags along the way. Called wherever text can contain |
|
1455 |
* an inline tag, such as in comments or in free-form text arguments |
|
1456 |
* to non-inline tags. |
|
1457 |
* |
|
1458 |
* @param holderTag specific tag where comment resides |
|
1459 |
* @param doc specific doc where comment resides |
|
1460 |
* @param tags array of text tags and inline tags (often alternating) |
|
1461 |
* present in the text of interest for this doc |
|
1462 |
* @param isFirstSentence true if text is first sentence |
|
1463 |
*/ |
|
1464 |
public String commentTagsToString(Tag holderTag, Doc doc, Tag[] tags, |
|
1465 |
boolean isFirstSentence) { |
|
8631
664f84942e74
6866185: Util.getPackageSourcePath should use lastIndexOf not indexOf and related cleanup
jjg
parents:
7681
diff
changeset
|
1466 |
StringBuilder result = new StringBuilder(); |
9608 | 1467 |
boolean textTagChange = false; |
10 | 1468 |
// Array of all possible inline tags for this javadoc run |
1469 |
configuration.tagletManager.checkTags(doc, tags, true); |
|
1470 |
for (int i = 0; i < tags.length; i++) { |
|
1471 |
Tag tagelem = tags[i]; |
|
1472 |
String tagName = tagelem.name(); |
|
1473 |
if (tagelem instanceof SeeTag) { |
|
1474 |
result.append(seeTagToString((SeeTag)tagelem)); |
|
1475 |
} else if (! tagName.equals("Text")) { |
|
1476 |
int originalLength = result.length(); |
|
1477 |
TagletOutput output = TagletWriter.getInlineTagOuput( |
|
1478 |
configuration.tagletManager, holderTag, |
|
868 | 1479 |
tagelem, getTagletWriterInstance(isFirstSentence)); |
10 | 1480 |
result.append(output == null ? "" : output.toString()); |
1481 |
if (originalLength == 0 && isFirstSentence && tagelem.name().equals("@inheritDoc") && result.length() > 0) { |
|
1482 |
break; |
|
9608 | 1483 |
} else if (configuration.docrootparent.length() > 0 && |
1484 |
tagelem.name().equals("@docRoot") && |
|
1485 |
((tags[i + 1]).text()).startsWith("/..")) { |
|
1486 |
//If Xdocrootparent switch ON, set the flag to remove the /.. occurance after |
|
1487 |
//{@docRoot} tag in the very next Text tag. |
|
1488 |
textTagChange = true; |
|
1489 |
continue; |
|
10 | 1490 |
} else { |
9608 | 1491 |
continue; |
10 | 1492 |
} |
1493 |
} else { |
|
9608 | 1494 |
String text = tagelem.text(); |
1495 |
//If Xdocrootparent switch ON, remove the /.. occurance after {@docRoot} tag. |
|
1496 |
if (textTagChange) { |
|
1497 |
text = text.replaceFirst("/..", ""); |
|
1498 |
textTagChange = false; |
|
1499 |
} |
|
10 | 1500 |
//This is just a regular text tag. The text may contain html links (<a>) |
1501 |
//or inline tag {@docRoot}, which will be handled as special cases. |
|
9608 | 1502 |
text = redirectRelativeLinks(tagelem.holder(), text); |
10 | 1503 |
|
1504 |
// Replace @docRoot only if not represented by an instance of DocRootTaglet, |
|
1505 |
// that is, only if it was not present in a source file doc comment. |
|
1506 |
// This happens when inserted by the doclet (a few lines |
|
1507 |
// above in this method). [It might also happen when passed in on the command |
|
1508 |
// line as a text argument to an option (like -header).] |
|
1509 |
text = replaceDocRootDir(text); |
|
1510 |
if (isFirstSentence) { |
|
1511 |
text = removeNonInlineHtmlTags(text); |
|
1512 |
} |
|
1513 |
StringTokenizer lines = new StringTokenizer(text, "\r\n", true); |
|
14263 | 1514 |
StringBuilder textBuff = new StringBuilder(); |
10 | 1515 |
while (lines.hasMoreTokens()) { |
8631
664f84942e74
6866185: Util.getPackageSourcePath should use lastIndexOf not indexOf and related cleanup
jjg
parents:
7681
diff
changeset
|
1516 |
StringBuilder line = new StringBuilder(lines.nextToken()); |
14542 | 1517 |
Util.replaceTabs(configuration, line); |
10 | 1518 |
textBuff.append(line.toString()); |
1519 |
} |
|
1520 |
result.append(textBuff); |
|
1521 |
} |
|
1522 |
} |
|
1523 |
return result.toString(); |
|
1524 |
} |
|
1525 |
||
1526 |
/** |
|
1527 |
* Return true if relative links should not be redirected. |
|
1528 |
* |
|
1529 |
* @return Return true if a relative link should not be redirected. |
|
1530 |
*/ |
|
1531 |
private boolean shouldNotRedirectRelativeLinks() { |
|
1532 |
return this instanceof AnnotationTypeWriter || |
|
1533 |
this instanceof ClassWriter || |
|
1534 |
this instanceof PackageSummaryWriter; |
|
1535 |
} |
|
1536 |
||
1537 |
/** |
|
1538 |
* Suppose a piece of documentation has a relative link. When you copy |
|
14357
faf9cde2817b
8000741: refactor javadoc to use abstraction to handle relative paths
jjg
parents:
14266
diff
changeset
|
1539 |
* that documentation to another place such as the index or class-use page, |
10 | 1540 |
* that relative link will no longer work. We should redirect those links |
1541 |
* so that they will work again. |
|
1542 |
* <p> |
|
1543 |
* Here is the algorithm used to fix the link: |
|
1544 |
* <p> |
|
13844 | 1545 |
* {@literal <relative link> => docRoot + <relative path to file> + <relative link> } |
10 | 1546 |
* <p> |
1547 |
* For example, suppose com.sun.javadoc.RootDoc has this link: |
|
13844 | 1548 |
* {@literal <a href="package-summary.html">The package Page</a> } |
10 | 1549 |
* <p> |
1550 |
* If this link appeared in the index, we would redirect |
|
1551 |
* the link like this: |
|
1552 |
* |
|
13844 | 1553 |
* {@literal <a href="./com/sun/javadoc/package-summary.html">The package Page</a>} |
10 | 1554 |
* |
1555 |
* @param doc the Doc object whose documentation is being written. |
|
1556 |
* @param text the text being written. |
|
1557 |
* |
|
1558 |
* @return the text, with all the relative links redirected to work. |
|
1559 |
*/ |
|
1560 |
private String redirectRelativeLinks(Doc doc, String text) { |
|
1561 |
if (doc == null || shouldNotRedirectRelativeLinks()) { |
|
1562 |
return text; |
|
1563 |
} |
|
1564 |
||
14357
faf9cde2817b
8000741: refactor javadoc to use abstraction to handle relative paths
jjg
parents:
14266
diff
changeset
|
1565 |
DocPath redirectPathFromRoot; |
10 | 1566 |
if (doc instanceof ClassDoc) { |
14357
faf9cde2817b
8000741: refactor javadoc to use abstraction to handle relative paths
jjg
parents:
14266
diff
changeset
|
1567 |
redirectPathFromRoot = DocPath.forPackage(((ClassDoc) doc).containingPackage()); |
10 | 1568 |
} else if (doc instanceof MemberDoc) { |
14357
faf9cde2817b
8000741: refactor javadoc to use abstraction to handle relative paths
jjg
parents:
14266
diff
changeset
|
1569 |
redirectPathFromRoot = DocPath.forPackage(((MemberDoc) doc).containingPackage()); |
10 | 1570 |
} else if (doc instanceof PackageDoc) { |
14357
faf9cde2817b
8000741: refactor javadoc to use abstraction to handle relative paths
jjg
parents:
14266
diff
changeset
|
1571 |
redirectPathFromRoot = DocPath.forPackage((PackageDoc) doc); |
10 | 1572 |
} else { |
1573 |
return text; |
|
1574 |
} |
|
1575 |
||
1576 |
//Redirect all relative links. |
|
1577 |
int end, begin = text.toLowerCase().indexOf("<a"); |
|
1578 |
if(begin >= 0){ |
|
14263 | 1579 |
StringBuilder textBuff = new StringBuilder(text); |
10 | 1580 |
|
1581 |
while(begin >=0){ |
|
1582 |
if (textBuff.length() > begin + 2 && ! Character.isWhitespace(textBuff.charAt(begin+2))) { |
|
1583 |
begin = textBuff.toString().toLowerCase().indexOf("<a", begin + 1); |
|
1584 |
continue; |
|
1585 |
} |
|
1586 |
||
1587 |
begin = textBuff.indexOf("=", begin) + 1; |
|
1588 |
end = textBuff.indexOf(">", begin +1); |
|
1589 |
if(begin == 0){ |
|
1590 |
//Link has no equal symbol. |
|
1591 |
configuration.root.printWarning( |
|
1592 |
doc.position(), |
|
1593 |
configuration.getText("doclet.malformed_html_link_tag", text)); |
|
1594 |
break; |
|
1595 |
} |
|
1596 |
if (end == -1) { |
|
1597 |
//Break without warning. This <a> tag is not necessarily malformed. The text |
|
1598 |
//might be missing '>' character because the href has an inline tag. |
|
1599 |
break; |
|
1600 |
} |
|
14357
faf9cde2817b
8000741: refactor javadoc to use abstraction to handle relative paths
jjg
parents:
14266
diff
changeset
|
1601 |
if (textBuff.substring(begin, end).indexOf("\"") != -1){ |
10 | 1602 |
begin = textBuff.indexOf("\"", begin) + 1; |
1603 |
end = textBuff.indexOf("\"", begin +1); |
|
14357
faf9cde2817b
8000741: refactor javadoc to use abstraction to handle relative paths
jjg
parents:
14266
diff
changeset
|
1604 |
if (begin == 0 || end == -1){ |
10 | 1605 |
//Link is missing a quote. |
1606 |
break; |
|
1607 |
} |
|
1608 |
} |
|
1609 |
String relativeLink = textBuff.substring(begin, end); |
|
14357
faf9cde2817b
8000741: refactor javadoc to use abstraction to handle relative paths
jjg
parents:
14266
diff
changeset
|
1610 |
if (!(relativeLink.toLowerCase().startsWith("mailto:") || |
faf9cde2817b
8000741: refactor javadoc to use abstraction to handle relative paths
jjg
parents:
14266
diff
changeset
|
1611 |
relativeLink.toLowerCase().startsWith("http:") || |
faf9cde2817b
8000741: refactor javadoc to use abstraction to handle relative paths
jjg
parents:
14266
diff
changeset
|
1612 |
relativeLink.toLowerCase().startsWith("https:") || |
faf9cde2817b
8000741: refactor javadoc to use abstraction to handle relative paths
jjg
parents:
14266
diff
changeset
|
1613 |
relativeLink.toLowerCase().startsWith("file:"))) { |
faf9cde2817b
8000741: refactor javadoc to use abstraction to handle relative paths
jjg
parents:
14266
diff
changeset
|
1614 |
relativeLink = "{@"+(new DocRootTaglet()).getName() + "}/" |
faf9cde2817b
8000741: refactor javadoc to use abstraction to handle relative paths
jjg
parents:
14266
diff
changeset
|
1615 |
+ redirectPathFromRoot.resolve(relativeLink).getPath(); |
10 | 1616 |
textBuff.replace(begin, end, relativeLink); |
1617 |
} |
|
1618 |
begin = textBuff.toString().toLowerCase().indexOf("<a", begin + 1); |
|
1619 |
} |
|
1620 |
return textBuff.toString(); |
|
1621 |
} |
|
1622 |
return text; |
|
1623 |
} |
|
1624 |
||
1625 |
public String removeNonInlineHtmlTags(String text) { |
|
1626 |
if (text.indexOf('<') < 0) { |
|
1627 |
return text; |
|
1628 |
} |
|
1629 |
String noninlinetags[] = { "<ul>", "</ul>", "<ol>", "</ol>", |
|
1630 |
"<dl>", "</dl>", "<table>", "</table>", |
|
1631 |
"<tr>", "</tr>", "<td>", "</td>", |
|
1632 |
"<th>", "</th>", "<p>", "</p>", |
|
1633 |
"<li>", "</li>", "<dd>", "</dd>", |
|
1634 |
"<dir>", "</dir>", "<dt>", "</dt>", |
|
1635 |
"<h1>", "</h1>", "<h2>", "</h2>", |
|
1636 |
"<h3>", "</h3>", "<h4>", "</h4>", |
|
1637 |
"<h5>", "</h5>", "<h6>", "</h6>", |
|
1638 |
"<pre>", "</pre>", "<menu>", "</menu>", |
|
1639 |
"<listing>", "</listing>", "<hr>", |
|
1640 |
"<blockquote>", "</blockquote>", |
|
1641 |
"<center>", "</center>", |
|
1642 |
"<UL>", "</UL>", "<OL>", "</OL>", |
|
1643 |
"<DL>", "</DL>", "<TABLE>", "</TABLE>", |
|
1644 |
"<TR>", "</TR>", "<TD>", "</TD>", |
|
1645 |
"<TH>", "</TH>", "<P>", "</P>", |
|
1646 |
"<LI>", "</LI>", "<DD>", "</DD>", |
|
1647 |
"<DIR>", "</DIR>", "<DT>", "</DT>", |
|
1648 |
"<H1>", "</H1>", "<H2>", "</H2>", |
|
1649 |
"<H3>", "</H3>", "<H4>", "</H4>", |
|
1650 |
"<H5>", "</H5>", "<H6>", "</H6>", |
|
1651 |
"<PRE>", "</PRE>", "<MENU>", "</MENU>", |
|
1652 |
"<LISTING>", "</LISTING>", "<HR>", |
|
1653 |
"<BLOCKQUOTE>", "</BLOCKQUOTE>", |
|
1654 |
"<CENTER>", "</CENTER>" |
|
1655 |
}; |
|
1656 |
for (int i = 0; i < noninlinetags.length; i++) { |
|
1657 |
text = replace(text, noninlinetags[i], ""); |
|
1658 |
} |
|
1659 |
return text; |
|
1660 |
} |
|
1661 |
||
1662 |
public String replace(String text, String tobe, String by) { |
|
1663 |
while (true) { |
|
1664 |
int startindex = text.indexOf(tobe); |
|
1665 |
if (startindex < 0) { |
|
1666 |
return text; |
|
1667 |
} |
|
1668 |
int endindex = startindex + tobe.length(); |
|
8631
664f84942e74
6866185: Util.getPackageSourcePath should use lastIndexOf not indexOf and related cleanup
jjg
parents:
7681
diff
changeset
|
1669 |
StringBuilder replaced = new StringBuilder(); |
10 | 1670 |
if (startindex > 0) { |
1671 |
replaced.append(text.substring(0, startindex)); |
|
1672 |
} |
|
1673 |
replaced.append(by); |
|
1674 |
if (text.length() > endindex) { |
|
1675 |
replaced.append(text.substring(endindex)); |
|
1676 |
} |
|
1677 |
text = replaced.toString(); |
|
1678 |
} |
|
1679 |
} |
|
1680 |
||
1681 |
/** |
|
7614
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
1682 |
* Returns a link to the stylesheet file. |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
1683 |
* |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
1684 |
* @return an HtmlTree for the lINK tag which provides the stylesheet location |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
1685 |
*/ |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
1686 |
public HtmlTree getStyleSheetProperties() { |
14368
6f4c62de6985
8001664: refactor javadoc to use abstraction to handle files
jjg
parents:
14366
diff
changeset
|
1687 |
String stylesheetfile = configuration.stylesheetfile; |
14357
faf9cde2817b
8000741: refactor javadoc to use abstraction to handle relative paths
jjg
parents:
14266
diff
changeset
|
1688 |
DocPath stylesheet; |
14368
6f4c62de6985
8001664: refactor javadoc to use abstraction to handle files
jjg
parents:
14366
diff
changeset
|
1689 |
if (stylesheetfile.isEmpty()) { |
6f4c62de6985
8001664: refactor javadoc to use abstraction to handle files
jjg
parents:
14366
diff
changeset
|
1690 |
stylesheet = DocPaths.STYLESHEET; |
7614
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
1691 |
} else { |
14368
6f4c62de6985
8001664: refactor javadoc to use abstraction to handle files
jjg
parents:
14366
diff
changeset
|
1692 |
DocFile file = DocFile.createFileForInput(configuration, stylesheetfile); |
6f4c62de6985
8001664: refactor javadoc to use abstraction to handle files
jjg
parents:
14366
diff
changeset
|
1693 |
stylesheet = DocPath.create(file.getName()); |
7614
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
1694 |
} |
14357
faf9cde2817b
8000741: refactor javadoc to use abstraction to handle relative paths
jjg
parents:
14266
diff
changeset
|
1695 |
HtmlTree link = HtmlTree.LINK("stylesheet", "text/css", |
faf9cde2817b
8000741: refactor javadoc to use abstraction to handle relative paths
jjg
parents:
14266
diff
changeset
|
1696 |
pathToRoot.resolve(stylesheet).getPath(), |
faf9cde2817b
8000741: refactor javadoc to use abstraction to handle relative paths
jjg
parents:
14266
diff
changeset
|
1697 |
"Style"); |
7614
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
1698 |
return link; |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
1699 |
} |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
1700 |
|
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
1701 |
/** |
14549
0599d73bf1da
8002304: Group methods by types in methods summary section
bpatel
parents:
14542
diff
changeset
|
1702 |
* Returns a link to the JavaScript file. |
0599d73bf1da
8002304: Group methods by types in methods summary section
bpatel
parents:
14542
diff
changeset
|
1703 |
* |
0599d73bf1da
8002304: Group methods by types in methods summary section
bpatel
parents:
14542
diff
changeset
|
1704 |
* @return an HtmlTree for the Script tag which provides the JavaScript location |
0599d73bf1da
8002304: Group methods by types in methods summary section
bpatel
parents:
14542
diff
changeset
|
1705 |
*/ |
0599d73bf1da
8002304: Group methods by types in methods summary section
bpatel
parents:
14542
diff
changeset
|
1706 |
public HtmlTree getScriptProperties() { |
0599d73bf1da
8002304: Group methods by types in methods summary section
bpatel
parents:
14542
diff
changeset
|
1707 |
HtmlTree script = HtmlTree.SCRIPT("text/javascript", |
0599d73bf1da
8002304: Group methods by types in methods summary section
bpatel
parents:
14542
diff
changeset
|
1708 |
pathToRoot.resolve(DocPaths.JAVASCRIPT).getPath()); |
0599d73bf1da
8002304: Group methods by types in methods summary section
bpatel
parents:
14542
diff
changeset
|
1709 |
return script; |
0599d73bf1da
8002304: Group methods by types in methods summary section
bpatel
parents:
14542
diff
changeset
|
1710 |
} |
0599d73bf1da
8002304: Group methods by types in methods summary section
bpatel
parents:
14542
diff
changeset
|
1711 |
|
0599d73bf1da
8002304: Group methods by types in methods summary section
bpatel
parents:
14542
diff
changeset
|
1712 |
/** |
9303
eae35c201e19
7032975: API files in javax.annotation.processing need to be updated for references to JLS
jjh
parents:
8631
diff
changeset
|
1713 |
* According to |
eae35c201e19
7032975: API files in javax.annotation.processing need to be updated for references to JLS
jjh
parents:
8631
diff
changeset
|
1714 |
* <cite>The Java™ Language Specification</cite>, |
eae35c201e19
7032975: API files in javax.annotation.processing need to be updated for references to JLS
jjh
parents:
8631
diff
changeset
|
1715 |
* all the outer classes and static nested classes are core classes. |
10 | 1716 |
*/ |
1717 |
public boolean isCoreClass(ClassDoc cd) { |
|
1718 |
return cd.containingClass() == null || cd.isStatic(); |
|
1719 |
} |
|
1720 |
||
1721 |
/** |
|
7614
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
1722 |
* Adds the annotatation types for the given packageDoc. |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
1723 |
* |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
1724 |
* @param packageDoc the package to write annotations for. |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
1725 |
* @param htmltree the documentation tree to which the annotation info will be |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
1726 |
* added |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
1727 |
*/ |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
1728 |
public void addAnnotationInfo(PackageDoc packageDoc, Content htmltree) { |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
1729 |
addAnnotationInfo(packageDoc, packageDoc.annotations(), htmltree); |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
1730 |
} |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
1731 |
|
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
1732 |
/** |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
1733 |
* Adds the annotatation types for the given doc. |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
1734 |
* |
14259 | 1735 |
* @param doc the package to write annotations for |
7614
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
1736 |
* @param htmltree the content tree to which the annotation types will be added |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
1737 |
*/ |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
1738 |
public void addAnnotationInfo(ProgramElementDoc doc, Content htmltree) { |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
1739 |
addAnnotationInfo(doc, doc.annotations(), htmltree); |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
1740 |
} |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
1741 |
|
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
1742 |
/** |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
1743 |
* Add the annotatation types for the given doc and parameter. |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
1744 |
* |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
1745 |
* @param indent the number of spaces to indent the parameters. |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
1746 |
* @param doc the doc to write annotations for. |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
1747 |
* @param param the parameter to write annotations for. |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
1748 |
* @param tree the content tree to which the annotation types will be added |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
1749 |
*/ |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
1750 |
public boolean addAnnotationInfo(int indent, Doc doc, Parameter param, |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
1751 |
Content tree) { |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
1752 |
return addAnnotationInfo(indent, doc, param.annotations(), false, tree); |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
1753 |
} |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
1754 |
|
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
1755 |
/** |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
1756 |
* Adds the annotatation types for the given doc. |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
1757 |
* |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
1758 |
* @param doc the doc to write annotations for. |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
1759 |
* @param descList the array of {@link AnnotationDesc}. |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
1760 |
* @param htmltree the documentation tree to which the annotation info will be |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
1761 |
* added |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
1762 |
*/ |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
1763 |
private void addAnnotationInfo(Doc doc, AnnotationDesc[] descList, |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
1764 |
Content htmltree) { |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
1765 |
addAnnotationInfo(0, doc, descList, true, htmltree); |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
1766 |
} |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
1767 |
|
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
1768 |
/** |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
1769 |
* Adds the annotatation types for the given doc. |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
1770 |
* |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
1771 |
* @param indent the number of extra spaces to indent the annotations. |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
1772 |
* @param doc the doc to write annotations for. |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
1773 |
* @param descList the array of {@link AnnotationDesc}. |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
1774 |
* @param htmltree the documentation tree to which the annotation info will be |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
1775 |
* added |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
1776 |
*/ |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
1777 |
private boolean addAnnotationInfo(int indent, Doc doc, |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
1778 |
AnnotationDesc[] descList, boolean lineBreak, Content htmltree) { |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
1779 |
List<String> annotations = getAnnotations(indent, descList, lineBreak); |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
1780 |
if (annotations.size() == 0) { |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
1781 |
return false; |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
1782 |
} |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
1783 |
Content annotationContent; |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
1784 |
for (Iterator<String> iter = annotations.iterator(); iter.hasNext();) { |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
1785 |
annotationContent = new RawHtml(iter.next()); |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
1786 |
htmltree.addContent(annotationContent); |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
1787 |
} |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
1788 |
return true; |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
1789 |
} |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
1790 |
|
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
1791 |
/** |
10 | 1792 |
* Return the string representations of the annotation types for |
1793 |
* the given doc. |
|
1794 |
* |
|
1795 |
* @param indent the number of extra spaces to indent the annotations. |
|
1796 |
* @param descList the array of {@link AnnotationDesc}. |
|
1797 |
* @param linkBreak if true, add new line between each member value. |
|
1798 |
* @return an array of strings representing the annotations being |
|
1799 |
* documented. |
|
1800 |
*/ |
|
868 | 1801 |
private List<String> getAnnotations(int indent, AnnotationDesc[] descList, boolean linkBreak) { |
1802 |
List<String> results = new ArrayList<String>(); |
|
14263 | 1803 |
StringBuilder annotation; |
10 | 1804 |
for (int i = 0; i < descList.length; i++) { |
1805 |
AnnotationTypeDoc annotationDoc = descList[i].annotationType(); |
|
15035
d03c311f44e6
8005092: javadoc should check for synthesized bit on an annotation
bpatel
parents:
14549
diff
changeset
|
1806 |
// If an annotation is not documented, do not add it to the list. If |
d03c311f44e6
8005092: javadoc should check for synthesized bit on an annotation
bpatel
parents:
14549
diff
changeset
|
1807 |
// the annotation is of a repeatable type, and if it is not documented |
d03c311f44e6
8005092: javadoc should check for synthesized bit on an annotation
bpatel
parents:
14549
diff
changeset
|
1808 |
// and also if its container annotation is not documented, do not add it |
d03c311f44e6
8005092: javadoc should check for synthesized bit on an annotation
bpatel
parents:
14549
diff
changeset
|
1809 |
// to the list. If an annotation of a repeatable type is not documented |
d03c311f44e6
8005092: javadoc should check for synthesized bit on an annotation
bpatel
parents:
14549
diff
changeset
|
1810 |
// but its container is documented, it will be added to the list. |
d03c311f44e6
8005092: javadoc should check for synthesized bit on an annotation
bpatel
parents:
14549
diff
changeset
|
1811 |
if (! Util.isDocumentedAnnotation(annotationDoc) && |
d03c311f44e6
8005092: javadoc should check for synthesized bit on an annotation
bpatel
parents:
14549
diff
changeset
|
1812 |
(!isAnnotationDocumented && !isContainerDocumented)) { |
10 | 1813 |
continue; |
1814 |
} |
|
14263 | 1815 |
annotation = new StringBuilder(); |
15035
d03c311f44e6
8005092: javadoc should check for synthesized bit on an annotation
bpatel
parents:
14549
diff
changeset
|
1816 |
isAnnotationDocumented = false; |
14542 | 1817 |
LinkInfoImpl linkInfo = new LinkInfoImpl(configuration, |
10 | 1818 |
LinkInfoImpl.CONTEXT_ANNOTATION, annotationDoc); |
1819 |
AnnotationDesc.ElementValuePair[] pairs = descList[i].elementValues(); |
|
15035
d03c311f44e6
8005092: javadoc should check for synthesized bit on an annotation
bpatel
parents:
14549
diff
changeset
|
1820 |
// If the annotation is synthesized, do not print the container. |
d03c311f44e6
8005092: javadoc should check for synthesized bit on an annotation
bpatel
parents:
14549
diff
changeset
|
1821 |
if (descList[i].isSynthesized()) { |
10 | 1822 |
for (int j = 0; j < pairs.length; j++) { |
1823 |
AnnotationValue annotationValue = pairs[j].value(); |
|
868 | 1824 |
List<AnnotationValue> annotationTypeValues = new ArrayList<AnnotationValue>(); |
10 | 1825 |
if (annotationValue.value() instanceof AnnotationValue[]) { |
1826 |
AnnotationValue[] annotationArray = |
|
15035
d03c311f44e6
8005092: javadoc should check for synthesized bit on an annotation
bpatel
parents:
14549
diff
changeset
|
1827 |
(AnnotationValue[]) annotationValue.value(); |
d03c311f44e6
8005092: javadoc should check for synthesized bit on an annotation
bpatel
parents:
14549
diff
changeset
|
1828 |
annotationTypeValues.addAll(Arrays.asList(annotationArray)); |
10 | 1829 |
} else { |
1830 |
annotationTypeValues.add(annotationValue); |
|
1831 |
} |
|
15035
d03c311f44e6
8005092: javadoc should check for synthesized bit on an annotation
bpatel
parents:
14549
diff
changeset
|
1832 |
String sep = ""; |
d03c311f44e6
8005092: javadoc should check for synthesized bit on an annotation
bpatel
parents:
14549
diff
changeset
|
1833 |
for (AnnotationValue av : annotationTypeValues) { |
d03c311f44e6
8005092: javadoc should check for synthesized bit on an annotation
bpatel
parents:
14549
diff
changeset
|
1834 |
annotation.append(sep); |
d03c311f44e6
8005092: javadoc should check for synthesized bit on an annotation
bpatel
parents:
14549
diff
changeset
|
1835 |
annotation.append(annotationValueToString(av)); |
d03c311f44e6
8005092: javadoc should check for synthesized bit on an annotation
bpatel
parents:
14549
diff
changeset
|
1836 |
sep = " "; |
10 | 1837 |
} |
1838 |
} |
|
15035
d03c311f44e6
8005092: javadoc should check for synthesized bit on an annotation
bpatel
parents:
14549
diff
changeset
|
1839 |
} |
d03c311f44e6
8005092: javadoc should check for synthesized bit on an annotation
bpatel
parents:
14549
diff
changeset
|
1840 |
else if (isAnnotationArray(pairs)) { |
d03c311f44e6
8005092: javadoc should check for synthesized bit on an annotation
bpatel
parents:
14549
diff
changeset
|
1841 |
// If the container has 1 or more value defined and if the |
d03c311f44e6
8005092: javadoc should check for synthesized bit on an annotation
bpatel
parents:
14549
diff
changeset
|
1842 |
// repeatable type annotation is not documented, do not print |
d03c311f44e6
8005092: javadoc should check for synthesized bit on an annotation
bpatel
parents:
14549
diff
changeset
|
1843 |
// the container. |
d03c311f44e6
8005092: javadoc should check for synthesized bit on an annotation
bpatel
parents:
14549
diff
changeset
|
1844 |
if (pairs.length == 1 && isAnnotationDocumented) { |
d03c311f44e6
8005092: javadoc should check for synthesized bit on an annotation
bpatel
parents:
14549
diff
changeset
|
1845 |
AnnotationValue[] annotationArray = |
d03c311f44e6
8005092: javadoc should check for synthesized bit on an annotation
bpatel
parents:
14549
diff
changeset
|
1846 |
(AnnotationValue[]) (pairs[0].value()).value(); |
d03c311f44e6
8005092: javadoc should check for synthesized bit on an annotation
bpatel
parents:
14549
diff
changeset
|
1847 |
List<AnnotationValue> annotationTypeValues = new ArrayList<AnnotationValue>(); |
d03c311f44e6
8005092: javadoc should check for synthesized bit on an annotation
bpatel
parents:
14549
diff
changeset
|
1848 |
annotationTypeValues.addAll(Arrays.asList(annotationArray)); |
d03c311f44e6
8005092: javadoc should check for synthesized bit on an annotation
bpatel
parents:
14549
diff
changeset
|
1849 |
String sep = ""; |
d03c311f44e6
8005092: javadoc should check for synthesized bit on an annotation
bpatel
parents:
14549
diff
changeset
|
1850 |
for (AnnotationValue av : annotationTypeValues) { |
d03c311f44e6
8005092: javadoc should check for synthesized bit on an annotation
bpatel
parents:
14549
diff
changeset
|
1851 |
annotation.append(sep); |
d03c311f44e6
8005092: javadoc should check for synthesized bit on an annotation
bpatel
parents:
14549
diff
changeset
|
1852 |
annotation.append(annotationValueToString(av)); |
d03c311f44e6
8005092: javadoc should check for synthesized bit on an annotation
bpatel
parents:
14549
diff
changeset
|
1853 |
sep = " "; |
d03c311f44e6
8005092: javadoc should check for synthesized bit on an annotation
bpatel
parents:
14549
diff
changeset
|
1854 |
} |
d03c311f44e6
8005092: javadoc should check for synthesized bit on an annotation
bpatel
parents:
14549
diff
changeset
|
1855 |
} |
d03c311f44e6
8005092: javadoc should check for synthesized bit on an annotation
bpatel
parents:
14549
diff
changeset
|
1856 |
// If the container has 1 or more value defined and if the |
d03c311f44e6
8005092: javadoc should check for synthesized bit on an annotation
bpatel
parents:
14549
diff
changeset
|
1857 |
// repeatable type annotation is not documented, print the container. |
d03c311f44e6
8005092: javadoc should check for synthesized bit on an annotation
bpatel
parents:
14549
diff
changeset
|
1858 |
else { |
d03c311f44e6
8005092: javadoc should check for synthesized bit on an annotation
bpatel
parents:
14549
diff
changeset
|
1859 |
addAnnotations(annotationDoc, linkInfo, annotation, pairs, |
d03c311f44e6
8005092: javadoc should check for synthesized bit on an annotation
bpatel
parents:
14549
diff
changeset
|
1860 |
indent, false); |
d03c311f44e6
8005092: javadoc should check for synthesized bit on an annotation
bpatel
parents:
14549
diff
changeset
|
1861 |
} |
d03c311f44e6
8005092: javadoc should check for synthesized bit on an annotation
bpatel
parents:
14549
diff
changeset
|
1862 |
} |
d03c311f44e6
8005092: javadoc should check for synthesized bit on an annotation
bpatel
parents:
14549
diff
changeset
|
1863 |
else { |
d03c311f44e6
8005092: javadoc should check for synthesized bit on an annotation
bpatel
parents:
14549
diff
changeset
|
1864 |
addAnnotations(annotationDoc, linkInfo, annotation, pairs, |
d03c311f44e6
8005092: javadoc should check for synthesized bit on an annotation
bpatel
parents:
14549
diff
changeset
|
1865 |
indent, linkBreak); |
10 | 1866 |
} |
1867 |
annotation.append(linkBreak ? DocletConstants.NL : ""); |
|
1868 |
results.add(annotation.toString()); |
|
1869 |
} |
|
1870 |
return results; |
|
1871 |
} |
|
1872 |
||
15035
d03c311f44e6
8005092: javadoc should check for synthesized bit on an annotation
bpatel
parents:
14549
diff
changeset
|
1873 |
/** |
d03c311f44e6
8005092: javadoc should check for synthesized bit on an annotation
bpatel
parents:
14549
diff
changeset
|
1874 |
* Add annotation to the annotation string. |
d03c311f44e6
8005092: javadoc should check for synthesized bit on an annotation
bpatel
parents:
14549
diff
changeset
|
1875 |
* |
d03c311f44e6
8005092: javadoc should check for synthesized bit on an annotation
bpatel
parents:
14549
diff
changeset
|
1876 |
* @param annotationDoc the annotation being documented |
d03c311f44e6
8005092: javadoc should check for synthesized bit on an annotation
bpatel
parents:
14549
diff
changeset
|
1877 |
* @param linkInfo the information about the link |
d03c311f44e6
8005092: javadoc should check for synthesized bit on an annotation
bpatel
parents:
14549
diff
changeset
|
1878 |
* @param annotation the annotation string to which the annotation will be added |
d03c311f44e6
8005092: javadoc should check for synthesized bit on an annotation
bpatel
parents:
14549
diff
changeset
|
1879 |
* @param pairs annotation type element and value pairs |
d03c311f44e6
8005092: javadoc should check for synthesized bit on an annotation
bpatel
parents:
14549
diff
changeset
|
1880 |
* @param indent the number of extra spaces to indent the annotations. |
d03c311f44e6
8005092: javadoc should check for synthesized bit on an annotation
bpatel
parents:
14549
diff
changeset
|
1881 |
* @param linkBreak if true, add new line between each member value |
d03c311f44e6
8005092: javadoc should check for synthesized bit on an annotation
bpatel
parents:
14549
diff
changeset
|
1882 |
*/ |
d03c311f44e6
8005092: javadoc should check for synthesized bit on an annotation
bpatel
parents:
14549
diff
changeset
|
1883 |
private void addAnnotations(AnnotationTypeDoc annotationDoc, LinkInfoImpl linkInfo, |
d03c311f44e6
8005092: javadoc should check for synthesized bit on an annotation
bpatel
parents:
14549
diff
changeset
|
1884 |
StringBuilder annotation, AnnotationDesc.ElementValuePair[] pairs, |
d03c311f44e6
8005092: javadoc should check for synthesized bit on an annotation
bpatel
parents:
14549
diff
changeset
|
1885 |
int indent, boolean linkBreak) { |
d03c311f44e6
8005092: javadoc should check for synthesized bit on an annotation
bpatel
parents:
14549
diff
changeset
|
1886 |
linkInfo.label = "@" + annotationDoc.name(); |
d03c311f44e6
8005092: javadoc should check for synthesized bit on an annotation
bpatel
parents:
14549
diff
changeset
|
1887 |
annotation.append(getLink(linkInfo)); |
d03c311f44e6
8005092: javadoc should check for synthesized bit on an annotation
bpatel
parents:
14549
diff
changeset
|
1888 |
if (pairs.length > 0) { |
d03c311f44e6
8005092: javadoc should check for synthesized bit on an annotation
bpatel
parents:
14549
diff
changeset
|
1889 |
annotation.append('('); |
d03c311f44e6
8005092: javadoc should check for synthesized bit on an annotation
bpatel
parents:
14549
diff
changeset
|
1890 |
for (int j = 0; j < pairs.length; j++) { |
d03c311f44e6
8005092: javadoc should check for synthesized bit on an annotation
bpatel
parents:
14549
diff
changeset
|
1891 |
if (j > 0) { |
d03c311f44e6
8005092: javadoc should check for synthesized bit on an annotation
bpatel
parents:
14549
diff
changeset
|
1892 |
annotation.append(","); |
d03c311f44e6
8005092: javadoc should check for synthesized bit on an annotation
bpatel
parents:
14549
diff
changeset
|
1893 |
if (linkBreak) { |
d03c311f44e6
8005092: javadoc should check for synthesized bit on an annotation
bpatel
parents:
14549
diff
changeset
|
1894 |
annotation.append(DocletConstants.NL); |
d03c311f44e6
8005092: javadoc should check for synthesized bit on an annotation
bpatel
parents:
14549
diff
changeset
|
1895 |
int spaces = annotationDoc.name().length() + 2; |
d03c311f44e6
8005092: javadoc should check for synthesized bit on an annotation
bpatel
parents:
14549
diff
changeset
|
1896 |
for (int k = 0; k < (spaces + indent); k++) { |
d03c311f44e6
8005092: javadoc should check for synthesized bit on an annotation
bpatel
parents:
14549
diff
changeset
|
1897 |
annotation.append(' '); |
d03c311f44e6
8005092: javadoc should check for synthesized bit on an annotation
bpatel
parents:
14549
diff
changeset
|
1898 |
} |
d03c311f44e6
8005092: javadoc should check for synthesized bit on an annotation
bpatel
parents:
14549
diff
changeset
|
1899 |
} |
d03c311f44e6
8005092: javadoc should check for synthesized bit on an annotation
bpatel
parents:
14549
diff
changeset
|
1900 |
} |
d03c311f44e6
8005092: javadoc should check for synthesized bit on an annotation
bpatel
parents:
14549
diff
changeset
|
1901 |
annotation.append(getDocLink(LinkInfoImpl.CONTEXT_ANNOTATION, |
d03c311f44e6
8005092: javadoc should check for synthesized bit on an annotation
bpatel
parents:
14549
diff
changeset
|
1902 |
pairs[j].element(), pairs[j].element().name(), false)); |
d03c311f44e6
8005092: javadoc should check for synthesized bit on an annotation
bpatel
parents:
14549
diff
changeset
|
1903 |
annotation.append('='); |
d03c311f44e6
8005092: javadoc should check for synthesized bit on an annotation
bpatel
parents:
14549
diff
changeset
|
1904 |
AnnotationValue annotationValue = pairs[j].value(); |
d03c311f44e6
8005092: javadoc should check for synthesized bit on an annotation
bpatel
parents:
14549
diff
changeset
|
1905 |
List<AnnotationValue> annotationTypeValues = new ArrayList<AnnotationValue>(); |
d03c311f44e6
8005092: javadoc should check for synthesized bit on an annotation
bpatel
parents:
14549
diff
changeset
|
1906 |
if (annotationValue.value() instanceof AnnotationValue[]) { |
d03c311f44e6
8005092: javadoc should check for synthesized bit on an annotation
bpatel
parents:
14549
diff
changeset
|
1907 |
AnnotationValue[] annotationArray = |
d03c311f44e6
8005092: javadoc should check for synthesized bit on an annotation
bpatel
parents:
14549
diff
changeset
|
1908 |
(AnnotationValue[]) annotationValue.value(); |
d03c311f44e6
8005092: javadoc should check for synthesized bit on an annotation
bpatel
parents:
14549
diff
changeset
|
1909 |
annotationTypeValues.addAll(Arrays.asList(annotationArray)); |
d03c311f44e6
8005092: javadoc should check for synthesized bit on an annotation
bpatel
parents:
14549
diff
changeset
|
1910 |
} else { |
d03c311f44e6
8005092: javadoc should check for synthesized bit on an annotation
bpatel
parents:
14549
diff
changeset
|
1911 |
annotationTypeValues.add(annotationValue); |
d03c311f44e6
8005092: javadoc should check for synthesized bit on an annotation
bpatel
parents:
14549
diff
changeset
|
1912 |
} |
d03c311f44e6
8005092: javadoc should check for synthesized bit on an annotation
bpatel
parents:
14549
diff
changeset
|
1913 |
annotation.append(annotationTypeValues.size() == 1 ? "" : "{"); |
d03c311f44e6
8005092: javadoc should check for synthesized bit on an annotation
bpatel
parents:
14549
diff
changeset
|
1914 |
String sep = ""; |
d03c311f44e6
8005092: javadoc should check for synthesized bit on an annotation
bpatel
parents:
14549
diff
changeset
|
1915 |
for (AnnotationValue av : annotationTypeValues) { |
d03c311f44e6
8005092: javadoc should check for synthesized bit on an annotation
bpatel
parents:
14549
diff
changeset
|
1916 |
annotation.append(sep); |
d03c311f44e6
8005092: javadoc should check for synthesized bit on an annotation
bpatel
parents:
14549
diff
changeset
|
1917 |
annotation.append(annotationValueToString(av)); |
d03c311f44e6
8005092: javadoc should check for synthesized bit on an annotation
bpatel
parents:
14549
diff
changeset
|
1918 |
sep = ","; |
d03c311f44e6
8005092: javadoc should check for synthesized bit on an annotation
bpatel
parents:
14549
diff
changeset
|
1919 |
} |
d03c311f44e6
8005092: javadoc should check for synthesized bit on an annotation
bpatel
parents:
14549
diff
changeset
|
1920 |
annotation.append(annotationTypeValues.size() == 1 ? "" : "}"); |
d03c311f44e6
8005092: javadoc should check for synthesized bit on an annotation
bpatel
parents:
14549
diff
changeset
|
1921 |
isContainerDocumented = false; |
d03c311f44e6
8005092: javadoc should check for synthesized bit on an annotation
bpatel
parents:
14549
diff
changeset
|
1922 |
} |
d03c311f44e6
8005092: javadoc should check for synthesized bit on an annotation
bpatel
parents:
14549
diff
changeset
|
1923 |
annotation.append(")"); |
d03c311f44e6
8005092: javadoc should check for synthesized bit on an annotation
bpatel
parents:
14549
diff
changeset
|
1924 |
} |
d03c311f44e6
8005092: javadoc should check for synthesized bit on an annotation
bpatel
parents:
14549
diff
changeset
|
1925 |
} |
d03c311f44e6
8005092: javadoc should check for synthesized bit on an annotation
bpatel
parents:
14549
diff
changeset
|
1926 |
|
d03c311f44e6
8005092: javadoc should check for synthesized bit on an annotation
bpatel
parents:
14549
diff
changeset
|
1927 |
/** |
d03c311f44e6
8005092: javadoc should check for synthesized bit on an annotation
bpatel
parents:
14549
diff
changeset
|
1928 |
* Check if the annotation contains an array of annotation as a value. This |
d03c311f44e6
8005092: javadoc should check for synthesized bit on an annotation
bpatel
parents:
14549
diff
changeset
|
1929 |
* check is to verify if a repeatable type annotation is present or not. |
d03c311f44e6
8005092: javadoc should check for synthesized bit on an annotation
bpatel
parents:
14549
diff
changeset
|
1930 |
* |
d03c311f44e6
8005092: javadoc should check for synthesized bit on an annotation
bpatel
parents:
14549
diff
changeset
|
1931 |
* @param pairs annotation type element and value pairs |
d03c311f44e6
8005092: javadoc should check for synthesized bit on an annotation
bpatel
parents:
14549
diff
changeset
|
1932 |
* |
d03c311f44e6
8005092: javadoc should check for synthesized bit on an annotation
bpatel
parents:
14549
diff
changeset
|
1933 |
* @return true if the annotation contains an array of annotation as a value. |
d03c311f44e6
8005092: javadoc should check for synthesized bit on an annotation
bpatel
parents:
14549
diff
changeset
|
1934 |
*/ |
d03c311f44e6
8005092: javadoc should check for synthesized bit on an annotation
bpatel
parents:
14549
diff
changeset
|
1935 |
private boolean isAnnotationArray(AnnotationDesc.ElementValuePair[] pairs) { |
d03c311f44e6
8005092: javadoc should check for synthesized bit on an annotation
bpatel
parents:
14549
diff
changeset
|
1936 |
AnnotationValue annotationValue; |
d03c311f44e6
8005092: javadoc should check for synthesized bit on an annotation
bpatel
parents:
14549
diff
changeset
|
1937 |
for (int j = 0; j < pairs.length; j++) { |
d03c311f44e6
8005092: javadoc should check for synthesized bit on an annotation
bpatel
parents:
14549
diff
changeset
|
1938 |
annotationValue = pairs[j].value(); |
d03c311f44e6
8005092: javadoc should check for synthesized bit on an annotation
bpatel
parents:
14549
diff
changeset
|
1939 |
if (annotationValue.value() instanceof AnnotationValue[]) { |
d03c311f44e6
8005092: javadoc should check for synthesized bit on an annotation
bpatel
parents:
14549
diff
changeset
|
1940 |
AnnotationValue[] annotationArray = |
d03c311f44e6
8005092: javadoc should check for synthesized bit on an annotation
bpatel
parents:
14549
diff
changeset
|
1941 |
(AnnotationValue[]) annotationValue.value(); |
d03c311f44e6
8005092: javadoc should check for synthesized bit on an annotation
bpatel
parents:
14549
diff
changeset
|
1942 |
if (annotationArray.length > 1) { |
d03c311f44e6
8005092: javadoc should check for synthesized bit on an annotation
bpatel
parents:
14549
diff
changeset
|
1943 |
if (annotationArray[0].value() instanceof AnnotationDesc) { |
d03c311f44e6
8005092: javadoc should check for synthesized bit on an annotation
bpatel
parents:
14549
diff
changeset
|
1944 |
AnnotationTypeDoc annotationDoc = |
d03c311f44e6
8005092: javadoc should check for synthesized bit on an annotation
bpatel
parents:
14549
diff
changeset
|
1945 |
((AnnotationDesc) annotationArray[0].value()).annotationType(); |
d03c311f44e6
8005092: javadoc should check for synthesized bit on an annotation
bpatel
parents:
14549
diff
changeset
|
1946 |
isContainerDocumented = true; |
d03c311f44e6
8005092: javadoc should check for synthesized bit on an annotation
bpatel
parents:
14549
diff
changeset
|
1947 |
if (Util.isDocumentedAnnotation(annotationDoc)) { |
d03c311f44e6
8005092: javadoc should check for synthesized bit on an annotation
bpatel
parents:
14549
diff
changeset
|
1948 |
isAnnotationDocumented = true; |
d03c311f44e6
8005092: javadoc should check for synthesized bit on an annotation
bpatel
parents:
14549
diff
changeset
|
1949 |
} |
d03c311f44e6
8005092: javadoc should check for synthesized bit on an annotation
bpatel
parents:
14549
diff
changeset
|
1950 |
return true; |
d03c311f44e6
8005092: javadoc should check for synthesized bit on an annotation
bpatel
parents:
14549
diff
changeset
|
1951 |
} |
d03c311f44e6
8005092: javadoc should check for synthesized bit on an annotation
bpatel
parents:
14549
diff
changeset
|
1952 |
} |
d03c311f44e6
8005092: javadoc should check for synthesized bit on an annotation
bpatel
parents:
14549
diff
changeset
|
1953 |
} |
d03c311f44e6
8005092: javadoc should check for synthesized bit on an annotation
bpatel
parents:
14549
diff
changeset
|
1954 |
} |
d03c311f44e6
8005092: javadoc should check for synthesized bit on an annotation
bpatel
parents:
14549
diff
changeset
|
1955 |
return false; |
d03c311f44e6
8005092: javadoc should check for synthesized bit on an annotation
bpatel
parents:
14549
diff
changeset
|
1956 |
} |
d03c311f44e6
8005092: javadoc should check for synthesized bit on an annotation
bpatel
parents:
14549
diff
changeset
|
1957 |
|
10 | 1958 |
private String annotationValueToString(AnnotationValue annotationValue) { |
1959 |
if (annotationValue.value() instanceof Type) { |
|
1960 |
Type type = (Type) annotationValue.value(); |
|
1961 |
if (type.asClassDoc() != null) { |
|
14542 | 1962 |
LinkInfoImpl linkInfo = new LinkInfoImpl(configuration, |
10 | 1963 |
LinkInfoImpl.CONTEXT_ANNOTATION, type); |
1964 |
linkInfo.label = (type.asClassDoc().isIncluded() ? |
|
1965 |
type.typeName() : |
|
1966 |
type.qualifiedTypeName()) + type.dimension() + ".class"; |
|
1967 |
return getLink(linkInfo); |
|
1968 |
} else { |
|
1969 |
return type.typeName() + type.dimension() + ".class"; |
|
1970 |
} |
|
1971 |
} else if (annotationValue.value() instanceof AnnotationDesc) { |
|
1789
7ac8c0815000
6765045: Remove rawtypes warnings from langtools
mcimadamore
parents:
1787
diff
changeset
|
1972 |
List<String> list = getAnnotations(0, |
10 | 1973 |
new AnnotationDesc[]{(AnnotationDesc) annotationValue.value()}, |
1974 |
false); |
|
14263 | 1975 |
StringBuilder buf = new StringBuilder(); |
1976 |
for (String s: list) { |
|
1977 |
buf.append(s); |
|
10 | 1978 |
} |
1979 |
return buf.toString(); |
|
1980 |
} else if (annotationValue.value() instanceof MemberDoc) { |
|
1981 |
return getDocLink(LinkInfoImpl.CONTEXT_ANNOTATION, |
|
1982 |
(MemberDoc) annotationValue.value(), |
|
1983 |
((MemberDoc) annotationValue.value()).name(), false); |
|
1984 |
} else { |
|
1985 |
return annotationValue.toString(); |
|
1986 |
} |
|
1987 |
} |
|
1988 |
||
1989 |
/** |
|
1990 |
* Return the configuation for this doclet. |
|
1991 |
* |
|
1992 |
* @return the configuration for this doclet. |
|
1993 |
*/ |
|
1994 |
public Configuration configuration() { |
|
1995 |
return configuration; |
|
1996 |
} |
|
1997 |
} |