author | jjg |
Wed, 20 Feb 2019 16:15:02 -0800 | |
changeset 53863 | d001808c57e8 |
parent 53562 | 0d9dee001667 |
child 53879 | e7cb0348fa1c |
permissions | -rw-r--r-- |
10 | 1 |
/* |
53863
d001808c57e8
8218998: Add metadata to generated API documentation files
jjg
parents:
53562
diff
changeset
|
2 |
* Copyright (c) 1998, 2019, 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:
29957
diff
changeset
|
26 |
package jdk.javadoc.internal.doclets.formats.html; |
10 | 27 |
|
47846 | 28 |
import jdk.javadoc.internal.doclets.formats.html.markup.Table; |
29 |
||
19512
07dcf1232608
8013887: In class use, some tables are randomly unsorted
jjg
parents:
17570
diff
changeset
|
30 |
import java.util.ArrayList; |
07dcf1232608
8013887: In class use, some tables are randomly unsorted
jjg
parents:
17570
diff
changeset
|
31 |
import java.util.Collections; |
07dcf1232608
8013887: In class use, some tables are randomly unsorted
jjg
parents:
17570
diff
changeset
|
32 |
import java.util.HashMap; |
07dcf1232608
8013887: In class use, some tables are randomly unsorted
jjg
parents:
17570
diff
changeset
|
33 |
import java.util.List; |
07dcf1232608
8013887: In class use, some tables are randomly unsorted
jjg
parents:
17570
diff
changeset
|
34 |
import java.util.Map; |
07dcf1232608
8013887: In class use, some tables are randomly unsorted
jjg
parents:
17570
diff
changeset
|
35 |
import java.util.Set; |
07dcf1232608
8013887: In class use, some tables are randomly unsorted
jjg
parents:
17570
diff
changeset
|
36 |
import java.util.SortedSet; |
07dcf1232608
8013887: In class use, some tables are randomly unsorted
jjg
parents:
17570
diff
changeset
|
37 |
import java.util.TreeSet; |
14258 | 38 |
|
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
29957
diff
changeset
|
39 |
import javax.lang.model.element.Element; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
29957
diff
changeset
|
40 |
import javax.lang.model.element.PackageElement; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
29957
diff
changeset
|
41 |
import javax.lang.model.element.TypeElement; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
29957
diff
changeset
|
42 |
import javax.tools.Diagnostic; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
29957
diff
changeset
|
43 |
|
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
29957
diff
changeset
|
44 |
import jdk.javadoc.internal.doclets.formats.html.markup.ContentBuilder; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
29957
diff
changeset
|
45 |
import jdk.javadoc.internal.doclets.formats.html.markup.HtmlConstants; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
29957
diff
changeset
|
46 |
import jdk.javadoc.internal.doclets.formats.html.markup.HtmlStyle; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
29957
diff
changeset
|
47 |
import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTag; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
29957
diff
changeset
|
48 |
import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTree; |
49551
0d4786e42471
8196200: Implement a navigation builder in javadoc
bpatel
parents:
48759
diff
changeset
|
49 |
import jdk.javadoc.internal.doclets.formats.html.markup.Navigation; |
0d4786e42471
8196200: Implement a navigation builder in javadoc
bpatel
parents:
48759
diff
changeset
|
50 |
import jdk.javadoc.internal.doclets.formats.html.markup.Navigation.PageMode; |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
29957
diff
changeset
|
51 |
import jdk.javadoc.internal.doclets.formats.html.markup.StringContent; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
29957
diff
changeset
|
52 |
import jdk.javadoc.internal.doclets.toolkit.Content; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
29957
diff
changeset
|
53 |
import jdk.javadoc.internal.doclets.toolkit.util.ClassTree; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
29957
diff
changeset
|
54 |
import jdk.javadoc.internal.doclets.toolkit.util.ClassUseMapper; |
40587 | 55 |
import jdk.javadoc.internal.doclets.toolkit.util.DocFileIOException; |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
29957
diff
changeset
|
56 |
import jdk.javadoc.internal.doclets.toolkit.util.DocPath; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
29957
diff
changeset
|
57 |
import jdk.javadoc.internal.doclets.toolkit.util.DocPaths; |
10 | 58 |
|
42277 | 59 |
|
10 | 60 |
/** |
61 |
* Generate class usage information. |
|
62 |
* |
|
14260
727a84636f12
8000665: fix "internal API" comments on javadoc files
jjg
parents:
14258
diff
changeset
|
63 |
* <p><b>This is NOT part of any supported API. |
727a84636f12
8000665: fix "internal API" comments on javadoc files
jjg
parents:
14258
diff
changeset
|
64 |
* 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:
14258
diff
changeset
|
65 |
* This code and its internal interfaces are subject to change or |
727a84636f12
8000665: fix "internal API" comments on javadoc files
jjg
parents:
14258
diff
changeset
|
66 |
* deletion without notice.</b> |
727a84636f12
8000665: fix "internal API" comments on javadoc files
jjg
parents:
14258
diff
changeset
|
67 |
* |
10 | 68 |
* @author Robert G. Field |
2320
5b8c377175f4
6786688: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - Table must have captions and headers
bpatel
parents:
1789
diff
changeset
|
69 |
* @author Bhavesh Patel (Modified) |
10 | 70 |
*/ |
71 |
public class ClassUseWriter extends SubWriterHolderWriter { |
|
72 |
||
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
29957
diff
changeset
|
73 |
final TypeElement typeElement; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
29957
diff
changeset
|
74 |
Set<PackageElement> pkgToPackageAnnotations = null; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
29957
diff
changeset
|
75 |
final Map<PackageElement, List<Element>> pkgToClassTypeParameter; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
29957
diff
changeset
|
76 |
final Map<PackageElement, List<Element>> pkgToClassAnnotations; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
29957
diff
changeset
|
77 |
final Map<PackageElement, List<Element>> pkgToMethodTypeParameter; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
29957
diff
changeset
|
78 |
final Map<PackageElement, List<Element>> pkgToMethodArgTypeParameter; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
29957
diff
changeset
|
79 |
final Map<PackageElement, List<Element>> pkgToMethodReturnTypeParameter; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
29957
diff
changeset
|
80 |
final Map<PackageElement, List<Element>> pkgToMethodAnnotations; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
29957
diff
changeset
|
81 |
final Map<PackageElement, List<Element>> pkgToMethodParameterAnnotations; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
29957
diff
changeset
|
82 |
final Map<PackageElement, List<Element>> pkgToFieldTypeParameter; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
29957
diff
changeset
|
83 |
final Map<PackageElement, List<Element>> pkgToFieldAnnotations; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
29957
diff
changeset
|
84 |
final Map<PackageElement, List<Element>> pkgToSubclass; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
29957
diff
changeset
|
85 |
final Map<PackageElement, List<Element>> pkgToSubinterface; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
29957
diff
changeset
|
86 |
final Map<PackageElement, List<Element>> pkgToImplementingClass; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
29957
diff
changeset
|
87 |
final Map<PackageElement, List<Element>> pkgToField; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
29957
diff
changeset
|
88 |
final Map<PackageElement, List<Element>> pkgToMethodReturn; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
29957
diff
changeset
|
89 |
final Map<PackageElement, List<Element>> pkgToMethodArgs; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
29957
diff
changeset
|
90 |
final Map<PackageElement, List<Element>> pkgToMethodThrows; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
29957
diff
changeset
|
91 |
final Map<PackageElement, List<Element>> pkgToConstructorAnnotations; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
29957
diff
changeset
|
92 |
final Map<PackageElement, List<Element>> pkgToConstructorParameterAnnotations; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
29957
diff
changeset
|
93 |
final Map<PackageElement, List<Element>> pkgToConstructorArgs; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
29957
diff
changeset
|
94 |
final Map<PackageElement, List<Element>> pkgToConstructorArgTypeParameter; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
29957
diff
changeset
|
95 |
final Map<PackageElement, List<Element>> pkgToConstructorThrows; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
29957
diff
changeset
|
96 |
final SortedSet<PackageElement> pkgSet; |
10 | 97 |
final MethodWriterImpl methodSubWriter; |
98 |
final ConstructorWriterImpl constrSubWriter; |
|
99 |
final FieldWriterImpl fieldSubWriter; |
|
100 |
final NestedClassWriterImpl classSubWriter; |
|
49551
0d4786e42471
8196200: Implement a navigation builder in javadoc
bpatel
parents:
48759
diff
changeset
|
101 |
private final Navigation navBar; |
10 | 102 |
|
103 |
/** |
|
29957
7740f9657f56
8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents:
26900
diff
changeset
|
104 |
* The HTML tree for main tag. |
7740f9657f56
8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents:
26900
diff
changeset
|
105 |
*/ |
7740f9657f56
8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents:
26900
diff
changeset
|
106 |
protected HtmlTree mainTree = HtmlTree.MAIN(); |
7740f9657f56
8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents:
26900
diff
changeset
|
107 |
|
7740f9657f56
8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents:
26900
diff
changeset
|
108 |
/** |
10 | 109 |
* Constructor. |
110 |
* |
|
111 |
* @param filename the file to be generated. |
|
112 |
*/ |
|
45417 | 113 |
public ClassUseWriter(HtmlConfiguration configuration, |
14357
faf9cde2817b
8000741: refactor javadoc to use abstraction to handle relative paths
jjg
parents:
14260
diff
changeset
|
114 |
ClassUseMapper mapper, DocPath filename, |
40587 | 115 |
TypeElement typeElement) { |
14357
faf9cde2817b
8000741: refactor javadoc to use abstraction to handle relative paths
jjg
parents:
14260
diff
changeset
|
116 |
super(configuration, filename); |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
29957
diff
changeset
|
117 |
this.typeElement = typeElement; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
29957
diff
changeset
|
118 |
if (mapper.classToPackageAnnotations.containsKey(typeElement)) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
29957
diff
changeset
|
119 |
pkgToPackageAnnotations = new TreeSet<>(utils.makeClassUseComparator()); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
29957
diff
changeset
|
120 |
pkgToPackageAnnotations.addAll(mapper.classToPackageAnnotations.get(typeElement)); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
29957
diff
changeset
|
121 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
29957
diff
changeset
|
122 |
configuration.currentTypeElement = typeElement; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
29957
diff
changeset
|
123 |
this.pkgSet = new TreeSet<>(utils.makePackageComparator()); |
10 | 124 |
this.pkgToClassTypeParameter = pkgDivide(mapper.classToClassTypeParam); |
125 |
this.pkgToClassAnnotations = pkgDivide(mapper.classToClassAnnotations); |
|
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
29957
diff
changeset
|
126 |
this.pkgToMethodTypeParameter = pkgDivide(mapper.classToMethodTypeParam); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
29957
diff
changeset
|
127 |
this.pkgToMethodArgTypeParameter = pkgDivide(mapper.classToMethodArgTypeParam); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
29957
diff
changeset
|
128 |
this.pkgToFieldTypeParameter = pkgDivide(mapper.classToFieldTypeParam); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
29957
diff
changeset
|
129 |
this.pkgToFieldAnnotations = pkgDivide(mapper.annotationToField); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
29957
diff
changeset
|
130 |
this.pkgToMethodReturnTypeParameter = pkgDivide(mapper.classToMethodReturnTypeParam); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
29957
diff
changeset
|
131 |
this.pkgToMethodAnnotations = pkgDivide(mapper.classToMethodAnnotations); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
29957
diff
changeset
|
132 |
this.pkgToMethodParameterAnnotations = pkgDivide(mapper.classToMethodParamAnnotation); |
10 | 133 |
this.pkgToSubclass = pkgDivide(mapper.classToSubclass); |
134 |
this.pkgToSubinterface = pkgDivide(mapper.classToSubinterface); |
|
135 |
this.pkgToImplementingClass = pkgDivide(mapper.classToImplementingClass); |
|
136 |
this.pkgToField = pkgDivide(mapper.classToField); |
|
137 |
this.pkgToMethodReturn = pkgDivide(mapper.classToMethodReturn); |
|
138 |
this.pkgToMethodArgs = pkgDivide(mapper.classToMethodArgs); |
|
139 |
this.pkgToMethodThrows = pkgDivide(mapper.classToMethodThrows); |
|
140 |
this.pkgToConstructorAnnotations = pkgDivide(mapper.classToConstructorAnnotations); |
|
141 |
this.pkgToConstructorParameterAnnotations = pkgDivide(mapper.classToConstructorParamAnnotation); |
|
142 |
this.pkgToConstructorArgs = pkgDivide(mapper.classToConstructorArgs); |
|
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
29957
diff
changeset
|
143 |
this.pkgToConstructorArgTypeParameter = pkgDivide(mapper.classToConstructorArgTypeParam); |
10 | 144 |
this.pkgToConstructorThrows = pkgDivide(mapper.classToConstructorThrows); |
145 |
//tmp test |
|
146 |
if (pkgSet.size() > 0 && |
|
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
29957
diff
changeset
|
147 |
mapper.classToPackage.containsKey(this.typeElement) && |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
29957
diff
changeset
|
148 |
!pkgSet.equals(mapper.classToPackage.get(this.typeElement))) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
29957
diff
changeset
|
149 |
configuration.reporter.print(Diagnostic.Kind.WARNING, |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
29957
diff
changeset
|
150 |
"Internal error: package sets don't match: " |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
29957
diff
changeset
|
151 |
+ pkgSet + " with: " + mapper.classToPackage.get(this.typeElement)); |
10 | 152 |
} |
47427 | 153 |
|
10 | 154 |
methodSubWriter = new MethodWriterImpl(this); |
155 |
constrSubWriter = new ConstructorWriterImpl(this); |
|
156 |
fieldSubWriter = new FieldWriterImpl(this); |
|
157 |
classSubWriter = new NestedClassWriterImpl(this); |
|
49551
0d4786e42471
8196200: Implement a navigation builder in javadoc
bpatel
parents:
48759
diff
changeset
|
158 |
this.navBar = new Navigation(typeElement, configuration, fixedNavDiv, PageMode.USE, path); |
10 | 159 |
} |
160 |
||
161 |
/** |
|
162 |
* Write out class use pages. |
|
40587 | 163 |
* |
164 |
* @param configuration the configuration for this doclet |
|
165 |
* @param classtree the class tree hierarchy |
|
166 |
* @throws DocFileIOException if there is an error while generating the documentation |
|
10 | 167 |
*/ |
45417 | 168 |
public static void generate(HtmlConfiguration configuration, ClassTree classtree) throws DocFileIOException { |
26270
a3635e6d3d78
8050031: [javadoc] class-use pages have duplicates and missing entries
ksrini
parents:
25874
diff
changeset
|
169 |
ClassUseMapper mapper = new ClassUseMapper(configuration, classtree); |
42277 | 170 |
for (TypeElement aClass : configuration.getIncludedTypeElements()) { |
9606
e5a619cb5dd3
6492694: @deprecated tag doesn't work in package-info files.
bpatel
parents:
8841
diff
changeset
|
171 |
// If -nodeprecated option is set and the containing package is marked |
e5a619cb5dd3
6492694: @deprecated tag doesn't work in package-info files.
bpatel
parents:
8841
diff
changeset
|
172 |
// as deprecated, do not generate the class-use page. We will still generate |
e5a619cb5dd3
6492694: @deprecated tag doesn't work in package-info files.
bpatel
parents:
8841
diff
changeset
|
173 |
// the class-use page if the class is marked as deprecated but the containing |
e5a619cb5dd3
6492694: @deprecated tag doesn't work in package-info files.
bpatel
parents:
8841
diff
changeset
|
174 |
// package is not since it could still be linked from that package-use page. |
e5a619cb5dd3
6492694: @deprecated tag doesn't work in package-info files.
bpatel
parents:
8841
diff
changeset
|
175 |
if (!(configuration.nodeprecated && |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
29957
diff
changeset
|
176 |
configuration.utils.isDeprecated(configuration.utils.containingPackage(aClass)))) |
22159
682da512ec17
8030253: Update langtools to use strings-in-switch
briangoetz
parents:
20613
diff
changeset
|
177 |
ClassUseWriter.generate(configuration, mapper, aClass); |
10 | 178 |
} |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
29957
diff
changeset
|
179 |
for (PackageElement pkg : configuration.packages) { |
9606
e5a619cb5dd3
6492694: @deprecated tag doesn't work in package-info files.
bpatel
parents:
8841
diff
changeset
|
180 |
// If -nodeprecated option is set and the package is marked |
e5a619cb5dd3
6492694: @deprecated tag doesn't work in package-info files.
bpatel
parents:
8841
diff
changeset
|
181 |
// as deprecated, do not generate the package-use page. |
25454
376a52c9540c
8039028: [javadoc] refactor the usage of Util.java
ksrini
parents:
24297
diff
changeset
|
182 |
if (!(configuration.nodeprecated && configuration.utils.isDeprecated(pkg))) |
22159
682da512ec17
8030253: Update langtools to use strings-in-switch
briangoetz
parents:
20613
diff
changeset
|
183 |
PackageUseWriter.generate(configuration, mapper, pkg); |
10 | 184 |
} |
185 |
} |
|
186 |
||
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
29957
diff
changeset
|
187 |
private Map<PackageElement, List<Element>> pkgDivide(Map<TypeElement, ? extends List<? extends Element>> classMap) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
29957
diff
changeset
|
188 |
Map<PackageElement, List<Element>> map = new HashMap<>(); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
29957
diff
changeset
|
189 |
List<? extends Element> elements = (List<? extends Element>) classMap.get(typeElement); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
29957
diff
changeset
|
190 |
if (elements != null) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
29957
diff
changeset
|
191 |
Collections.sort(elements, utils.makeClassUseComparator()); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
29957
diff
changeset
|
192 |
for (Element e : elements) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
29957
diff
changeset
|
193 |
PackageElement pkg = utils.containingPackage(e); |
10 | 194 |
pkgSet.add(pkg); |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
29957
diff
changeset
|
195 |
List<Element> inPkg = map.get(pkg); |
10 | 196 |
if (inPkg == null) { |
22163 | 197 |
inPkg = new ArrayList<>(); |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
29957
diff
changeset
|
198 |
map.put(pkg, inPkg); |
10 | 199 |
} |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
29957
diff
changeset
|
200 |
inPkg.add(e); |
10 | 201 |
} |
202 |
} |
|
203 |
return map; |
|
204 |
} |
|
205 |
||
206 |
/** |
|
207 |
* Generate a class page. |
|
40587 | 208 |
* |
209 |
* @throws DocFileIOException if there is a problem while generating the documentation |
|
10 | 210 |
*/ |
45417 | 211 |
public static void generate(HtmlConfiguration configuration, ClassUseMapper mapper, |
40587 | 212 |
TypeElement typeElement) throws DocFileIOException { |
10 | 213 |
ClassUseWriter clsgen; |
48759
ffa68af7da87
8195795: Organize output files by module/package, not just package
jjg
parents:
48654
diff
changeset
|
214 |
DocPath path = configuration.docPaths.forPackage(typeElement) |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
29957
diff
changeset
|
215 |
.resolve(DocPaths.CLASS_USE) |
48759
ffa68af7da87
8195795: Organize output files by module/package, not just package
jjg
parents:
48654
diff
changeset
|
216 |
.resolve(configuration.docPaths.forName( typeElement)); |
40587 | 217 |
clsgen = new ClassUseWriter(configuration, mapper, path, typeElement); |
218 |
clsgen.generateClassUseFile(); |
|
10 | 219 |
} |
220 |
||
221 |
/** |
|
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
29957
diff
changeset
|
222 |
* Generate the class use elements. |
40587 | 223 |
* |
224 |
* @throws DocFileIOException if there is a problem while generating the documentation |
|
10 | 225 |
*/ |
40587 | 226 |
protected void generateClassUseFile() throws DocFileIOException { |
29957
7740f9657f56
8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents:
26900
diff
changeset
|
227 |
HtmlTree body = getClassUseHeader(); |
7614
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
228 |
HtmlTree div = new HtmlTree(HtmlTag.DIV); |
47846 | 229 |
div.setStyle(HtmlStyle.classUseContainer); |
10 | 230 |
if (pkgSet.size() > 0) { |
7614
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
231 |
addClassUse(div); |
10 | 232 |
} else { |
40303 | 233 |
div.addContent(contents.getContent("doclet.ClassUse_No.usage.of.0", |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
29957
diff
changeset
|
234 |
utils.getFullyQualifiedName(typeElement))); |
10 | 235 |
} |
53562 | 236 |
mainTree.addContent(div); |
237 |
body.addContent(mainTree); |
|
238 |
HtmlTree footer = HtmlTree.FOOTER(); |
|
49551
0d4786e42471
8196200: Implement a navigation builder in javadoc
bpatel
parents:
48759
diff
changeset
|
239 |
navBar.setUserFooter(getUserHeaderFooter(false)); |
53562 | 240 |
footer.addContent(navBar.getContent(false)); |
241 |
addBottom(footer); |
|
242 |
body.addContent(footer); |
|
53863
d001808c57e8
8218998: Add metadata to generated API documentation files
jjg
parents:
53562
diff
changeset
|
243 |
String description = getDescription("use", typeElement); |
d001808c57e8
8218998: Add metadata to generated API documentation files
jjg
parents:
53562
diff
changeset
|
244 |
printHtmlDocument(null, description, true, body); |
10 | 245 |
} |
246 |
||
7614
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
247 |
/** |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
248 |
* Add the class use documentation. |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
249 |
* |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
250 |
* @param contentTree the content tree to which the class use information will be added |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
251 |
*/ |
40587 | 252 |
protected void addClassUse(Content contentTree) { |
7614
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
253 |
HtmlTree ul = new HtmlTree(HtmlTag.UL); |
47846 | 254 |
ul.setStyle(HtmlStyle.blockList); |
24221
2376793dd33b
8038583: [javadoc] Refactor uses of arrays to Collections
ksrini
parents:
24220
diff
changeset
|
255 |
if (configuration.packages.size() > 1) { |
7614
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
256 |
addPackageList(ul); |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
257 |
addPackageAnnotationList(ul); |
10 | 258 |
} |
7614
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
259 |
addClassList(ul); |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
260 |
contentTree.addContent(ul); |
10 | 261 |
} |
262 |
||
7614
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
263 |
/** |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
29957
diff
changeset
|
264 |
* Add the packages elements that use the given class. |
7614
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
265 |
* |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
29957
diff
changeset
|
266 |
* @param contentTree the content tree to which the packages elements will be added |
7614
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
267 |
*/ |
40587 | 268 |
protected void addPackageList(Content contentTree) { |
47846 | 269 |
Content caption = getTableCaption(contents.getContent( |
7614
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
270 |
"doclet.ClassUse_Packages.that.use.0", |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
29957
diff
changeset
|
271 |
getLink(new LinkInfoImpl(configuration, |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
29957
diff
changeset
|
272 |
LinkInfoImpl.Kind.CLASS_USE_HEADER, typeElement)))); |
53562 | 273 |
Table table = new Table(HtmlStyle.useSummary) |
47846 | 274 |
.setCaption(caption) |
275 |
.setHeader(getPackageTableHeader()) |
|
276 |
.setColumnStyles(HtmlStyle.colFirst, HtmlStyle.colLast); |
|
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
29957
diff
changeset
|
277 |
for (PackageElement pkg : pkgSet) { |
47846 | 278 |
addPackageUse(pkg, table); |
10 | 279 |
} |
47846 | 280 |
Content li = HtmlTree.LI(HtmlStyle.blockList, table.toContent()); |
7614
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
281 |
contentTree.addContent(li); |
10 | 282 |
} |
283 |
||
284 |
/** |
|
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
29957
diff
changeset
|
285 |
* Add the package annotation elements. |
7614
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
286 |
* |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
29957
diff
changeset
|
287 |
* @param contentTree the content tree to which the package annotation elements will be added |
10 | 288 |
*/ |
40587 | 289 |
protected void addPackageAnnotationList(Content contentTree) { |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
29957
diff
changeset
|
290 |
if (!utils.isAnnotationType(typeElement) || |
7614
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
291 |
pkgToPackageAnnotations == null || |
14542 | 292 |
pkgToPackageAnnotations.isEmpty()) { |
7614
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
293 |
return; |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
294 |
} |
47846 | 295 |
Content caption = getTableCaption(contents.getContent( |
7614
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
296 |
"doclet.ClassUse_PackageAnnotation", |
14542 | 297 |
getLink(new LinkInfoImpl(configuration, |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
29957
diff
changeset
|
298 |
LinkInfoImpl.Kind.CLASS_USE_HEADER, typeElement)))); |
47846 | 299 |
|
53562 | 300 |
Table table = new Table(HtmlStyle.useSummary) |
47846 | 301 |
.setCaption(caption) |
302 |
.setHeader(getPackageTableHeader()) |
|
303 |
.setColumnStyles(HtmlStyle.colFirst, HtmlStyle.colLast); |
|
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
29957
diff
changeset
|
304 |
for (PackageElement pkg : pkgToPackageAnnotations) { |
47846 | 305 |
Content summary = new ContentBuilder(); |
306 |
addSummaryComment(pkg, summary); |
|
307 |
table.addRow(getPackageLink(pkg), summary); |
|
7614
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
308 |
} |
47846 | 309 |
Content li = HtmlTree.LI(HtmlStyle.blockList, table.toContent()); |
7614
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
310 |
contentTree.addContent(li); |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
311 |
} |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
312 |
|
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
313 |
/** |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
29957
diff
changeset
|
314 |
* Add the class elements that use the given class. |
7614
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
315 |
* |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
29957
diff
changeset
|
316 |
* @param contentTree the content tree to which the class elements will be added |
7614
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
317 |
*/ |
40587 | 318 |
protected void addClassList(Content contentTree) { |
7614
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
319 |
HtmlTree ul = new HtmlTree(HtmlTag.UL); |
47846 | 320 |
ul.setStyle(HtmlStyle.blockList); |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
29957
diff
changeset
|
321 |
for (PackageElement pkg : pkgSet) { |
47850 | 322 |
Content markerAnchor = links.createAnchor(getPackageAnchorName(pkg)); |
53562 | 323 |
HtmlTree htmlTree = HtmlTree.SECTION(markerAnchor); |
40303 | 324 |
Content link = contents.getContent("doclet.ClassUse_Uses.of.0.in.1", |
325 |
getLink(new LinkInfoImpl(configuration, LinkInfoImpl.Kind.CLASS_USE_HEADER, |
|
326 |
typeElement)), |
|
327 |
getPackageLink(pkg, utils.getPackageName(pkg))); |
|
7614
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
328 |
Content heading = HtmlTree.HEADING(HtmlConstants.SUMMARY_HEADING, link); |
29957
7740f9657f56
8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents:
26900
diff
changeset
|
329 |
htmlTree.addContent(heading); |
7740f9657f56
8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents:
26900
diff
changeset
|
330 |
addClassUse(pkg, htmlTree); |
53562 | 331 |
ul.addContent(HtmlTree.LI(HtmlStyle.blockList, htmlTree)); |
7614
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
332 |
} |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
333 |
Content li = HtmlTree.LI(HtmlStyle.blockList, ul); |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
334 |
contentTree.addContent(li); |
10 | 335 |
} |
336 |
||
337 |
/** |
|
7614
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
338 |
* Add the package use information. |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
339 |
* |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
340 |
* @param pkg the package that uses the given class |
47846 | 341 |
* @param table the table to which the package use information will be added |
10 | 342 |
*/ |
47846 | 343 |
protected void addPackageUse(PackageElement pkg, Table table) { |
344 |
Content pkgLink = |
|
47850 | 345 |
links.createLink(getPackageAnchorName(pkg), new StringContent(utils.getPackageName(pkg))); |
47846 | 346 |
Content summary = new ContentBuilder(); |
347 |
addSummaryComment(pkg, summary); |
|
348 |
table.addRow(pkgLink, summary); |
|
10 | 349 |
} |
350 |
||
351 |
/** |
|
7614
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
352 |
* Add the class use information. |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
353 |
* |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
354 |
* @param pkg the package that uses the given class |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
355 |
* @param contentTree the content tree to which the class use information will be added |
10 | 356 |
*/ |
40587 | 357 |
protected void addClassUse(PackageElement pkg, Content contentTree) { |
17570
78512b2899db
8012183: replace some uses of Configuration.getText with Configuration.getResource
jjg
parents:
17569
diff
changeset
|
358 |
Content classLink = getLink(new LinkInfoImpl(configuration, |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
29957
diff
changeset
|
359 |
LinkInfoImpl.Kind.CLASS_USE_HEADER, typeElement)); |
25454
376a52c9540c
8039028: [javadoc] refactor the usage of Util.java
ksrini
parents:
24297
diff
changeset
|
360 |
Content pkgLink = getPackageLink(pkg, utils.getPackageName(pkg)); |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
29957
diff
changeset
|
361 |
classSubWriter.addUseInfo(pkgToClassAnnotations.get(pkg), |
52644
43efb4ca6d6c
8214139: Remove wrapper methods from {Base,Html}Configuration
jjg
parents:
49551
diff
changeset
|
362 |
contents.getContent("doclet.ClassUse_Annotation", classLink, |
53562 | 363 |
pkgLink), contentTree); |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
29957
diff
changeset
|
364 |
classSubWriter.addUseInfo(pkgToClassTypeParameter.get(pkg), |
52644
43efb4ca6d6c
8214139: Remove wrapper methods from {Base,Html}Configuration
jjg
parents:
49551
diff
changeset
|
365 |
contents.getContent("doclet.ClassUse_TypeParameter", classLink, |
53562 | 366 |
pkgLink), contentTree); |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
29957
diff
changeset
|
367 |
classSubWriter.addUseInfo(pkgToSubclass.get(pkg), |
52644
43efb4ca6d6c
8214139: Remove wrapper methods from {Base,Html}Configuration
jjg
parents:
49551
diff
changeset
|
368 |
contents.getContent("doclet.ClassUse_Subclass", classLink, |
53562 | 369 |
pkgLink), contentTree); |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
29957
diff
changeset
|
370 |
classSubWriter.addUseInfo(pkgToSubinterface.get(pkg), |
52644
43efb4ca6d6c
8214139: Remove wrapper methods from {Base,Html}Configuration
jjg
parents:
49551
diff
changeset
|
371 |
contents.getContent("doclet.ClassUse_Subinterface", classLink, |
53562 | 372 |
pkgLink), contentTree); |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
29957
diff
changeset
|
373 |
classSubWriter.addUseInfo(pkgToImplementingClass.get(pkg), |
52644
43efb4ca6d6c
8214139: Remove wrapper methods from {Base,Html}Configuration
jjg
parents:
49551
diff
changeset
|
374 |
contents.getContent("doclet.ClassUse_ImplementingClass", classLink, |
53562 | 375 |
pkgLink), contentTree); |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
29957
diff
changeset
|
376 |
fieldSubWriter.addUseInfo(pkgToField.get(pkg), |
52644
43efb4ca6d6c
8214139: Remove wrapper methods from {Base,Html}Configuration
jjg
parents:
49551
diff
changeset
|
377 |
contents.getContent("doclet.ClassUse_Field", classLink, |
53562 | 378 |
pkgLink), contentTree); |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
29957
diff
changeset
|
379 |
fieldSubWriter.addUseInfo(pkgToFieldAnnotations.get(pkg), |
52644
43efb4ca6d6c
8214139: Remove wrapper methods from {Base,Html}Configuration
jjg
parents:
49551
diff
changeset
|
380 |
contents.getContent("doclet.ClassUse_FieldAnnotations", classLink, |
53562 | 381 |
pkgLink), contentTree); |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
29957
diff
changeset
|
382 |
fieldSubWriter.addUseInfo(pkgToFieldTypeParameter.get(pkg), |
52644
43efb4ca6d6c
8214139: Remove wrapper methods from {Base,Html}Configuration
jjg
parents:
49551
diff
changeset
|
383 |
contents.getContent("doclet.ClassUse_FieldTypeParameter", classLink, |
53562 | 384 |
pkgLink), contentTree); |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
29957
diff
changeset
|
385 |
methodSubWriter.addUseInfo(pkgToMethodAnnotations.get(pkg), |
52644
43efb4ca6d6c
8214139: Remove wrapper methods from {Base,Html}Configuration
jjg
parents:
49551
diff
changeset
|
386 |
contents.getContent("doclet.ClassUse_MethodAnnotations", classLink, |
53562 | 387 |
pkgLink), contentTree); |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
29957
diff
changeset
|
388 |
methodSubWriter.addUseInfo(pkgToMethodParameterAnnotations.get(pkg), |
52644
43efb4ca6d6c
8214139: Remove wrapper methods from {Base,Html}Configuration
jjg
parents:
49551
diff
changeset
|
389 |
contents.getContent("doclet.ClassUse_MethodParameterAnnotations", classLink, |
53562 | 390 |
pkgLink), contentTree); |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
29957
diff
changeset
|
391 |
methodSubWriter.addUseInfo(pkgToMethodTypeParameter.get(pkg), |
52644
43efb4ca6d6c
8214139: Remove wrapper methods from {Base,Html}Configuration
jjg
parents:
49551
diff
changeset
|
392 |
contents.getContent("doclet.ClassUse_MethodTypeParameter", classLink, |
53562 | 393 |
pkgLink), contentTree); |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
29957
diff
changeset
|
394 |
methodSubWriter.addUseInfo(pkgToMethodReturn.get(pkg), |
52644
43efb4ca6d6c
8214139: Remove wrapper methods from {Base,Html}Configuration
jjg
parents:
49551
diff
changeset
|
395 |
contents.getContent("doclet.ClassUse_MethodReturn", classLink, |
53562 | 396 |
pkgLink), contentTree); |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
29957
diff
changeset
|
397 |
methodSubWriter.addUseInfo(pkgToMethodReturnTypeParameter.get(pkg), |
52644
43efb4ca6d6c
8214139: Remove wrapper methods from {Base,Html}Configuration
jjg
parents:
49551
diff
changeset
|
398 |
contents.getContent("doclet.ClassUse_MethodReturnTypeParameter", classLink, |
53562 | 399 |
pkgLink), contentTree); |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
29957
diff
changeset
|
400 |
methodSubWriter.addUseInfo(pkgToMethodArgs.get(pkg), |
52644
43efb4ca6d6c
8214139: Remove wrapper methods from {Base,Html}Configuration
jjg
parents:
49551
diff
changeset
|
401 |
contents.getContent("doclet.ClassUse_MethodArgs", classLink, |
53562 | 402 |
pkgLink), contentTree); |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
29957
diff
changeset
|
403 |
methodSubWriter.addUseInfo(pkgToMethodArgTypeParameter.get(pkg), |
52644
43efb4ca6d6c
8214139: Remove wrapper methods from {Base,Html}Configuration
jjg
parents:
49551
diff
changeset
|
404 |
contents.getContent("doclet.ClassUse_MethodArgsTypeParameters", classLink, |
53562 | 405 |
pkgLink), contentTree); |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
29957
diff
changeset
|
406 |
methodSubWriter.addUseInfo(pkgToMethodThrows.get(pkg), |
52644
43efb4ca6d6c
8214139: Remove wrapper methods from {Base,Html}Configuration
jjg
parents:
49551
diff
changeset
|
407 |
contents.getContent("doclet.ClassUse_MethodThrows", classLink, |
53562 | 408 |
pkgLink), contentTree); |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
29957
diff
changeset
|
409 |
constrSubWriter.addUseInfo(pkgToConstructorAnnotations.get(pkg), |
52644
43efb4ca6d6c
8214139: Remove wrapper methods from {Base,Html}Configuration
jjg
parents:
49551
diff
changeset
|
410 |
contents.getContent("doclet.ClassUse_ConstructorAnnotations", classLink, |
53562 | 411 |
pkgLink), contentTree); |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
29957
diff
changeset
|
412 |
constrSubWriter.addUseInfo(pkgToConstructorParameterAnnotations.get(pkg), |
52644
43efb4ca6d6c
8214139: Remove wrapper methods from {Base,Html}Configuration
jjg
parents:
49551
diff
changeset
|
413 |
contents.getContent("doclet.ClassUse_ConstructorParameterAnnotations", classLink, |
53562 | 414 |
pkgLink), contentTree); |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
29957
diff
changeset
|
415 |
constrSubWriter.addUseInfo(pkgToConstructorArgs.get(pkg), |
52644
43efb4ca6d6c
8214139: Remove wrapper methods from {Base,Html}Configuration
jjg
parents:
49551
diff
changeset
|
416 |
contents.getContent("doclet.ClassUse_ConstructorArgs", classLink, |
53562 | 417 |
pkgLink), contentTree); |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
29957
diff
changeset
|
418 |
constrSubWriter.addUseInfo(pkgToConstructorArgTypeParameter.get(pkg), |
52644
43efb4ca6d6c
8214139: Remove wrapper methods from {Base,Html}Configuration
jjg
parents:
49551
diff
changeset
|
419 |
contents.getContent("doclet.ClassUse_ConstructorArgsTypeParameters", classLink, |
53562 | 420 |
pkgLink), contentTree); |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
29957
diff
changeset
|
421 |
constrSubWriter.addUseInfo(pkgToConstructorThrows.get(pkg), |
52644
43efb4ca6d6c
8214139: Remove wrapper methods from {Base,Html}Configuration
jjg
parents:
49551
diff
changeset
|
422 |
contents.getContent("doclet.ClassUse_ConstructorThrows", classLink, |
53562 | 423 |
pkgLink), contentTree); |
10 | 424 |
} |
425 |
||
426 |
/** |
|
7614
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
427 |
* Get the header for the class use Listing. |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
428 |
* |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
429 |
* @return a content tree representing the class use header |
10 | 430 |
*/ |
29957
7740f9657f56
8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents:
26900
diff
changeset
|
431 |
protected HtmlTree getClassUseHeader() { |
52644
43efb4ca6d6c
8214139: Remove wrapper methods from {Base,Html}Configuration
jjg
parents:
49551
diff
changeset
|
432 |
String cltype = resources.getText(utils.isInterface(typeElement) |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
29957
diff
changeset
|
433 |
? "doclet.Interface" |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
29957
diff
changeset
|
434 |
: "doclet.Class"); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
29957
diff
changeset
|
435 |
String clname = utils.getFullyQualifiedName(typeElement); |
52644
43efb4ca6d6c
8214139: Remove wrapper methods from {Base,Html}Configuration
jjg
parents:
49551
diff
changeset
|
436 |
String title = resources.getText("doclet.Window_ClassUse_Header", |
7614
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
437 |
cltype, clname); |
29957
7740f9657f56
8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents:
26900
diff
changeset
|
438 |
HtmlTree bodyTree = getBody(true, getWindowTitle(title)); |
53562 | 439 |
HtmlTree htmlTree = HtmlTree.HEADER(); |
29957
7740f9657f56
8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents:
26900
diff
changeset
|
440 |
addTop(htmlTree); |
49551
0d4786e42471
8196200: Implement a navigation builder in javadoc
bpatel
parents:
48759
diff
changeset
|
441 |
Content mdleLinkContent = getModuleLink(utils.elementUtils.getModuleOf(typeElement), |
0d4786e42471
8196200: Implement a navigation builder in javadoc
bpatel
parents:
48759
diff
changeset
|
442 |
contents.moduleLabel); |
0d4786e42471
8196200: Implement a navigation builder in javadoc
bpatel
parents:
48759
diff
changeset
|
443 |
navBar.setNavLinkModule(mdleLinkContent); |
0d4786e42471
8196200: Implement a navigation builder in javadoc
bpatel
parents:
48759
diff
changeset
|
444 |
Content classLinkContent = getLink(new LinkInfoImpl( |
0d4786e42471
8196200: Implement a navigation builder in javadoc
bpatel
parents:
48759
diff
changeset
|
445 |
configuration, LinkInfoImpl.Kind.CLASS_USE_HEADER, typeElement) |
52644
43efb4ca6d6c
8214139: Remove wrapper methods from {Base,Html}Configuration
jjg
parents:
49551
diff
changeset
|
446 |
.label(resources.getText("doclet.Class"))); |
49551
0d4786e42471
8196200: Implement a navigation builder in javadoc
bpatel
parents:
48759
diff
changeset
|
447 |
navBar.setNavLinkClass(classLinkContent); |
0d4786e42471
8196200: Implement a navigation builder in javadoc
bpatel
parents:
48759
diff
changeset
|
448 |
navBar.setUserHeader(getUserHeaderFooter(true)); |
0d4786e42471
8196200: Implement a navigation builder in javadoc
bpatel
parents:
48759
diff
changeset
|
449 |
htmlTree.addContent(navBar.getContent(true)); |
53562 | 450 |
bodyTree.addContent(htmlTree); |
17562
c84f1d7fa11d
8011662: Remove single instance of resource with HTML from doclet resource bundle
jjg
parents:
17561
diff
changeset
|
451 |
ContentBuilder headContent = new ContentBuilder(); |
40303 | 452 |
headContent.addContent(contents.getContent("doclet.ClassUse_Title", cltype)); |
17562
c84f1d7fa11d
8011662: Remove single instance of resource with HTML from doclet resource bundle
jjg
parents:
17561
diff
changeset
|
453 |
headContent.addContent(new HtmlTree(HtmlTag.BR)); |
c84f1d7fa11d
8011662: Remove single instance of resource with HTML from doclet resource bundle
jjg
parents:
17561
diff
changeset
|
454 |
headContent.addContent(clname); |
7614
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
455 |
Content heading = HtmlTree.HEADING(HtmlConstants.CLASS_PAGE_HEADING, |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
456 |
true, HtmlStyle.title, headContent); |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
457 |
Content div = HtmlTree.DIV(HtmlStyle.header, heading); |
53562 | 458 |
mainTree.addContent(div); |
7614
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
459 |
return bodyTree; |
10 | 460 |
} |
461 |
} |