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