author | jjg |
Thu, 16 Nov 2017 15:17:47 -0800 | |
changeset 47851 | 6a9bb4f77d50 |
parent 47850 | 4a28dc8a86c2 |
child 47852 | 90e0110a05f6 |
permissions | -rw-r--r-- |
10 | 1 |
/* |
45417 | 2 |
* Copyright (c) 1998, 2017, 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 |
||
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
26 |
package jdk.javadoc.internal.doclets.formats.html; |
10 | 27 |
|
47849 | 28 |
import jdk.javadoc.internal.doclets.formats.html.markup.Head; |
47846 | 29 |
import jdk.javadoc.internal.doclets.formats.html.markup.TableHeader; |
30 |
||
10 | 31 |
import java.util.*; |
24603
43e7e44d63da
8043186: javac test langtools/tools/javac/util/StringUtilsTest.java fails
jlahoda
parents:
24221
diff
changeset
|
32 |
import java.util.regex.Matcher; |
43e7e44d63da
8043186: javac test langtools/tools/javac/util/StringUtilsTest.java fails
jlahoda
parents:
24221
diff
changeset
|
33 |
import java.util.regex.Pattern; |
10 | 34 |
|
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
35 |
import javax.lang.model.element.AnnotationMirror; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
36 |
import javax.lang.model.element.AnnotationValue; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
37 |
import javax.lang.model.element.Element; |
47328
d18df41954ba
8187521: In some corner cases the javadoc tool can reuse id attribute
jjg
parents:
47300
diff
changeset
|
38 |
import javax.lang.model.element.ElementKind; |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
39 |
import javax.lang.model.element.ExecutableElement; |
36526 | 40 |
import javax.lang.model.element.ModuleElement; |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
41 |
import javax.lang.model.element.Name; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
42 |
import javax.lang.model.element.PackageElement; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
43 |
import javax.lang.model.element.TypeElement; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
44 |
import javax.lang.model.element.VariableElement; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
45 |
import javax.lang.model.type.DeclaredType; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
46 |
import javax.lang.model.type.TypeMirror; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
47 |
import javax.lang.model.util.SimpleAnnotationValueVisitor9; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
48 |
import javax.lang.model.util.SimpleElementVisitor9; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
49 |
import javax.lang.model.util.SimpleTypeVisitor9; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
50 |
|
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
51 |
import com.sun.source.doctree.AttributeTree; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
52 |
import com.sun.source.doctree.AttributeTree.ValueKind; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
53 |
import com.sun.source.doctree.CommentTree; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
54 |
import com.sun.source.doctree.DocRootTree; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
55 |
import com.sun.source.doctree.DocTree; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
56 |
import com.sun.source.doctree.DocTree.Kind; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
57 |
import com.sun.source.doctree.EndElementTree; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
58 |
import com.sun.source.doctree.EntityTree; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
59 |
import com.sun.source.doctree.ErroneousTree; |
40587 | 60 |
import com.sun.source.doctree.IndexTree; |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
61 |
import com.sun.source.doctree.InheritDocTree; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
62 |
import com.sun.source.doctree.LinkTree; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
63 |
import com.sun.source.doctree.LiteralTree; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
64 |
import com.sun.source.doctree.SeeTree; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
65 |
import com.sun.source.doctree.StartElementTree; |
46184
f1325703ea85
8173425: Javadoc needs a new tag to specify the summary.
ksrini
parents:
46080
diff
changeset
|
66 |
import com.sun.source.doctree.SummaryTree; |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
67 |
import com.sun.source.doctree.TextTree; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
68 |
import com.sun.source.util.SimpleDocTreeVisitor; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
69 |
|
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
70 |
import jdk.javadoc.internal.doclets.formats.html.markup.Comment; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
71 |
import jdk.javadoc.internal.doclets.formats.html.markup.ContentBuilder; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
72 |
import jdk.javadoc.internal.doclets.formats.html.markup.DocType; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
73 |
import jdk.javadoc.internal.doclets.formats.html.markup.HtmlAttr; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
74 |
import jdk.javadoc.internal.doclets.formats.html.markup.HtmlConstants; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
75 |
import jdk.javadoc.internal.doclets.formats.html.markup.HtmlDocWriter; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
76 |
import jdk.javadoc.internal.doclets.formats.html.markup.HtmlDocument; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
77 |
import jdk.javadoc.internal.doclets.formats.html.markup.HtmlStyle; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
78 |
import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTag; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
79 |
import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTree; |
47850 | 80 |
import jdk.javadoc.internal.doclets.formats.html.markup.Links; |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
81 |
import jdk.javadoc.internal.doclets.formats.html.markup.RawHtml; |
47847 | 82 |
import jdk.javadoc.internal.doclets.formats.html.markup.Script; |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
83 |
import jdk.javadoc.internal.doclets.formats.html.markup.StringContent; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
84 |
import jdk.javadoc.internal.doclets.toolkit.AnnotationTypeWriter; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
85 |
import jdk.javadoc.internal.doclets.toolkit.ClassWriter; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
86 |
import jdk.javadoc.internal.doclets.toolkit.Content; |
40303 | 87 |
import jdk.javadoc.internal.doclets.toolkit.Messages; |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
88 |
import jdk.javadoc.internal.doclets.toolkit.PackageSummaryWriter; |
40303 | 89 |
import jdk.javadoc.internal.doclets.toolkit.Resources; |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
90 |
import jdk.javadoc.internal.doclets.toolkit.taglets.DocRootTaglet; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
91 |
import jdk.javadoc.internal.doclets.toolkit.taglets.TagletWriter; |
40587 | 92 |
import jdk.javadoc.internal.doclets.toolkit.util.CommentHelper; |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
93 |
import jdk.javadoc.internal.doclets.toolkit.util.DocFile; |
40587 | 94 |
import jdk.javadoc.internal.doclets.toolkit.util.DocFileIOException; |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
95 |
import jdk.javadoc.internal.doclets.toolkit.util.DocLink; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
96 |
import jdk.javadoc.internal.doclets.toolkit.util.DocPath; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
97 |
import jdk.javadoc.internal.doclets.toolkit.util.DocPaths; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
98 |
import jdk.javadoc.internal.doclets.toolkit.util.DocletConstants; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
99 |
import jdk.javadoc.internal.doclets.toolkit.util.ImplementedMethods; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
100 |
import jdk.javadoc.internal.doclets.toolkit.util.Utils; |
47395
2ea4edfdef8e
8157000: Do not generate javadoc for overridden method with no spec change
ksrini
parents:
47328
diff
changeset
|
101 |
import jdk.javadoc.internal.doclets.toolkit.util.VisibleMemberMap; |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
102 |
|
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
103 |
import static com.sun.source.doctree.DocTree.Kind.*; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
104 |
import static jdk.javadoc.internal.doclets.toolkit.util.CommentHelper.SPACER; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
105 |
|
10 | 106 |
|
107 |
/** |
|
108 |
* Class for the Html Format Code Generation specific to JavaDoc. |
|
109 |
* This Class contains methods related to the Html Code Generation which |
|
110 |
* are used extensively while generating the entire documentation. |
|
111 |
* |
|
14260
727a84636f12
8000665: fix "internal API" comments on javadoc files
jjg
parents:
14259
diff
changeset
|
112 |
* <p><b>This is NOT part of any supported API. |
727a84636f12
8000665: fix "internal API" comments on javadoc files
jjg
parents:
14259
diff
changeset
|
113 |
* 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
|
114 |
* 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
|
115 |
* deletion without notice.</b> |
727a84636f12
8000665: fix "internal API" comments on javadoc files
jjg
parents:
14259
diff
changeset
|
116 |
* |
10 | 117 |
* @author Atul M Dambalkar |
118 |
* @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
|
119 |
* @author Bhavesh Patel (Modified) |
10 | 120 |
*/ |
121 |
public class HtmlDocletWriter extends HtmlDocWriter { |
|
122 |
||
123 |
/** |
|
124 |
* Relative path from the file getting generated to the destination |
|
125 |
* 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
|
126 |
* "java/lang/Object.html", then the path to the root is "../..". |
10 | 127 |
* This string can be empty if the file getting generated is in |
128 |
* the destination directory. |
|
129 |
*/ |
|
14357
faf9cde2817b
8000741: refactor javadoc to use abstraction to handle relative paths
jjg
parents:
14266
diff
changeset
|
130 |
public final DocPath pathToRoot; |
10 | 131 |
|
132 |
/** |
|
14357
faf9cde2817b
8000741: refactor javadoc to use abstraction to handle relative paths
jjg
parents:
14266
diff
changeset
|
133 |
* Platform-independent path from the current or the |
10 | 134 |
* destination directory to the file getting generated. |
135 |
* Used when creating the file. |
|
136 |
*/ |
|
14357
faf9cde2817b
8000741: refactor javadoc to use abstraction to handle relative paths
jjg
parents:
14266
diff
changeset
|
137 |
public final DocPath path; |
10 | 138 |
|
139 |
/** |
|
140 |
* Name of the file getting generated. If the file getting generated is |
|
141 |
* "java/lang/Object.html", then the filename is "Object.html". |
|
142 |
*/ |
|
14357
faf9cde2817b
8000741: refactor javadoc to use abstraction to handle relative paths
jjg
parents:
14266
diff
changeset
|
143 |
public final DocPath filename; |
10 | 144 |
|
145 |
/** |
|
146 |
* The global configuration information for this run. |
|
147 |
*/ |
|
45417 | 148 |
public final HtmlConfiguration configuration; |
10 | 149 |
|
25454
376a52c9540c
8039028: [javadoc] refactor the usage of Util.java
ksrini
parents:
24603
diff
changeset
|
150 |
protected final Utils utils; |
376a52c9540c
8039028: [javadoc] refactor the usage of Util.java
ksrini
parents:
24603
diff
changeset
|
151 |
|
40303 | 152 |
protected final Contents contents; |
153 |
||
154 |
protected final Messages messages; |
|
155 |
||
156 |
protected final Resources resources; |
|
157 |
||
47850 | 158 |
protected final Links links; |
159 |
||
10 | 160 |
/** |
7614
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
161 |
* 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
|
162 |
*/ |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
163 |
protected boolean printedAnnotationHeading = false; |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
164 |
|
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
165 |
/** |
20237
b6d89903c867
8015249: javadoc fails to document static final fields in annotation types
bpatel
parents:
19920
diff
changeset
|
166 |
* To check whether annotation field heading is printed or not. |
b6d89903c867
8015249: javadoc fails to document static final fields in annotation types
bpatel
parents:
19920
diff
changeset
|
167 |
*/ |
b6d89903c867
8015249: javadoc fails to document static final fields in annotation types
bpatel
parents:
19920
diff
changeset
|
168 |
protected boolean printedAnnotationFieldHeading = false; |
b6d89903c867
8015249: javadoc fails to document static final fields in annotation types
bpatel
parents:
19920
diff
changeset
|
169 |
|
b6d89903c867
8015249: javadoc fails to document static final fields in annotation types
bpatel
parents:
19920
diff
changeset
|
170 |
/** |
15035
d03c311f44e6
8005092: javadoc should check for synthesized bit on an annotation
bpatel
parents:
14549
diff
changeset
|
171 |
* 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
|
172 |
*/ |
d03c311f44e6
8005092: javadoc should check for synthesized bit on an annotation
bpatel
parents:
14549
diff
changeset
|
173 |
private boolean isAnnotationDocumented = false; |
d03c311f44e6
8005092: javadoc should check for synthesized bit on an annotation
bpatel
parents:
14549
diff
changeset
|
174 |
|
d03c311f44e6
8005092: javadoc should check for synthesized bit on an annotation
bpatel
parents:
14549
diff
changeset
|
175 |
/** |
d03c311f44e6
8005092: javadoc should check for synthesized bit on an annotation
bpatel
parents:
14549
diff
changeset
|
176 |
* 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
|
177 |
*/ |
d03c311f44e6
8005092: javadoc should check for synthesized bit on an annotation
bpatel
parents:
14549
diff
changeset
|
178 |
private boolean isContainerDocumented = false; |
d03c311f44e6
8005092: javadoc should check for synthesized bit on an annotation
bpatel
parents:
14549
diff
changeset
|
179 |
|
33920 | 180 |
HtmlTree fixedNavDiv = new HtmlTree(HtmlTag.DIV); |
181 |
||
36500
d31e4986dc8b
8149139: [javadoc] Modify Content to accept CharSequence
ksrini
parents:
36038
diff
changeset
|
182 |
final static Pattern IMPROPER_HTML_CHARS = Pattern.compile(".*[&<>].*"); |
d31e4986dc8b
8149139: [javadoc] Modify Content to accept CharSequence
ksrini
parents:
36038
diff
changeset
|
183 |
|
15035
d03c311f44e6
8005092: javadoc should check for synthesized bit on an annotation
bpatel
parents:
14549
diff
changeset
|
184 |
/** |
47847 | 185 |
* The window title of this file. |
186 |
*/ |
|
187 |
protected String winTitle; |
|
188 |
||
189 |
protected Script mainBodyScript; |
|
190 |
||
191 |
/** |
|
10 | 192 |
* Constructor to construct the HtmlStandardWriter object. |
193 |
* |
|
14357
faf9cde2817b
8000741: refactor javadoc to use abstraction to handle relative paths
jjg
parents:
14266
diff
changeset
|
194 |
* @param path File to be generated. |
10 | 195 |
*/ |
45417 | 196 |
public HtmlDocletWriter(HtmlConfiguration configuration, DocPath path) { |
14357
faf9cde2817b
8000741: refactor javadoc to use abstraction to handle relative paths
jjg
parents:
14266
diff
changeset
|
197 |
super(configuration, path); |
10 | 198 |
this.configuration = configuration; |
40303 | 199 |
this.contents = configuration.contents; |
200 |
this.messages = configuration.messages; |
|
201 |
this.resources = configuration.resources; |
|
47850 | 202 |
this.links = configuration.links; |
25454
376a52c9540c
8039028: [javadoc] refactor the usage of Util.java
ksrini
parents:
24603
diff
changeset
|
203 |
this.utils = configuration.utils; |
10 | 204 |
this.path = path; |
14357
faf9cde2817b
8000741: refactor javadoc to use abstraction to handle relative paths
jjg
parents:
14266
diff
changeset
|
205 |
this.pathToRoot = path.parent().invert(); |
faf9cde2817b
8000741: refactor javadoc to use abstraction to handle relative paths
jjg
parents:
14266
diff
changeset
|
206 |
this.filename = path.basename(); |
10 | 207 |
} |
208 |
||
209 |
/** |
|
210 |
* Replace {@docRoot} tag used in options that accept HTML text, such |
|
211 |
* as -header, -footer, -top and -bottom, and when converting a relative |
|
212 |
* HREF where commentTagsToString inserts a {@docRoot} where one was |
|
213 |
* missing. (Also see DocRootTaglet for {@docRoot} tags in doc |
|
214 |
* comments.) |
|
215 |
* <p> |
|
216 |
* Replace {@docRoot} tag in htmlstr with the relative path to the |
|
217 |
* destination directory from the directory where the file is being |
|
218 |
* written, looping to handle all such tags in htmlstr. |
|
219 |
* <p> |
|
220 |
* For example, for "-d docs" and -header containing {@docRoot}, when |
|
221 |
* the HTML page for source file p/C1.java is being generated, the |
|
222 |
* {@docRoot} tag would be inserted into the header as "../", |
|
223 |
* the relative path from docs/p/ to docs/ (the document root). |
|
224 |
* <p> |
|
225 |
* Note: This doc comment was written with '&#064;' representing '@' |
|
226 |
* to prevent the inline tag from being interpreted. |
|
227 |
*/ |
|
228 |
public String replaceDocRootDir(String htmlstr) { |
|
229 |
// Return if no inline tags exist |
|
230 |
int index = htmlstr.indexOf("{@"); |
|
231 |
if (index < 0) { |
|
232 |
return htmlstr; |
|
233 |
} |
|
24603
43e7e44d63da
8043186: javac test langtools/tools/javac/util/StringUtilsTest.java fails
jlahoda
parents:
24221
diff
changeset
|
234 |
Matcher docrootMatcher = docrootPattern.matcher(htmlstr); |
43e7e44d63da
8043186: javac test langtools/tools/javac/util/StringUtilsTest.java fails
jlahoda
parents:
24221
diff
changeset
|
235 |
if (!docrootMatcher.find()) { |
10 | 236 |
return htmlstr; |
237 |
} |
|
8631
664f84942e74
6866185: Util.getPackageSourcePath should use lastIndexOf not indexOf and related cleanup
jjg
parents:
7681
diff
changeset
|
238 |
StringBuilder buf = new StringBuilder(); |
24603
43e7e44d63da
8043186: javac test langtools/tools/javac/util/StringUtilsTest.java fails
jlahoda
parents:
24221
diff
changeset
|
239 |
int prevEnd = 0; |
43e7e44d63da
8043186: javac test langtools/tools/javac/util/StringUtilsTest.java fails
jlahoda
parents:
24221
diff
changeset
|
240 |
do { |
43e7e44d63da
8043186: javac test langtools/tools/javac/util/StringUtilsTest.java fails
jlahoda
parents:
24221
diff
changeset
|
241 |
int match = docrootMatcher.start(); |
43e7e44d63da
8043186: javac test langtools/tools/javac/util/StringUtilsTest.java fails
jlahoda
parents:
24221
diff
changeset
|
242 |
// append htmlstr up to start of next {@docroot} |
43e7e44d63da
8043186: javac test langtools/tools/javac/util/StringUtilsTest.java fails
jlahoda
parents:
24221
diff
changeset
|
243 |
buf.append(htmlstr.substring(prevEnd, match)); |
43e7e44d63da
8043186: javac test langtools/tools/javac/util/StringUtilsTest.java fails
jlahoda
parents:
24221
diff
changeset
|
244 |
prevEnd = docrootMatcher.end(); |
43e7e44d63da
8043186: javac test langtools/tools/javac/util/StringUtilsTest.java fails
jlahoda
parents:
24221
diff
changeset
|
245 |
if (configuration.docrootparent.length() > 0 && htmlstr.startsWith("/..", prevEnd)) { |
22005
4270ada5dcd1
8025416: doclet not substituting {@docRoot} in some cases
bpatel
parents:
21494
diff
changeset
|
246 |
// Insert the absolute link if {@docRoot} is followed by "/..". |
9608 | 247 |
buf.append(configuration.docrootparent); |
24603
43e7e44d63da
8043186: javac test langtools/tools/javac/util/StringUtilsTest.java fails
jlahoda
parents:
24221
diff
changeset
|
248 |
prevEnd += 3; |
9608 | 249 |
} else { |
250 |
// Insert relative path where {@docRoot} was located |
|
14357
faf9cde2817b
8000741: refactor javadoc to use abstraction to handle relative paths
jjg
parents:
14266
diff
changeset
|
251 |
buf.append(pathToRoot.isEmpty() ? "." : pathToRoot.getPath()); |
22005
4270ada5dcd1
8025416: doclet not substituting {@docRoot} in some cases
bpatel
parents:
21494
diff
changeset
|
252 |
} |
4270ada5dcd1
8025416: doclet not substituting {@docRoot} in some cases
bpatel
parents:
21494
diff
changeset
|
253 |
// Append slash if next character is not a slash |
24603
43e7e44d63da
8043186: javac test langtools/tools/javac/util/StringUtilsTest.java fails
jlahoda
parents:
24221
diff
changeset
|
254 |
if (prevEnd < htmlstr.length() && htmlstr.charAt(prevEnd) != '/') { |
22005
4270ada5dcd1
8025416: doclet not substituting {@docRoot} in some cases
bpatel
parents:
21494
diff
changeset
|
255 |
buf.append('/'); |
10 | 256 |
} |
24603
43e7e44d63da
8043186: javac test langtools/tools/javac/util/StringUtilsTest.java fails
jlahoda
parents:
24221
diff
changeset
|
257 |
} while (docrootMatcher.find()); |
43e7e44d63da
8043186: javac test langtools/tools/javac/util/StringUtilsTest.java fails
jlahoda
parents:
24221
diff
changeset
|
258 |
buf.append(htmlstr.substring(prevEnd)); |
10 | 259 |
return buf.toString(); |
260 |
} |
|
24603
43e7e44d63da
8043186: javac test langtools/tools/javac/util/StringUtilsTest.java fails
jlahoda
parents:
24221
diff
changeset
|
261 |
//where: |
43e7e44d63da
8043186: javac test langtools/tools/javac/util/StringUtilsTest.java fails
jlahoda
parents:
24221
diff
changeset
|
262 |
// Note: {@docRoot} is not case sensitive when passed in w/command line option: |
43e7e44d63da
8043186: javac test langtools/tools/javac/util/StringUtilsTest.java fails
jlahoda
parents:
24221
diff
changeset
|
263 |
private static final Pattern docrootPattern = |
43e7e44d63da
8043186: javac test langtools/tools/javac/util/StringUtilsTest.java fails
jlahoda
parents:
24221
diff
changeset
|
264 |
Pattern.compile(Pattern.quote("{@docroot}"), Pattern.CASE_INSENSITIVE); |
10 | 265 |
|
266 |
/** |
|
7614
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
267 |
* 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
|
268 |
* |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
269 |
* @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
|
270 |
* @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
|
271 |
*/ |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
272 |
public Content getAllClassesLinkScript(String id) { |
47847 | 273 |
Script script = new Script("<!--\n" + |
274 |
" allClassesLink = document.getElementById(") |
|
275 |
.appendStringLiteral(id) |
|
276 |
.append(");\n" + |
|
40303 | 277 |
" if(window==top) {\n" + |
278 |
" allClassesLink.style.display = \"block\";\n" + |
|
279 |
" }\n" + |
|
280 |
" else {\n" + |
|
281 |
" allClassesLink.style.display = \"none\";\n" + |
|
282 |
" }\n" + |
|
47847 | 283 |
" //-->\n"); |
284 |
Content div = HtmlTree.DIV(script.asContent()); |
|
40303 | 285 |
Content div_noscript = HtmlTree.DIV(contents.noScriptMessage); |
29957
7740f9657f56
8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents:
26900
diff
changeset
|
286 |
Content noScript = HtmlTree.NOSCRIPT(div_noscript); |
7740f9657f56
8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents:
26900
diff
changeset
|
287 |
div.addContent(noScript); |
7614
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
288 |
return div; |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
289 |
} |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
290 |
|
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
291 |
/** |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
292 |
* Add method information. |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
293 |
* |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
294 |
* @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
|
295 |
* @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
|
296 |
*/ |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
297 |
private void addMethodInfo(ExecutableElement method, Content dl) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
298 |
TypeElement enclosing = utils.getEnclosingTypeElement(method); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
299 |
List<? extends TypeMirror> intfacs = enclosing.getInterfaces(); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
300 |
ExecutableElement overriddenMethod = utils.overriddenMethod(method); |
2216
b124d5c924eb
6786690: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - DL tag and nesting issue
bpatel
parents:
2086
diff
changeset
|
301 |
// 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
|
302 |
// 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
|
303 |
// printed, do not print this section. |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
304 |
if ((!intfacs.isEmpty() |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
305 |
&& new ImplementedMethods(method, this.configuration).build().isEmpty() == false) |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
306 |
|| overriddenMethod != null) { |
7614
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
307 |
MethodWriterImpl.addImplementsInfo(this, method, dl); |
10 | 308 |
if (overriddenMethod != null) { |
7614
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
309 |
MethodWriterImpl.addOverridden(this, |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
310 |
utils.overriddenType(method), |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
311 |
overriddenMethod, |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
312 |
dl); |
10 | 313 |
} |
314 |
} |
|
315 |
} |
|
316 |
||
7614
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
317 |
/** |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
318 |
* Adds the tags information. |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
319 |
* |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
320 |
* @param e the Element for which the tags will be generated |
7614
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
321 |
* @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
|
322 |
*/ |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
323 |
protected void addTagsInfo(Element e, Content htmltree) { |
7614
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
324 |
if (configuration.nocomment) { |
10 | 325 |
return; |
326 |
} |
|
7614
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
327 |
Content dl = new HtmlTree(HtmlTag.DL); |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
328 |
if (utils.isExecutableElement(e) && !utils.isConstructor(e)) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
329 |
addMethodInfo((ExecutableElement)e, dl); |
10 | 330 |
} |
17574
044c7e1e4d53
8012308: Remove TagletOutput in favor of direct use of Content
jjg
parents:
17573
diff
changeset
|
331 |
Content output = new ContentBuilder(); |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
332 |
TagletWriter.genTagOutput(configuration.tagletManager, e, |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
333 |
configuration.tagletManager.getCustomTaglets(e), |
10 | 334 |
getTagletWriterInstance(false), output); |
17574
044c7e1e4d53
8012308: Remove TagletOutput in favor of direct use of Content
jjg
parents:
17573
diff
changeset
|
335 |
dl.addContent(output); |
7614
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
336 |
htmltree.addContent(dl); |
10 | 337 |
} |
338 |
||
339 |
/** |
|
2216
b124d5c924eb
6786690: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - DL tag and nesting issue
bpatel
parents:
2086
diff
changeset
|
340 |
* 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
|
341 |
* 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
|
342 |
* |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
343 |
* @param field the VariableElement 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
|
344 |
* @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
|
345 |
*/ |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
346 |
protected boolean hasSerializationOverviewTags(VariableElement field) { |
17574
044c7e1e4d53
8012308: Remove TagletOutput in favor of direct use of Content
jjg
parents:
17573
diff
changeset
|
347 |
Content output = new ContentBuilder(); |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
348 |
TagletWriter.genTagOutput(configuration.tagletManager, field, |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
349 |
configuration.tagletManager.getCustomTaglets(field), |
2086
cca2603eab0b
6802694: Javadoc doclet does not display deprecated information with -nocomment option for serialized form
bpatel
parents:
1789
diff
changeset
|
350 |
getTagletWriterInstance(false), output); |
17574
044c7e1e4d53
8012308: Remove TagletOutput in favor of direct use of Content
jjg
parents:
17573
diff
changeset
|
351 |
return !output.isEmpty(); |
2086
cca2603eab0b
6802694: Javadoc doclet does not display deprecated information with -nocomment option for serialized form
bpatel
parents:
1789
diff
changeset
|
352 |
} |
cca2603eab0b
6802694: Javadoc doclet does not display deprecated information with -nocomment option for serialized form
bpatel
parents:
1789
diff
changeset
|
353 |
|
cca2603eab0b
6802694: Javadoc doclet does not display deprecated information with -nocomment option for serialized form
bpatel
parents:
1789
diff
changeset
|
354 |
/** |
10 | 355 |
* Returns a TagletWriter that knows how to write HTML. |
356 |
* |
|
357 |
* @return a TagletWriter that knows how to write HTML. |
|
358 |
*/ |
|
359 |
public TagletWriter getTagletWriterInstance(boolean isFirstSentence) { |
|
360 |
return new TagletWriterImpl(this, isFirstSentence); |
|
361 |
} |
|
362 |
||
363 |
/** |
|
7614
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
364 |
* Get Package link, with target frame. |
10 | 365 |
* |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
366 |
* @param pkg The link will be to the "package-summary.html" page for this package |
7614
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
367 |
* @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
|
368 |
* @param label tag for the link |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
369 |
* @return a content for the target package link |
10 | 370 |
*/ |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
371 |
public Content getTargetPackageLink(PackageElement pkg, String target, |
7614
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
372 |
Content label) { |
47850 | 373 |
return Links.createLink(pathString(pkg, DocPaths.PACKAGE_SUMMARY), label, "", target); |
15723
58a73dac9ee4
8006124: javadoc/doclet should be updated to support profiles
bpatel
parents:
15035
diff
changeset
|
374 |
} |
58a73dac9ee4
8006124: javadoc/doclet should be updated to support profiles
bpatel
parents:
15035
diff
changeset
|
375 |
|
36526 | 376 |
/** |
377 |
* Get Module Package link, with target frame. |
|
378 |
* |
|
379 |
* @param pkg the PackageElement |
|
380 |
* @param target name of the target frame |
|
381 |
* @param label tag for the link |
|
382 |
* @param mdle the module being documented |
|
383 |
* @return a content for the target module packages link |
|
384 |
*/ |
|
385 |
public Content getTargetModulePackageLink(PackageElement pkg, String target, |
|
386 |
Content label, ModuleElement mdle) { |
|
47850 | 387 |
return Links.createLink(pathString(pkg, DocPaths.PACKAGE_SUMMARY), |
36526 | 388 |
label, "", target); |
389 |
} |
|
390 |
||
391 |
/** |
|
392 |
* Get Module link, with target frame. |
|
393 |
* |
|
394 |
* @param target name of the target frame |
|
395 |
* @param label tag for the link |
|
396 |
* @param mdle the module being documented |
|
397 |
* @return a content for the target module link |
|
398 |
*/ |
|
399 |
public Content getTargetModuleLink(String target, Content label, ModuleElement mdle) { |
|
47850 | 400 |
return Links.createLink(pathToRoot.resolve( |
36526 | 401 |
DocPaths.moduleSummary(mdle)), label, "", target); |
402 |
} |
|
15723
58a73dac9ee4
8006124: javadoc/doclet should be updated to support profiles
bpatel
parents:
15035
diff
changeset
|
403 |
|
58a73dac9ee4
8006124: javadoc/doclet should be updated to support profiles
bpatel
parents:
15035
diff
changeset
|
404 |
/** |
7614
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
405 |
* 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
|
406 |
* |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
407 |
* @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
|
408 |
* 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
|
409 |
* Pass in null for no array |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
410 |
* @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
|
411 |
* 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
|
412 |
* @param body the body htmltree to be included in the document |
40587 | 413 |
* @throws DocFileIOException if there is a problem writing the file |
7614
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
414 |
*/ |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
415 |
public void printHtmlDocument(List<String> metakeywords, boolean includeScript, |
40587 | 416 |
Content body) throws DocFileIOException { |
47848 | 417 |
DocType htmlDocType = DocType.forVersion(configuration.htmlVersion); |
418 |
Content htmlComment = contents.newPage; |
|
47849 | 419 |
Head head = new Head(path, configuration.htmlVersion, configuration.docletVersion) |
420 |
.setTimestamp(!configuration.notimestamp) |
|
421 |
.setTitle(winTitle) |
|
422 |
.setCharset(configuration.charset) |
|
423 |
.addKeywords(metakeywords) |
|
424 |
.setStylesheets(configuration.getMainStylesheet(), configuration.getAdditionalStylesheets()) |
|
425 |
.setIndex(configuration.createindex, mainBodyScript); |
|
47848 | 426 |
|
47849 | 427 |
Content htmlTree = HtmlTree.HTML(configuration.getLocale().getLanguage(), head.toContent(), body); |
47848 | 428 |
HtmlDocument htmlDocument = new HtmlDocument(htmlDocType, htmlComment, htmlTree); |
429 |
htmlDocument.write(DocFile.createFileForOutput(configuration, path)); |
|
7614
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
430 |
} |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
431 |
|
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
432 |
/** |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
433 |
* Get the window title. |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
434 |
* |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
435 |
* @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
|
436 |
* @return the window title string |
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 |
public String getWindowTitle(String title) { |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
439 |
if (configuration.windowtitle.length() > 0) { |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
440 |
title += " (" + configuration.windowtitle + ")"; |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
441 |
} |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
442 |
return title; |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
443 |
} |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
444 |
|
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
445 |
/** |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
446 |
* 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
|
447 |
* |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
448 |
* @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
|
449 |
* user provided footer. |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
450 |
*/ |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
451 |
public Content getUserHeaderFooter(boolean header) { |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
452 |
String content; |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
453 |
if (header) { |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
454 |
content = replaceDocRootDir(configuration.header); |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
455 |
} else { |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
456 |
if (configuration.footer.length() != 0) { |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
457 |
content = replaceDocRootDir(configuration.footer); |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
458 |
} else { |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
459 |
content = replaceDocRootDir(configuration.header); |
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 |
} |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
462 |
Content rawContent = new RawHtml(content); |
19254
0988183c8164
4749567: stddoclet: Add CSS style for setting header/footer to be italic
bpatel
parents:
19253
diff
changeset
|
463 |
return rawContent; |
7614
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 |
|
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
466 |
/** |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
467 |
* Adds the user specified top. |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
468 |
* |
29957
7740f9657f56
8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents:
26900
diff
changeset
|
469 |
* @param htmlTree the content tree to which user specified top will be added |
7614
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
470 |
*/ |
29957
7740f9657f56
8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents:
26900
diff
changeset
|
471 |
public void addTop(Content htmlTree) { |
7614
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
472 |
Content top = new RawHtml(replaceDocRootDir(configuration.top)); |
33920 | 473 |
fixedNavDiv.addContent(top); |
7614
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
474 |
} |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
475 |
|
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
476 |
/** |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
477 |
* Adds the user specified bottom. |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
478 |
* |
29957
7740f9657f56
8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents:
26900
diff
changeset
|
479 |
* @param htmlTree the content tree to which user specified bottom will be added |
7614
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
480 |
*/ |
29957
7740f9657f56
8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents:
26900
diff
changeset
|
481 |
public void addBottom(Content htmlTree) { |
7614
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
482 |
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
|
483 |
Content small = HtmlTree.SMALL(bottom); |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
484 |
Content p = HtmlTree.P(HtmlStyle.legalCopy, small); |
29957
7740f9657f56
8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents:
26900
diff
changeset
|
485 |
htmlTree.addContent(p); |
7614
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
486 |
} |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
487 |
|
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
488 |
/** |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
489 |
* 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
|
490 |
* |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
491 |
* @param header If true print navigation bar at the top of the page else |
29957
7740f9657f56
8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents:
26900
diff
changeset
|
492 |
* @param htmlTree the HtmlTree to which the nav links will be added |
7614
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
493 |
*/ |
29957
7740f9657f56
8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents:
26900
diff
changeset
|
494 |
protected void addNavLinks(boolean header, Content htmlTree) { |
7614
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
495 |
if (!configuration.nonavbar) { |
29957
7740f9657f56
8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents:
26900
diff
changeset
|
496 |
Content tree = (configuration.allowTag(HtmlTag.NAV)) |
7740f9657f56
8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents:
26900
diff
changeset
|
497 |
? HtmlTree.NAV() |
7740f9657f56
8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents:
26900
diff
changeset
|
498 |
: htmlTree; |
7614
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
499 |
String allClassesId = "allclasses_"; |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
500 |
HtmlTree navDiv = new HtmlTree(HtmlTag.DIV); |
47846 | 501 |
fixedNavDiv.setStyle(HtmlStyle.fixedNav); |
40303 | 502 |
Content skipNavLinks = configuration.getContent("doclet.Skip_navigation_links"); |
7614
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
503 |
if (header) { |
33920 | 504 |
fixedNavDiv.addContent(HtmlConstants.START_OF_TOP_NAVBAR); |
47846 | 505 |
navDiv.setStyle(HtmlStyle.topNav); |
7614
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
506 |
allClassesId += "navbar_top"; |
47850 | 507 |
Content a = links.createAnchor(SectionName.NAVBAR_TOP); |
19909
784c68032a36
7198273: RFE : Javadoc Accessibility : Hyperlinks should contain text or an image with alt text
bpatel
parents:
19663
diff
changeset
|
508 |
//WCAG - Hyperlinks should contain text or an image with alt text - for AT tools |
7614
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
509 |
navDiv.addContent(a); |
47850 | 510 |
Content skipLinkContent = HtmlTree.DIV(HtmlStyle.skipNav, |
511 |
Links.createLink(SectionName.SKIP_NAVBAR_TOP, skipNavLinks, |
|
512 |
skipNavLinks.toString(), "")); |
|
7614
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
513 |
navDiv.addContent(skipLinkContent); |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
514 |
} else { |
29957
7740f9657f56
8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents:
26900
diff
changeset
|
515 |
tree.addContent(HtmlConstants.START_OF_BOTTOM_NAVBAR); |
47846 | 516 |
navDiv.setStyle(HtmlStyle.bottomNav); |
7614
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
517 |
allClassesId += "navbar_bottom"; |
47850 | 518 |
Content a = links.createAnchor(SectionName.NAVBAR_BOTTOM); |
7614
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
519 |
navDiv.addContent(a); |
47850 | 520 |
Content skipLinkContent = HtmlTree.DIV(HtmlStyle.skipNav, |
521 |
Links.createLink(SectionName.SKIP_NAVBAR_BOTTOM, skipNavLinks, |
|
522 |
skipNavLinks.toString(), "")); |
|
7614
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
523 |
navDiv.addContent(skipLinkContent); |
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 |
if (header) { |
47850 | 526 |
navDiv.addContent(links.createAnchor(SectionName.NAVBAR_TOP_FIRSTROW)); |
7614
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
527 |
} else { |
47850 | 528 |
navDiv.addContent(links.createAnchor(SectionName.NAVBAR_BOTTOM_FIRSTROW)); |
7614
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
529 |
} |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
530 |
HtmlTree navList = new HtmlTree(HtmlTag.UL); |
47846 | 531 |
navList.setStyle(HtmlStyle.navList); |
16319
e586bfeb39c5
7112427: The doclet needs to be able to generate JavaFX documentation.
jjg
parents:
15725
diff
changeset
|
532 |
navList.addAttr(HtmlAttr.TITLE, |
e586bfeb39c5
7112427: The doclet needs to be able to generate JavaFX documentation.
jjg
parents:
15725
diff
changeset
|
533 |
configuration.getText("doclet.Navigation")); |
7614
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
534 |
if (configuration.createoverview) { |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
535 |
navList.addContent(getNavLinkContents()); |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
536 |
} |
40503
cb34fd6e8071
8135291: [javadoc] broken link in Package com.sun.tools.jconsole
bpatel
parents:
40500
diff
changeset
|
537 |
if (configuration.showModules) { |
cb34fd6e8071
8135291: [javadoc] broken link in Package com.sun.tools.jconsole
bpatel
parents:
40500
diff
changeset
|
538 |
if (configuration.modules.size() == 1) { |
cb34fd6e8071
8135291: [javadoc] broken link in Package com.sun.tools.jconsole
bpatel
parents:
40500
diff
changeset
|
539 |
navList.addContent(getNavLinkModule(configuration.modules.first())); |
cb34fd6e8071
8135291: [javadoc] broken link in Package com.sun.tools.jconsole
bpatel
parents:
40500
diff
changeset
|
540 |
} else if (!configuration.modules.isEmpty()) { |
cb34fd6e8071
8135291: [javadoc] broken link in Package com.sun.tools.jconsole
bpatel
parents:
40500
diff
changeset
|
541 |
navList.addContent(getNavLinkModule()); |
cb34fd6e8071
8135291: [javadoc] broken link in Package com.sun.tools.jconsole
bpatel
parents:
40500
diff
changeset
|
542 |
} |
37943
2efb75c09230
8154262: Navigation bar in javadoc generated pages needs to be updated to display module information
bpatel
parents:
36526
diff
changeset
|
543 |
} |
24221
2376793dd33b
8038583: [javadoc] Refactor uses of arrays to Collections
ksrini
parents:
23794
diff
changeset
|
544 |
if (configuration.packages.size() == 1) { |
2376793dd33b
8038583: [javadoc] Refactor uses of arrays to Collections
ksrini
parents:
23794
diff
changeset
|
545 |
navList.addContent(getNavLinkPackage(configuration.packages.first())); |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
546 |
} else if (!configuration.packages.isEmpty()) { |
7614
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
547 |
navList.addContent(getNavLinkPackage()); |
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 |
navList.addContent(getNavLinkClass()); |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
550 |
if(configuration.classuse) { |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
551 |
navList.addContent(getNavLinkClassUse()); |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
552 |
} |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
553 |
if(configuration.createtree) { |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
554 |
navList.addContent(getNavLinkTree()); |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
555 |
} |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
556 |
if(!(configuration.nodeprecated || |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
557 |
configuration.nodeprecatedlist)) { |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
558 |
navList.addContent(getNavLinkDeprecated()); |
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 |
if(configuration.createindex) { |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
561 |
navList.addContent(getNavLinkIndex()); |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
562 |
} |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
563 |
if (!configuration.nohelp) { |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
564 |
navList.addContent(getNavLinkHelp()); |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
565 |
} |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
566 |
navDiv.addContent(navList); |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
567 |
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
|
568 |
navDiv.addContent(aboutDiv); |
33920 | 569 |
if (header) { |
570 |
fixedNavDiv.addContent(navDiv); |
|
571 |
} else { |
|
572 |
tree.addContent(navDiv); |
|
573 |
} |
|
40500
f293dbb81a53
8162353: javadoc should provide a way to disable use of frames
jjg
parents:
40303
diff
changeset
|
574 |
Content ulNav = HtmlTree.UL(HtmlStyle.navList, getNavLinkPrevious(), getNavLinkNext()); |
7614
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
575 |
Content subDiv = HtmlTree.DIV(HtmlStyle.subNav, ulNav); |
40500
f293dbb81a53
8162353: javadoc should provide a way to disable use of frames
jjg
parents:
40303
diff
changeset
|
576 |
if (configuration.frames) { |
f293dbb81a53
8162353: javadoc should provide a way to disable use of frames
jjg
parents:
40303
diff
changeset
|
577 |
Content ulFrames = HtmlTree.UL(HtmlStyle.navList, |
f293dbb81a53
8162353: javadoc should provide a way to disable use of frames
jjg
parents:
40303
diff
changeset
|
578 |
getNavShowLists(), getNavHideLists(filename)); |
f293dbb81a53
8162353: javadoc should provide a way to disable use of frames
jjg
parents:
40303
diff
changeset
|
579 |
subDiv.addContent(ulFrames); |
f293dbb81a53
8162353: javadoc should provide a way to disable use of frames
jjg
parents:
40303
diff
changeset
|
580 |
} |
7614
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
581 |
HtmlTree ulAllClasses = HtmlTree.UL(HtmlStyle.navList, getNavLinkClassIndex()); |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
582 |
ulAllClasses.addAttr(HtmlAttr.ID, allClassesId); |
7614
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
583 |
subDiv.addContent(ulAllClasses); |
33920 | 584 |
if (header && configuration.createindex) { |
47047
91082c3c1d05
8182263: Search box and reset button needs to be a11y fixed.
bpatel
parents:
46184
diff
changeset
|
585 |
String searchValueId = "search"; |
91082c3c1d05
8182263: Search box and reset button needs to be a11y fixed.
bpatel
parents:
46184
diff
changeset
|
586 |
String reset = "reset"; |
91082c3c1d05
8182263: Search box and reset button needs to be a11y fixed.
bpatel
parents:
46184
diff
changeset
|
587 |
HtmlTree inputText = HtmlTree.INPUT("text", searchValueId, searchValueId); |
91082c3c1d05
8182263: Search box and reset button needs to be a11y fixed.
bpatel
parents:
46184
diff
changeset
|
588 |
HtmlTree inputReset = HtmlTree.INPUT(reset, reset, reset); |
91082c3c1d05
8182263: Search box and reset button needs to be a11y fixed.
bpatel
parents:
46184
diff
changeset
|
589 |
Content searchTxt = configuration.getContent("doclet.search"); |
91082c3c1d05
8182263: Search box and reset button needs to be a11y fixed.
bpatel
parents:
46184
diff
changeset
|
590 |
HtmlTree liInput = HtmlTree.LI(HtmlTree.LABEL(searchValueId, searchTxt)); |
33920 | 591 |
liInput.addContent(inputText); |
592 |
liInput.addContent(inputReset); |
|
593 |
HtmlTree ulSearch = HtmlTree.UL(HtmlStyle.navListSearch, liInput); |
|
594 |
subDiv.addContent(ulSearch); |
|
595 |
} |
|
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
596 |
subDiv.addContent(getAllClassesLinkScript(allClassesId)); |
7614
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
597 |
addSummaryDetailLinks(subDiv); |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
598 |
if (header) { |
47850 | 599 |
subDiv.addContent(links.createAnchor(SectionName.SKIP_NAVBAR_TOP)); |
33920 | 600 |
fixedNavDiv.addContent(subDiv); |
601 |
fixedNavDiv.addContent(HtmlConstants.END_OF_TOP_NAVBAR); |
|
602 |
tree.addContent(fixedNavDiv); |
|
40303 | 603 |
HtmlTree paddingDiv = HtmlTree.DIV(HtmlStyle.navPadding, Contents.SPACE); |
36526 | 604 |
tree.addContent(paddingDiv); |
47847 | 605 |
Script script = new Script( |
606 |
"<!--\n" |
|
43870
8805a0acaded
8151743: Header can still disappear behind the navbar
bpatel
parents:
42831
diff
changeset
|
607 |
+ "$('.navPadding').css('padding-top', $('.fixedNav').css(\"height\"));\n" |
47847 | 608 |
+ "//-->\n"); |
609 |
tree.addContent(script.asContent()); |
|
7614
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
610 |
} else { |
47850 | 611 |
subDiv.addContent(links.createAnchor(SectionName.SKIP_NAVBAR_BOTTOM)); |
29957
7740f9657f56
8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents:
26900
diff
changeset
|
612 |
tree.addContent(subDiv); |
7740f9657f56
8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents:
26900
diff
changeset
|
613 |
tree.addContent(HtmlConstants.END_OF_BOTTOM_NAVBAR); |
7740f9657f56
8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents:
26900
diff
changeset
|
614 |
} |
7740f9657f56
8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents:
26900
diff
changeset
|
615 |
if (configuration.allowTag(HtmlTag.NAV)) { |
7740f9657f56
8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents:
26900
diff
changeset
|
616 |
htmlTree.addContent(tree); |
7614
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 |
} |
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 |
|
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
621 |
/** |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
622 |
* 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
|
623 |
* this method to customize next link. |
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 |
* @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
|
626 |
*/ |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
627 |
protected Content getNavLinkNext() { |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
628 |
return getNavLinkNext(null); |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
629 |
} |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
630 |
|
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
631 |
/** |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
632 |
* 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
|
633 |
* this method to customize prev link. |
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 |
* @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
|
636 |
*/ |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
637 |
protected Content getNavLinkPrevious() { |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
638 |
return getNavLinkPrevious(null); |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
639 |
} |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
640 |
|
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
641 |
/** |
10 | 642 |
* Do nothing. This is the default method. |
643 |
*/ |
|
7614
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
644 |
protected void addSummaryDetailLinks(Content navDiv) { |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
645 |
} |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
646 |
|
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
647 |
/** |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
648 |
* 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
|
649 |
* |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
650 |
* @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
|
651 |
*/ |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
652 |
protected Content getNavLinkContents() { |
47850 | 653 |
Content linkContent = Links.createLink(pathToRoot.resolve(DocPaths.overviewSummary(configuration.frames)), |
40303 | 654 |
contents.overviewLabel, "", ""); |
7614
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
655 |
Content li = HtmlTree.LI(linkContent); |
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 |
/** |
37943
2efb75c09230
8154262: Navigation bar in javadoc generated pages needs to be updated to display module information
bpatel
parents:
36526
diff
changeset
|
660 |
* Get link to the module summary page for the module passed. |
2efb75c09230
8154262: Navigation bar in javadoc generated pages needs to be updated to display module information
bpatel
parents:
36526
diff
changeset
|
661 |
* |
2efb75c09230
8154262: Navigation bar in javadoc generated pages needs to be updated to display module information
bpatel
parents:
36526
diff
changeset
|
662 |
* @param mdle Module to which link will be generated |
2efb75c09230
8154262: Navigation bar in javadoc generated pages needs to be updated to display module information
bpatel
parents:
36526
diff
changeset
|
663 |
* @return a content tree for the link |
2efb75c09230
8154262: Navigation bar in javadoc generated pages needs to be updated to display module information
bpatel
parents:
36526
diff
changeset
|
664 |
*/ |
2efb75c09230
8154262: Navigation bar in javadoc generated pages needs to be updated to display module information
bpatel
parents:
36526
diff
changeset
|
665 |
protected Content getNavLinkModule(ModuleElement mdle) { |
40303 | 666 |
Content linkContent = getModuleLink(mdle, contents.moduleLabel); |
37943
2efb75c09230
8154262: Navigation bar in javadoc generated pages needs to be updated to display module information
bpatel
parents:
36526
diff
changeset
|
667 |
Content li = HtmlTree.LI(linkContent); |
2efb75c09230
8154262: Navigation bar in javadoc generated pages needs to be updated to display module information
bpatel
parents:
36526
diff
changeset
|
668 |
return li; |
2efb75c09230
8154262: Navigation bar in javadoc generated pages needs to be updated to display module information
bpatel
parents:
36526
diff
changeset
|
669 |
} |
2efb75c09230
8154262: Navigation bar in javadoc generated pages needs to be updated to display module information
bpatel
parents:
36526
diff
changeset
|
670 |
|
2efb75c09230
8154262: Navigation bar in javadoc generated pages needs to be updated to display module information
bpatel
parents:
36526
diff
changeset
|
671 |
/** |
2efb75c09230
8154262: Navigation bar in javadoc generated pages needs to be updated to display module information
bpatel
parents:
36526
diff
changeset
|
672 |
* Get the word "Module", to indicate that link is not available here. |
2efb75c09230
8154262: Navigation bar in javadoc generated pages needs to be updated to display module information
bpatel
parents:
36526
diff
changeset
|
673 |
* |
2efb75c09230
8154262: Navigation bar in javadoc generated pages needs to be updated to display module information
bpatel
parents:
36526
diff
changeset
|
674 |
* @return a content tree for the link |
2efb75c09230
8154262: Navigation bar in javadoc generated pages needs to be updated to display module information
bpatel
parents:
36526
diff
changeset
|
675 |
*/ |
2efb75c09230
8154262: Navigation bar in javadoc generated pages needs to be updated to display module information
bpatel
parents:
36526
diff
changeset
|
676 |
protected Content getNavLinkModule() { |
40303 | 677 |
Content li = HtmlTree.LI(contents.moduleLabel); |
37943
2efb75c09230
8154262: Navigation bar in javadoc generated pages needs to be updated to display module information
bpatel
parents:
36526
diff
changeset
|
678 |
return li; |
2efb75c09230
8154262: Navigation bar in javadoc generated pages needs to be updated to display module information
bpatel
parents:
36526
diff
changeset
|
679 |
} |
2efb75c09230
8154262: Navigation bar in javadoc generated pages needs to be updated to display module information
bpatel
parents:
36526
diff
changeset
|
680 |
|
2efb75c09230
8154262: Navigation bar in javadoc generated pages needs to be updated to display module information
bpatel
parents:
36526
diff
changeset
|
681 |
/** |
7614
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
682 |
* 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
|
683 |
* |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
684 |
* @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
|
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 |
*/ |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
687 |
protected Content getNavLinkPackage(PackageElement pkg) { |
40303 | 688 |
Content linkContent = getPackageLink(pkg, contents.packageLabel); |
7614
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
689 |
Content li = HtmlTree.LI(linkContent); |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
690 |
return li; |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
691 |
} |
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 |
* 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
|
695 |
* |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
696 |
* @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
|
697 |
*/ |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
698 |
protected Content getNavLinkPackage() { |
40303 | 699 |
Content li = HtmlTree.LI(contents.packageLabel); |
7614
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
700 |
return li; |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
701 |
} |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
702 |
|
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
703 |
/** |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
704 |
* 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
|
705 |
* |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
706 |
* @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
|
707 |
*/ |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
708 |
protected Content getNavLinkClassUse() { |
40303 | 709 |
Content li = HtmlTree.LI(contents.useLabel); |
7614
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
710 |
return li; |
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 |
|
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 |
* Get link for previous file. |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
715 |
* |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
716 |
* @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
|
717 |
* @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
|
718 |
*/ |
14357
faf9cde2817b
8000741: refactor javadoc to use abstraction to handle relative paths
jjg
parents:
14266
diff
changeset
|
719 |
public Content getNavLinkPrevious(DocPath prev) { |
7614
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
720 |
Content li; |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
721 |
if (prev != null) { |
47850 | 722 |
li = HtmlTree.LI(Links.createLink(prev, contents.prevLabel, "", "")); |
7614
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 |
else |
40303 | 725 |
li = HtmlTree.LI(contents.prevLabel); |
7614
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
726 |
return li; |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
727 |
} |
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 |
/** |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
730 |
* 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
|
731 |
* without linking it anywhere. |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
732 |
* |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
733 |
* @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
|
734 |
* @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
|
735 |
*/ |
14357
faf9cde2817b
8000741: refactor javadoc to use abstraction to handle relative paths
jjg
parents:
14266
diff
changeset
|
736 |
public Content getNavLinkNext(DocPath next) { |
7614
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
737 |
Content li; |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
738 |
if (next != null) { |
47850 | 739 |
li = HtmlTree.LI(Links.createLink(next, contents.nextLabel, "", "")); |
7614
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
740 |
} |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
741 |
else |
40303 | 742 |
li = HtmlTree.LI(contents.nextLabel); |
7614
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 "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
|
748 |
* |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
749 |
* @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
|
750 |
* @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
|
751 |
*/ |
14357
faf9cde2817b
8000741: refactor javadoc to use abstraction to handle relative paths
jjg
parents:
14266
diff
changeset
|
752 |
protected Content getNavShowLists(DocPath link) { |
14358
9eda9239cba0
8000416: refactor javadoc to provide and use an abstraction for relative URIs
jjg
parents:
14357
diff
changeset
|
753 |
DocLink dl = new DocLink(link, path.getPath(), null); |
47850 | 754 |
Content framesContent = Links.createLink(dl, contents.framesLabel, "", "_top"); |
7614
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
755 |
Content li = HtmlTree.LI(framesContent); |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
756 |
return li; |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
757 |
} |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
758 |
|
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
759 |
/** |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
760 |
* 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
|
761 |
* |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
762 |
* @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
|
763 |
*/ |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
764 |
protected Content getNavShowLists() { |
14357
faf9cde2817b
8000741: refactor javadoc to use abstraction to handle relative paths
jjg
parents:
14266
diff
changeset
|
765 |
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
|
766 |
} |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
767 |
|
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
768 |
/** |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
769 |
* 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
|
770 |
* |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
771 |
* @param link File to be linked |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
772 |
* @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
|
773 |
*/ |
14357
faf9cde2817b
8000741: refactor javadoc to use abstraction to handle relative paths
jjg
parents:
14266
diff
changeset
|
774 |
protected Content getNavHideLists(DocPath link) { |
47850 | 775 |
Content noFramesContent = Links.createLink(link, contents.noFramesLabel, "", "_top"); |
7614
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
776 |
Content li = HtmlTree.LI(noFramesContent); |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
777 |
return li; |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
778 |
} |
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 |
/** |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
781 |
* 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
|
782 |
* 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
|
783 |
* 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
|
784 |
* "overview-tree.html" file. |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
785 |
* |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
786 |
* @return a content tree for the link |
10 | 787 |
*/ |
7614
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
788 |
protected Content getNavLinkTree() { |
42277 | 789 |
List<PackageElement> packages = new ArrayList<>(configuration.getSpecifiedPackageElements()); |
790 |
DocPath docPath = packages.size() == 1 && configuration.getSpecifiedTypeElements().isEmpty() |
|
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
791 |
? pathString(packages.get(0), DocPaths.PACKAGE_TREE) |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
792 |
: pathToRoot.resolve(DocPaths.OVERVIEW_TREE); |
47850 | 793 |
return HtmlTree.LI(Links.createLink(docPath, contents.treeLabel, "", "")); |
7614
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
794 |
} |
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 |
/** |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
797 |
* 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
|
798 |
* |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
799 |
* @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
|
800 |
* @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
|
801 |
*/ |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
802 |
protected Content getNavLinkMainTree(String label) { |
47850 | 803 |
Content mainTreeContent = Links.createLink(pathToRoot.resolve(DocPaths.OVERVIEW_TREE), |
7614
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
804 |
new StringContent(label)); |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
805 |
Content li = HtmlTree.LI(mainTreeContent); |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
806 |
return li; |
10 | 807 |
} |
808 |
||
809 |
/** |
|
7614
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
810 |
* 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
|
811 |
* |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
812 |
* @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
|
813 |
*/ |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
814 |
protected Content getNavLinkClass() { |
40303 | 815 |
Content li = HtmlTree.LI(contents.classLabel); |
7614
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
816 |
return li; |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
817 |
} |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
818 |
|
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 |
* 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
|
821 |
* |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
822 |
* @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
|
823 |
*/ |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
824 |
protected Content getNavLinkDeprecated() { |
47850 | 825 |
Content linkContent = Links.createLink(pathToRoot.resolve(DocPaths.DEPRECATED_LIST), |
40303 | 826 |
contents.deprecatedLabel, "", ""); |
7614
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
827 |
Content li = HtmlTree.LI(linkContent); |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
828 |
return li; |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
829 |
} |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
830 |
|
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 |
* 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
|
833 |
* 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
|
834 |
* 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
|
835 |
* |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
836 |
* @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
|
837 |
*/ |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
838 |
protected Content getNavLinkClassIndex() { |
47850 | 839 |
Content allClassesContent = Links.createLink(pathToRoot.resolve( |
40500
f293dbb81a53
8162353: javadoc should provide a way to disable use of frames
jjg
parents:
40303
diff
changeset
|
840 |
DocPaths.AllClasses(configuration.frames)), |
40303 | 841 |
contents.allClassesLabel, "", ""); |
7614
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
842 |
Content li = HtmlTree.LI(allClassesContent); |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
843 |
return li; |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
844 |
} |
10 | 845 |
|
846 |
/** |
|
7614
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
847 |
* Get link for generated class index. |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
848 |
* |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
849 |
* @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
|
850 |
*/ |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
851 |
protected Content getNavLinkIndex() { |
47850 | 852 |
Content linkContent = Links.createLink(pathToRoot.resolve( |
14357
faf9cde2817b
8000741: refactor javadoc to use abstraction to handle relative paths
jjg
parents:
14266
diff
changeset
|
853 |
(configuration.splitindex |
faf9cde2817b
8000741: refactor javadoc to use abstraction to handle relative paths
jjg
parents:
14266
diff
changeset
|
854 |
? 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
|
855 |
: DocPaths.INDEX_ALL)), |
40303 | 856 |
contents.indexLabel, "", ""); |
7614
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
857 |
Content li = HtmlTree.LI(linkContent); |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
858 |
return li; |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
859 |
} |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
860 |
|
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
861 |
/** |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
862 |
* 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
|
863 |
* 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
|
864 |
* destination directory. |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
865 |
* |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
866 |
* @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
|
867 |
*/ |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
868 |
protected Content getNavLinkHelp() { |
14357
faf9cde2817b
8000741: refactor javadoc to use abstraction to handle relative paths
jjg
parents:
14266
diff
changeset
|
869 |
String helpfile = configuration.helpfile; |
faf9cde2817b
8000741: refactor javadoc to use abstraction to handle relative paths
jjg
parents:
14266
diff
changeset
|
870 |
DocPath helpfilenm; |
faf9cde2817b
8000741: refactor javadoc to use abstraction to handle relative paths
jjg
parents:
14266
diff
changeset
|
871 |
if (helpfile.isEmpty()) { |
faf9cde2817b
8000741: refactor javadoc to use abstraction to handle relative paths
jjg
parents:
14266
diff
changeset
|
872 |
helpfilenm = DocPaths.HELP_DOC; |
7614
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
873 |
} else { |
14368
6f4c62de6985
8001664: refactor javadoc to use abstraction to handle files
jjg
parents:
14366
diff
changeset
|
874 |
DocFile file = DocFile.createFileForInput(configuration, helpfile); |
6f4c62de6985
8001664: refactor javadoc to use abstraction to handle files
jjg
parents:
14366
diff
changeset
|
875 |
helpfilenm = DocPath.create(file.getName()); |
7614
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
876 |
} |
47850 | 877 |
Content linkContent = Links.createLink(pathToRoot.resolve(helpfilenm), |
40303 | 878 |
contents.helpLabel, "", ""); |
7614
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
879 |
Content li = HtmlTree.LI(linkContent); |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
880 |
return li; |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
881 |
} |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
882 |
|
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
883 |
/** |
39670
9d1eafbf29c6
8154261: Module summary page should display directives for the module
bpatel
parents:
37943
diff
changeset
|
884 |
* Add gap between navigation bar elements. |
9d1eafbf29c6
8154261: Module summary page should display directives for the module
bpatel
parents:
37943
diff
changeset
|
885 |
* |
9d1eafbf29c6
8154261: Module summary page should display directives for the module
bpatel
parents:
37943
diff
changeset
|
886 |
* @param liNav the content tree to which the gap will be added |
9d1eafbf29c6
8154261: Module summary page should display directives for the module
bpatel
parents:
37943
diff
changeset
|
887 |
*/ |
9d1eafbf29c6
8154261: Module summary page should display directives for the module
bpatel
parents:
37943
diff
changeset
|
888 |
protected void addNavGap(Content liNav) { |
40303 | 889 |
liNav.addContent(Contents.SPACE); |
39670
9d1eafbf29c6
8154261: Module summary page should display directives for the module
bpatel
parents:
37943
diff
changeset
|
890 |
liNav.addContent("|"); |
40303 | 891 |
liNav.addContent(Contents.SPACE); |
39670
9d1eafbf29c6
8154261: Module summary page should display directives for the module
bpatel
parents:
37943
diff
changeset
|
892 |
} |
9d1eafbf29c6
8154261: Module summary page should display directives for the module
bpatel
parents:
37943
diff
changeset
|
893 |
|
9d1eafbf29c6
8154261: Module summary page should display directives for the module
bpatel
parents:
37943
diff
changeset
|
894 |
/** |
7614
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
895 |
* Get table caption. |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
896 |
* |
47427 | 897 |
* @param title the content for the caption |
7614
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
898 |
* @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
|
899 |
*/ |
17570
78512b2899db
8012183: replace some uses of Configuration.getText with Configuration.getResource
jjg
parents:
17569
diff
changeset
|
900 |
public Content getTableCaption(Content title) { |
7614
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
901 |
Content captionSpan = HtmlTree.SPAN(title); |
40303 | 902 |
Content space = Contents.SPACE; |
7614
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
903 |
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
|
904 |
Content caption = HtmlTree.CAPTION(captionSpan); |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
905 |
caption.addContent(tabSpan); |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
906 |
return caption; |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
907 |
} |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
908 |
|
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
909 |
/** |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
910 |
* Returns a packagename content. |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
911 |
* |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
912 |
* @param packageElement the package to check |
7614
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
913 |
* @return package name content |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
914 |
*/ |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
915 |
public Content getPackageName(PackageElement packageElement) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
916 |
return packageElement == null || packageElement.isUnnamed() |
40303 | 917 |
? contents.defaultPackageLabel |
36500
d31e4986dc8b
8149139: [javadoc] Modify Content to accept CharSequence
ksrini
parents:
36038
diff
changeset
|
918 |
: getPackageLabel(packageElement.getQualifiedName()); |
7614
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
919 |
} |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
920 |
|
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
921 |
/** |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
922 |
* Returns a package name label. |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
923 |
* |
14259 | 924 |
* @param packageName the package name |
7614
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
925 |
* @return the package name content |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
926 |
*/ |
36500
d31e4986dc8b
8149139: [javadoc] Modify Content to accept CharSequence
ksrini
parents:
36038
diff
changeset
|
927 |
public Content getPackageLabel(CharSequence packageName) { |
7614
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
928 |
return new StringContent(packageName); |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
929 |
} |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
930 |
|
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
931 |
/** |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
932 |
* Return the path to the class page for a typeElement. |
10 | 933 |
* |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
934 |
* @param te TypeElement for which the path is requested. |
10 | 935 |
* @param name Name of the file(doesn't include path). |
936 |
*/ |
|
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
937 |
protected DocPath pathString(TypeElement te, DocPath name) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
938 |
return pathString(utils.containingPackage(te), name); |
10 | 939 |
} |
940 |
||
941 |
/** |
|
942 |
* Return path to the given file name in the given package. So if the name |
|
943 |
* passed is "Object.html" and the name of the package is "java.lang", and |
|
944 |
* if the relative path is "../.." then returned string will be |
|
945 |
* "../../java/lang/Object.html" |
|
946 |
* |
|
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
947 |
* @param packageElement Package in which the file name is assumed to be. |
10 | 948 |
* @param name File name, to which path string is. |
949 |
*/ |
|
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
950 |
protected DocPath pathString(PackageElement packageElement, DocPath name) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
951 |
return pathToRoot.resolve(DocPath.forPackage(packageElement).resolve(name)); |
10 | 952 |
} |
953 |
||
954 |
/** |
|
26900
dccc7a72526d
8048351: tidy errors for attribute href, name for langtools javadoc tests needs investigation
bpatel
parents:
26665
diff
changeset
|
955 |
* Given a package, return the name to be used in HTML anchor tag. |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
956 |
* @param packageElement the package. |
26900
dccc7a72526d
8048351: tidy errors for attribute href, name for langtools javadoc tests needs investigation
bpatel
parents:
26665
diff
changeset
|
957 |
* @return the name to be used in HTML anchor tag. |
dccc7a72526d
8048351: tidy errors for attribute href, name for langtools javadoc tests needs investigation
bpatel
parents:
26665
diff
changeset
|
958 |
*/ |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
959 |
public String getPackageAnchorName(PackageElement packageElement) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
960 |
return packageElement == null || packageElement.isUnnamed() |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
961 |
? SectionName.UNNAMED_PACKAGE_ANCHOR.getName() |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
962 |
: utils.getPackageName(packageElement); |
26900
dccc7a72526d
8048351: tidy errors for attribute href, name for langtools javadoc tests needs investigation
bpatel
parents:
26665
diff
changeset
|
963 |
} |
dccc7a72526d
8048351: tidy errors for attribute href, name for langtools javadoc tests needs investigation
bpatel
parents:
26665
diff
changeset
|
964 |
|
dccc7a72526d
8048351: tidy errors for attribute href, name for langtools javadoc tests needs investigation
bpatel
parents:
26665
diff
changeset
|
965 |
/** |
10 | 966 |
* Return the link to the given package. |
967 |
* |
|
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
968 |
* @param packageElement the package to link to. |
10 | 969 |
* @param label the label for the link. |
7614
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
970 |
* @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
|
971 |
*/ |
36500
d31e4986dc8b
8149139: [javadoc] Modify Content to accept CharSequence
ksrini
parents:
36038
diff
changeset
|
972 |
public Content getPackageLink(PackageElement packageElement, CharSequence label) { |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
973 |
return getPackageLink(packageElement, new StringContent(label)); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
974 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
975 |
|
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
976 |
public Content getPackageLink(PackageElement packageElement) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
977 |
StringContent content = packageElement.isUnnamed() |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
978 |
? new StringContent() |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
979 |
: new StringContent(utils.getPackageName(packageElement)); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
980 |
return getPackageLink(packageElement, content); |
17563
e8ddeb9bd17c
8011668: Allow HTMLWriter.getResource to take Content args
jjg
parents:
17561
diff
changeset
|
981 |
} |
e8ddeb9bd17c
8011668: Allow HTMLWriter.getResource to take Content args
jjg
parents:
17561
diff
changeset
|
982 |
|
e8ddeb9bd17c
8011668: Allow HTMLWriter.getResource to take Content args
jjg
parents:
17561
diff
changeset
|
983 |
/** |
e8ddeb9bd17c
8011668: Allow HTMLWriter.getResource to take Content args
jjg
parents:
17561
diff
changeset
|
984 |
* Return the link to the given package. |
e8ddeb9bd17c
8011668: Allow HTMLWriter.getResource to take Content args
jjg
parents:
17561
diff
changeset
|
985 |
* |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
986 |
* @param packageElement the package to link to. |
17563
e8ddeb9bd17c
8011668: Allow HTMLWriter.getResource to take Content args
jjg
parents:
17561
diff
changeset
|
987 |
* @param label the label for the link. |
e8ddeb9bd17c
8011668: Allow HTMLWriter.getResource to take Content args
jjg
parents:
17561
diff
changeset
|
988 |
* @return a content tree for the package link. |
e8ddeb9bd17c
8011668: Allow HTMLWriter.getResource to take Content args
jjg
parents:
17561
diff
changeset
|
989 |
*/ |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
990 |
public Content getPackageLink(PackageElement packageElement, Content label) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
991 |
boolean included = packageElement != null && utils.isIncluded(packageElement); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
992 |
if (!included) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
993 |
for (PackageElement p : configuration.packages) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
994 |
if (p.equals(packageElement)) { |
7614
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
995 |
included = true; |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
996 |
break; |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
997 |
} |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
998 |
} |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
999 |
} |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1000 |
if (included || packageElement == null) { |
47850 | 1001 |
return Links.createLink(pathString(packageElement, DocPaths.PACKAGE_SUMMARY), |
14358
9eda9239cba0
8000416: refactor javadoc to provide and use an abstraction for relative URIs
jjg
parents:
14357
diff
changeset
|
1002 |
label); |
7614
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
1003 |
} else { |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1004 |
DocLink crossPkgLink = getCrossPackageLink(utils.getPackageName(packageElement)); |
7614
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
1005 |
if (crossPkgLink != null) { |
47850 | 1006 |
return Links.createLink(crossPkgLink, label); |
10 | 1007 |
} else { |
1008 |
return label; |
|
1009 |
} |
|
1010 |
} |
|
1011 |
} |
|
1012 |
||
36526 | 1013 |
/** |
1014 |
* Get Module link. |
|
1015 |
* |
|
1016 |
* @param mdle the module being documented |
|
1017 |
* @param label tag for the link |
|
1018 |
* @return a content for the module link |
|
1019 |
*/ |
|
1020 |
public Content getModuleLink(ModuleElement mdle, Content label) { |
|
42831
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42816
diff
changeset
|
1021 |
boolean included = utils.isIncluded(mdle); |
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42816
diff
changeset
|
1022 |
return (included) |
47850 | 1023 |
? Links.createLink(pathToRoot.resolve(DocPaths.moduleSummary(mdle)), label, "", "") |
42831
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42816
diff
changeset
|
1024 |
: label; |
36526 | 1025 |
} |
1026 |
||
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1027 |
public Content interfaceName(TypeElement typeElement, boolean qual) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1028 |
Content name = new StringContent((qual) |
36500
d31e4986dc8b
8149139: [javadoc] Modify Content to accept CharSequence
ksrini
parents:
36038
diff
changeset
|
1029 |
? typeElement.getQualifiedName() |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1030 |
: utils.getSimpleName(typeElement)); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1031 |
return (utils.isInterface(typeElement)) ? HtmlTree.SPAN(HtmlStyle.interfaceName, name) : name; |
10 | 1032 |
} |
1033 |
||
1034 |
/** |
|
7614
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
1035 |
* 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
|
1036 |
* |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1037 |
* @param typeElement program element typeElement for which the link will be added |
7614
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
1038 |
* @param label label for the link |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
1039 |
* @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
|
1040 |
*/ |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1041 |
public void addSrcLink(Element typeElement, Content label, Content htmltree) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1042 |
if (typeElement == null) { |
7614
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
1043 |
return; |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
1044 |
} |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1045 |
TypeElement te = utils.getEnclosingTypeElement(typeElement); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1046 |
if (te == null) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1047 |
// must be a typeElement since in has no containing class. |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1048 |
te = (TypeElement) typeElement; |
7614
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
1049 |
} |
14357
faf9cde2817b
8000741: refactor javadoc to use abstraction to handle relative paths
jjg
parents:
14266
diff
changeset
|
1050 |
DocPath href = pathToRoot |
faf9cde2817b
8000741: refactor javadoc to use abstraction to handle relative paths
jjg
parents:
14266
diff
changeset
|
1051 |
.resolve(DocPaths.SOURCE_OUTPUT) |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1052 |
.resolve(DocPath.forClass(utils, te)); |
47850 | 1053 |
Content linkContent = Links.createLink(href |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1054 |
.fragment(SourceToHTMLConverter.getAnchorName(utils, typeElement)), label, "", ""); |
7614
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
1055 |
htmltree.addContent(linkContent); |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
1056 |
} |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
1057 |
|
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
1058 |
/** |
10 | 1059 |
* Return the link to the given class. |
1060 |
* |
|
1061 |
* @param linkInfo the information about the link. |
|
1062 |
* |
|
1063 |
* @return the link for the given class. |
|
1064 |
*/ |
|
17559
87c28ee29329
8011642: Remove LinkOutput in favor of direct use of Content
jjg
parents:
17558
diff
changeset
|
1065 |
public Content getLink(LinkInfoImpl linkInfo) { |
10 | 1066 |
LinkFactoryImpl factory = new LinkFactoryImpl(this); |
17564
c329fe11193d
8011288: Erratic/inconsistent indentation of signatures
jjg
parents:
17563
diff
changeset
|
1067 |
return factory.getLink(linkInfo); |
10 | 1068 |
} |
1069 |
||
1070 |
/** |
|
1071 |
* Return the type parameters for the given class. |
|
1072 |
* |
|
1073 |
* @param linkInfo the information about the link. |
|
1074 |
* @return the type for the given class. |
|
1075 |
*/ |
|
17559
87c28ee29329
8011642: Remove LinkOutput in favor of direct use of Content
jjg
parents:
17558
diff
changeset
|
1076 |
public Content getTypeParameterLinks(LinkInfoImpl linkInfo) { |
10 | 1077 |
LinkFactoryImpl factory = new LinkFactoryImpl(this); |
17559
87c28ee29329
8011642: Remove LinkOutput in favor of direct use of Content
jjg
parents:
17558
diff
changeset
|
1078 |
return factory.getTypeParameterLinks(linkInfo, false); |
10 | 1079 |
} |
1080 |
||
1081 |
/************************************************************* |
|
1082 |
* Return a class cross link to external class documentation. |
|
1083 |
* The name must be fully qualified to determine which package |
|
1084 |
* the class is in. The -link option does not allow users to |
|
1085 |
* link to external classes in the "default" package. |
|
1086 |
* |
|
1087 |
* @param qualifiedClassName the qualified name of the external class. |
|
1088 |
* @param refMemName the name of the member being referenced. This should |
|
1089 |
* be null or empty string if no member is being referenced. |
|
1090 |
* @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
|
1091 |
* @param strong true if the link should be strong. |
10 | 1092 |
* @param code true if the label should be code font. |
47851
6a9bb4f77d50
8190822: Remove dead code that could lead to invalid HTML
jjg
parents:
47850
diff
changeset
|
1093 |
* @return the link |
10 | 1094 |
*/ |
17560 | 1095 |
public Content getCrossClassLink(String qualifiedClassName, String refMemName, |
47851
6a9bb4f77d50
8190822: Remove dead code that could lead to invalid HTML
jjg
parents:
47850
diff
changeset
|
1096 |
Content label, boolean strong, boolean code) { |
14358
9eda9239cba0
8000416: refactor javadoc to provide and use an abstraction for relative URIs
jjg
parents:
14357
diff
changeset
|
1097 |
String className = ""; |
9eda9239cba0
8000416: refactor javadoc to provide and use an abstraction for relative URIs
jjg
parents:
14357
diff
changeset
|
1098 |
String packageName = qualifiedClassName == null ? "" : qualifiedClassName; |
10 | 1099 |
int periodIndex; |
14358
9eda9239cba0
8000416: refactor javadoc to provide and use an abstraction for relative URIs
jjg
parents:
14357
diff
changeset
|
1100 |
while ((periodIndex = packageName.lastIndexOf('.')) != -1) { |
10 | 1101 |
className = packageName.substring(periodIndex + 1, packageName.length()) + |
1102 |
(className.length() > 0 ? "." + className : ""); |
|
17560 | 1103 |
Content defaultLabel = new StringContent(className); |
1104 |
if (code) |
|
1105 |
defaultLabel = HtmlTree.CODE(defaultLabel); |
|
10 | 1106 |
packageName = packageName.substring(0, periodIndex); |
1107 |
if (getCrossPackageLink(packageName) != null) { |
|
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1108 |
/* |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1109 |
The package exists in external documentation, so link to the external |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1110 |
class (assuming that it exists). This is definitely a limitation of |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1111 |
the -link option. There are ways to determine if an external package |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1112 |
exists, but no way to determine if the external class exists. We just |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1113 |
have to assume that it does. |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1114 |
*/ |
14358
9eda9239cba0
8000416: refactor javadoc to provide and use an abstraction for relative URIs
jjg
parents:
14357
diff
changeset
|
1115 |
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
|
1116 |
className + ".html", refMemName); |
47850 | 1117 |
return Links.createLink(link, |
17560 | 1118 |
(label == null) || label.isEmpty() ? defaultLabel : label, |
47851
6a9bb4f77d50
8190822: Remove dead code that could lead to invalid HTML
jjg
parents:
47850
diff
changeset
|
1119 |
strong, |
6a9bb4f77d50
8190822: Remove dead code that could lead to invalid HTML
jjg
parents:
47850
diff
changeset
|
1120 |
resources.getText("doclet.Href_Class_Or_Interface_Title", packageName), |
10 | 1121 |
""); |
1122 |
} |
|
1123 |
} |
|
1124 |
return null; |
|
1125 |
} |
|
1126 |
||
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1127 |
public boolean isClassLinkable(TypeElement typeElement) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1128 |
if (utils.isIncluded(typeElement)) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1129 |
return configuration.isGeneratedDoc(typeElement); |
10 | 1130 |
} |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1131 |
return configuration.extern.isExternal(typeElement); |
10 | 1132 |
} |
1133 |
||
14358
9eda9239cba0
8000416: refactor javadoc to provide and use an abstraction for relative URIs
jjg
parents:
14357
diff
changeset
|
1134 |
public DocLink getCrossPackageLink(String pkgName) { |
14357
faf9cde2817b
8000741: refactor javadoc to use abstraction to handle relative paths
jjg
parents:
14266
diff
changeset
|
1135 |
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
|
1136 |
DocPaths.PACKAGE_SUMMARY.getPath()); |
10 | 1137 |
} |
1138 |
||
7614
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
1139 |
/** |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
1140 |
* Get the class link. |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
1141 |
* |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
1142 |
* @param context the id of the context where the link will be added |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1143 |
* @param element to link to |
7614
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
1144 |
* @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
|
1145 |
*/ |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1146 |
public Content getQualifiedClassLink(LinkInfoImpl.Kind context, Element element) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1147 |
LinkInfoImpl linkInfoImpl = new LinkInfoImpl(configuration, context, (TypeElement)element); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1148 |
return getLink(linkInfoImpl.label(utils.getFullyQualifiedName(element))); |
10 | 1149 |
} |
1150 |
||
1151 |
/** |
|
7614
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
1152 |
* Add the class link. |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
1153 |
* |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
1154 |
* @param context the id of the context where the link will be added |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1155 |
* @param typeElement to link to |
7614
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
1156 |
* @param contentTree the content tree to which the link will be added |
10 | 1157 |
*/ |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1158 |
public void addPreQualifiedClassLink(LinkInfoImpl.Kind context, TypeElement typeElement, Content contentTree) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1159 |
addPreQualifiedClassLink(context, typeElement, false, contentTree); |
10 | 1160 |
} |
1161 |
||
1162 |
/** |
|
1163 |
* 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
|
1164 |
* plain text. If the qualifier is excluded, it will not be included in the |
10 | 1165 |
* link label. |
1166 |
* |
|
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1167 |
* @param typeElement 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
|
1168 |
* @param isStrong true if the link should be strong. |
10 | 1169 |
* @return the link with the package portion of the label in plain text. |
1170 |
*/ |
|
17560 | 1171 |
public Content getPreQualifiedClassLink(LinkInfoImpl.Kind context, |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1172 |
TypeElement typeElement, boolean isStrong) { |
17560 | 1173 |
ContentBuilder classlink = new ContentBuilder(); |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1174 |
PackageElement pkg = utils.containingPackage(typeElement); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1175 |
if (pkg != null && ! configuration.shouldExcludeQualifier(pkg.getSimpleName().toString())) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1176 |
classlink.addContent(getEnclosingPackageName(typeElement)); |
10 | 1177 |
} |
17560 | 1178 |
classlink.addContent(getLink(new LinkInfoImpl(configuration, |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1179 |
context, typeElement).label(utils.getSimpleName(typeElement)).strong(isStrong))); |
10 | 1180 |
return classlink; |
1181 |
} |
|
1182 |
||
7614
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
1183 |
/** |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
1184 |
* 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
|
1185 |
* 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
|
1186 |
* link label. |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
1187 |
* |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
1188 |
* @param context the id of the context where the link will be added |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1189 |
* @param typeElement the class to link to |
7614
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
1190 |
* @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
|
1191 |
* @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
|
1192 |
*/ |
17558
eee4ccf66cfd
8010440: Replace int constants in LinkInfoImpl with enum
jjg
parents:
17547
diff
changeset
|
1193 |
public void addPreQualifiedClassLink(LinkInfoImpl.Kind context, |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1194 |
TypeElement typeElement, boolean isStrong, Content contentTree) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1195 |
PackageElement pkg = utils.containingPackage(typeElement); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1196 |
if(pkg != null && ! configuration.shouldExcludeQualifier(pkg.getSimpleName().toString())) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1197 |
contentTree.addContent(getEnclosingPackageName(typeElement)); |
7614
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
1198 |
} |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1199 |
LinkInfoImpl linkinfo = new LinkInfoImpl(configuration, context, typeElement) |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1200 |
.label(utils.getSimpleName(typeElement)) |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1201 |
.strong(isStrong); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1202 |
Content link = getLink(linkinfo); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1203 |
contentTree.addContent(link); |
7614
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
1204 |
} |
10 | 1205 |
|
1206 |
/** |
|
7614
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
1207 |
* Add the class link, with only class name as the strong link and prefixing |
10 | 1208 |
* plain package name. |
7614
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
1209 |
* |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
1210 |
* @param context the id of the context where the link will be added |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1211 |
* @param typeElement the class to link to |
7614
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
1212 |
* @param contentTree the content tree to which the link with be added |
10 | 1213 |
*/ |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1214 |
public void addPreQualifiedStrongClassLink(LinkInfoImpl.Kind context, TypeElement typeElement, Content contentTree) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1215 |
addPreQualifiedClassLink(context, typeElement, true, contentTree); |
10 | 1216 |
} |
1217 |
||
1218 |
/** |
|
7614
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
1219 |
* Get the link for the given member. |
10 | 1220 |
* |
7614
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
1221 |
* @param context the id of the context where the link will be added |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1222 |
* @param element the member being linked to |
7614
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
1223 |
* @param label the label for the link |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1224 |
* @return a content tree for the element link |
10 | 1225 |
*/ |
36500
d31e4986dc8b
8149139: [javadoc] Modify Content to accept CharSequence
ksrini
parents:
36038
diff
changeset
|
1226 |
public Content getDocLink(LinkInfoImpl.Kind context, Element element, CharSequence label) { |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1227 |
return getDocLink(context, utils.getEnclosingTypeElement(element), element, |
17560 | 1228 |
new StringContent(label)); |
10 | 1229 |
} |
1230 |
||
1231 |
/** |
|
1232 |
* Return the link for the given member. |
|
1233 |
* |
|
1234 |
* @param context the id of the context where the link will be printed. |
|
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1235 |
* @param element the member being linked to. |
10 | 1236 |
* @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
|
1237 |
* @param strong true if the link should be strong. |
10 | 1238 |
* @return the link for the given member. |
1239 |
*/ |
|
36500
d31e4986dc8b
8149139: [javadoc] Modify Content to accept CharSequence
ksrini
parents:
36038
diff
changeset
|
1240 |
public Content getDocLink(LinkInfoImpl.Kind context, Element element, CharSequence label, |
17559
87c28ee29329
8011642: Remove LinkOutput in favor of direct use of Content
jjg
parents:
17558
diff
changeset
|
1241 |
boolean strong) { |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1242 |
return getDocLink(context, utils.getEnclosingTypeElement(element), element, label, strong); |
10 | 1243 |
} |
1244 |
||
1245 |
/** |
|
1246 |
* Return the link for the given member. |
|
1247 |
* |
|
1248 |
* @param context the id of the context where the link will be printed. |
|
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1249 |
* @param typeElement the typeElement that we should link to. This is not |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1250 |
necessarily equal to element.containingClass(). We may be |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1251 |
inheriting comments. |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1252 |
* @param element the member being linked to. |
10 | 1253 |
* @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
|
1254 |
* @param strong true if the link should be strong. |
10 | 1255 |
* @return the link for the given member. |
1256 |
*/ |
|
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1257 |
public Content getDocLink(LinkInfoImpl.Kind context, TypeElement typeElement, Element element, |
36500
d31e4986dc8b
8149139: [javadoc] Modify Content to accept CharSequence
ksrini
parents:
36038
diff
changeset
|
1258 |
CharSequence label, boolean strong) { |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1259 |
return getDocLink(context, typeElement, element, label, strong, false); |
16319
e586bfeb39c5
7112427: The doclet needs to be able to generate JavaFX documentation.
jjg
parents:
15725
diff
changeset
|
1260 |
} |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1261 |
|
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1262 |
public Content getDocLink(LinkInfoImpl.Kind context, TypeElement typeElement, Element element, |
17569 | 1263 |
Content label, boolean strong) { |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1264 |
return getDocLink(context, typeElement, element, label, strong, false); |
17569 | 1265 |
} |
16319
e586bfeb39c5
7112427: The doclet needs to be able to generate JavaFX documentation.
jjg
parents:
15725
diff
changeset
|
1266 |
|
e586bfeb39c5
7112427: The doclet needs to be able to generate JavaFX documentation.
jjg
parents:
15725
diff
changeset
|
1267 |
/** |
e586bfeb39c5
7112427: The doclet needs to be able to generate JavaFX documentation.
jjg
parents:
15725
diff
changeset
|
1268 |
* Return the link for the given member. |
e586bfeb39c5
7112427: The doclet needs to be able to generate JavaFX documentation.
jjg
parents:
15725
diff
changeset
|
1269 |
* |
e586bfeb39c5
7112427: The doclet needs to be able to generate JavaFX documentation.
jjg
parents:
15725
diff
changeset
|
1270 |
* @param context the id of the context where the link will be printed. |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1271 |
* @param typeElement the typeElement that we should link to. This is not |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1272 |
necessarily equal to element.containingClass(). We may be |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1273 |
inheriting comments. |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1274 |
* @param element the member being linked to. |
16319
e586bfeb39c5
7112427: The doclet needs to be able to generate JavaFX documentation.
jjg
parents:
15725
diff
changeset
|
1275 |
* @param label the label for the link. |
e586bfeb39c5
7112427: The doclet needs to be able to generate JavaFX documentation.
jjg
parents:
15725
diff
changeset
|
1276 |
* @param strong true if the link should be strong. |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1277 |
* @param isProperty true if the element parameter is a JavaFX property. |
16319
e586bfeb39c5
7112427: The doclet needs to be able to generate JavaFX documentation.
jjg
parents:
15725
diff
changeset
|
1278 |
* @return the link for the given member. |
e586bfeb39c5
7112427: The doclet needs to be able to generate JavaFX documentation.
jjg
parents:
15725
diff
changeset
|
1279 |
*/ |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1280 |
public Content getDocLink(LinkInfoImpl.Kind context, TypeElement typeElement, Element element, |
36500
d31e4986dc8b
8149139: [javadoc] Modify Content to accept CharSequence
ksrini
parents:
36038
diff
changeset
|
1281 |
CharSequence label, boolean strong, boolean isProperty) { |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1282 |
return getDocLink(context, typeElement, element, new StringContent(check(label)), strong, isProperty); |
17569 | 1283 |
} |
1284 |
||
36500
d31e4986dc8b
8149139: [javadoc] Modify Content to accept CharSequence
ksrini
parents:
36038
diff
changeset
|
1285 |
CharSequence check(CharSequence s) { |
d31e4986dc8b
8149139: [javadoc] Modify Content to accept CharSequence
ksrini
parents:
36038
diff
changeset
|
1286 |
Matcher m = IMPROPER_HTML_CHARS.matcher(s); |
d31e4986dc8b
8149139: [javadoc] Modify Content to accept CharSequence
ksrini
parents:
36038
diff
changeset
|
1287 |
if (m.matches()) { |
d31e4986dc8b
8149139: [javadoc] Modify Content to accept CharSequence
ksrini
parents:
36038
diff
changeset
|
1288 |
throw new IllegalArgumentException(s.toString()); |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1289 |
} |
17569 | 1290 |
return s; |
17560 | 1291 |
} |
1292 |
||
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1293 |
public Content getDocLink(LinkInfoImpl.Kind context, TypeElement typeElement, Element element, |
17560 | 1294 |
Content label, boolean strong, boolean isProperty) { |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1295 |
if (! (utils.isIncluded(element) || utils.isLinkable(typeElement))) { |
17560 | 1296 |
return label; |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1297 |
} else if (utils.isExecutableElement(element)) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1298 |
ExecutableElement ee = (ExecutableElement)element; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1299 |
return getLink(new LinkInfoImpl(configuration, context, typeElement) |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1300 |
.label(label) |
47850 | 1301 |
.where(links.getName(getAnchor(ee, isProperty))) |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1302 |
.strong(strong)); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1303 |
} else if (utils.isVariableElement(element) || utils.isTypeElement(element)) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1304 |
return getLink(new LinkInfoImpl(configuration, context, typeElement) |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1305 |
.label(label) |
47850 | 1306 |
.where(links.getName(element.getSimpleName().toString())) |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1307 |
.strong(strong)); |
10 | 1308 |
} else { |
17560 | 1309 |
return label; |
10 | 1310 |
} |
1311 |
} |
|
1312 |
||
7614
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
1313 |
/** |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
1314 |
* 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
|
1315 |
* |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
1316 |
* @param context the id of the context where the link will be added |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1317 |
* @param typeElement the typeElement that we should link to. This is not |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1318 |
necessarily equal to element.containingClass(). We may be |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1319 |
inheriting comments |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1320 |
* @param element the member being linked to |
7614
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
1321 |
* @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
|
1322 |
* @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
|
1323 |
*/ |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1324 |
public Content getDocLink(LinkInfoImpl.Kind context, TypeElement typeElement, Element element, |
17560 | 1325 |
Content label) { |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1326 |
if (! (utils.isIncluded(element) || utils.isLinkable(typeElement))) { |
17560 | 1327 |
return label; |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1328 |
} else if (utils.isExecutableElement(element)) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1329 |
ExecutableElement emd = (ExecutableElement) element; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1330 |
return getLink(new LinkInfoImpl(configuration, context, typeElement) |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1331 |
.label(label) |
47850 | 1332 |
.where(links.getName(getAnchor(emd)))); |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1333 |
} else if (utils.isVariableElement(element) || utils.isTypeElement(element)) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1334 |
return getLink(new LinkInfoImpl(configuration, context, typeElement) |
47850 | 1335 |
.label(label).where(links.getName(element.getSimpleName().toString()))); |
7614
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
1336 |
} else { |
17560 | 1337 |
return label; |
7614
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
1338 |
} |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
1339 |
} |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
1340 |
|
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1341 |
public String getAnchor(ExecutableElement executableElement) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1342 |
return getAnchor(executableElement, false); |
16319
e586bfeb39c5
7112427: The doclet needs to be able to generate JavaFX documentation.
jjg
parents:
15725
diff
changeset
|
1343 |
} |
e586bfeb39c5
7112427: The doclet needs to be able to generate JavaFX documentation.
jjg
parents:
15725
diff
changeset
|
1344 |
|
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1345 |
public String getAnchor(ExecutableElement executableElement, boolean isProperty) { |
16319
e586bfeb39c5
7112427: The doclet needs to be able to generate JavaFX documentation.
jjg
parents:
15725
diff
changeset
|
1346 |
if (isProperty) { |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1347 |
return executableElement.getSimpleName().toString(); |
16319
e586bfeb39c5
7112427: The doclet needs to be able to generate JavaFX documentation.
jjg
parents:
15725
diff
changeset
|
1348 |
} |
47328
d18df41954ba
8187521: In some corner cases the javadoc tool can reuse id attribute
jjg
parents:
47300
diff
changeset
|
1349 |
String member = anchorName(executableElement); |
d18df41954ba
8187521: In some corner cases the javadoc tool can reuse id attribute
jjg
parents:
47300
diff
changeset
|
1350 |
String erasedSignature = utils.makeSignature(executableElement, true, true); |
d18df41954ba
8187521: In some corner cases the javadoc tool can reuse id attribute
jjg
parents:
47300
diff
changeset
|
1351 |
return member + erasedSignature; |
d18df41954ba
8187521: In some corner cases the javadoc tool can reuse id attribute
jjg
parents:
47300
diff
changeset
|
1352 |
} |
d18df41954ba
8187521: In some corner cases the javadoc tool can reuse id attribute
jjg
parents:
47300
diff
changeset
|
1353 |
|
d18df41954ba
8187521: In some corner cases the javadoc tool can reuse id attribute
jjg
parents:
47300
diff
changeset
|
1354 |
public String anchorName(Element member) { |
d18df41954ba
8187521: In some corner cases the javadoc tool can reuse id attribute
jjg
parents:
47300
diff
changeset
|
1355 |
if (member.getKind() == ElementKind.CONSTRUCTOR |
d18df41954ba
8187521: In some corner cases the javadoc tool can reuse id attribute
jjg
parents:
47300
diff
changeset
|
1356 |
&& configuration.isOutputHtml5()) { |
d18df41954ba
8187521: In some corner cases the javadoc tool can reuse id attribute
jjg
parents:
47300
diff
changeset
|
1357 |
return "<init>"; |
d18df41954ba
8187521: In some corner cases the javadoc tool can reuse id attribute
jjg
parents:
47300
diff
changeset
|
1358 |
} else { |
d18df41954ba
8187521: In some corner cases the javadoc tool can reuse id attribute
jjg
parents:
47300
diff
changeset
|
1359 |
return utils.getSimpleName(member); |
10 | 1360 |
} |
1361 |
} |
|
1362 |
||
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1363 |
public Content seeTagToContent(Element element, DocTree see) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1364 |
|
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1365 |
Kind kind = see.getKind(); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1366 |
if (!(kind == LINK || kind == SEE || kind == LINK_PLAIN)) { |
17568
d9691936f5f9
8012177: HTMLDocletWriter methods should generate Content, not Strings
jjg
parents:
17567
diff
changeset
|
1367 |
return new ContentBuilder(); |
10 | 1368 |
} |
14266
69453558960d
8000673: remove dead code from HtmlWriter and subtypes
jjg
parents:
14265
diff
changeset
|
1369 |
|
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1370 |
CommentHelper ch = utils.getCommentHelper(element); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1371 |
String tagName = ch.getTagName(see); |
36500
d31e4986dc8b
8149139: [javadoc] Modify Content to accept CharSequence
ksrini
parents:
36038
diff
changeset
|
1372 |
String seetext = replaceDocRootDir(utils.normalizeNewlines(ch.getText(see)).toString()); |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1373 |
// Check if @see is an href or "string" |
10 | 1374 |
if (seetext.startsWith("<") || seetext.startsWith("\"")) { |
17568
d9691936f5f9
8012177: HTMLDocletWriter methods should generate Content, not Strings
jjg
parents:
17567
diff
changeset
|
1375 |
return new RawHtml(seetext); |
10 | 1376 |
} |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1377 |
boolean isLinkPlain = kind == LINK_PLAIN; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1378 |
Content label = plainOrCode(isLinkPlain, new RawHtml(ch.getLabel(configuration, see))); |
14266
69453558960d
8000673: remove dead code from HtmlWriter and subtypes
jjg
parents:
14265
diff
changeset
|
1379 |
|
10 | 1380 |
//The text from the @see tag. We will output this text when a label is not specified. |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1381 |
Content text = plainOrCode(kind == LINK_PLAIN, new RawHtml(seetext)); |
10 | 1382 |
|
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1383 |
TypeElement refClass = ch.getReferencedClass(configuration, see); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1384 |
String refClassName = ch.getReferencedClassName(configuration, see); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1385 |
Element refMem = ch.getReferencedMember(configuration, see); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1386 |
String refMemName = ch.getReferencedMemberName(see); |
14266
69453558960d
8000673: remove dead code from HtmlWriter and subtypes
jjg
parents:
14265
diff
changeset
|
1387 |
|
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1388 |
if (refMemName == null && refMem != null) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1389 |
refMemName = refMem.toString(); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1390 |
} |
10 | 1391 |
if (refClass == null) { |
1392 |
//@see is not referencing an included class |
|
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1393 |
PackageElement refPackage = ch.getReferencedPackage(configuration, see); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1394 |
if (refPackage != null && utils.isIncluded(refPackage)) { |
10 | 1395 |
//@see is referencing an included package |
14266
69453558960d
8000673: remove dead code from HtmlWriter and subtypes
jjg
parents:
14265
diff
changeset
|
1396 |
if (label.isEmpty()) |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1397 |
label = plainOrCode(isLinkPlain, |
36500
d31e4986dc8b
8149139: [javadoc] Modify Content to accept CharSequence
ksrini
parents:
36038
diff
changeset
|
1398 |
new StringContent(refPackage.getQualifiedName())); |
17568
d9691936f5f9
8012177: HTMLDocletWriter methods should generate Content, not Strings
jjg
parents:
17567
diff
changeset
|
1399 |
return getPackageLink(refPackage, label); |
10 | 1400 |
} else { |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1401 |
// @see is not referencing an included class or package. Check for cross links. |
17560 | 1402 |
Content classCrossLink; |
14358
9eda9239cba0
8000416: refactor javadoc to provide and use an abstraction for relative URIs
jjg
parents:
14357
diff
changeset
|
1403 |
DocLink packageCrossLink = getCrossPackageLink(refClassName); |
10 | 1404 |
if (packageCrossLink != null) { |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1405 |
// Package cross link found |
47850 | 1406 |
return Links.createLink(packageCrossLink, |
17568
d9691936f5f9
8012177: HTMLDocletWriter methods should generate Content, not Strings
jjg
parents:
17567
diff
changeset
|
1407 |
(label.isEmpty() ? text : label)); |
10 | 1408 |
} else if ((classCrossLink = getCrossClassLink(refClassName, |
47851
6a9bb4f77d50
8190822: Remove dead code that could lead to invalid HTML
jjg
parents:
47850
diff
changeset
|
1409 |
refMemName, label, false, !isLinkPlain)) != null) { |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1410 |
// Class cross link found (possibly to a member in the class) |
17568
d9691936f5f9
8012177: HTMLDocletWriter methods should generate Content, not Strings
jjg
parents:
17567
diff
changeset
|
1411 |
return classCrossLink; |
10 | 1412 |
} else { |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1413 |
// No cross link found so print warning |
40303 | 1414 |
messages.warning(ch.getDocTreePath(see), |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1415 |
"doclet.see.class_or_package_not_found", |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1416 |
"@" + tagName, |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1417 |
seetext); |
17568
d9691936f5f9
8012177: HTMLDocletWriter methods should generate Content, not Strings
jjg
parents:
17567
diff
changeset
|
1418 |
return (label.isEmpty() ? text: label); |
10 | 1419 |
} |
1420 |
} |
|
1421 |
} else if (refMemName == null) { |
|
1422 |
// 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
|
1423 |
if (label.isEmpty()) { |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1424 |
/* |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1425 |
* it seems to me this is the right thing to do, but it causes comparator failures. |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1426 |
*/ |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1427 |
if (!configuration.backwardCompatibility) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1428 |
StringContent content = utils.isEnclosingPackageIncluded(refClass) |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1429 |
? new StringContent(utils.getSimpleName(refClass)) |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1430 |
: new StringContent(utils.getFullyQualifiedName(refClass)); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1431 |
label = plainOrCode(isLinkPlain, content); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1432 |
} else { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1433 |
label = plainOrCode(isLinkPlain, |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1434 |
new StringContent(utils.getSimpleName(refClass))); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1435 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1436 |
|
10 | 1437 |
} |
17561 | 1438 |
return getLink(new LinkInfoImpl(configuration, LinkInfoImpl.Kind.DEFAULT, refClass) |
17568
d9691936f5f9
8012177: HTMLDocletWriter methods should generate Content, not Strings
jjg
parents:
17567
diff
changeset
|
1439 |
.label(label)); |
10 | 1440 |
} else if (refMem == null) { |
1441 |
// Must be a member reference since refClass is not null and refMemName is not null. |
|
1442 |
// However, refMem is null, so this referenced member does not exist. |
|
17568
d9691936f5f9
8012177: HTMLDocletWriter methods should generate Content, not Strings
jjg
parents:
17567
diff
changeset
|
1443 |
return (label.isEmpty() ? text: label); |
10 | 1444 |
} else { |
1445 |
// Must be a member reference since refClass is not null and refMemName is not null. |
|
1446 |
// refMem is not null, so this @see tag must be referencing a valid member. |
|
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1447 |
TypeElement containing = utils.getEnclosingTypeElement(refMem); |
47395
2ea4edfdef8e
8157000: Do not generate javadoc for overridden method with no spec change
ksrini
parents:
47328
diff
changeset
|
1448 |
|
2ea4edfdef8e
8157000: Do not generate javadoc for overridden method with no spec change
ksrini
parents:
47328
diff
changeset
|
1449 |
// Find the enclosing type where the method is actually visible |
2ea4edfdef8e
8157000: Do not generate javadoc for overridden method with no spec change
ksrini
parents:
47328
diff
changeset
|
1450 |
// in the inheritance hierarchy. |
2ea4edfdef8e
8157000: Do not generate javadoc for overridden method with no spec change
ksrini
parents:
47328
diff
changeset
|
1451 |
if (refMem.getKind() == ElementKind.METHOD) { |
2ea4edfdef8e
8157000: Do not generate javadoc for overridden method with no spec change
ksrini
parents:
47328
diff
changeset
|
1452 |
VisibleMemberMap vmm = configuration.getVisibleMemberMap(containing, |
2ea4edfdef8e
8157000: Do not generate javadoc for overridden method with no spec change
ksrini
parents:
47328
diff
changeset
|
1453 |
VisibleMemberMap.Kind.METHODS); |
2ea4edfdef8e
8157000: Do not generate javadoc for overridden method with no spec change
ksrini
parents:
47328
diff
changeset
|
1454 |
ExecutableElement overriddenMethod = vmm.getVisibleMethod((ExecutableElement)refMem); |
2ea4edfdef8e
8157000: Do not generate javadoc for overridden method with no spec change
ksrini
parents:
47328
diff
changeset
|
1455 |
if (overriddenMethod != null) |
2ea4edfdef8e
8157000: Do not generate javadoc for overridden method with no spec change
ksrini
parents:
47328
diff
changeset
|
1456 |
containing = utils.getEnclosingTypeElement(overriddenMethod); |
2ea4edfdef8e
8157000: Do not generate javadoc for overridden method with no spec change
ksrini
parents:
47328
diff
changeset
|
1457 |
} |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1458 |
if (ch.getText(see).trim().startsWith("#") && |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1459 |
! (utils.isPublic(containing) || utils.isLinkable(containing))) { |
10 | 1460 |
// Since the link is relative and the holder is not even being |
1461 |
// documented, this must be an inherited link. Redirect it. |
|
1462 |
// The current class either overrides the referenced member or |
|
1463 |
// inherits it automatically. |
|
3891
69ac41cb327b
5093723: REGRESSION: ClassCastException in SingleIndexWriter
jjg
parents:
2321
diff
changeset
|
1464 |
if (this instanceof ClassWriterImpl) { |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1465 |
containing = ((ClassWriterImpl) this).getTypeElement(); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1466 |
} else if (!utils.isPublic(containing)) { |
40303 | 1467 |
messages.warning( |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1468 |
ch.getDocTreePath(see), "doclet.see.class_or_package_not_accessible", |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1469 |
tagName, utils.getFullyQualifiedName(containing)); |
3891
69ac41cb327b
5093723: REGRESSION: ClassCastException in SingleIndexWriter
jjg
parents:
2321
diff
changeset
|
1470 |
} else { |
40303 | 1471 |
messages.warning( |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1472 |
ch.getDocTreePath(see), "doclet.see.class_or_package_not_found", |
3891
69ac41cb327b
5093723: REGRESSION: ClassCastException in SingleIndexWriter
jjg
parents:
2321
diff
changeset
|
1473 |
tagName, seetext); |
69ac41cb327b
5093723: REGRESSION: ClassCastException in SingleIndexWriter
jjg
parents:
2321
diff
changeset
|
1474 |
} |
10 | 1475 |
} |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1476 |
if (configuration.currentTypeElement != containing) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1477 |
refMemName = (utils.isConstructor(refMem)) |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1478 |
? refMemName |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1479 |
: utils.getSimpleName(containing) + "." + refMemName; |
10 | 1480 |
} |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1481 |
if (utils.isExecutableElement(refMem)) { |
10 | 1482 |
if (refMemName.indexOf('(') < 0) { |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1483 |
refMemName += utils.makeSignature((ExecutableElement)refMem, true); |
10 | 1484 |
} |
1485 |
} |
|
14266
69453558960d
8000673: remove dead code from HtmlWriter and subtypes
jjg
parents:
14265
diff
changeset
|
1486 |
|
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1487 |
text = plainOrCode(kind == LINK_PLAIN, new StringContent(refMemName)); |
10 | 1488 |
|
17558
eee4ccf66cfd
8010440: Replace int constants in LinkInfoImpl with enum
jjg
parents:
17547
diff
changeset
|
1489 |
return getDocLink(LinkInfoImpl.Kind.SEE_TAG, containing, |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1490 |
refMem, (label.isEmpty() ? text: label), false); |
10 | 1491 |
} |
1492 |
} |
|
1493 |
||
17560 | 1494 |
private Content plainOrCode(boolean plain, Content body) { |
1495 |
return (plain || body.isEmpty()) ? body : HtmlTree.CODE(body); |
|
1496 |
} |
|
1497 |
||
7614
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
1498 |
/** |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
1499 |
* Add the inline comment. |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
1500 |
* |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1501 |
* @param element the Element for which the inline comment will be added |
7614
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
1502 |
* @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
|
1503 |
* @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
|
1504 |
*/ |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1505 |
public void addInlineComment(Element element, DocTree tag, Content htmltree) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1506 |
CommentHelper ch = utils.getCommentHelper(element); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1507 |
List<? extends DocTree> description = ch.getDescription(configuration, tag); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1508 |
addCommentTags(element, tag, description, false, false, htmltree); |
7614
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
1509 |
} |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
1510 |
|
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
1511 |
/** |
42816
3638773ff1b0
8162674: change javadoc output text and style emitted by for-removal deprecations
bpatel
parents:
42408
diff
changeset
|
1512 |
* Get the deprecated phrase as content. |
3638773ff1b0
8162674: change javadoc output text and style emitted by for-removal deprecations
bpatel
parents:
42408
diff
changeset
|
1513 |
* |
3638773ff1b0
8162674: change javadoc output text and style emitted by for-removal deprecations
bpatel
parents:
42408
diff
changeset
|
1514 |
* @param e the Element for which the inline deprecated comment will be added |
3638773ff1b0
8162674: change javadoc output text and style emitted by for-removal deprecations
bpatel
parents:
42408
diff
changeset
|
1515 |
* @return a content tree for the deprecated phrase. |
3638773ff1b0
8162674: change javadoc output text and style emitted by for-removal deprecations
bpatel
parents:
42408
diff
changeset
|
1516 |
*/ |
3638773ff1b0
8162674: change javadoc output text and style emitted by for-removal deprecations
bpatel
parents:
42408
diff
changeset
|
1517 |
public Content getDeprecatedPhrase(Element e) { |
3638773ff1b0
8162674: change javadoc output text and style emitted by for-removal deprecations
bpatel
parents:
42408
diff
changeset
|
1518 |
return (utils.isDeprecatedForRemoval(e)) |
3638773ff1b0
8162674: change javadoc output text and style emitted by for-removal deprecations
bpatel
parents:
42408
diff
changeset
|
1519 |
? contents.deprecatedForRemovalPhrase |
3638773ff1b0
8162674: change javadoc output text and style emitted by for-removal deprecations
bpatel
parents:
42408
diff
changeset
|
1520 |
: contents.deprecatedPhrase; |
3638773ff1b0
8162674: change javadoc output text and style emitted by for-removal deprecations
bpatel
parents:
42408
diff
changeset
|
1521 |
} |
3638773ff1b0
8162674: change javadoc output text and style emitted by for-removal deprecations
bpatel
parents:
42408
diff
changeset
|
1522 |
|
3638773ff1b0
8162674: change javadoc output text and style emitted by for-removal deprecations
bpatel
parents:
42408
diff
changeset
|
1523 |
/** |
7614
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
1524 |
* Add the inline deprecated comment. |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
1525 |
* |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1526 |
* @param e the Element for which the inline deprecated comment will be added |
7614
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
1527 |
* @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
|
1528 |
* @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
|
1529 |
*/ |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1530 |
public void addInlineDeprecatedComment(Element e, DocTree tag, Content htmltree) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1531 |
CommentHelper ch = utils.getCommentHelper(e); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1532 |
addCommentTags(e, ch.getBody(configuration, tag), true, false, htmltree); |
7614
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
1533 |
} |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
1534 |
|
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
1535 |
/** |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
1536 |
* Adds the summary content. |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
1537 |
* |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1538 |
* @param element the Element for which the summary will be generated |
7614
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
1539 |
* @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
|
1540 |
*/ |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1541 |
public void addSummaryComment(Element element, Content htmltree) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1542 |
addSummaryComment(element, utils.getFirstSentenceTrees(element), htmltree); |
7614
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
1543 |
} |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
1544 |
|
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
1545 |
/** |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
1546 |
* Adds the summary content. |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
1547 |
* |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1548 |
* @param element the Element for which the summary will be generated |
7614
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
1549 |
* @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
|
1550 |
* @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
|
1551 |
*/ |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1552 |
public void addSummaryComment(Element element, List<? extends DocTree> firstSentenceTags, Content htmltree) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1553 |
addCommentTags(element, firstSentenceTags, false, true, htmltree); |
7614
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
1554 |
} |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
1555 |
|
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1556 |
public void addSummaryDeprecatedComment(Element element, DocTree tag, Content htmltree) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1557 |
CommentHelper ch = utils.getCommentHelper(element); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1558 |
List<? extends DocTree> body = ch.getBody(configuration, tag); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1559 |
addCommentTags(element, ch.getFirstSentenceTrees(configuration, body), true, true, htmltree); |
7614
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
1560 |
} |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
1561 |
|
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
1562 |
/** |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
1563 |
* Adds the inline comment. |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
1564 |
* |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1565 |
* @param element the Element for which the inline comments will be generated |
7614
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
1566 |
* @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
|
1567 |
*/ |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1568 |
public void addInlineComment(Element element, Content htmltree) { |
41452 | 1569 |
addCommentTags(element, utils.getFullBody(element), false, false, htmltree); |
7614
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
1570 |
} |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
1571 |
|
10 | 1572 |
/** |
7614
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
1573 |
* Adds the comment tags. |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
1574 |
* |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1575 |
* @param element the Element for which the comment tags will be generated |
7614
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
1576 |
* @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
|
1577 |
* @param depr true if it is deprecated |
14357
faf9cde2817b
8000741: refactor javadoc to use abstraction to handle relative paths
jjg
parents:
14266
diff
changeset
|
1578 |
* @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
|
1579 |
* @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
|
1580 |
*/ |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1581 |
private void addCommentTags(Element element, List<? extends DocTree> tags, boolean depr, |
7614
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
1582 |
boolean first, Content htmltree) { |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1583 |
addCommentTags(element, null, tags, depr, first, htmltree); |
17547
40f2f9a5a445
8008768: Using {@inheritDoc} in simple tag defined via -tag fails
jjg
parents:
16964
diff
changeset
|
1584 |
} |
40f2f9a5a445
8008768: Using {@inheritDoc} in simple tag defined via -tag fails
jjg
parents:
16964
diff
changeset
|
1585 |
|
40f2f9a5a445
8008768: Using {@inheritDoc} in simple tag defined via -tag fails
jjg
parents:
16964
diff
changeset
|
1586 |
/** |
40f2f9a5a445
8008768: Using {@inheritDoc} in simple tag defined via -tag fails
jjg
parents:
16964
diff
changeset
|
1587 |
* Adds the comment tags. |
40f2f9a5a445
8008768: Using {@inheritDoc} in simple tag defined via -tag fails
jjg
parents:
16964
diff
changeset
|
1588 |
* |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1589 |
* @param element for which the comment tags will be generated |
17547
40f2f9a5a445
8008768: Using {@inheritDoc} in simple tag defined via -tag fails
jjg
parents:
16964
diff
changeset
|
1590 |
* @param holderTag the block tag context for the inline tags |
40f2f9a5a445
8008768: Using {@inheritDoc} in simple tag defined via -tag fails
jjg
parents:
16964
diff
changeset
|
1591 |
* @param tags the first sentence tags for the doc |
40f2f9a5a445
8008768: Using {@inheritDoc} in simple tag defined via -tag fails
jjg
parents:
16964
diff
changeset
|
1592 |
* @param depr true if it is deprecated |
40f2f9a5a445
8008768: Using {@inheritDoc} in simple tag defined via -tag fails
jjg
parents:
16964
diff
changeset
|
1593 |
* @param first true if the first sentence tags should be added |
40f2f9a5a445
8008768: Using {@inheritDoc} in simple tag defined via -tag fails
jjg
parents:
16964
diff
changeset
|
1594 |
* @param htmltree the documentation tree to which the comment tags will be added |
40f2f9a5a445
8008768: Using {@inheritDoc} in simple tag defined via -tag fails
jjg
parents:
16964
diff
changeset
|
1595 |
*/ |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1596 |
private void addCommentTags(Element element, DocTree holderTag, List<? extends DocTree> tags, boolean depr, |
17547
40f2f9a5a445
8008768: Using {@inheritDoc} in simple tag defined via -tag fails
jjg
parents:
16964
diff
changeset
|
1597 |
boolean first, Content htmltree) { |
7614
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
1598 |
if(configuration.nocomment){ |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
1599 |
return; |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
1600 |
} |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
1601 |
Content div; |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1602 |
Content result = commentTagsToContent(null, element, tags, first); |
7614
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
1603 |
if (depr) { |
47300
a905ce398074
8074407: javadoc: using <pre> after @deprecated tag causes warnings
bpatel
parents:
47216
diff
changeset
|
1604 |
div = HtmlTree.DIV(HtmlStyle.deprecationComment, result); |
7614
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
1605 |
htmltree.addContent(div); |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
1606 |
} |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
1607 |
else { |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
1608 |
div = HtmlTree.DIV(HtmlStyle.block, result); |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
1609 |
htmltree.addContent(div); |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
1610 |
} |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1611 |
if (tags.isEmpty()) { |
40303 | 1612 |
htmltree.addContent(Contents.SPACE); |
7614
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
1613 |
} |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
1614 |
} |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
1615 |
|
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1616 |
boolean ignoreNonInlineTag(DocTree dtree) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1617 |
Name name = null; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1618 |
if (dtree.getKind() == Kind.START_ELEMENT) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1619 |
StartElementTree setree = (StartElementTree)dtree; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1620 |
name = setree.getName(); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1621 |
} else if (dtree.getKind() == Kind.END_ELEMENT) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1622 |
EndElementTree eetree = (EndElementTree)dtree; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1623 |
name = eetree.getName(); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1624 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1625 |
|
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1626 |
if (name != null) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1627 |
com.sun.tools.doclint.HtmlTag htmlTag = com.sun.tools.doclint.HtmlTag.get(name); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1628 |
if (htmlTag != null && |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1629 |
htmlTag.blockType != com.sun.tools.doclint.HtmlTag.BlockType.INLINE) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1630 |
return true; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1631 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1632 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1633 |
return false; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1634 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1635 |
|
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1636 |
boolean isAllWhiteSpace(String body) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1637 |
for (int i = 0 ; i < body.length(); i++) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1638 |
if (!Character.isWhitespace(body.charAt(i))) |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1639 |
return false; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1640 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1641 |
return true; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1642 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1643 |
|
45860
0952e2c6545a
8179704: doclet crashes with an empty package.html
ksrini
parents:
45417
diff
changeset
|
1644 |
// Notify the next DocTree handler to take necessary action |
0952e2c6545a
8179704: doclet crashes with an empty package.html
ksrini
parents:
45417
diff
changeset
|
1645 |
private boolean commentRemoved = false; |
0952e2c6545a
8179704: doclet crashes with an empty package.html
ksrini
parents:
45417
diff
changeset
|
1646 |
|
7614
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
1647 |
/** |
10 | 1648 |
* Converts inline tags and text to text strings, expanding the |
1649 |
* inline tags along the way. Called wherever text can contain |
|
1650 |
* an inline tag, such as in comments or in free-form text arguments |
|
1651 |
* to non-inline tags. |
|
1652 |
* |
|
1653 |
* @param holderTag specific tag where comment resides |
|
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1654 |
* @param element specific element where comment resides |
10 | 1655 |
* @param tags array of text tags and inline tags (often alternating) |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1656 |
present in the text of interest for this element |
10 | 1657 |
* @param isFirstSentence true if text is first sentence |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1658 |
* @return a Content object |
10 | 1659 |
*/ |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1660 |
public Content commentTagsToContent(DocTree holderTag, Element element, |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1661 |
List<? extends DocTree> tags, boolean isFirstSentence) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1662 |
|
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1663 |
final Content result = new ContentBuilder() { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1664 |
@Override |
36500
d31e4986dc8b
8149139: [javadoc] Modify Content to accept CharSequence
ksrini
parents:
36038
diff
changeset
|
1665 |
public void addContent(CharSequence text) { |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1666 |
super.addContent(utils.normalizeNewlines(text)); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1667 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1668 |
}; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1669 |
CommentHelper ch = utils.getCommentHelper(element); |
10 | 1670 |
// Array of all possible inline tags for this javadoc run |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1671 |
configuration.tagletManager.checkTags(utils, element, tags, true); |
45860
0952e2c6545a
8179704: doclet crashes with an empty package.html
ksrini
parents:
45417
diff
changeset
|
1672 |
commentRemoved = false; |
0952e2c6545a
8179704: doclet crashes with an empty package.html
ksrini
parents:
45417
diff
changeset
|
1673 |
|
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1674 |
for (ListIterator<? extends DocTree> iterator = tags.listIterator(); iterator.hasNext();) { |
45860
0952e2c6545a
8179704: doclet crashes with an empty package.html
ksrini
parents:
45417
diff
changeset
|
1675 |
boolean isFirstNode = !iterator.hasPrevious(); |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1676 |
DocTree tag = iterator.next(); |
45860
0952e2c6545a
8179704: doclet crashes with an empty package.html
ksrini
parents:
45417
diff
changeset
|
1677 |
boolean isLastNode = !iterator.hasNext(); |
0952e2c6545a
8179704: doclet crashes with an empty package.html
ksrini
parents:
45417
diff
changeset
|
1678 |
|
0952e2c6545a
8179704: doclet crashes with an empty package.html
ksrini
parents:
45417
diff
changeset
|
1679 |
if (isFirstSentence) { |
0952e2c6545a
8179704: doclet crashes with an empty package.html
ksrini
parents:
45417
diff
changeset
|
1680 |
// Ignore block tags |
0952e2c6545a
8179704: doclet crashes with an empty package.html
ksrini
parents:
45417
diff
changeset
|
1681 |
if (ignoreNonInlineTag(tag)) |
0952e2c6545a
8179704: doclet crashes with an empty package.html
ksrini
parents:
45417
diff
changeset
|
1682 |
continue; |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1683 |
|
45860
0952e2c6545a
8179704: doclet crashes with an empty package.html
ksrini
parents:
45417
diff
changeset
|
1684 |
// Ignore any trailing whitespace OR whitespace after removed html comment |
0952e2c6545a
8179704: doclet crashes with an empty package.html
ksrini
parents:
45417
diff
changeset
|
1685 |
if ((isLastNode || commentRemoved) |
0952e2c6545a
8179704: doclet crashes with an empty package.html
ksrini
parents:
45417
diff
changeset
|
1686 |
&& tag.getKind() == TEXT |
0952e2c6545a
8179704: doclet crashes with an empty package.html
ksrini
parents:
45417
diff
changeset
|
1687 |
&& isAllWhiteSpace(ch.getText(tag))) |
0952e2c6545a
8179704: doclet crashes with an empty package.html
ksrini
parents:
45417
diff
changeset
|
1688 |
continue; |
0952e2c6545a
8179704: doclet crashes with an empty package.html
ksrini
parents:
45417
diff
changeset
|
1689 |
|
0952e2c6545a
8179704: doclet crashes with an empty package.html
ksrini
parents:
45417
diff
changeset
|
1690 |
// Ignore any leading html comments |
0952e2c6545a
8179704: doclet crashes with an empty package.html
ksrini
parents:
45417
diff
changeset
|
1691 |
if ((isFirstNode || commentRemoved) && tag.getKind() == COMMENT) { |
0952e2c6545a
8179704: doclet crashes with an empty package.html
ksrini
parents:
45417
diff
changeset
|
1692 |
commentRemoved = true; |
0952e2c6545a
8179704: doclet crashes with an empty package.html
ksrini
parents:
45417
diff
changeset
|
1693 |
continue; |
0952e2c6545a
8179704: doclet crashes with an empty package.html
ksrini
parents:
45417
diff
changeset
|
1694 |
} |
0952e2c6545a
8179704: doclet crashes with an empty package.html
ksrini
parents:
45417
diff
changeset
|
1695 |
} |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1696 |
|
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1697 |
boolean allDone = new SimpleDocTreeVisitor<Boolean, Content>() { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1698 |
|
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1699 |
private boolean inAnAtag() { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1700 |
if (utils.isStartElement(tag)) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1701 |
StartElementTree st = (StartElementTree)tag; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1702 |
Name name = st.getName(); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1703 |
if (name != null) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1704 |
com.sun.tools.doclint.HtmlTag htag = |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1705 |
com.sun.tools.doclint.HtmlTag.get(name); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1706 |
return htag != null && htag.equals(com.sun.tools.doclint.HtmlTag.A); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1707 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1708 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1709 |
return false; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1710 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1711 |
|
40606
eb2c81860c86
8164836: TEST_BUG: adjust scope of the DefinedByAnalyzer in tools/all/RunCodingRules.java
jlahoda
parents:
40587
diff
changeset
|
1712 |
@Override |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1713 |
public Boolean visitAttribute(AttributeTree node, Content c) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1714 |
StringBuilder sb = new StringBuilder(SPACER).append(node.getName()); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1715 |
if (node.getValueKind() == ValueKind.EMPTY) { |
36500
d31e4986dc8b
8149139: [javadoc] Modify Content to accept CharSequence
ksrini
parents:
36038
diff
changeset
|
1716 |
result.addContent(sb); |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1717 |
return false; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1718 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1719 |
sb.append("="); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1720 |
String quote; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1721 |
switch (node.getValueKind()) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1722 |
case DOUBLE: |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1723 |
quote = "\""; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1724 |
break; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1725 |
case SINGLE: |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1726 |
quote = "\'"; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1727 |
break; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1728 |
default: |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1729 |
quote = ""; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1730 |
break; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1731 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1732 |
sb.append(quote); |
36500
d31e4986dc8b
8149139: [javadoc] Modify Content to accept CharSequence
ksrini
parents:
36038
diff
changeset
|
1733 |
result.addContent(sb); |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1734 |
Content docRootContent = new ContentBuilder(); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1735 |
|
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1736 |
for (DocTree dt : node.getValue()) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1737 |
if (utils.isText(dt) && inAnAtag()) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1738 |
String text = ((TextTree) dt).getBody(); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1739 |
if (text.startsWith("/..") && !configuration.docrootparent.isEmpty()) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1740 |
result.addContent(configuration.docrootparent); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1741 |
docRootContent = new ContentBuilder(); |
45860
0952e2c6545a
8179704: doclet crashes with an empty package.html
ksrini
parents:
45417
diff
changeset
|
1742 |
result.addContent(textCleanup(text.substring(3), isLastNode)); |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1743 |
} else { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1744 |
if (!docRootContent.isEmpty()) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1745 |
docRootContent = copyDocRootContent(docRootContent); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1746 |
} else { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1747 |
text = redirectRelativeLinks(element, (TextTree) dt); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1748 |
} |
45860
0952e2c6545a
8179704: doclet crashes with an empty package.html
ksrini
parents:
45417
diff
changeset
|
1749 |
result.addContent(textCleanup(text, isLastNode)); |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1750 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1751 |
} else { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1752 |
docRootContent = copyDocRootContent(docRootContent); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1753 |
dt.accept(this, docRootContent); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1754 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1755 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1756 |
copyDocRootContent(docRootContent); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1757 |
result.addContent(quote); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1758 |
return false; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1759 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1760 |
|
40606
eb2c81860c86
8164836: TEST_BUG: adjust scope of the DefinedByAnalyzer in tools/all/RunCodingRules.java
jlahoda
parents:
40587
diff
changeset
|
1761 |
@Override |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1762 |
public Boolean visitComment(CommentTree node, Content c) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1763 |
result.addContent(new RawHtml(node.getBody())); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1764 |
return false; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1765 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1766 |
|
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1767 |
private Content copyDocRootContent(Content content) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1768 |
if (!content.isEmpty()) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1769 |
result.addContent(content); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1770 |
return new ContentBuilder(); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1771 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1772 |
return content; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1773 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1774 |
|
40606
eb2c81860c86
8164836: TEST_BUG: adjust scope of the DefinedByAnalyzer in tools/all/RunCodingRules.java
jlahoda
parents:
40587
diff
changeset
|
1775 |
@Override |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1776 |
public Boolean visitDocRoot(DocRootTree node, Content c) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1777 |
Content docRootContent = TagletWriter.getInlineTagOutput(element, |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1778 |
configuration.tagletManager, |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1779 |
holderTag, |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1780 |
node, |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1781 |
getTagletWriterInstance(isFirstSentence)); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1782 |
if (c != null) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1783 |
c.addContent(docRootContent); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1784 |
} else { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1785 |
result.addContent(docRootContent); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1786 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1787 |
return false; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1788 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1789 |
|
40606
eb2c81860c86
8164836: TEST_BUG: adjust scope of the DefinedByAnalyzer in tools/all/RunCodingRules.java
jlahoda
parents:
40587
diff
changeset
|
1790 |
@Override |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1791 |
public Boolean visitEndElement(EndElementTree node, Content c) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1792 |
RawHtml rawHtml = new RawHtml("</" + node.getName() + ">"); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1793 |
result.addContent(rawHtml); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1794 |
return false; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1795 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1796 |
|
40606
eb2c81860c86
8164836: TEST_BUG: adjust scope of the DefinedByAnalyzer in tools/all/RunCodingRules.java
jlahoda
parents:
40587
diff
changeset
|
1797 |
@Override |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1798 |
public Boolean visitEntity(EntityTree node, Content c) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1799 |
result.addContent(new RawHtml(node.toString())); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1800 |
return false; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1801 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1802 |
|
40606
eb2c81860c86
8164836: TEST_BUG: adjust scope of the DefinedByAnalyzer in tools/all/RunCodingRules.java
jlahoda
parents:
40587
diff
changeset
|
1803 |
@Override |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1804 |
public Boolean visitErroneous(ErroneousTree node, Content c) { |
40303 | 1805 |
messages.warning(ch.getDocTreePath(node), |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1806 |
"doclet.tag.invalid_usage", node); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1807 |
result.addContent(new RawHtml(node.toString())); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1808 |
return false; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1809 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1810 |
|
40606
eb2c81860c86
8164836: TEST_BUG: adjust scope of the DefinedByAnalyzer in tools/all/RunCodingRules.java
jlahoda
parents:
40587
diff
changeset
|
1811 |
@Override |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1812 |
public Boolean visitInheritDoc(InheritDocTree node, Content c) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1813 |
Content output = TagletWriter.getInlineTagOutput(element, |
22005
4270ada5dcd1
8025416: doclet not substituting {@docRoot} in some cases
bpatel
parents:
21494
diff
changeset
|
1814 |
configuration.tagletManager, holderTag, |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1815 |
tag, getTagletWriterInstance(isFirstSentence)); |
17574
044c7e1e4d53
8012308: Remove TagletOutput in favor of direct use of Content
jjg
parents:
17573
diff
changeset
|
1816 |
result.addContent(output); |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1817 |
// if we obtained the first sentence successfully, nothing more to do |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1818 |
return (isFirstSentence && !output.isEmpty()); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1819 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1820 |
|
40606
eb2c81860c86
8164836: TEST_BUG: adjust scope of the DefinedByAnalyzer in tools/all/RunCodingRules.java
jlahoda
parents:
40587
diff
changeset
|
1821 |
@Override |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1822 |
public Boolean visitIndex(IndexTree node, Content p) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1823 |
Content output = TagletWriter.getInlineTagOutput(element, |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1824 |
configuration.tagletManager, holderTag, tag, |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1825 |
getTagletWriterInstance(isFirstSentence)); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1826 |
if (output != null) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1827 |
result.addContent(output); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1828 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1829 |
return false; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1830 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1831 |
|
40606
eb2c81860c86
8164836: TEST_BUG: adjust scope of the DefinedByAnalyzer in tools/all/RunCodingRules.java
jlahoda
parents:
40587
diff
changeset
|
1832 |
@Override |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1833 |
public Boolean visitLink(LinkTree node, Content c) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1834 |
// we need to pass the DocTreeImpl here, so ignore node |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1835 |
result.addContent(seeTagToContent(element, tag)); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1836 |
return false; |
10 | 1837 |
} |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1838 |
|
40606
eb2c81860c86
8164836: TEST_BUG: adjust scope of the DefinedByAnalyzer in tools/all/RunCodingRules.java
jlahoda
parents:
40587
diff
changeset
|
1839 |
@Override |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1840 |
public Boolean visitLiteral(LiteralTree node, Content c) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1841 |
String s = node.getBody().toString(); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1842 |
Content content = new StringContent(utils.normalizeNewlines(s)); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1843 |
if (node.getKind() == CODE) |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1844 |
content = HtmlTree.CODE(content); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1845 |
result.addContent(content); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1846 |
return false; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1847 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1848 |
|
40606
eb2c81860c86
8164836: TEST_BUG: adjust scope of the DefinedByAnalyzer in tools/all/RunCodingRules.java
jlahoda
parents:
40587
diff
changeset
|
1849 |
@Override |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1850 |
public Boolean visitSee(SeeTree node, Content c) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1851 |
// we need to pass the DocTreeImpl here, so ignore node |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1852 |
result.addContent(seeTagToContent(element, tag)); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1853 |
return false; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1854 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1855 |
|
40606
eb2c81860c86
8164836: TEST_BUG: adjust scope of the DefinedByAnalyzer in tools/all/RunCodingRules.java
jlahoda
parents:
40587
diff
changeset
|
1856 |
@Override |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1857 |
public Boolean visitStartElement(StartElementTree node, Content c) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1858 |
String text = "<" + node.getName(); |
36500
d31e4986dc8b
8149139: [javadoc] Modify Content to accept CharSequence
ksrini
parents:
36038
diff
changeset
|
1859 |
RawHtml rawHtml = new RawHtml(utils.normalizeNewlines(text)); |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1860 |
result.addContent(rawHtml); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1861 |
|
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1862 |
for (DocTree dt : node.getAttributes()) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1863 |
dt.accept(this, null); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1864 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1865 |
result.addContent(new RawHtml(node.isSelfClosing() ? "/>" : ">")); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1866 |
return false; |
9608 | 1867 |
} |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1868 |
|
46184
f1325703ea85
8173425: Javadoc needs a new tag to specify the summary.
ksrini
parents:
46080
diff
changeset
|
1869 |
@Override |
f1325703ea85
8173425: Javadoc needs a new tag to specify the summary.
ksrini
parents:
46080
diff
changeset
|
1870 |
public Boolean visitSummary(SummaryTree node, Content c) { |
f1325703ea85
8173425: Javadoc needs a new tag to specify the summary.
ksrini
parents:
46080
diff
changeset
|
1871 |
Content output = TagletWriter.getInlineTagOutput(element, |
f1325703ea85
8173425: Javadoc needs a new tag to specify the summary.
ksrini
parents:
46080
diff
changeset
|
1872 |
configuration.tagletManager, holderTag, tag, |
f1325703ea85
8173425: Javadoc needs a new tag to specify the summary.
ksrini
parents:
46080
diff
changeset
|
1873 |
getTagletWriterInstance(isFirstSentence)); |
f1325703ea85
8173425: Javadoc needs a new tag to specify the summary.
ksrini
parents:
46080
diff
changeset
|
1874 |
result.addContent(output); |
f1325703ea85
8173425: Javadoc needs a new tag to specify the summary.
ksrini
parents:
46080
diff
changeset
|
1875 |
return false; |
f1325703ea85
8173425: Javadoc needs a new tag to specify the summary.
ksrini
parents:
46080
diff
changeset
|
1876 |
} |
f1325703ea85
8173425: Javadoc needs a new tag to specify the summary.
ksrini
parents:
46080
diff
changeset
|
1877 |
|
36500
d31e4986dc8b
8149139: [javadoc] Modify Content to accept CharSequence
ksrini
parents:
36038
diff
changeset
|
1878 |
private CharSequence textCleanup(String text, boolean isLast) { |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1879 |
return textCleanup(text, isLast, false); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1880 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1881 |
|
36500
d31e4986dc8b
8149139: [javadoc] Modify Content to accept CharSequence
ksrini
parents:
36038
diff
changeset
|
1882 |
private CharSequence textCleanup(String text, boolean isLast, boolean trimLeader) { |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1883 |
if (trimLeader) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1884 |
text = removeLeadingWhitespace(text); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1885 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1886 |
if (isFirstSentence && isLast) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1887 |
text = removeTrailingWhitespace(text); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1888 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1889 |
text = utils.replaceTabs(text); |
36500
d31e4986dc8b
8149139: [javadoc] Modify Content to accept CharSequence
ksrini
parents:
36038
diff
changeset
|
1890 |
return utils.normalizeNewlines(text); |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1891 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1892 |
|
40606
eb2c81860c86
8164836: TEST_BUG: adjust scope of the DefinedByAnalyzer in tools/all/RunCodingRules.java
jlahoda
parents:
40587
diff
changeset
|
1893 |
@Override |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1894 |
public Boolean visitText(TextTree node, Content c) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1895 |
String text = node.getBody(); |
45860
0952e2c6545a
8179704: doclet crashes with an empty package.html
ksrini
parents:
45417
diff
changeset
|
1896 |
result.addContent(new RawHtml(textCleanup(text, isLastNode, commentRemoved))); |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1897 |
return false; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1898 |
} |
10 | 1899 |
|
40606
eb2c81860c86
8164836: TEST_BUG: adjust scope of the DefinedByAnalyzer in tools/all/RunCodingRules.java
jlahoda
parents:
40587
diff
changeset
|
1900 |
@Override |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1901 |
protected Boolean defaultAction(DocTree node, Content c) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1902 |
Content output = TagletWriter.getInlineTagOutput(element, |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1903 |
configuration.tagletManager, holderTag, tag, |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1904 |
getTagletWriterInstance(isFirstSentence)); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1905 |
if (output != null) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1906 |
result.addContent(output); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1907 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1908 |
return false; |
10 | 1909 |
} |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1910 |
|
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1911 |
}.visit(tag, null); |
45860
0952e2c6545a
8179704: doclet crashes with an empty package.html
ksrini
parents:
45417
diff
changeset
|
1912 |
commentRemoved = false; |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1913 |
if (allDone) |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1914 |
break; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1915 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1916 |
return result; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1917 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1918 |
|
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1919 |
private String removeTrailingWhitespace(String text) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1920 |
char[] buf = text.toCharArray(); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1921 |
for (int i = buf.length - 1; i > 0 ; i--) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1922 |
if (!Character.isWhitespace(buf[i])) |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1923 |
return text.substring(0, i + 1); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1924 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1925 |
return text; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1926 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1927 |
|
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1928 |
private String removeLeadingWhitespace(String text) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1929 |
char[] buf = text.toCharArray(); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1930 |
for (int i = 0; i < buf.length; i++) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1931 |
if (!Character.isWhitespace(buf[i])) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1932 |
return text.substring(i); |
10 | 1933 |
} |
1934 |
} |
|
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1935 |
return text; |
10 | 1936 |
} |
1937 |
||
1938 |
/** |
|
1939 |
* Return true if relative links should not be redirected. |
|
1940 |
* |
|
1941 |
* @return Return true if a relative link should not be redirected. |
|
1942 |
*/ |
|
1943 |
private boolean shouldNotRedirectRelativeLinks() { |
|
1944 |
return this instanceof AnnotationTypeWriter || |
|
1945 |
this instanceof ClassWriter || |
|
1946 |
this instanceof PackageSummaryWriter; |
|
1947 |
} |
|
1948 |
||
1949 |
/** |
|
1950 |
* 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
|
1951 |
* that documentation to another place such as the index or class-use page, |
10 | 1952 |
* that relative link will no longer work. We should redirect those links |
1953 |
* so that they will work again. |
|
1954 |
* <p> |
|
1955 |
* Here is the algorithm used to fix the link: |
|
1956 |
* <p> |
|
13844 | 1957 |
* {@literal <relative link> => docRoot + <relative path to file> + <relative link> } |
10 | 1958 |
* <p> |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1959 |
* For example, suppose DocletEnvironment has this link: |
13844 | 1960 |
* {@literal <a href="package-summary.html">The package Page</a> } |
10 | 1961 |
* <p> |
1962 |
* If this link appeared in the index, we would redirect |
|
1963 |
* the link like this: |
|
1964 |
* |
|
13844 | 1965 |
* {@literal <a href="./com/sun/javadoc/package-summary.html">The package Page</a>} |
10 | 1966 |
* |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1967 |
* @param element the Element object whose documentation is being written. |
10 | 1968 |
* @param text the text being written. |
1969 |
* |
|
1970 |
* @return the text, with all the relative links redirected to work. |
|
1971 |
*/ |
|
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1972 |
private String redirectRelativeLinks(Element element, TextTree tt) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1973 |
String text = tt.getBody(); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1974 |
if (element == null || utils.isOverviewElement(element) || shouldNotRedirectRelativeLinks()) { |
10 | 1975 |
return text; |
1976 |
} |
|
1977 |
||
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1978 |
DocPath redirectPathFromRoot = new SimpleElementVisitor9<DocPath, Void>() { |
40606
eb2c81860c86
8164836: TEST_BUG: adjust scope of the DefinedByAnalyzer in tools/all/RunCodingRules.java
jlahoda
parents:
40587
diff
changeset
|
1979 |
@Override |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1980 |
public DocPath visitType(TypeElement e, Void p) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1981 |
return DocPath.forPackage(utils.containingPackage(e)); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1982 |
} |
10 | 1983 |
|
40606
eb2c81860c86
8164836: TEST_BUG: adjust scope of the DefinedByAnalyzer in tools/all/RunCodingRules.java
jlahoda
parents:
40587
diff
changeset
|
1984 |
@Override |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1985 |
public DocPath visitPackage(PackageElement e, Void p) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1986 |
return DocPath.forPackage(e); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1987 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1988 |
|
40606
eb2c81860c86
8164836: TEST_BUG: adjust scope of the DefinedByAnalyzer in tools/all/RunCodingRules.java
jlahoda
parents:
40587
diff
changeset
|
1989 |
@Override |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1990 |
public DocPath visitVariable(VariableElement e, Void p) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1991 |
return DocPath.forPackage(utils.containingPackage(e)); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1992 |
} |
10 | 1993 |
|
40606
eb2c81860c86
8164836: TEST_BUG: adjust scope of the DefinedByAnalyzer in tools/all/RunCodingRules.java
jlahoda
parents:
40587
diff
changeset
|
1994 |
@Override |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1995 |
public DocPath visitExecutable(ExecutableElement e, Void p) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1996 |
return DocPath.forPackage(utils.containingPackage(e)); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
1997 |
} |
23123
fd8ad69ac7fe
6457406: javadoc doesn't handle <a href='http://...'> properly in producing index pages
yan
parents:
22163
diff
changeset
|
1998 |
|
40606
eb2c81860c86
8164836: TEST_BUG: adjust scope of the DefinedByAnalyzer in tools/all/RunCodingRules.java
jlahoda
parents:
40587
diff
changeset
|
1999 |
@Override |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
2000 |
protected DocPath defaultAction(Element e, Void p) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
2001 |
return null; |
10 | 2002 |
} |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
2003 |
}.visit(element); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
2004 |
if (redirectPathFromRoot == null) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
2005 |
return text; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
2006 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
2007 |
String lower = Utils.toLowerCase(text); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
2008 |
if (!(lower.startsWith("mailto:") |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
2009 |
|| lower.startsWith("http:") |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
2010 |
|| lower.startsWith("https:") |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
2011 |
|| lower.startsWith("file:"))) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
2012 |
text = "{@" + (new DocRootTaglet()).getName() + "}/" |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
2013 |
+ redirectPathFromRoot.resolve(text).getPath(); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
2014 |
text = replaceDocRootDir(text); |
10 | 2015 |
} |
2016 |
return text; |
|
2017 |
} |
|
2018 |
||
14549
0599d73bf1da
8002304: Group methods by types in methods summary section
bpatel
parents:
14542
diff
changeset
|
2019 |
/** |
9303
eae35c201e19
7032975: API files in javax.annotation.processing need to be updated for references to JLS
jjh
parents:
8631
diff
changeset
|
2020 |
* According to |
eae35c201e19
7032975: API files in javax.annotation.processing need to be updated for references to JLS
jjh
parents:
8631
diff
changeset
|
2021 |
* <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
|
2022 |
* all the outer classes and static nested classes are core classes. |
10 | 2023 |
*/ |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
2024 |
public boolean isCoreClass(TypeElement typeElement) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
2025 |
return utils.getEnclosingTypeElement(typeElement) == null || utils.isStatic(typeElement); |
10 | 2026 |
} |
2027 |
||
2028 |
/** |
|
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
2029 |
* Adds the annotation types for the given packageElement. |
7614
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
2030 |
* |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
2031 |
* @param packageElement 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
|
2032 |
* @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
|
2033 |
* added |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
2034 |
*/ |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
2035 |
public void addAnnotationInfo(PackageElement packageElement, Content htmltree) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
2036 |
addAnnotationInfo(packageElement, packageElement.getAnnotationMirrors(), htmltree); |
7614
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
2037 |
} |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
2038 |
|
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
2039 |
/** |
15385 | 2040 |
* Add the annotation types of the executable receiver. |
2041 |
* |
|
2042 |
* @param method the executable to write the receiver annotations for. |
|
16964
096de5815398
8005091: javadoc should be able to return the receiver type
bpatel
parents:
16319
diff
changeset
|
2043 |
* @param descList list of annotation description. |
15385 | 2044 |
* @param htmltree the documentation tree to which the annotation info will be |
2045 |
* added |
|
2046 |
*/ |
|
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
2047 |
public void addReceiverAnnotationInfo(ExecutableElement method, List<AnnotationMirror> descList, |
16964
096de5815398
8005091: javadoc should be able to return the receiver type
bpatel
parents:
16319
diff
changeset
|
2048 |
Content htmltree) { |
096de5815398
8005091: javadoc should be able to return the receiver type
bpatel
parents:
16319
diff
changeset
|
2049 |
addAnnotationInfo(0, method, descList, false, htmltree); |
15385 | 2050 |
} |
2051 |
||
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
2052 |
/* |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
2053 |
* this is a hack to delay dealing with Annotations in the writers, the assumption |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
2054 |
* is that all necessary checks have been made to get here. |
7614
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
2055 |
*/ |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
2056 |
public void addReceiverAnnotationInfo(ExecutableElement method, TypeMirror rcvrTypeMirror, |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
2057 |
List<? extends AnnotationMirror> annotationMirrors, Content htmltree) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
2058 |
TypeMirror rcvrType = method.getReceiverType(); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
2059 |
List<? extends AnnotationMirror> annotationMirrors1 = rcvrType.getAnnotationMirrors(); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
2060 |
addAnnotationInfo(0, method, annotationMirrors1, false, htmltree); |
7614
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
2061 |
} |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
2062 |
|
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
2063 |
/** |
47849 | 2064 |
* Adds the annotation types for the given element. |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
2065 |
* |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
2066 |
* @param element the package to write annotations for |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
2067 |
* @param htmltree the content tree to which the annotation types will be added |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
2068 |
*/ |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
2069 |
public void addAnnotationInfo(Element element, Content htmltree) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
2070 |
addAnnotationInfo(element, element.getAnnotationMirrors(), htmltree); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
2071 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
2072 |
|
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
2073 |
/** |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
2074 |
* Add the annotatation types for the given element and parameter. |
7614
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
2075 |
* |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
2076 |
* @param indent the number of spaces to indent the parameters. |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
2077 |
* @param element the element to write annotations for. |
7614
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
2078 |
* @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
|
2079 |
* @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
|
2080 |
*/ |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
2081 |
public boolean addAnnotationInfo(int indent, Element element, VariableElement param, |
7614
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
2082 |
Content tree) { |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
2083 |
return addAnnotationInfo(indent, element, param.getAnnotationMirrors(), false, tree); |
7614
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
2084 |
} |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
2085 |
|
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
2086 |
/** |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
2087 |
* Adds the annotatation types for the given Element. |
7614
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
2088 |
* |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
2089 |
* @param element the element to write annotations for. |
7614
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
2090 |
* @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
|
2091 |
* @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
|
2092 |
* added |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
2093 |
*/ |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
2094 |
private void addAnnotationInfo(Element element, List<? extends AnnotationMirror> descList, |
7614
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
2095 |
Content htmltree) { |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
2096 |
addAnnotationInfo(0, element, descList, true, htmltree); |
7614
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
2097 |
} |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
2098 |
|
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
2099 |
/** |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
2100 |
* Adds the annotation types for the given element. |
7614
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
2101 |
* |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
2102 |
* @param indent the number of extra spaces to indent the annotations. |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
2103 |
* @param element the element to write annotations for. |
7614
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
2104 |
* @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
|
2105 |
* @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
|
2106 |
* added |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
2107 |
*/ |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
2108 |
private boolean addAnnotationInfo(int indent, Element element, |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
2109 |
List<? extends AnnotationMirror> descList, boolean lineBreak, Content htmltree) { |
17570
78512b2899db
8012183: replace some uses of Configuration.getText with Configuration.getResource
jjg
parents:
17569
diff
changeset
|
2110 |
List<Content> annotations = getAnnotations(indent, descList, lineBreak); |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
2111 |
String sep = ""; |
17570
78512b2899db
8012183: replace some uses of Configuration.getText with Configuration.getResource
jjg
parents:
17569
diff
changeset
|
2112 |
if (annotations.isEmpty()) { |
7614
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
2113 |
return false; |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
2114 |
} |
17570
78512b2899db
8012183: replace some uses of Configuration.getText with Configuration.getResource
jjg
parents:
17569
diff
changeset
|
2115 |
for (Content annotation: annotations) { |
16964
096de5815398
8005091: javadoc should be able to return the receiver type
bpatel
parents:
16319
diff
changeset
|
2116 |
htmltree.addContent(sep); |
17570
78512b2899db
8012183: replace some uses of Configuration.getText with Configuration.getResource
jjg
parents:
17569
diff
changeset
|
2117 |
htmltree.addContent(annotation); |
31943
72b69ab429c9
8062647: Wrong indentation of arguments of annotated methods
igerasim
parents:
31297
diff
changeset
|
2118 |
if (!lineBreak) { |
72b69ab429c9
8062647: Wrong indentation of arguments of annotated methods
igerasim
parents:
31297
diff
changeset
|
2119 |
sep = " "; |
72b69ab429c9
8062647: Wrong indentation of arguments of annotated methods
igerasim
parents:
31297
diff
changeset
|
2120 |
} |
7614
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
2121 |
} |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
2122 |
return true; |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
2123 |
} |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
2124 |
|
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
2125 |
/** |
10 | 2126 |
* Return the string representations of the annotation types for |
2127 |
* the given doc. |
|
2128 |
* |
|
2129 |
* @param indent the number of extra spaces to indent the annotations. |
|
2130 |
* @param descList the array of {@link AnnotationDesc}. |
|
2131 |
* @param linkBreak if true, add new line between each member value. |
|
2132 |
* @return an array of strings representing the annotations being |
|
2133 |
* documented. |
|
2134 |
*/ |
|
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
2135 |
private List<Content> getAnnotations(int indent, List<? extends AnnotationMirror> descList, boolean linkBreak) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
2136 |
return getAnnotations(indent, descList, linkBreak, true); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
2137 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
2138 |
|
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
2139 |
private List<Content> getAnnotations(int indent, AnnotationMirror amirror, boolean linkBreak) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
2140 |
List<AnnotationMirror> descList = new ArrayList<>(); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
2141 |
descList.add(amirror); |
15385 | 2142 |
return getAnnotations(indent, descList, linkBreak, true); |
2143 |
} |
|
2144 |
||
2145 |
/** |
|
2146 |
* Return the string representations of the annotation types for |
|
2147 |
* the given doc. |
|
2148 |
* |
|
2149 |
* A {@code null} {@code elementType} indicates that all the |
|
2150 |
* annotations should be returned without any filtering. |
|
2151 |
* |
|
2152 |
* @param indent the number of extra spaces to indent the annotations. |
|
2153 |
* @param descList the array of {@link AnnotationDesc}. |
|
2154 |
* @param linkBreak if true, add new line between each member value. |
|
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
2155 |
* @param isJava5DeclarationLocation |
15385 | 2156 |
* @return an array of strings representing the annotations being |
2157 |
* documented. |
|
2158 |
*/ |
|
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
2159 |
public List<Content> getAnnotations(int indent, List<? extends AnnotationMirror> descList, |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
2160 |
boolean linkBreak, boolean isJava5DeclarationLocation) { |
22163 | 2161 |
List<Content> results = new ArrayList<>(); |
17570
78512b2899db
8012183: replace some uses of Configuration.getText with Configuration.getResource
jjg
parents:
17569
diff
changeset
|
2162 |
ContentBuilder annotation; |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
2163 |
for (AnnotationMirror aDesc : descList) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
2164 |
TypeElement annotationElement = (TypeElement)aDesc.getAnnotationType().asElement(); |
15035
d03c311f44e6
8005092: javadoc should check for synthesized bit on an annotation
bpatel
parents:
14549
diff
changeset
|
2165 |
// 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
|
2166 |
// 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
|
2167 |
// 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
|
2168 |
// 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
|
2169 |
// but its container is documented, it will be added to the list. |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
2170 |
if (!utils.isDocumentedAnnotation(annotationElement) && |
22159
682da512ec17
8030253: Update langtools to use strings-in-switch
briangoetz
parents:
22153
diff
changeset
|
2171 |
(!isAnnotationDocumented && !isContainerDocumented)) { |
10 | 2172 |
continue; |
2173 |
} |
|
15385 | 2174 |
/* TODO: check logic here to correctly handle declaration |
2175 |
* and type annotations. |
|
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
2176 |
if (utils.isDeclarationAnnotation(annotationElement, isJava5DeclarationLocation)) { |
15385 | 2177 |
continue; |
2178 |
}*/ |
|
17570
78512b2899db
8012183: replace some uses of Configuration.getText with Configuration.getResource
jjg
parents:
17569
diff
changeset
|
2179 |
annotation = new ContentBuilder(); |
15035
d03c311f44e6
8005092: javadoc should check for synthesized bit on an annotation
bpatel
parents:
14549
diff
changeset
|
2180 |
isAnnotationDocumented = false; |
14542 | 2181 |
LinkInfoImpl linkInfo = new LinkInfoImpl(configuration, |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
2182 |
LinkInfoImpl.Kind.ANNOTATION, annotationElement); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
2183 |
Map<? extends ExecutableElement, ? extends AnnotationValue> pairs = aDesc.getElementValues(); |
15035
d03c311f44e6
8005092: javadoc should check for synthesized bit on an annotation
bpatel
parents:
14549
diff
changeset
|
2184 |
// If the annotation is synthesized, do not print the container. |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
2185 |
if (utils.configuration.workArounds.isSynthesized(aDesc)) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
2186 |
for (ExecutableElement ee : pairs.keySet()) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
2187 |
AnnotationValue annotationValue = pairs.get(ee); |
22163 | 2188 |
List<AnnotationValue> annotationTypeValues = new ArrayList<>(); |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
2189 |
|
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
2190 |
new SimpleAnnotationValueVisitor9<Void, List<AnnotationValue>>() { |
40606
eb2c81860c86
8164836: TEST_BUG: adjust scope of the DefinedByAnalyzer in tools/all/RunCodingRules.java
jlahoda
parents:
40587
diff
changeset
|
2191 |
@Override |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
2192 |
public Void visitArray(List<? extends AnnotationValue> vals, List<AnnotationValue> p) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
2193 |
p.addAll(vals); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
2194 |
return null; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
2195 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
2196 |
|
40606
eb2c81860c86
8164836: TEST_BUG: adjust scope of the DefinedByAnalyzer in tools/all/RunCodingRules.java
jlahoda
parents:
40587
diff
changeset
|
2197 |
@Override |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
2198 |
protected Void defaultAction(Object o, List<AnnotationValue> p) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
2199 |
p.add(annotationValue); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
2200 |
return null; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
2201 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
2202 |
}.visit(annotationValue, annotationTypeValues); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
2203 |
|
15035
d03c311f44e6
8005092: javadoc should check for synthesized bit on an annotation
bpatel
parents:
14549
diff
changeset
|
2204 |
String sep = ""; |
d03c311f44e6
8005092: javadoc should check for synthesized bit on an annotation
bpatel
parents:
14549
diff
changeset
|
2205 |
for (AnnotationValue av : annotationTypeValues) { |
17570
78512b2899db
8012183: replace some uses of Configuration.getText with Configuration.getResource
jjg
parents:
17569
diff
changeset
|
2206 |
annotation.addContent(sep); |
78512b2899db
8012183: replace some uses of Configuration.getText with Configuration.getResource
jjg
parents:
17569
diff
changeset
|
2207 |
annotation.addContent(annotationValueToContent(av)); |
15035
d03c311f44e6
8005092: javadoc should check for synthesized bit on an annotation
bpatel
parents:
14549
diff
changeset
|
2208 |
sep = " "; |
10 | 2209 |
} |
2210 |
} |
|
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
2211 |
} else if (isAnnotationArray(pairs)) { |
15035
d03c311f44e6
8005092: javadoc should check for synthesized bit on an annotation
bpatel
parents:
14549
diff
changeset
|
2212 |
// 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
|
2213 |
// 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
|
2214 |
// the container. |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
2215 |
if (pairs.size() == 1 && isAnnotationDocumented) { |
22163 | 2216 |
List<AnnotationValue> annotationTypeValues = new ArrayList<>(); |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
2217 |
for (AnnotationValue a : pairs.values()) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
2218 |
new SimpleAnnotationValueVisitor9<Void, List<AnnotationValue>>() { |
40606
eb2c81860c86
8164836: TEST_BUG: adjust scope of the DefinedByAnalyzer in tools/all/RunCodingRules.java
jlahoda
parents:
40587
diff
changeset
|
2219 |
@Override |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
2220 |
public Void visitArray(List<? extends AnnotationValue> vals, List<AnnotationValue> annotationTypeValues) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
2221 |
for (AnnotationValue av : vals) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
2222 |
annotationTypeValues.add(av); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
2223 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
2224 |
return null; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
2225 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
2226 |
}.visit(a, annotationTypeValues); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
2227 |
} |
15035
d03c311f44e6
8005092: javadoc should check for synthesized bit on an annotation
bpatel
parents:
14549
diff
changeset
|
2228 |
String sep = ""; |
d03c311f44e6
8005092: javadoc should check for synthesized bit on an annotation
bpatel
parents:
14549
diff
changeset
|
2229 |
for (AnnotationValue av : annotationTypeValues) { |
17570
78512b2899db
8012183: replace some uses of Configuration.getText with Configuration.getResource
jjg
parents:
17569
diff
changeset
|
2230 |
annotation.addContent(sep); |
78512b2899db
8012183: replace some uses of Configuration.getText with Configuration.getResource
jjg
parents:
17569
diff
changeset
|
2231 |
annotation.addContent(annotationValueToContent(av)); |
15035
d03c311f44e6
8005092: javadoc should check for synthesized bit on an annotation
bpatel
parents:
14549
diff
changeset
|
2232 |
sep = " "; |
d03c311f44e6
8005092: javadoc should check for synthesized bit on an annotation
bpatel
parents:
14549
diff
changeset
|
2233 |
} |
d03c311f44e6
8005092: javadoc should check for synthesized bit on an annotation
bpatel
parents:
14549
diff
changeset
|
2234 |
} |
d03c311f44e6
8005092: javadoc should check for synthesized bit on an annotation
bpatel
parents:
14549
diff
changeset
|
2235 |
// 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
|
2236 |
// 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
|
2237 |
else { |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
2238 |
addAnnotations(annotationElement, linkInfo, annotation, pairs, |
22159
682da512ec17
8030253: Update langtools to use strings-in-switch
briangoetz
parents:
22153
diff
changeset
|
2239 |
indent, false); |
15035
d03c311f44e6
8005092: javadoc should check for synthesized bit on an annotation
bpatel
parents:
14549
diff
changeset
|
2240 |
} |
d03c311f44e6
8005092: javadoc should check for synthesized bit on an annotation
bpatel
parents:
14549
diff
changeset
|
2241 |
} |
d03c311f44e6
8005092: javadoc should check for synthesized bit on an annotation
bpatel
parents:
14549
diff
changeset
|
2242 |
else { |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
2243 |
addAnnotations(annotationElement, linkInfo, annotation, pairs, |
22159
682da512ec17
8030253: Update langtools to use strings-in-switch
briangoetz
parents:
22153
diff
changeset
|
2244 |
indent, linkBreak); |
10 | 2245 |
} |
17570
78512b2899db
8012183: replace some uses of Configuration.getText with Configuration.getResource
jjg
parents:
17569
diff
changeset
|
2246 |
annotation.addContent(linkBreak ? DocletConstants.NL : ""); |
78512b2899db
8012183: replace some uses of Configuration.getText with Configuration.getResource
jjg
parents:
17569
diff
changeset
|
2247 |
results.add(annotation); |
10 | 2248 |
} |
2249 |
return results; |
|
2250 |
} |
|
2251 |
||
15035
d03c311f44e6
8005092: javadoc should check for synthesized bit on an annotation
bpatel
parents:
14549
diff
changeset
|
2252 |
/** |
d03c311f44e6
8005092: javadoc should check for synthesized bit on an annotation
bpatel
parents:
14549
diff
changeset
|
2253 |
* Add annotation to the annotation string. |
d03c311f44e6
8005092: javadoc should check for synthesized bit on an annotation
bpatel
parents:
14549
diff
changeset
|
2254 |
* |
d03c311f44e6
8005092: javadoc should check for synthesized bit on an annotation
bpatel
parents:
14549
diff
changeset
|
2255 |
* @param annotationDoc the annotation being documented |
d03c311f44e6
8005092: javadoc should check for synthesized bit on an annotation
bpatel
parents:
14549
diff
changeset
|
2256 |
* @param linkInfo the information about the link |
d03c311f44e6
8005092: javadoc should check for synthesized bit on an annotation
bpatel
parents:
14549
diff
changeset
|
2257 |
* @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
|
2258 |
* @param pairs annotation type element and value pairs |
d03c311f44e6
8005092: javadoc should check for synthesized bit on an annotation
bpatel
parents:
14549
diff
changeset
|
2259 |
* @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
|
2260 |
* @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
|
2261 |
*/ |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
2262 |
private void addAnnotations(TypeElement annotationDoc, LinkInfoImpl linkInfo, |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
2263 |
ContentBuilder annotation, Map<? extends ExecutableElement,? extends AnnotationValue>map, |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
2264 |
int indent, boolean linkBreak) { |
36500
d31e4986dc8b
8149139: [javadoc] Modify Content to accept CharSequence
ksrini
parents:
36038
diff
changeset
|
2265 |
linkInfo.label = new StringContent("@"); |
d31e4986dc8b
8149139: [javadoc] Modify Content to accept CharSequence
ksrini
parents:
36038
diff
changeset
|
2266 |
linkInfo.label.addContent(annotationDoc.getSimpleName()); |
17570
78512b2899db
8012183: replace some uses of Configuration.getText with Configuration.getResource
jjg
parents:
17569
diff
changeset
|
2267 |
annotation.addContent(getLink(linkInfo)); |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
2268 |
if (!map.isEmpty()) { |
17570
78512b2899db
8012183: replace some uses of Configuration.getText with Configuration.getResource
jjg
parents:
17569
diff
changeset
|
2269 |
annotation.addContent("("); |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
2270 |
boolean isFirst = true; |
36038
39c5445924b9
6469561: javadoc for annotation types should not display "public abstract" modifiers on methods
darcy
parents:
35426
diff
changeset
|
2271 |
Set<? extends ExecutableElement> keys = map.keySet(); |
39c5445924b9
6469561: javadoc for annotation types should not display "public abstract" modifiers on methods
darcy
parents:
35426
diff
changeset
|
2272 |
boolean multipleValues = keys.size() > 1; |
39c5445924b9
6469561: javadoc for annotation types should not display "public abstract" modifiers on methods
darcy
parents:
35426
diff
changeset
|
2273 |
for (ExecutableElement element : keys) { |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
2274 |
if (isFirst) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
2275 |
isFirst = false; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
2276 |
} else { |
17570
78512b2899db
8012183: replace some uses of Configuration.getText with Configuration.getResource
jjg
parents:
17569
diff
changeset
|
2277 |
annotation.addContent(","); |
15035
d03c311f44e6
8005092: javadoc should check for synthesized bit on an annotation
bpatel
parents:
14549
diff
changeset
|
2278 |
if (linkBreak) { |
17570
78512b2899db
8012183: replace some uses of Configuration.getText with Configuration.getResource
jjg
parents:
17569
diff
changeset
|
2279 |
annotation.addContent(DocletConstants.NL); |
36500
d31e4986dc8b
8149139: [javadoc] Modify Content to accept CharSequence
ksrini
parents:
36038
diff
changeset
|
2280 |
int spaces = annotationDoc.getSimpleName().length() + 2; |
15035
d03c311f44e6
8005092: javadoc should check for synthesized bit on an annotation
bpatel
parents:
14549
diff
changeset
|
2281 |
for (int k = 0; k < (spaces + indent); k++) { |
17570
78512b2899db
8012183: replace some uses of Configuration.getText with Configuration.getResource
jjg
parents:
17569
diff
changeset
|
2282 |
annotation.addContent(" "); |
15035
d03c311f44e6
8005092: javadoc should check for synthesized bit on an annotation
bpatel
parents:
14549
diff
changeset
|
2283 |
} |
d03c311f44e6
8005092: javadoc should check for synthesized bit on an annotation
bpatel
parents:
14549
diff
changeset
|
2284 |
} |
d03c311f44e6
8005092: javadoc should check for synthesized bit on an annotation
bpatel
parents:
14549
diff
changeset
|
2285 |
} |
36038
39c5445924b9
6469561: javadoc for annotation types should not display "public abstract" modifiers on methods
darcy
parents:
35426
diff
changeset
|
2286 |
String simpleName = element.getSimpleName().toString(); |
39c5445924b9
6469561: javadoc for annotation types should not display "public abstract" modifiers on methods
darcy
parents:
35426
diff
changeset
|
2287 |
if (multipleValues || !"value".equals(simpleName)) { // Omit "value=" where unnecessary |
39c5445924b9
6469561: javadoc for annotation types should not display "public abstract" modifiers on methods
darcy
parents:
35426
diff
changeset
|
2288 |
annotation.addContent(getDocLink(LinkInfoImpl.Kind.ANNOTATION, |
39c5445924b9
6469561: javadoc for annotation types should not display "public abstract" modifiers on methods
darcy
parents:
35426
diff
changeset
|
2289 |
element, simpleName, false)); |
39c5445924b9
6469561: javadoc for annotation types should not display "public abstract" modifiers on methods
darcy
parents:
35426
diff
changeset
|
2290 |
annotation.addContent("="); |
39c5445924b9
6469561: javadoc for annotation types should not display "public abstract" modifiers on methods
darcy
parents:
35426
diff
changeset
|
2291 |
} |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
2292 |
AnnotationValue annotationValue = map.get(element); |
22163 | 2293 |
List<AnnotationValue> annotationTypeValues = new ArrayList<>(); |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
2294 |
new SimpleAnnotationValueVisitor9<Void, AnnotationValue>() { |
40606
eb2c81860c86
8164836: TEST_BUG: adjust scope of the DefinedByAnalyzer in tools/all/RunCodingRules.java
jlahoda
parents:
40587
diff
changeset
|
2295 |
@Override |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
2296 |
public Void visitArray(List<? extends AnnotationValue> vals, AnnotationValue p) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
2297 |
annotationTypeValues.addAll(vals); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
2298 |
return null; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
2299 |
} |
40606
eb2c81860c86
8164836: TEST_BUG: adjust scope of the DefinedByAnalyzer in tools/all/RunCodingRules.java
jlahoda
parents:
40587
diff
changeset
|
2300 |
@Override |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
2301 |
protected Void defaultAction(Object o, AnnotationValue p) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
2302 |
annotationTypeValues.add(p); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
2303 |
return null; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
2304 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
2305 |
}.visit(annotationValue, annotationValue); |
17570
78512b2899db
8012183: replace some uses of Configuration.getText with Configuration.getResource
jjg
parents:
17569
diff
changeset
|
2306 |
annotation.addContent(annotationTypeValues.size() == 1 ? "" : "{"); |
15035
d03c311f44e6
8005092: javadoc should check for synthesized bit on an annotation
bpatel
parents:
14549
diff
changeset
|
2307 |
String sep = ""; |
d03c311f44e6
8005092: javadoc should check for synthesized bit on an annotation
bpatel
parents:
14549
diff
changeset
|
2308 |
for (AnnotationValue av : annotationTypeValues) { |
17570
78512b2899db
8012183: replace some uses of Configuration.getText with Configuration.getResource
jjg
parents:
17569
diff
changeset
|
2309 |
annotation.addContent(sep); |
78512b2899db
8012183: replace some uses of Configuration.getText with Configuration.getResource
jjg
parents:
17569
diff
changeset
|
2310 |
annotation.addContent(annotationValueToContent(av)); |
15035
d03c311f44e6
8005092: javadoc should check for synthesized bit on an annotation
bpatel
parents:
14549
diff
changeset
|
2311 |
sep = ","; |
d03c311f44e6
8005092: javadoc should check for synthesized bit on an annotation
bpatel
parents:
14549
diff
changeset
|
2312 |
} |
17570
78512b2899db
8012183: replace some uses of Configuration.getText with Configuration.getResource
jjg
parents:
17569
diff
changeset
|
2313 |
annotation.addContent(annotationTypeValues.size() == 1 ? "" : "}"); |
15035
d03c311f44e6
8005092: javadoc should check for synthesized bit on an annotation
bpatel
parents:
14549
diff
changeset
|
2314 |
isContainerDocumented = false; |
d03c311f44e6
8005092: javadoc should check for synthesized bit on an annotation
bpatel
parents:
14549
diff
changeset
|
2315 |
} |
17570
78512b2899db
8012183: replace some uses of Configuration.getText with Configuration.getResource
jjg
parents:
17569
diff
changeset
|
2316 |
annotation.addContent(")"); |
15035
d03c311f44e6
8005092: javadoc should check for synthesized bit on an annotation
bpatel
parents:
14549
diff
changeset
|
2317 |
} |
d03c311f44e6
8005092: javadoc should check for synthesized bit on an annotation
bpatel
parents:
14549
diff
changeset
|
2318 |
} |
d03c311f44e6
8005092: javadoc should check for synthesized bit on an annotation
bpatel
parents:
14549
diff
changeset
|
2319 |
|
d03c311f44e6
8005092: javadoc should check for synthesized bit on an annotation
bpatel
parents:
14549
diff
changeset
|
2320 |
/** |
d03c311f44e6
8005092: javadoc should check for synthesized bit on an annotation
bpatel
parents:
14549
diff
changeset
|
2321 |
* 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
|
2322 |
* 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
|
2323 |
* |
d03c311f44e6
8005092: javadoc should check for synthesized bit on an annotation
bpatel
parents:
14549
diff
changeset
|
2324 |
* @param pairs annotation type element and value pairs |
d03c311f44e6
8005092: javadoc should check for synthesized bit on an annotation
bpatel
parents:
14549
diff
changeset
|
2325 |
* |
d03c311f44e6
8005092: javadoc should check for synthesized bit on an annotation
bpatel
parents:
14549
diff
changeset
|
2326 |
* @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
|
2327 |
*/ |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
2328 |
private boolean isAnnotationArray(Map<? extends ExecutableElement, ? extends AnnotationValue> pairs) { |
15035
d03c311f44e6
8005092: javadoc should check for synthesized bit on an annotation
bpatel
parents:
14549
diff
changeset
|
2329 |
AnnotationValue annotationValue; |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
2330 |
for (ExecutableElement ee : pairs.keySet()) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
2331 |
annotationValue = pairs.get(ee); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
2332 |
boolean rvalue = new SimpleAnnotationValueVisitor9<Boolean, Void>() { |
40606
eb2c81860c86
8164836: TEST_BUG: adjust scope of the DefinedByAnalyzer in tools/all/RunCodingRules.java
jlahoda
parents:
40587
diff
changeset
|
2333 |
@Override |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
2334 |
public Boolean visitArray(List<? extends AnnotationValue> vals, Void p) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
2335 |
if (vals.size() > 1) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
2336 |
if (vals.get(0) instanceof AnnotationMirror) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
2337 |
isContainerDocumented = true; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
2338 |
return new SimpleAnnotationValueVisitor9<Boolean, Void>() { |
40606
eb2c81860c86
8164836: TEST_BUG: adjust scope of the DefinedByAnalyzer in tools/all/RunCodingRules.java
jlahoda
parents:
40587
diff
changeset
|
2339 |
@Override |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
2340 |
public Boolean visitAnnotation(AnnotationMirror a, Void p) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
2341 |
isContainerDocumented = true; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
2342 |
Element asElement = a.getAnnotationType().asElement(); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
2343 |
if (utils.isDocumentedAnnotation((TypeElement)asElement)) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
2344 |
isAnnotationDocumented = true; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
2345 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
2346 |
return true; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
2347 |
} |
40606
eb2c81860c86
8164836: TEST_BUG: adjust scope of the DefinedByAnalyzer in tools/all/RunCodingRules.java
jlahoda
parents:
40587
diff
changeset
|
2348 |
@Override |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
2349 |
protected Boolean defaultAction(Object o, Void p) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
2350 |
return false; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
2351 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
2352 |
}.visit(vals.get(0)); |
15035
d03c311f44e6
8005092: javadoc should check for synthesized bit on an annotation
bpatel
parents:
14549
diff
changeset
|
2353 |
} |
d03c311f44e6
8005092: javadoc should check for synthesized bit on an annotation
bpatel
parents:
14549
diff
changeset
|
2354 |
} |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
2355 |
return false; |
15035
d03c311f44e6
8005092: javadoc should check for synthesized bit on an annotation
bpatel
parents:
14549
diff
changeset
|
2356 |
} |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
2357 |
|
40606
eb2c81860c86
8164836: TEST_BUG: adjust scope of the DefinedByAnalyzer in tools/all/RunCodingRules.java
jlahoda
parents:
40587
diff
changeset
|
2358 |
@Override |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
2359 |
protected Boolean defaultAction(Object o, Void p) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
2360 |
return false; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
2361 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
2362 |
}.visit(annotationValue); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
2363 |
if (rvalue) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
2364 |
return true; |
15035
d03c311f44e6
8005092: javadoc should check for synthesized bit on an annotation
bpatel
parents:
14549
diff
changeset
|
2365 |
} |
d03c311f44e6
8005092: javadoc should check for synthesized bit on an annotation
bpatel
parents:
14549
diff
changeset
|
2366 |
} |
d03c311f44e6
8005092: javadoc should check for synthesized bit on an annotation
bpatel
parents:
14549
diff
changeset
|
2367 |
return false; |
d03c311f44e6
8005092: javadoc should check for synthesized bit on an annotation
bpatel
parents:
14549
diff
changeset
|
2368 |
} |
d03c311f44e6
8005092: javadoc should check for synthesized bit on an annotation
bpatel
parents:
14549
diff
changeset
|
2369 |
|
17570
78512b2899db
8012183: replace some uses of Configuration.getText with Configuration.getResource
jjg
parents:
17569
diff
changeset
|
2370 |
private Content annotationValueToContent(AnnotationValue annotationValue) { |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
2371 |
return new SimpleAnnotationValueVisitor9<Content, Void>() { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
2372 |
|
40606
eb2c81860c86
8164836: TEST_BUG: adjust scope of the DefinedByAnalyzer in tools/all/RunCodingRules.java
jlahoda
parents:
40587
diff
changeset
|
2373 |
@Override |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
2374 |
public Content visitType(TypeMirror t, Void p) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
2375 |
return new SimpleTypeVisitor9<Content, Void>() { |
40606
eb2c81860c86
8164836: TEST_BUG: adjust scope of the DefinedByAnalyzer in tools/all/RunCodingRules.java
jlahoda
parents:
40587
diff
changeset
|
2376 |
@Override |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
2377 |
public Content visitDeclared(DeclaredType t, Void p) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
2378 |
LinkInfoImpl linkInfo = new LinkInfoImpl(configuration, |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
2379 |
LinkInfoImpl.Kind.ANNOTATION, t); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
2380 |
String name = utils.isIncluded(t.asElement()) |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
2381 |
? t.asElement().getSimpleName().toString() |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
2382 |
: utils.getFullyQualifiedName(t.asElement()); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
2383 |
linkInfo.label = new StringContent(name + utils.getDimension(t) + ".class"); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
2384 |
return getLink(linkInfo); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
2385 |
} |
40606
eb2c81860c86
8164836: TEST_BUG: adjust scope of the DefinedByAnalyzer in tools/all/RunCodingRules.java
jlahoda
parents:
40587
diff
changeset
|
2386 |
@Override |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
2387 |
protected Content defaultAction(TypeMirror e, Void p) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
2388 |
return new StringContent(t + utils.getDimension(t) + ".class"); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
2389 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
2390 |
}.visit(t); |
10 | 2391 |
} |
40606
eb2c81860c86
8164836: TEST_BUG: adjust scope of the DefinedByAnalyzer in tools/all/RunCodingRules.java
jlahoda
parents:
40587
diff
changeset
|
2392 |
@Override |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
2393 |
public Content visitAnnotation(AnnotationMirror a, Void p) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
2394 |
List<Content> list = getAnnotations(0, a, false); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
2395 |
ContentBuilder buf = new ContentBuilder(); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
2396 |
for (Content c : list) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
2397 |
buf.addContent(c); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
2398 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
2399 |
return buf; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
2400 |
} |
40606
eb2c81860c86
8164836: TEST_BUG: adjust scope of the DefinedByAnalyzer in tools/all/RunCodingRules.java
jlahoda
parents:
40587
diff
changeset
|
2401 |
@Override |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
2402 |
public Content visitEnumConstant(VariableElement c, Void p) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
2403 |
return getDocLink(LinkInfoImpl.Kind.ANNOTATION, |
36500
d31e4986dc8b
8149139: [javadoc] Modify Content to accept CharSequence
ksrini
parents:
36038
diff
changeset
|
2404 |
c, c.getSimpleName(), false); |
10 | 2405 |
} |
40606
eb2c81860c86
8164836: TEST_BUG: adjust scope of the DefinedByAnalyzer in tools/all/RunCodingRules.java
jlahoda
parents:
40587
diff
changeset
|
2406 |
@Override |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
2407 |
public Content visitArray(List<? extends AnnotationValue> vals, Void p) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
2408 |
ContentBuilder buf = new ContentBuilder(); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
2409 |
String sep = ""; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
2410 |
for (AnnotationValue av : vals) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
2411 |
buf.addContent(sep); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
2412 |
buf.addContent(visit(av)); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
2413 |
sep = " "; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
2414 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
2415 |
return buf; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
2416 |
} |
40606
eb2c81860c86
8164836: TEST_BUG: adjust scope of the DefinedByAnalyzer in tools/all/RunCodingRules.java
jlahoda
parents:
40587
diff
changeset
|
2417 |
@Override |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
2418 |
protected Content defaultAction(Object o, Void p) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
2419 |
return new StringContent(annotationValue.toString()); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
2420 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
2421 |
}.visit(annotationValue); |
10 | 2422 |
} |
2423 |
||
47427 | 2424 |
protected TableHeader getPackageTableHeader() { |
2425 |
return new TableHeader(contents.packageLabel, contents.descriptionLabel); |
|
10 | 2426 |
} |
47846 | 2427 |
|
47847 | 2428 |
/** |
2429 |
* Returns an HtmlTree for the SCRIPT tag. |
|
2430 |
* |
|
2431 |
* @return an HtmlTree for the SCRIPT tag |
|
2432 |
*/ |
|
2433 |
protected Script getWinTitleScript() { |
|
2434 |
Script script = new Script(); |
|
2435 |
if (winTitle != null && winTitle.length() > 0) { |
|
2436 |
script.append("<!--\n" + |
|
2437 |
" try {\n" + |
|
2438 |
" if (location.href.indexOf('is-external=true') == -1) {\n" + |
|
2439 |
" parent.document.title=") |
|
2440 |
.appendStringLiteral(winTitle) |
|
2441 |
.append(";\n" + |
|
2442 |
" }\n" + |
|
2443 |
" }\n" + |
|
2444 |
" catch(err) {\n" + |
|
2445 |
" }\n" + |
|
2446 |
"//-->\n"); |
|
2447 |
} |
|
47846 | 2448 |
return script; |
2449 |
} |
|
47847 | 2450 |
|
2451 |
/** |
|
2452 |
* Returns an HtmlTree for the BODY tag. |
|
2453 |
* |
|
2454 |
* @param includeScript set true if printing windowtitle script |
|
2455 |
* @param title title for the window |
|
2456 |
* @return an HtmlTree for the BODY tag |
|
2457 |
*/ |
|
2458 |
public HtmlTree getBody(boolean includeScript, String title) { |
|
2459 |
HtmlTree body = new HtmlTree(HtmlTag.BODY); |
|
2460 |
// Set window title string which is later printed |
|
2461 |
this.winTitle = title; |
|
2462 |
// Don't print windowtitle script for overview-frame, allclasses-frame |
|
2463 |
// and package-frame |
|
2464 |
if (includeScript) { |
|
2465 |
this.mainBodyScript = getWinTitleScript(); |
|
2466 |
body.addContent(mainBodyScript.asContent()); |
|
2467 |
Content noScript = HtmlTree.NOSCRIPT(HtmlTree.DIV(contents.noScriptMessage)); |
|
2468 |
body.addContent(noScript); |
|
2469 |
} |
|
2470 |
return body; |
|
2471 |
} |
|
2472 |
||
2473 |
Script getMainBodyScript() { |
|
2474 |
return mainBodyScript; |
|
2475 |
} |
|
10 | 2476 |
} |