author | jjg |
Wed, 13 Dec 2017 17:27:43 -0800 | |
changeset 48325 | e5cdedd37b78 |
parent 47850 | 4a28dc8a86c2 |
child 48437 | dd3b97564ed7 |
permissions | -rw-r--r-- |
36526 | 1 |
/* |
44293
2f47b2c16612
8176778: javadoc does not produce summary pages for aggregated modules
ksrini
parents:
42831
diff
changeset
|
2 |
* Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved. |
36526 | 3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 |
* |
|
5 |
* This code is free software; you can redistribute it and/or modify it |
|
6 |
* under the terms of the GNU General Public License version 2 only, as |
|
7 |
* published by the Free Software Foundation. Oracle designates this |
|
8 |
* particular file as subject to the "Classpath" exception as provided |
|
9 |
* by Oracle in the LICENSE file that accompanied this code. |
|
10 |
* |
|
11 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
|
12 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
13 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
14 |
* version 2 for more details (a copy is included in the LICENSE file that |
|
15 |
* accompanied this code). |
|
16 |
* |
|
17 |
* You should have received a copy of the GNU General Public License version |
|
18 |
* 2 along with this work; if not, write to the Free Software Foundation, |
|
19 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
|
20 |
* |
|
21 |
* Please contact 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. |
|
24 |
*/ |
|
25 |
||
26 |
package jdk.javadoc.internal.doclets.formats.html; |
|
27 |
||
47846 | 28 |
import jdk.javadoc.internal.doclets.formats.html.markup.Table; |
29 |
import jdk.javadoc.internal.doclets.formats.html.markup.TableHeader; |
|
30 |
||
31 |
import java.util.ArrayList; |
|
44293
2f47b2c16612
8176778: javadoc does not produce summary pages for aggregated modules
ksrini
parents:
42831
diff
changeset
|
32 |
import java.util.Collections; |
36526 | 33 |
import java.util.List; |
39670
9d1eafbf29c6
8154261: Module summary page should display directives for the module
bpatel
parents:
38911
diff
changeset
|
34 |
import java.util.Map; |
42831
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42816
diff
changeset
|
35 |
import java.util.Set; |
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42816
diff
changeset
|
36 |
import java.util.SortedSet; |
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42816
diff
changeset
|
37 |
import java.util.TreeMap; |
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42816
diff
changeset
|
38 |
import java.util.TreeSet; |
36526 | 39 |
|
42831
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42816
diff
changeset
|
40 |
import javax.lang.model.element.Element; |
36526 | 41 |
import javax.lang.model.element.ModuleElement; |
42 |
import javax.lang.model.element.PackageElement; |
|
39670
9d1eafbf29c6
8154261: Module summary page should display directives for the module
bpatel
parents:
38911
diff
changeset
|
43 |
import javax.lang.model.element.TypeElement; |
42831
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42816
diff
changeset
|
44 |
import javax.lang.model.util.ElementFilter; |
36526 | 45 |
|
46 |
import com.sun.source.doctree.DocTree; |
|
42831
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42816
diff
changeset
|
47 |
import jdk.javadoc.doclet.DocletEnvironment.ModuleMode; |
47846 | 48 |
import jdk.javadoc.internal.doclets.formats.html.markup.ContentBuilder; |
36526 | 49 |
import jdk.javadoc.internal.doclets.formats.html.markup.HtmlConstants; |
50 |
import jdk.javadoc.internal.doclets.formats.html.markup.HtmlStyle; |
|
51 |
import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTag; |
|
52 |
import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTree; |
|
47850 | 53 |
import jdk.javadoc.internal.doclets.formats.html.markup.Links; |
36526 | 54 |
import jdk.javadoc.internal.doclets.formats.html.markup.RawHtml; |
39670
9d1eafbf29c6
8154261: Module summary page should display directives for the module
bpatel
parents:
38911
diff
changeset
|
55 |
import jdk.javadoc.internal.doclets.formats.html.markup.StringContent; |
36526 | 56 |
import jdk.javadoc.internal.doclets.toolkit.Content; |
57 |
import jdk.javadoc.internal.doclets.toolkit.ModuleSummaryWriter; |
|
58 |
import jdk.javadoc.internal.doclets.toolkit.util.CommentHelper; |
|
40587 | 59 |
import jdk.javadoc.internal.doclets.toolkit.util.DocFileIOException; |
36526 | 60 |
import jdk.javadoc.internal.doclets.toolkit.util.DocPaths; |
61 |
||
62 |
/** |
|
42831
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42816
diff
changeset
|
63 |
* Class to generate file for each module contents in the right-hand frame. This will list all the |
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42816
diff
changeset
|
64 |
* required modules, packages and service types for the module. A click on any of the links will update |
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42816
diff
changeset
|
65 |
* the frame with the clicked element page. |
36526 | 66 |
* |
67 |
* <p><b>This is NOT part of any supported API. |
|
68 |
* If you write code that depends on this, you do so at your own risk. |
|
69 |
* This code and its internal interfaces are subject to change or |
|
70 |
* deletion without notice.</b> |
|
71 |
* |
|
72 |
* @author Bhavesh Patel |
|
73 |
*/ |
|
74 |
public class ModuleWriterImpl extends HtmlDocletWriter implements ModuleSummaryWriter { |
|
75 |
||
76 |
/** |
|
77 |
* The prev module name in the alpha-order list. |
|
78 |
*/ |
|
79 |
protected ModuleElement prevModule; |
|
80 |
||
81 |
/** |
|
82 |
* The next module name in the alpha-order list. |
|
83 |
*/ |
|
84 |
protected ModuleElement nextModule; |
|
85 |
||
86 |
/** |
|
87 |
* The module being documented. |
|
88 |
*/ |
|
89 |
protected ModuleElement mdle; |
|
90 |
||
42831
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42816
diff
changeset
|
91 |
/** |
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42816
diff
changeset
|
92 |
* The module mode for this javadoc run. It can be set to "api" or "all". |
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42816
diff
changeset
|
93 |
*/ |
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42816
diff
changeset
|
94 |
private final ModuleMode moduleMode; |
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42816
diff
changeset
|
95 |
|
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42816
diff
changeset
|
96 |
/** |
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42816
diff
changeset
|
97 |
* Map of module elements and modifiers required by this module. |
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42816
diff
changeset
|
98 |
*/ |
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42816
diff
changeset
|
99 |
private final Map<ModuleElement, Content> requires |
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42816
diff
changeset
|
100 |
= new TreeMap<>(utils.makeModuleComparator()); |
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42816
diff
changeset
|
101 |
|
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42816
diff
changeset
|
102 |
/** |
44564 | 103 |
* Map of indirect modules and modifiers, transitive closure, required by this module. |
42831
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42816
diff
changeset
|
104 |
*/ |
44564 | 105 |
private final Map<ModuleElement, Content> indirectModules |
42831
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42816
diff
changeset
|
106 |
= new TreeMap<>(utils.makeModuleComparator()); |
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42816
diff
changeset
|
107 |
|
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42816
diff
changeset
|
108 |
/** |
48325 | 109 |
* Details about a package in a module. |
110 |
* A package may be not exported, or exported to some modules, or exported to all modules. |
|
111 |
* A package may be not opened, or opened to some modules, or opened to all modules. |
|
112 |
* A package that is neither exported or opened to any modules is a concealed package. |
|
113 |
* An open module opens all its packages to all modules. |
|
42831
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42816
diff
changeset
|
114 |
*/ |
48325 | 115 |
class PackageEntry { |
116 |
/** |
|
117 |
* Summary of package exports: |
|
118 |
* If null, the package is not exported to any modules; |
|
119 |
* if empty, the package is exported to all modules; |
|
120 |
* otherwise, the package is exported to these modules. |
|
121 |
*/ |
|
122 |
Set<ModuleElement> exportedTo; |
|
123 |
||
124 |
/** |
|
125 |
* Summary of package opens: |
|
126 |
* If null, the package is not opened to any modules; |
|
127 |
* if empty, the package is opened to all modules; |
|
128 |
* otherwise, the package is opened to these modules. |
|
129 |
*/ |
|
130 |
Set<ModuleElement> openedTo; |
|
131 |
} |
|
42831
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42816
diff
changeset
|
132 |
|
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42816
diff
changeset
|
133 |
/** |
48325 | 134 |
* Map of packages of this module, and details of whether they are exported or opened. |
42831
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42816
diff
changeset
|
135 |
*/ |
48325 | 136 |
private final Map<PackageElement, PackageEntry> packages = new TreeMap<>(utils.makePackageComparator()); |
42831
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42816
diff
changeset
|
137 |
|
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42816
diff
changeset
|
138 |
/** |
44564 | 139 |
* Map of indirect modules (transitive closure) and their exported packages. |
42831
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42816
diff
changeset
|
140 |
*/ |
44564 | 141 |
private final Map<ModuleElement, SortedSet<PackageElement>> indirectPackages |
42831
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42816
diff
changeset
|
142 |
= new TreeMap<>(utils.makeModuleComparator()); |
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42816
diff
changeset
|
143 |
|
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42816
diff
changeset
|
144 |
/** |
44564 | 145 |
* Map of indirect modules (transitive closure) and their open packages. |
42831
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42816
diff
changeset
|
146 |
*/ |
44564 | 147 |
private final Map<ModuleElement, SortedSet<PackageElement>> indirectOpenPackages |
42831
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42816
diff
changeset
|
148 |
= new TreeMap<>(utils.makeModuleComparator()); |
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42816
diff
changeset
|
149 |
|
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42816
diff
changeset
|
150 |
/** |
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42816
diff
changeset
|
151 |
* Set of services used by the module. |
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42816
diff
changeset
|
152 |
*/ |
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42816
diff
changeset
|
153 |
private final SortedSet<TypeElement> uses |
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42816
diff
changeset
|
154 |
= new TreeSet<>(utils.makeAllClassesComparator()); |
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42816
diff
changeset
|
155 |
|
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42816
diff
changeset
|
156 |
/** |
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42816
diff
changeset
|
157 |
* Map of services used by the module and specified using @uses javadoc tag, and description. |
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42816
diff
changeset
|
158 |
*/ |
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42816
diff
changeset
|
159 |
private final Map<TypeElement, Content> usesTrees |
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42816
diff
changeset
|
160 |
= new TreeMap<>(utils.makeAllClassesComparator()); |
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42816
diff
changeset
|
161 |
|
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42816
diff
changeset
|
162 |
/** |
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42816
diff
changeset
|
163 |
* Map of services provided by this module, and set of its implementations. |
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42816
diff
changeset
|
164 |
*/ |
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42816
diff
changeset
|
165 |
private final Map<TypeElement, SortedSet<TypeElement>> provides |
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42816
diff
changeset
|
166 |
= new TreeMap<>(utils.makeAllClassesComparator()); |
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42816
diff
changeset
|
167 |
|
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42816
diff
changeset
|
168 |
/** |
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42816
diff
changeset
|
169 |
* Map of services provided by the module and specified using @provides javadoc tag, and |
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42816
diff
changeset
|
170 |
* description. |
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42816
diff
changeset
|
171 |
*/ |
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42816
diff
changeset
|
172 |
private final Map<TypeElement, Content> providesTrees |
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42816
diff
changeset
|
173 |
= new TreeMap<>(utils.makeAllClassesComparator()); |
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42816
diff
changeset
|
174 |
|
36526 | 175 |
/** |
176 |
* The HTML tree for main tag. |
|
177 |
*/ |
|
178 |
protected HtmlTree mainTree = HtmlTree.MAIN(); |
|
179 |
||
180 |
/** |
|
39670
9d1eafbf29c6
8154261: Module summary page should display directives for the module
bpatel
parents:
38911
diff
changeset
|
181 |
* The HTML tree for section tag. |
9d1eafbf29c6
8154261: Module summary page should display directives for the module
bpatel
parents:
38911
diff
changeset
|
182 |
*/ |
9d1eafbf29c6
8154261: Module summary page should display directives for the module
bpatel
parents:
38911
diff
changeset
|
183 |
protected HtmlTree sectionTree = HtmlTree.SECTION(); |
9d1eafbf29c6
8154261: Module summary page should display directives for the module
bpatel
parents:
38911
diff
changeset
|
184 |
|
9d1eafbf29c6
8154261: Module summary page should display directives for the module
bpatel
parents:
38911
diff
changeset
|
185 |
/** |
42831
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42816
diff
changeset
|
186 |
* Constructor to construct ModuleWriter object and to generate "moduleName-summary.html" file. |
36526 | 187 |
* |
188 |
* @param configuration the configuration of the doclet. |
|
39670
9d1eafbf29c6
8154261: Module summary page should display directives for the module
bpatel
parents:
38911
diff
changeset
|
189 |
* @param mdle Module under consideration. |
36526 | 190 |
* @param prevModule Previous module in the sorted array. |
191 |
* @param nextModule Next module in the sorted array. |
|
192 |
*/ |
|
45417 | 193 |
public ModuleWriterImpl(HtmlConfiguration configuration, |
40303 | 194 |
ModuleElement mdle, ModuleElement prevModule, ModuleElement nextModule) { |
36526 | 195 |
super(configuration, DocPaths.moduleSummary(mdle)); |
196 |
this.prevModule = prevModule; |
|
197 |
this.nextModule = nextModule; |
|
198 |
this.mdle = mdle; |
|
42831
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42816
diff
changeset
|
199 |
this.moduleMode = configuration.docEnv.getModuleMode(); |
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42816
diff
changeset
|
200 |
computeModulesData(); |
36526 | 201 |
} |
202 |
||
203 |
/** |
|
39670
9d1eafbf29c6
8154261: Module summary page should display directives for the module
bpatel
parents:
38911
diff
changeset
|
204 |
* Get the module header. |
9d1eafbf29c6
8154261: Module summary page should display directives for the module
bpatel
parents:
38911
diff
changeset
|
205 |
* |
9d1eafbf29c6
8154261: Module summary page should display directives for the module
bpatel
parents:
38911
diff
changeset
|
206 |
* @param heading the heading for the section |
36526 | 207 |
*/ |
42407
f3702cff2933
8169069: Module system implementation refresh (11/2016)
alanb
parents:
41452
diff
changeset
|
208 |
@Override |
36526 | 209 |
public Content getModuleHeader(String heading) { |
210 |
HtmlTree bodyTree = getBody(true, getWindowTitle(mdle.getQualifiedName().toString())); |
|
211 |
HtmlTree htmlTree = (configuration.allowTag(HtmlTag.HEADER)) |
|
212 |
? HtmlTree.HEADER() |
|
213 |
: bodyTree; |
|
214 |
addTop(htmlTree); |
|
215 |
addNavLinks(true, htmlTree); |
|
216 |
if (configuration.allowTag(HtmlTag.HEADER)) { |
|
217 |
bodyTree.addContent(htmlTree); |
|
218 |
} |
|
219 |
HtmlTree div = new HtmlTree(HtmlTag.DIV); |
|
47846 | 220 |
div.setStyle(HtmlStyle.header); |
42407
f3702cff2933
8169069: Module system implementation refresh (11/2016)
alanb
parents:
41452
diff
changeset
|
221 |
Content annotationContent = new HtmlTree(HtmlTag.P); |
f3702cff2933
8169069: Module system implementation refresh (11/2016)
alanb
parents:
41452
diff
changeset
|
222 |
addAnnotationInfo(mdle, annotationContent); |
f3702cff2933
8169069: Module system implementation refresh (11/2016)
alanb
parents:
41452
diff
changeset
|
223 |
div.addContent(annotationContent); |
44564 | 224 |
Content label = mdle.isOpen() && (configuration.docEnv.getModuleMode() == ModuleMode.ALL) |
225 |
? contents.openModuleLabel : contents.moduleLabel; |
|
36526 | 226 |
Content tHeading = HtmlTree.HEADING(HtmlConstants.TITLE_HEADING, true, |
44564 | 227 |
HtmlStyle.title, label); |
40303 | 228 |
tHeading.addContent(Contents.SPACE); |
36526 | 229 |
Content moduleHead = new RawHtml(heading); |
230 |
tHeading.addContent(moduleHead); |
|
231 |
div.addContent(tHeading); |
|
232 |
if (configuration.allowTag(HtmlTag.MAIN)) { |
|
233 |
mainTree.addContent(div); |
|
234 |
} else { |
|
235 |
bodyTree.addContent(div); |
|
236 |
} |
|
237 |
return bodyTree; |
|
238 |
} |
|
239 |
||
240 |
/** |
|
39670
9d1eafbf29c6
8154261: Module summary page should display directives for the module
bpatel
parents:
38911
diff
changeset
|
241 |
* Get the content header. |
36526 | 242 |
*/ |
42407
f3702cff2933
8169069: Module system implementation refresh (11/2016)
alanb
parents:
41452
diff
changeset
|
243 |
@Override |
36526 | 244 |
public Content getContentHeader() { |
245 |
HtmlTree div = new HtmlTree(HtmlTag.DIV); |
|
47846 | 246 |
div.setStyle(HtmlStyle.contentContainer); |
36526 | 247 |
return div; |
248 |
} |
|
249 |
||
250 |
/** |
|
39670
9d1eafbf29c6
8154261: Module summary page should display directives for the module
bpatel
parents:
38911
diff
changeset
|
251 |
* Get the summary section header. |
36526 | 252 |
*/ |
42407
f3702cff2933
8169069: Module system implementation refresh (11/2016)
alanb
parents:
41452
diff
changeset
|
253 |
@Override |
36526 | 254 |
public Content getSummaryHeader() { |
255 |
HtmlTree li = new HtmlTree(HtmlTag.LI); |
|
47846 | 256 |
li.setStyle(HtmlStyle.blockList); |
36526 | 257 |
return li; |
258 |
} |
|
259 |
||
260 |
/** |
|
39670
9d1eafbf29c6
8154261: Module summary page should display directives for the module
bpatel
parents:
38911
diff
changeset
|
261 |
* Get the summary tree. |
9d1eafbf29c6
8154261: Module summary page should display directives for the module
bpatel
parents:
38911
diff
changeset
|
262 |
* |
9d1eafbf29c6
8154261: Module summary page should display directives for the module
bpatel
parents:
38911
diff
changeset
|
263 |
* @param summaryContentTree the content tree to be added to the summary tree. |
36526 | 264 |
*/ |
42407
f3702cff2933
8169069: Module system implementation refresh (11/2016)
alanb
parents:
41452
diff
changeset
|
265 |
@Override |
36526 | 266 |
public Content getSummaryTree(Content summaryContentTree) { |
267 |
HtmlTree ul = HtmlTree.UL(HtmlStyle.blockList, summaryContentTree); |
|
268 |
return ul; |
|
269 |
} |
|
270 |
||
271 |
/** |
|
42831
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42816
diff
changeset
|
272 |
* Compute the modules data that will be displayed in various tables on the module summary page. |
39670
9d1eafbf29c6
8154261: Module summary page should display directives for the module
bpatel
parents:
38911
diff
changeset
|
273 |
*/ |
42831
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42816
diff
changeset
|
274 |
public void computeModulesData() { |
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42816
diff
changeset
|
275 |
CommentHelper ch = utils.getCommentHelper(mdle); |
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42816
diff
changeset
|
276 |
// Get module dependencies using the module's transitive closure. |
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42816
diff
changeset
|
277 |
Map<ModuleElement, String> dependentModules = utils.getDependentModules(mdle); |
44564 | 278 |
// Add all dependent modules to indirect modules set. We will remove the modules, |
279 |
// listed using the requires directive, from this set to come up with the table of indirect |
|
42831
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42816
diff
changeset
|
280 |
// required modules. |
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42816
diff
changeset
|
281 |
dependentModules.forEach((module, mod) -> { |
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42816
diff
changeset
|
282 |
if (shouldDocument(module)) { |
44564 | 283 |
indirectModules.put(module, new StringContent(mod)); |
42831
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42816
diff
changeset
|
284 |
} |
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42816
diff
changeset
|
285 |
}); |
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42816
diff
changeset
|
286 |
(ElementFilter.requiresIn(mdle.getDirectives())).forEach((directive) -> { |
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42816
diff
changeset
|
287 |
ModuleElement m = directive.getDependency(); |
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42816
diff
changeset
|
288 |
if (shouldDocument(m)) { |
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42816
diff
changeset
|
289 |
if (moduleMode == ModuleMode.ALL || directive.isTransitive()) { |
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42816
diff
changeset
|
290 |
requires.put(m, new StringContent(utils.getModifiers(directive))); |
39670
9d1eafbf29c6
8154261: Module summary page should display directives for the module
bpatel
parents:
38911
diff
changeset
|
291 |
} else { |
44564 | 292 |
// For api mode, just keep the public requires in dependentModules for display of |
293 |
// indirect packages in the "Packages" section. |
|
42831
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42816
diff
changeset
|
294 |
dependentModules.remove(m); |
44564 | 295 |
} |
296 |
indirectModules.remove(m); |
|
42831
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42816
diff
changeset
|
297 |
} |
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42816
diff
changeset
|
298 |
}); |
44293
2f47b2c16612
8176778: javadoc does not produce summary pages for aggregated modules
ksrini
parents:
42831
diff
changeset
|
299 |
|
48325 | 300 |
// Get all packages if module is open or if displaying concealed modules |
301 |
for (PackageElement pkg : utils.getModulePackageMap().getOrDefault(mdle, Collections.emptySet())) { |
|
302 |
if (shouldDocument(pkg) && (mdle.isOpen() || moduleMode == ModuleMode.ALL)) { |
|
303 |
PackageEntry e = new PackageEntry(); |
|
304 |
if (mdle.isOpen()) { |
|
305 |
e.openedTo = Collections.emptySet(); |
|
306 |
} |
|
307 |
packages.put(pkg, e); |
|
42831
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42816
diff
changeset
|
308 |
} |
48325 | 309 |
}; |
44293
2f47b2c16612
8176778: javadoc does not produce summary pages for aggregated modules
ksrini
parents:
42831
diff
changeset
|
310 |
|
48325 | 311 |
// Get all exported packages for the module, using the exports directive for the module. |
312 |
for (ModuleElement.ExportsDirective directive : ElementFilter.exportsIn(mdle.getDirectives())) { |
|
42831
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42816
diff
changeset
|
313 |
PackageElement p = directive.getPackage(); |
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42816
diff
changeset
|
314 |
if (shouldDocument(p)) { |
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42816
diff
changeset
|
315 |
List<? extends ModuleElement> targetMdles = directive.getTargetModules(); |
48325 | 316 |
// Include package if in details mode, or exported to all (i.e. targetModules == null) |
317 |
if (moduleMode == ModuleMode.ALL || targetMdles == null) { |
|
318 |
PackageEntry packageEntry = packages.computeIfAbsent(p, pkg -> new PackageEntry()); |
|
319 |
SortedSet<ModuleElement> mdleList = new TreeSet<>(utils.makeModuleComparator()); |
|
320 |
if (targetMdles != null) { |
|
321 |
mdleList.addAll(targetMdles); |
|
322 |
} |
|
323 |
packageEntry.exportedTo = mdleList; |
|
44689
53c703004306
8175823: doclet crashes when documenting a single class in a module.
bpatel
parents:
44684
diff
changeset
|
324 |
} |
42831
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42816
diff
changeset
|
325 |
} |
48325 | 326 |
} |
327 |
||
328 |
// Get all opened packages for the module, using the opens directive for the module. |
|
329 |
// If it is an open module, there will be no separate opens directives. |
|
330 |
for (ModuleElement.OpensDirective directive : ElementFilter.opensIn(mdle.getDirectives())) { |
|
42831
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42816
diff
changeset
|
331 |
PackageElement p = directive.getPackage(); |
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42816
diff
changeset
|
332 |
if (shouldDocument(p)) { |
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42816
diff
changeset
|
333 |
List<? extends ModuleElement> targetMdles = directive.getTargetModules(); |
48325 | 334 |
// Include package if in details mode, or opened to all (i.e. targetModules == null) |
335 |
if (moduleMode == ModuleMode.ALL || targetMdles == null) { |
|
336 |
PackageEntry packageEntry = packages.computeIfAbsent(p, pkg -> new PackageEntry()); |
|
337 |
SortedSet<ModuleElement> mdleList = new TreeSet<>(utils.makeModuleComparator()); |
|
338 |
if (targetMdles != null) { |
|
339 |
mdleList.addAll(targetMdles); |
|
340 |
} |
|
341 |
packageEntry.openedTo = mdleList; |
|
44689
53c703004306
8175823: doclet crashes when documenting a single class in a module.
bpatel
parents:
44684
diff
changeset
|
342 |
} |
42831
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42816
diff
changeset
|
343 |
} |
48325 | 344 |
} |
345 |
||
42831
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42816
diff
changeset
|
346 |
// Get all the exported and opened packages, for the transitive closure of the module, to be displayed in |
44564 | 347 |
// the indirect packages tables. |
42831
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42816
diff
changeset
|
348 |
dependentModules.forEach((module, mod) -> { |
44807
47e09e3f1829
8178339: javadoc includes qualified opens in "Additional Opened Packages" section
ksrini
parents:
44689
diff
changeset
|
349 |
SortedSet<PackageElement> exportPkgList = new TreeSet<>(utils.makePackageComparator()); |
42831
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42816
diff
changeset
|
350 |
(ElementFilter.exportsIn(module.getDirectives())).forEach((directive) -> { |
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42816
diff
changeset
|
351 |
PackageElement pkg = directive.getPackage(); |
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42816
diff
changeset
|
352 |
if (shouldDocument(pkg)) { |
44807
47e09e3f1829
8178339: javadoc includes qualified opens in "Additional Opened Packages" section
ksrini
parents:
44689
diff
changeset
|
353 |
// Qualified exports are not displayed in API mode |
47e09e3f1829
8178339: javadoc includes qualified opens in "Additional Opened Packages" section
ksrini
parents:
44689
diff
changeset
|
354 |
if (moduleMode == ModuleMode.ALL || directive.getTargetModules() == null) { |
47e09e3f1829
8178339: javadoc includes qualified opens in "Additional Opened Packages" section
ksrini
parents:
44689
diff
changeset
|
355 |
exportPkgList.add(pkg); |
47e09e3f1829
8178339: javadoc includes qualified opens in "Additional Opened Packages" section
ksrini
parents:
44689
diff
changeset
|
356 |
} |
42831
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42816
diff
changeset
|
357 |
} |
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42816
diff
changeset
|
358 |
}); |
44807
47e09e3f1829
8178339: javadoc includes qualified opens in "Additional Opened Packages" section
ksrini
parents:
44689
diff
changeset
|
359 |
// If none of the indirect modules have exported packages to be displayed, we should not be |
42831
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42816
diff
changeset
|
360 |
// displaying the table and so it should not be added to the map. |
44807
47e09e3f1829
8178339: javadoc includes qualified opens in "Additional Opened Packages" section
ksrini
parents:
44689
diff
changeset
|
361 |
if (!exportPkgList.isEmpty()) { |
47e09e3f1829
8178339: javadoc includes qualified opens in "Additional Opened Packages" section
ksrini
parents:
44689
diff
changeset
|
362 |
indirectPackages.put(module, exportPkgList); |
39670
9d1eafbf29c6
8154261: Module summary page should display directives for the module
bpatel
parents:
38911
diff
changeset
|
363 |
} |
42831
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42816
diff
changeset
|
364 |
SortedSet<PackageElement> openPkgList = new TreeSet<>(utils.makePackageComparator()); |
48325 | 365 |
if (module.isOpen()) { |
366 |
openPkgList.addAll(utils.getModulePackageMap().getOrDefault(module, Collections.emptySet())); |
|
367 |
} else { |
|
368 |
(ElementFilter.opensIn(module.getDirectives())).forEach((directive) -> { |
|
369 |
PackageElement pkg = directive.getPackage(); |
|
370 |
if (shouldDocument(pkg)) { |
|
371 |
// Qualified opens are not displayed in API mode |
|
372 |
if (moduleMode == ModuleMode.ALL || directive.getTargetModules() == null) { |
|
373 |
openPkgList.add(pkg); |
|
374 |
} |
|
44807
47e09e3f1829
8178339: javadoc includes qualified opens in "Additional Opened Packages" section
ksrini
parents:
44689
diff
changeset
|
375 |
} |
48325 | 376 |
}); |
377 |
} |
|
44807
47e09e3f1829
8178339: javadoc includes qualified opens in "Additional Opened Packages" section
ksrini
parents:
44689
diff
changeset
|
378 |
// If none of the indirect modules have opened packages to be displayed, we should not be |
42831
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42816
diff
changeset
|
379 |
// displaying the table and so it should not be added to the map. |
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42816
diff
changeset
|
380 |
if (!openPkgList.isEmpty()) { |
44564 | 381 |
indirectOpenPackages.put(module, openPkgList); |
42831
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42816
diff
changeset
|
382 |
} |
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42816
diff
changeset
|
383 |
}); |
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42816
diff
changeset
|
384 |
// Get all the services listed as uses directive. |
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42816
diff
changeset
|
385 |
(ElementFilter.usesIn(mdle.getDirectives())).forEach((directive) -> { |
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42816
diff
changeset
|
386 |
TypeElement u = directive.getService(); |
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42816
diff
changeset
|
387 |
if (shouldDocument(u)) { |
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42816
diff
changeset
|
388 |
uses.add(u); |
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42816
diff
changeset
|
389 |
} |
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42816
diff
changeset
|
390 |
}); |
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42816
diff
changeset
|
391 |
// Get all the services and implementations listed as provides directive. |
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42816
diff
changeset
|
392 |
(ElementFilter.providesIn(mdle.getDirectives())).forEach((directive) -> { |
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42816
diff
changeset
|
393 |
TypeElement u = directive.getService(); |
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42816
diff
changeset
|
394 |
if (shouldDocument(u)) { |
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42816
diff
changeset
|
395 |
List<? extends TypeElement> implList = directive.getImplementations(); |
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42816
diff
changeset
|
396 |
SortedSet<TypeElement> implSet = new TreeSet<>(utils.makeAllClassesComparator()); |
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42816
diff
changeset
|
397 |
implSet.addAll(implList); |
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42816
diff
changeset
|
398 |
provides.put(u, implSet); |
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42816
diff
changeset
|
399 |
} |
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42816
diff
changeset
|
400 |
}); |
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42816
diff
changeset
|
401 |
// Generate the map of all services listed using @provides, and the description. |
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42816
diff
changeset
|
402 |
(utils.getBlockTags(mdle, DocTree.Kind.PROVIDES)).forEach((tree) -> { |
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42816
diff
changeset
|
403 |
TypeElement t = ch.getServiceType(configuration, tree); |
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42816
diff
changeset
|
404 |
if (t != null) { |
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42816
diff
changeset
|
405 |
providesTrees.put(t, commentTagsToContent(tree, mdle, ch.getDescription(configuration, tree), false)); |
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42816
diff
changeset
|
406 |
} |
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42816
diff
changeset
|
407 |
}); |
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42816
diff
changeset
|
408 |
// Generate the map of all services listed using @uses, and the description. |
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42816
diff
changeset
|
409 |
(utils.getBlockTags(mdle, DocTree.Kind.USES)).forEach((tree) -> { |
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42816
diff
changeset
|
410 |
TypeElement t = ch.getServiceType(configuration, tree); |
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42816
diff
changeset
|
411 |
if (t != null) { |
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42816
diff
changeset
|
412 |
usesTrees.put(t, commentTagsToContent(tree, mdle, ch.getDescription(configuration, tree), false)); |
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42816
diff
changeset
|
413 |
} |
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42816
diff
changeset
|
414 |
}); |
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42816
diff
changeset
|
415 |
} |
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42816
diff
changeset
|
416 |
|
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42816
diff
changeset
|
417 |
/** |
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42816
diff
changeset
|
418 |
* Returns true if the element should be documented on the module summary page. |
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42816
diff
changeset
|
419 |
* |
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42816
diff
changeset
|
420 |
* @param element the element to be checked |
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42816
diff
changeset
|
421 |
* @return true if the element should be documented |
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42816
diff
changeset
|
422 |
*/ |
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42816
diff
changeset
|
423 |
public boolean shouldDocument(Element element) { |
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42816
diff
changeset
|
424 |
return (moduleMode == ModuleMode.ALL || utils.isIncluded(element)); |
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42816
diff
changeset
|
425 |
} |
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42816
diff
changeset
|
426 |
|
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42816
diff
changeset
|
427 |
/** |
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42816
diff
changeset
|
428 |
* Returns true if there are elements to be displayed. |
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42816
diff
changeset
|
429 |
* |
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42816
diff
changeset
|
430 |
* @param section set of elements |
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42816
diff
changeset
|
431 |
* @return true if there are elements to be displayed |
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42816
diff
changeset
|
432 |
*/ |
44684
6ce4d52084e8
8178067: support for @uses/@provides tags is broken
ksrini
parents:
44564
diff
changeset
|
433 |
public boolean display(Set<? extends Element> section) { |
42831
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42816
diff
changeset
|
434 |
return section != null && !section.isEmpty(); |
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42816
diff
changeset
|
435 |
} |
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42816
diff
changeset
|
436 |
|
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42816
diff
changeset
|
437 |
/** |
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42816
diff
changeset
|
438 |
* Returns true if there are elements to be displayed. |
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42816
diff
changeset
|
439 |
* |
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42816
diff
changeset
|
440 |
* @param section map of elements. |
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42816
diff
changeset
|
441 |
* @return true if there are elements to be displayed |
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42816
diff
changeset
|
442 |
*/ |
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42816
diff
changeset
|
443 |
public boolean display(Map<? extends Element, ?> section) { |
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42816
diff
changeset
|
444 |
return section != null && !section.isEmpty(); |
39670
9d1eafbf29c6
8154261: Module summary page should display directives for the module
bpatel
parents:
38911
diff
changeset
|
445 |
} |
9d1eafbf29c6
8154261: Module summary page should display directives for the module
bpatel
parents:
38911
diff
changeset
|
446 |
|
44684
6ce4d52084e8
8178067: support for @uses/@provides tags is broken
ksrini
parents:
44564
diff
changeset
|
447 |
/* |
6ce4d52084e8
8178067: support for @uses/@provides tags is broken
ksrini
parents:
44564
diff
changeset
|
448 |
* Returns true, in API mode, if at least one type element in |
6ce4d52084e8
8178067: support for @uses/@provides tags is broken
ksrini
parents:
44564
diff
changeset
|
449 |
* the typeElements set is referenced by a javadoc tag in tagsMap. |
6ce4d52084e8
8178067: support for @uses/@provides tags is broken
ksrini
parents:
44564
diff
changeset
|
450 |
*/ |
6ce4d52084e8
8178067: support for @uses/@provides tags is broken
ksrini
parents:
44564
diff
changeset
|
451 |
private boolean displayServices(Set<TypeElement> typeElements, |
6ce4d52084e8
8178067: support for @uses/@provides tags is broken
ksrini
parents:
44564
diff
changeset
|
452 |
Map<TypeElement, Content> tagsMap) { |
6ce4d52084e8
8178067: support for @uses/@provides tags is broken
ksrini
parents:
44564
diff
changeset
|
453 |
return typeElements != null && |
6ce4d52084e8
8178067: support for @uses/@provides tags is broken
ksrini
parents:
44564
diff
changeset
|
454 |
typeElements.stream().anyMatch((v) -> displayServiceDirective(v, tagsMap)); |
6ce4d52084e8
8178067: support for @uses/@provides tags is broken
ksrini
parents:
44564
diff
changeset
|
455 |
} |
6ce4d52084e8
8178067: support for @uses/@provides tags is broken
ksrini
parents:
44564
diff
changeset
|
456 |
|
6ce4d52084e8
8178067: support for @uses/@provides tags is broken
ksrini
parents:
44564
diff
changeset
|
457 |
/* |
6ce4d52084e8
8178067: support for @uses/@provides tags is broken
ksrini
parents:
44564
diff
changeset
|
458 |
* Returns true, in API mode, if the type element is referenced |
6ce4d52084e8
8178067: support for @uses/@provides tags is broken
ksrini
parents:
44564
diff
changeset
|
459 |
* from a javadoc tag in tagsMap. |
6ce4d52084e8
8178067: support for @uses/@provides tags is broken
ksrini
parents:
44564
diff
changeset
|
460 |
*/ |
6ce4d52084e8
8178067: support for @uses/@provides tags is broken
ksrini
parents:
44564
diff
changeset
|
461 |
private boolean displayServiceDirective(TypeElement typeElement, |
6ce4d52084e8
8178067: support for @uses/@provides tags is broken
ksrini
parents:
44564
diff
changeset
|
462 |
Map<TypeElement, Content> tagsMap) { |
6ce4d52084e8
8178067: support for @uses/@provides tags is broken
ksrini
parents:
44564
diff
changeset
|
463 |
return moduleMode == ModuleMode.ALL || tagsMap.containsKey(typeElement); |
6ce4d52084e8
8178067: support for @uses/@provides tags is broken
ksrini
parents:
44564
diff
changeset
|
464 |
} |
6ce4d52084e8
8178067: support for @uses/@provides tags is broken
ksrini
parents:
44564
diff
changeset
|
465 |
|
39670
9d1eafbf29c6
8154261: Module summary page should display directives for the module
bpatel
parents:
38911
diff
changeset
|
466 |
/** |
9d1eafbf29c6
8154261: Module summary page should display directives for the module
bpatel
parents:
38911
diff
changeset
|
467 |
* Add the summary header. |
9d1eafbf29c6
8154261: Module summary page should display directives for the module
bpatel
parents:
38911
diff
changeset
|
468 |
* |
9d1eafbf29c6
8154261: Module summary page should display directives for the module
bpatel
parents:
38911
diff
changeset
|
469 |
* @param startMarker the marker comment |
9d1eafbf29c6
8154261: Module summary page should display directives for the module
bpatel
parents:
38911
diff
changeset
|
470 |
* @param markerAnchor the marker anchor for the section |
9d1eafbf29c6
8154261: Module summary page should display directives for the module
bpatel
parents:
38911
diff
changeset
|
471 |
* @param heading the heading for the section |
9d1eafbf29c6
8154261: Module summary page should display directives for the module
bpatel
parents:
38911
diff
changeset
|
472 |
* @param htmltree the content tree to which the information is added |
9d1eafbf29c6
8154261: Module summary page should display directives for the module
bpatel
parents:
38911
diff
changeset
|
473 |
*/ |
47427 | 474 |
public void addSummaryHeader(Content startMarker, SectionName markerAnchor, Content heading, |
475 |
Content htmltree) { |
|
39670
9d1eafbf29c6
8154261: Module summary page should display directives for the module
bpatel
parents:
38911
diff
changeset
|
476 |
htmltree.addContent(startMarker); |
47850 | 477 |
htmltree.addContent(links.createAnchor(markerAnchor)); |
39670
9d1eafbf29c6
8154261: Module summary page should display directives for the module
bpatel
parents:
38911
diff
changeset
|
478 |
htmltree.addContent(HtmlTree.HEADING(HtmlTag.H3, heading)); |
9d1eafbf29c6
8154261: Module summary page should display directives for the module
bpatel
parents:
38911
diff
changeset
|
479 |
} |
9d1eafbf29c6
8154261: Module summary page should display directives for the module
bpatel
parents:
38911
diff
changeset
|
480 |
|
9d1eafbf29c6
8154261: Module summary page should display directives for the module
bpatel
parents:
38911
diff
changeset
|
481 |
/** |
47846 | 482 |
* Get a table, with two columns. |
42831
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42816
diff
changeset
|
483 |
* |
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42816
diff
changeset
|
484 |
* @param caption the table caption |
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42816
diff
changeset
|
485 |
* @param tableSummary the summary for the table |
39670
9d1eafbf29c6
8154261: Module summary page should display directives for the module
bpatel
parents:
38911
diff
changeset
|
486 |
* @param tableStyle the table style |
9d1eafbf29c6
8154261: Module summary page should display directives for the module
bpatel
parents:
38911
diff
changeset
|
487 |
* @param tableHeader the table header |
42831
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42816
diff
changeset
|
488 |
* @return a content object |
39670
9d1eafbf29c6
8154261: Module summary page should display directives for the module
bpatel
parents:
38911
diff
changeset
|
489 |
*/ |
47846 | 490 |
private Table getTable2(Content caption, String tableSummary, HtmlStyle tableStyle, |
47427 | 491 |
TableHeader tableHeader) { |
47846 | 492 |
return new Table(configuration.htmlVersion, tableStyle) |
493 |
.setSummary(tableSummary) |
|
494 |
.setCaption(caption) |
|
495 |
.setHeader(tableHeader) |
|
496 |
.setColumnStyles(HtmlStyle.colFirst, HtmlStyle.colLast); |
|
497 |
} |
|
498 |
||
499 |
/** |
|
500 |
* Get a table, with three columns, with the second column being the defining column. |
|
501 |
* |
|
502 |
* @param caption the table caption |
|
503 |
* @param tableSummary the summary for the table |
|
504 |
* @param tableStyle the table style |
|
505 |
* @param tableHeader the table header |
|
506 |
* @return a content object |
|
507 |
*/ |
|
508 |
private Table getTable3(Content caption, String tableSummary, HtmlStyle tableStyle, |
|
509 |
TableHeader tableHeader) { |
|
510 |
return new Table(configuration.htmlVersion, tableStyle) |
|
511 |
.setSummary(tableSummary) |
|
512 |
.setCaption(caption) |
|
513 |
.setHeader(tableHeader) |
|
514 |
.setRowScopeColumn(1) |
|
515 |
.setColumnStyles(HtmlStyle.colFirst, HtmlStyle.colSecond, HtmlStyle.colLast); |
|
42831
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42816
diff
changeset
|
516 |
} |
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42816
diff
changeset
|
517 |
|
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42816
diff
changeset
|
518 |
/** |
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42816
diff
changeset
|
519 |
* {@inheritDoc} |
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42816
diff
changeset
|
520 |
*/ |
47427 | 521 |
@Override |
42831
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42816
diff
changeset
|
522 |
public void addModulesSummary(Content summaryContentTree) { |
44564 | 523 |
if (display(requires) || display(indirectModules)) { |
47427 | 524 |
TableHeader requiresTableHeader = |
525 |
new TableHeader(contents.modifierLabel, contents.moduleLabel, |
|
526 |
contents.descriptionLabel); |
|
42831
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42816
diff
changeset
|
527 |
HtmlTree li = new HtmlTree(HtmlTag.LI); |
47846 | 528 |
li.setStyle(HtmlStyle.blockList); |
42831
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42816
diff
changeset
|
529 |
addSummaryHeader(HtmlConstants.START_OF_MODULES_SUMMARY, SectionName.MODULES, |
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42816
diff
changeset
|
530 |
contents.navModules, li); |
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42816
diff
changeset
|
531 |
if (display(requires)) { |
47846 | 532 |
String text = resources.getText("doclet.Requires_Summary"); |
533 |
String tableSummary = resources.getText("doclet.Member_Table_Summary", |
|
47427 | 534 |
text, |
47846 | 535 |
resources.getText("doclet.modules")); |
536 |
Content caption = getTableCaption(new StringContent(text)); |
|
537 |
Table table = getTable3(caption, tableSummary, HtmlStyle.requiresSummary, |
|
538 |
requiresTableHeader); |
|
539 |
addModulesList(requires, table); |
|
540 |
li.addContent(table.toContent()); |
|
42831
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42816
diff
changeset
|
541 |
} |
44564 | 542 |
// Display indirect modules table in both "api" and "all" mode. |
543 |
if (display(indirectModules)) { |
|
47846 | 544 |
String amrText = resources.getText("doclet.Indirect_Requires_Summary"); |
545 |
String amrTableSummary = resources.getText("doclet.Member_Table_Summary", |
|
47427 | 546 |
amrText, |
42831
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42816
diff
changeset
|
547 |
configuration.getText("doclet.modules")); |
47846 | 548 |
Content amrCaption = getTableCaption(new StringContent(amrText)); |
549 |
Table amrTable = getTable3(amrCaption, amrTableSummary, HtmlStyle.requiresSummary, |
|
550 |
requiresTableHeader); |
|
551 |
addModulesList(indirectModules, amrTable); |
|
552 |
li.addContent(amrTable.toContent()); |
|
42831
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42816
diff
changeset
|
553 |
} |
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42816
diff
changeset
|
554 |
HtmlTree ul = HtmlTree.UL(HtmlStyle.blockList, li); |
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42816
diff
changeset
|
555 |
summaryContentTree.addContent(ul); |
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42816
diff
changeset
|
556 |
} |
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42816
diff
changeset
|
557 |
} |
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42816
diff
changeset
|
558 |
|
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42816
diff
changeset
|
559 |
/** |
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42816
diff
changeset
|
560 |
* Add the list of modules. |
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42816
diff
changeset
|
561 |
* |
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42816
diff
changeset
|
562 |
* @param mdleMap map of modules and modifiers |
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42816
diff
changeset
|
563 |
* @param tbody the content tree to which the list will be added |
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42816
diff
changeset
|
564 |
*/ |
47846 | 565 |
private void addModulesList(Map<ModuleElement, Content> mdleMap, Table table) { |
42831
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42816
diff
changeset
|
566 |
for (ModuleElement m : mdleMap.keySet()) { |
47846 | 567 |
Content modifiers = mdleMap.get(m); |
568 |
Content moduleLink = getModuleLink(m, new StringContent(m.getQualifiedName())); |
|
569 |
Content moduleSummary = new ContentBuilder(); |
|
570 |
addSummaryComment(m, moduleSummary); |
|
571 |
table.addRow(modifiers, moduleLink, moduleSummary); |
|
42831
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42816
diff
changeset
|
572 |
} |
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42816
diff
changeset
|
573 |
} |
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42816
diff
changeset
|
574 |
|
47427 | 575 |
@Override |
42831
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42816
diff
changeset
|
576 |
public void addPackagesSummary(Content summaryContentTree) { |
48325 | 577 |
if (display(packages) |
44564 | 578 |
|| display(indirectPackages) || display(indirectOpenPackages)) { |
42831
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42816
diff
changeset
|
579 |
HtmlTree li = new HtmlTree(HtmlTag.LI); |
47846 | 580 |
li.setStyle(HtmlStyle.blockList); |
42831
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42816
diff
changeset
|
581 |
addSummaryHeader(HtmlConstants.START_OF_PACKAGES_SUMMARY, SectionName.PACKAGES, |
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42816
diff
changeset
|
582 |
contents.navPackages, li); |
48325 | 583 |
if (display(packages)) { |
47846 | 584 |
String tableSummary = resources.getText("doclet.Member_Table_Summary", |
585 |
resources.getText("doclet.Packages_Summary"), |
|
586 |
resources.getText("doclet.packages")); |
|
42831
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42816
diff
changeset
|
587 |
addPackageSummary(tableSummary, li); |
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42816
diff
changeset
|
588 |
} |
47427 | 589 |
TableHeader indirectPackagesHeader = |
590 |
new TableHeader(contents.fromLabel, contents.packagesLabel); |
|
44564 | 591 |
if (display(indirectPackages)) { |
47846 | 592 |
String aepText = resources.getText("doclet.Indirect_Exports_Summary"); |
593 |
String aepTableSummary = resources.getText("doclet.Indirect_Packages_Table_Summary", |
|
47427 | 594 |
aepText, |
47846 | 595 |
resources.getText("doclet.modules"), |
596 |
resources.getText("doclet.packages")); |
|
597 |
Table aepTable = getTable2(new StringContent(aepText), aepTableSummary, |
|
598 |
HtmlStyle.packagesSummary, indirectPackagesHeader); |
|
599 |
addIndirectPackages(aepTable, indirectPackages); |
|
600 |
li.addContent(aepTable.toContent()); |
|
42831
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42816
diff
changeset
|
601 |
} |
44564 | 602 |
if (display(indirectOpenPackages)) { |
47846 | 603 |
String aopText = resources.getText("doclet.Indirect_Opens_Summary"); |
604 |
String aopTableSummary = resources.getText("doclet.Indirect_Packages_Table_Summary", |
|
47427 | 605 |
aopText, |
47846 | 606 |
resources.getText("doclet.modules"), |
607 |
resources.getText("doclet.packages")); |
|
608 |
Table aopTable = getTable2(new StringContent(aopText), aopTableSummary, |
|
609 |
HtmlStyle.packagesSummary, indirectPackagesHeader); |
|
610 |
addIndirectPackages(aopTable, indirectOpenPackages); |
|
611 |
li.addContent(aopTable.toContent()); |
|
42831
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42816
diff
changeset
|
612 |
} |
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42816
diff
changeset
|
613 |
HtmlTree ul = HtmlTree.UL(HtmlStyle.blockList, li); |
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42816
diff
changeset
|
614 |
summaryContentTree.addContent(ul); |
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42816
diff
changeset
|
615 |
} |
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42816
diff
changeset
|
616 |
} |
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42816
diff
changeset
|
617 |
|
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42816
diff
changeset
|
618 |
/** |
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42816
diff
changeset
|
619 |
* Add the package summary for the module. |
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42816
diff
changeset
|
620 |
* |
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42816
diff
changeset
|
621 |
* @param tableSummary |
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42816
diff
changeset
|
622 |
* @param li |
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42816
diff
changeset
|
623 |
*/ |
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42816
diff
changeset
|
624 |
public void addPackageSummary(String tableSummary, HtmlTree li) { |
47846 | 625 |
Table table = new Table(configuration.htmlVersion, HtmlStyle.packagesSummary) |
626 |
.setSummary(tableSummary) |
|
627 |
.setDefaultTab(resources.getText("doclet.All_Packages")) |
|
48325 | 628 |
.addTab(resources.getText("doclet.Exported_Packages_Summary"), this::isExported) |
629 |
.addTab(resources.getText("doclet.Opened_Packages_Summary"), this::isOpened) |
|
630 |
.addTab(resources.getText("doclet.Concealed_Packages_Summary"), this::isConcealed) |
|
47846 | 631 |
.setTabScript(i -> String.format("showPkgs(%d);", i)) |
632 |
.setTabScriptVariable("packages"); |
|
42831
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42816
diff
changeset
|
633 |
|
48325 | 634 |
// Determine whether to show the "Exported To" and "Opened To" columns, |
635 |
// based on whether such columns would provide "useful" info. |
|
636 |
int numExports = 0; |
|
637 |
int numUnqualifiedExports = 0; |
|
638 |
int numOpens = 0; |
|
639 |
int numUnqualifiedOpens = 0; |
|
640 |
||
641 |
for (PackageEntry e : packages.values()) { |
|
642 |
if (e.exportedTo != null) { |
|
643 |
numExports++; |
|
644 |
if (e.exportedTo.isEmpty()) { |
|
645 |
numUnqualifiedExports++; |
|
646 |
} |
|
647 |
} |
|
648 |
if (e.openedTo != null) { |
|
649 |
numOpens++; |
|
650 |
if (e.openedTo.isEmpty()) { |
|
651 |
numUnqualifiedOpens++; |
|
652 |
} |
|
653 |
} |
|
42831
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42816
diff
changeset
|
654 |
} |
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42816
diff
changeset
|
655 |
|
48325 | 656 |
boolean showExportedTo = numExports > 0 && (numOpens > 0 || numUnqualifiedExports < packages.size()); |
657 |
boolean showOpenedTo = numOpens > 0 && (numExports > 0 || numUnqualifiedOpens < packages.size()); |
|
658 |
||
659 |
// Create the table header and column styles. |
|
660 |
List<Content> colHeaders = new ArrayList<>(); |
|
661 |
List<HtmlStyle> colStyles = new ArrayList<>(); |
|
662 |
colHeaders.add(contents.packageLabel); |
|
663 |
colStyles.add(HtmlStyle.colFirst); |
|
664 |
||
665 |
if (showExportedTo) { |
|
666 |
colHeaders.add(contents.exportedTo); |
|
667 |
colStyles.add(HtmlStyle.colSecond); |
|
668 |
} |
|
669 |
||
670 |
if (showOpenedTo) { |
|
671 |
colHeaders.add(contents.openedTo); |
|
672 |
colStyles.add(HtmlStyle.colSecond); |
|
673 |
} |
|
674 |
||
675 |
colHeaders.add(contents.descriptionLabel); |
|
676 |
colStyles.add(HtmlStyle.colLast); |
|
677 |
||
678 |
table.setHeader(new TableHeader(colHeaders).styles(colStyles)) |
|
679 |
.setColumnStyles(colStyles); |
|
680 |
||
681 |
// Add the table rows, based on the "packages" map. |
|
682 |
for (Map.Entry<PackageElement, PackageEntry> e : packages.entrySet()) { |
|
683 |
PackageElement pkg = e.getKey(); |
|
684 |
PackageEntry entry = e.getValue(); |
|
685 |
List<Content> row = new ArrayList<>(); |
|
686 |
Content pkgLinkContent = getPackageLink(pkg, new StringContent(utils.getPackageName(pkg))); |
|
687 |
row.add(pkgLinkContent); |
|
688 |
||
689 |
if (showExportedTo) { |
|
690 |
row.add(getPackageExportOpensTo(entry.exportedTo)); |
|
691 |
} |
|
692 |
if (showOpenedTo) { |
|
693 |
row.add(getPackageExportOpensTo(entry.openedTo)); |
|
694 |
} |
|
695 |
Content summary = new ContentBuilder(); |
|
696 |
addSummaryComment(pkg, summary); |
|
697 |
row.add(summary); |
|
698 |
||
699 |
table.addRow(pkg, row); |
|
700 |
} |
|
701 |
||
47846 | 702 |
li.addContent(table.toContent()); |
703 |
if (table.needsScript()) { |
|
47847 | 704 |
mainBodyScript.append(table.getScript()); |
47846 | 705 |
} |
42831
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42816
diff
changeset
|
706 |
} |
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42816
diff
changeset
|
707 |
|
48325 | 708 |
private boolean isExported(Element e) { |
709 |
PackageEntry entry = packages.get((PackageElement) e); |
|
710 |
return (entry != null) && (entry.exportedTo != null); |
|
711 |
} |
|
712 |
||
713 |
private boolean isOpened(Element e) { |
|
714 |
PackageEntry entry = packages.get((PackageElement) e); |
|
715 |
return (entry != null) && (entry.openedTo != null); |
|
716 |
} |
|
717 |
||
718 |
private boolean isConcealed(Element e) { |
|
719 |
PackageEntry entry = packages.get((PackageElement) e); |
|
720 |
return (entry != null) && (entry.exportedTo == null) && (entry.openedTo == null); |
|
42831
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42816
diff
changeset
|
721 |
} |
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42816
diff
changeset
|
722 |
|
48325 | 723 |
private Content getPackageExportOpensTo(Set<ModuleElement> modules) { |
724 |
if (modules == null) { |
|
725 |
return new StringContent(resources.getText("doclet.None")); |
|
726 |
} else if (modules.isEmpty()) { |
|
727 |
return new StringContent(resources.getText("doclet.All_Modules")); |
|
728 |
} else { |
|
729 |
Content list = new ContentBuilder(); |
|
730 |
for (ModuleElement m : modules) { |
|
731 |
if (!list.isEmpty()) { |
|
732 |
list.addContent(new StringContent(", ")); |
|
42831
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42816
diff
changeset
|
733 |
} |
48325 | 734 |
list.addContent(getModuleLink(m, new StringContent(m.getQualifiedName()))); |
42831
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42816
diff
changeset
|
735 |
} |
48325 | 736 |
return list; |
42831
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42816
diff
changeset
|
737 |
} |
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42816
diff
changeset
|
738 |
} |
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42816
diff
changeset
|
739 |
|
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42816
diff
changeset
|
740 |
/** |
44564 | 741 |
* Add the indirect packages for the module being documented. |
42831
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42816
diff
changeset
|
742 |
* |
47846 | 743 |
* @param table the table to which the content rows will be added |
44564 | 744 |
* @param ip indirect packages to be added |
42831
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42816
diff
changeset
|
745 |
*/ |
47846 | 746 |
public void addIndirectPackages(Table table, Map<ModuleElement, SortedSet<PackageElement>> ip) { |
44564 | 747 |
for (Map.Entry<ModuleElement, SortedSet<PackageElement>> entry : ip.entrySet()) { |
42831
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42816
diff
changeset
|
748 |
ModuleElement m = entry.getKey(); |
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42816
diff
changeset
|
749 |
SortedSet<PackageElement> pkgList = entry.getValue(); |
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42816
diff
changeset
|
750 |
Content moduleLinkContent = getModuleLink(m, new StringContent(m.getQualifiedName())); |
48325 | 751 |
Content list = new ContentBuilder(); |
42831
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42816
diff
changeset
|
752 |
String sep = ""; |
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42816
diff
changeset
|
753 |
for (PackageElement pkg : pkgList) { |
48325 | 754 |
list.addContent(sep); |
755 |
list.addContent(getPackageLink(pkg, new StringContent(utils.getPackageName(pkg)))); |
|
42831
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42816
diff
changeset
|
756 |
sep = " "; |
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42816
diff
changeset
|
757 |
} |
48325 | 758 |
table.addRow(moduleLinkContent, list); |
39670
9d1eafbf29c6
8154261: Module summary page should display directives for the module
bpatel
parents:
38911
diff
changeset
|
759 |
} |
9d1eafbf29c6
8154261: Module summary page should display directives for the module
bpatel
parents:
38911
diff
changeset
|
760 |
} |
9d1eafbf29c6
8154261: Module summary page should display directives for the module
bpatel
parents:
38911
diff
changeset
|
761 |
|
9d1eafbf29c6
8154261: Module summary page should display directives for the module
bpatel
parents:
38911
diff
changeset
|
762 |
/** |
9d1eafbf29c6
8154261: Module summary page should display directives for the module
bpatel
parents:
38911
diff
changeset
|
763 |
* {@inheritDoc} |
9d1eafbf29c6
8154261: Module summary page should display directives for the module
bpatel
parents:
38911
diff
changeset
|
764 |
*/ |
47427 | 765 |
@Override |
39670
9d1eafbf29c6
8154261: Module summary page should display directives for the module
bpatel
parents:
38911
diff
changeset
|
766 |
public void addServicesSummary(Content summaryContentTree) { |
44684
6ce4d52084e8
8178067: support for @uses/@provides tags is broken
ksrini
parents:
44564
diff
changeset
|
767 |
|
6ce4d52084e8
8178067: support for @uses/@provides tags is broken
ksrini
parents:
44564
diff
changeset
|
768 |
boolean haveUses = displayServices(uses, usesTrees); |
6ce4d52084e8
8178067: support for @uses/@provides tags is broken
ksrini
parents:
44564
diff
changeset
|
769 |
boolean haveProvides = displayServices(provides.keySet(), providesTrees); |
6ce4d52084e8
8178067: support for @uses/@provides tags is broken
ksrini
parents:
44564
diff
changeset
|
770 |
|
6ce4d52084e8
8178067: support for @uses/@provides tags is broken
ksrini
parents:
44564
diff
changeset
|
771 |
if (haveProvides || haveUses) { |
39670
9d1eafbf29c6
8154261: Module summary page should display directives for the module
bpatel
parents:
38911
diff
changeset
|
772 |
HtmlTree li = new HtmlTree(HtmlTag.LI); |
47846 | 773 |
li.setStyle(HtmlStyle.blockList); |
39670
9d1eafbf29c6
8154261: Module summary page should display directives for the module
bpatel
parents:
38911
diff
changeset
|
774 |
addSummaryHeader(HtmlConstants.START_OF_SERVICES_SUMMARY, SectionName.SERVICES, |
40303 | 775 |
contents.navServices, li); |
47427 | 776 |
TableHeader usesProvidesTableHeader = |
777 |
new TableHeader(contents.typeLabel, contents.descriptionLabel); |
|
44684
6ce4d52084e8
8178067: support for @uses/@provides tags is broken
ksrini
parents:
44564
diff
changeset
|
778 |
if (haveProvides) { |
47427 | 779 |
String label = resources.getText("doclet.Provides_Summary"); |
780 |
String tableSummary = resources.getText("doclet.Member_Table_Summary", |
|
47846 | 781 |
label, |
782 |
resources.getText("doclet.types")); |
|
783 |
Table table = getTable2(new StringContent(label), tableSummary, HtmlStyle.providesSummary, |
|
47427 | 784 |
usesProvidesTableHeader); |
47846 | 785 |
addProvidesList(table); |
786 |
if (!table.isEmpty()) { |
|
787 |
li.addContent(table.toContent()); |
|
44564 | 788 |
} |
789 |
} |
|
44684
6ce4d52084e8
8178067: support for @uses/@provides tags is broken
ksrini
parents:
44564
diff
changeset
|
790 |
if (haveUses){ |
47427 | 791 |
String label = resources.getText("doclet.Uses_Summary"); |
792 |
String tableSummary = resources.getText("doclet.Member_Table_Summary", |
|
47846 | 793 |
label, |
794 |
resources.getText("doclet.types")); |
|
795 |
Table table = getTable2(new StringContent(label), tableSummary, HtmlStyle.usesSummary, |
|
47427 | 796 |
usesProvidesTableHeader); |
47846 | 797 |
addUsesList(table); |
798 |
if (!table.isEmpty()) { |
|
799 |
li.addContent(table.toContent()); |
|
42831
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42816
diff
changeset
|
800 |
} |
39670
9d1eafbf29c6
8154261: Module summary page should display directives for the module
bpatel
parents:
38911
diff
changeset
|
801 |
} |
9d1eafbf29c6
8154261: Module summary page should display directives for the module
bpatel
parents:
38911
diff
changeset
|
802 |
HtmlTree ul = HtmlTree.UL(HtmlStyle.blockList, li); |
9d1eafbf29c6
8154261: Module summary page should display directives for the module
bpatel
parents:
38911
diff
changeset
|
803 |
summaryContentTree.addContent(ul); |
9d1eafbf29c6
8154261: Module summary page should display directives for the module
bpatel
parents:
38911
diff
changeset
|
804 |
} |
9d1eafbf29c6
8154261: Module summary page should display directives for the module
bpatel
parents:
38911
diff
changeset
|
805 |
} |
9d1eafbf29c6
8154261: Module summary page should display directives for the module
bpatel
parents:
38911
diff
changeset
|
806 |
|
9d1eafbf29c6
8154261: Module summary page should display directives for the module
bpatel
parents:
38911
diff
changeset
|
807 |
/** |
9d1eafbf29c6
8154261: Module summary page should display directives for the module
bpatel
parents:
38911
diff
changeset
|
808 |
* Add the uses list for the module. |
9d1eafbf29c6
8154261: Module summary page should display directives for the module
bpatel
parents:
38911
diff
changeset
|
809 |
* |
47846 | 810 |
* @param table the table to which the services used will be added |
39670
9d1eafbf29c6
8154261: Module summary page should display directives for the module
bpatel
parents:
38911
diff
changeset
|
811 |
*/ |
47846 | 812 |
public void addUsesList(Table table) { |
42831
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42816
diff
changeset
|
813 |
Content typeLinkContent; |
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42816
diff
changeset
|
814 |
Content description; |
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42816
diff
changeset
|
815 |
for (TypeElement t : uses) { |
44684
6ce4d52084e8
8178067: support for @uses/@provides tags is broken
ksrini
parents:
44564
diff
changeset
|
816 |
if (!displayServiceDirective(t, usesTrees)) { |
42831
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42816
diff
changeset
|
817 |
continue; |
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42816
diff
changeset
|
818 |
} |
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42816
diff
changeset
|
819 |
typeLinkContent = getLink(new LinkInfoImpl(configuration, LinkInfoImpl.Kind.PACKAGE, t)); |
47846 | 820 |
Content summary = new ContentBuilder(); |
42831
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42816
diff
changeset
|
821 |
if (display(usesTrees)) { |
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42816
diff
changeset
|
822 |
description = usesTrees.get(t); |
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42816
diff
changeset
|
823 |
if (description != null) { |
47846 | 824 |
summary.addContent(description); |
42831
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42816
diff
changeset
|
825 |
} |
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42816
diff
changeset
|
826 |
} |
47846 | 827 |
addSummaryComment(t, summary); |
828 |
table.addRow(typeLinkContent, summary); |
|
42831
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42816
diff
changeset
|
829 |
} |
39670
9d1eafbf29c6
8154261: Module summary page should display directives for the module
bpatel
parents:
38911
diff
changeset
|
830 |
} |
9d1eafbf29c6
8154261: Module summary page should display directives for the module
bpatel
parents:
38911
diff
changeset
|
831 |
|
9d1eafbf29c6
8154261: Module summary page should display directives for the module
bpatel
parents:
38911
diff
changeset
|
832 |
/** |
42831
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42816
diff
changeset
|
833 |
* Add the provides list for the module. |
39670
9d1eafbf29c6
8154261: Module summary page should display directives for the module
bpatel
parents:
38911
diff
changeset
|
834 |
* |
47846 | 835 |
* @param table the table to which the services provided will be added |
39670
9d1eafbf29c6
8154261: Module summary page should display directives for the module
bpatel
parents:
38911
diff
changeset
|
836 |
*/ |
47846 | 837 |
public void addProvidesList(Table table) { |
42831
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42816
diff
changeset
|
838 |
SortedSet<TypeElement> implSet; |
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42816
diff
changeset
|
839 |
Content description; |
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42816
diff
changeset
|
840 |
for (Map.Entry<TypeElement, SortedSet<TypeElement>> entry : provides.entrySet()) { |
44684
6ce4d52084e8
8178067: support for @uses/@provides tags is broken
ksrini
parents:
44564
diff
changeset
|
841 |
TypeElement srv = entry.getKey(); |
6ce4d52084e8
8178067: support for @uses/@provides tags is broken
ksrini
parents:
44564
diff
changeset
|
842 |
if (!displayServiceDirective(srv, providesTrees)) { |
42831
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42816
diff
changeset
|
843 |
continue; |
44684
6ce4d52084e8
8178067: support for @uses/@provides tags is broken
ksrini
parents:
44564
diff
changeset
|
844 |
} |
42831
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42816
diff
changeset
|
845 |
implSet = entry.getValue(); |
42407
f3702cff2933
8169069: Module system implementation refresh (11/2016)
alanb
parents:
41452
diff
changeset
|
846 |
Content srvLinkContent = getLink(new LinkInfoImpl(configuration, LinkInfoImpl.Kind.PACKAGE, srv)); |
47846 | 847 |
Content desc = new ContentBuilder(); |
42831
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42816
diff
changeset
|
848 |
if (display(providesTrees)) { |
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42816
diff
changeset
|
849 |
description = providesTrees.get(srv); |
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42816
diff
changeset
|
850 |
if (description != null) { |
47846 | 851 |
desc.addContent(description); |
42831
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42816
diff
changeset
|
852 |
} |
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42816
diff
changeset
|
853 |
} |
47846 | 854 |
addSummaryComment(srv, desc); |
42831
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42816
diff
changeset
|
855 |
// Only display the implementation details in the "all" mode. |
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42816
diff
changeset
|
856 |
if (moduleMode == ModuleMode.ALL && !implSet.isEmpty()) { |
47846 | 857 |
desc.addContent(new HtmlTree(HtmlTag.BR)); |
858 |
desc.addContent("("); |
|
42831
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42816
diff
changeset
|
859 |
HtmlTree implSpan = HtmlTree.SPAN(HtmlStyle.implementationLabel, contents.implementation); |
47846 | 860 |
desc.addContent(implSpan); |
861 |
desc.addContent(Contents.SPACE); |
|
42831
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42816
diff
changeset
|
862 |
String sep = ""; |
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42816
diff
changeset
|
863 |
for (TypeElement impl : implSet) { |
47846 | 864 |
desc.addContent(sep); |
865 |
desc.addContent(getLink(new LinkInfoImpl(configuration, LinkInfoImpl.Kind.PACKAGE, impl))); |
|
42831
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42816
diff
changeset
|
866 |
sep = ", "; |
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42816
diff
changeset
|
867 |
} |
47846 | 868 |
desc.addContent(")"); |
42831
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42816
diff
changeset
|
869 |
} |
47846 | 870 |
table.addRow(srvLinkContent, desc); |
42407
f3702cff2933
8169069: Module system implementation refresh (11/2016)
alanb
parents:
41452
diff
changeset
|
871 |
} |
f3702cff2933
8169069: Module system implementation refresh (11/2016)
alanb
parents:
41452
diff
changeset
|
872 |
} |
f3702cff2933
8169069: Module system implementation refresh (11/2016)
alanb
parents:
41452
diff
changeset
|
873 |
|
f3702cff2933
8169069: Module system implementation refresh (11/2016)
alanb
parents:
41452
diff
changeset
|
874 |
/** |
f3702cff2933
8169069: Module system implementation refresh (11/2016)
alanb
parents:
41452
diff
changeset
|
875 |
* Add the module deprecation information to the documentation tree. |
f3702cff2933
8169069: Module system implementation refresh (11/2016)
alanb
parents:
41452
diff
changeset
|
876 |
* |
f3702cff2933
8169069: Module system implementation refresh (11/2016)
alanb
parents:
41452
diff
changeset
|
877 |
* @param div the content tree to which the deprecation information will be added |
f3702cff2933
8169069: Module system implementation refresh (11/2016)
alanb
parents:
41452
diff
changeset
|
878 |
*/ |
f3702cff2933
8169069: Module system implementation refresh (11/2016)
alanb
parents:
41452
diff
changeset
|
879 |
public void addDeprecationInfo(Content div) { |
f3702cff2933
8169069: Module system implementation refresh (11/2016)
alanb
parents:
41452
diff
changeset
|
880 |
List<? extends DocTree> deprs = utils.getBlockTags(mdle, DocTree.Kind.DEPRECATED); |
f3702cff2933
8169069: Module system implementation refresh (11/2016)
alanb
parents:
41452
diff
changeset
|
881 |
if (utils.isDeprecated(mdle)) { |
f3702cff2933
8169069: Module system implementation refresh (11/2016)
alanb
parents:
41452
diff
changeset
|
882 |
CommentHelper ch = utils.getCommentHelper(mdle); |
f3702cff2933
8169069: Module system implementation refresh (11/2016)
alanb
parents:
41452
diff
changeset
|
883 |
HtmlTree deprDiv = new HtmlTree(HtmlTag.DIV); |
47846 | 884 |
deprDiv.setStyle(HtmlStyle.deprecationBlock); |
42816
3638773ff1b0
8162674: change javadoc output text and style emitted by for-removal deprecations
bpatel
parents:
42407
diff
changeset
|
885 |
Content deprPhrase = HtmlTree.SPAN(HtmlStyle.deprecatedLabel, getDeprecatedPhrase(mdle)); |
42407
f3702cff2933
8169069: Module system implementation refresh (11/2016)
alanb
parents:
41452
diff
changeset
|
886 |
deprDiv.addContent(deprPhrase); |
f3702cff2933
8169069: Module system implementation refresh (11/2016)
alanb
parents:
41452
diff
changeset
|
887 |
if (!deprs.isEmpty()) { |
f3702cff2933
8169069: Module system implementation refresh (11/2016)
alanb
parents:
41452
diff
changeset
|
888 |
List<? extends DocTree> commentTags = ch.getDescription(configuration, deprs.get(0)); |
f3702cff2933
8169069: Module system implementation refresh (11/2016)
alanb
parents:
41452
diff
changeset
|
889 |
if (!commentTags.isEmpty()) { |
f3702cff2933
8169069: Module system implementation refresh (11/2016)
alanb
parents:
41452
diff
changeset
|
890 |
addInlineDeprecatedComment(mdle, deprs.get(0), deprDiv); |
f3702cff2933
8169069: Module system implementation refresh (11/2016)
alanb
parents:
41452
diff
changeset
|
891 |
} |
f3702cff2933
8169069: Module system implementation refresh (11/2016)
alanb
parents:
41452
diff
changeset
|
892 |
} |
f3702cff2933
8169069: Module system implementation refresh (11/2016)
alanb
parents:
41452
diff
changeset
|
893 |
div.addContent(deprDiv); |
f3702cff2933
8169069: Module system implementation refresh (11/2016)
alanb
parents:
41452
diff
changeset
|
894 |
} |
36526 | 895 |
} |
896 |
||
897 |
/** |
|
37747
878801512393
8154119: Module summary page should display module description
bpatel
parents:
36526
diff
changeset
|
898 |
* {@inheritDoc} |
878801512393
8154119: Module summary page should display module description
bpatel
parents:
36526
diff
changeset
|
899 |
*/ |
42407
f3702cff2933
8169069: Module system implementation refresh (11/2016)
alanb
parents:
41452
diff
changeset
|
900 |
@Override |
37747
878801512393
8154119: Module summary page should display module description
bpatel
parents:
36526
diff
changeset
|
901 |
public void addModuleDescription(Content moduleContentTree) { |
41452 | 902 |
if (!utils.getFullBody(mdle).isEmpty()) { |
37747
878801512393
8154119: Module summary page should display module description
bpatel
parents:
36526
diff
changeset
|
903 |
Content tree = configuration.allowTag(HtmlTag.SECTION) ? HtmlTree.SECTION() : moduleContentTree; |
42407
f3702cff2933
8169069: Module system implementation refresh (11/2016)
alanb
parents:
41452
diff
changeset
|
904 |
addDeprecationInfo(tree); |
37747
878801512393
8154119: Module summary page should display module description
bpatel
parents:
36526
diff
changeset
|
905 |
tree.addContent(HtmlConstants.START_OF_MODULE_DESCRIPTION); |
47850 | 906 |
tree.addContent(links.createAnchor(SectionName.MODULE_DESCRIPTION)); |
37747
878801512393
8154119: Module summary page should display module description
bpatel
parents:
36526
diff
changeset
|
907 |
addInlineComment(mdle, tree); |
878801512393
8154119: Module summary page should display module description
bpatel
parents:
36526
diff
changeset
|
908 |
if (configuration.allowTag(HtmlTag.SECTION)) { |
878801512393
8154119: Module summary page should display module description
bpatel
parents:
36526
diff
changeset
|
909 |
moduleContentTree.addContent(tree); |
878801512393
8154119: Module summary page should display module description
bpatel
parents:
36526
diff
changeset
|
910 |
} |
878801512393
8154119: Module summary page should display module description
bpatel
parents:
36526
diff
changeset
|
911 |
} |
878801512393
8154119: Module summary page should display module description
bpatel
parents:
36526
diff
changeset
|
912 |
} |
878801512393
8154119: Module summary page should display module description
bpatel
parents:
36526
diff
changeset
|
913 |
|
878801512393
8154119: Module summary page should display module description
bpatel
parents:
36526
diff
changeset
|
914 |
/** |
38911
48a00b5ee366
8156077: Support javadoc tags in module documentation
bpatel
parents:
37943
diff
changeset
|
915 |
* {@inheritDoc} |
48a00b5ee366
8156077: Support javadoc tags in module documentation
bpatel
parents:
37943
diff
changeset
|
916 |
*/ |
42407
f3702cff2933
8169069: Module system implementation refresh (11/2016)
alanb
parents:
41452
diff
changeset
|
917 |
@Override |
38911
48a00b5ee366
8156077: Support javadoc tags in module documentation
bpatel
parents:
37943
diff
changeset
|
918 |
public void addModuleTags(Content moduleContentTree) { |
48a00b5ee366
8156077: Support javadoc tags in module documentation
bpatel
parents:
37943
diff
changeset
|
919 |
Content tree = (configuration.allowTag(HtmlTag.SECTION)) |
48a00b5ee366
8156077: Support javadoc tags in module documentation
bpatel
parents:
37943
diff
changeset
|
920 |
? HtmlTree.SECTION() |
48a00b5ee366
8156077: Support javadoc tags in module documentation
bpatel
parents:
37943
diff
changeset
|
921 |
: moduleContentTree; |
48a00b5ee366
8156077: Support javadoc tags in module documentation
bpatel
parents:
37943
diff
changeset
|
922 |
addTagsInfo(mdle, tree); |
48a00b5ee366
8156077: Support javadoc tags in module documentation
bpatel
parents:
37943
diff
changeset
|
923 |
if (configuration.allowTag(HtmlTag.SECTION)) { |
48a00b5ee366
8156077: Support javadoc tags in module documentation
bpatel
parents:
37943
diff
changeset
|
924 |
moduleContentTree.addContent(tree); |
48a00b5ee366
8156077: Support javadoc tags in module documentation
bpatel
parents:
37943
diff
changeset
|
925 |
} |
48a00b5ee366
8156077: Support javadoc tags in module documentation
bpatel
parents:
37943
diff
changeset
|
926 |
} |
48a00b5ee366
8156077: Support javadoc tags in module documentation
bpatel
parents:
37943
diff
changeset
|
927 |
|
48a00b5ee366
8156077: Support javadoc tags in module documentation
bpatel
parents:
37943
diff
changeset
|
928 |
/** |
39670
9d1eafbf29c6
8154261: Module summary page should display directives for the module
bpatel
parents:
38911
diff
changeset
|
929 |
* Add summary details to the navigation bar. |
36526 | 930 |
* |
39670
9d1eafbf29c6
8154261: Module summary page should display directives for the module
bpatel
parents:
38911
diff
changeset
|
931 |
* @param subDiv the content tree to which the summary detail links will be added |
9d1eafbf29c6
8154261: Module summary page should display directives for the module
bpatel
parents:
38911
diff
changeset
|
932 |
*/ |
42407
f3702cff2933
8169069: Module system implementation refresh (11/2016)
alanb
parents:
41452
diff
changeset
|
933 |
@Override |
39670
9d1eafbf29c6
8154261: Module summary page should display directives for the module
bpatel
parents:
38911
diff
changeset
|
934 |
protected void addSummaryDetailLinks(Content subDiv) { |
40587 | 935 |
Content div = HtmlTree.DIV(getNavSummaryLinks()); |
936 |
subDiv.addContent(div); |
|
39670
9d1eafbf29c6
8154261: Module summary page should display directives for the module
bpatel
parents:
38911
diff
changeset
|
937 |
} |
9d1eafbf29c6
8154261: Module summary page should display directives for the module
bpatel
parents:
38911
diff
changeset
|
938 |
|
9d1eafbf29c6
8154261: Module summary page should display directives for the module
bpatel
parents:
38911
diff
changeset
|
939 |
/** |
9d1eafbf29c6
8154261: Module summary page should display directives for the module
bpatel
parents:
38911
diff
changeset
|
940 |
* Get summary links for navigation bar. |
9d1eafbf29c6
8154261: Module summary page should display directives for the module
bpatel
parents:
38911
diff
changeset
|
941 |
* |
9d1eafbf29c6
8154261: Module summary page should display directives for the module
bpatel
parents:
38911
diff
changeset
|
942 |
* @return the content tree for the navigation summary links |
36526 | 943 |
*/ |
40587 | 944 |
protected Content getNavSummaryLinks() { |
40303 | 945 |
Content li = HtmlTree.LI(contents.moduleSubNavLabel); |
946 |
li.addContent(Contents.SPACE); |
|
39670
9d1eafbf29c6
8154261: Module summary page should display directives for the module
bpatel
parents:
38911
diff
changeset
|
947 |
Content ulNav = HtmlTree.UL(HtmlStyle.subNavList, li); |
9d1eafbf29c6
8154261: Module summary page should display directives for the module
bpatel
parents:
38911
diff
changeset
|
948 |
Content liNav = new HtmlTree(HtmlTag.LI); |
41452 | 949 |
liNav.addContent(!utils.getFullBody(mdle).isEmpty() && !configuration.nocomment |
47850 | 950 |
? Links.createLink(SectionName.MODULE_DESCRIPTION, contents.navModuleDescription) |
40303 | 951 |
: contents.navModuleDescription); |
39670
9d1eafbf29c6
8154261: Module summary page should display directives for the module
bpatel
parents:
38911
diff
changeset
|
952 |
addNavGap(liNav); |
44564 | 953 |
liNav.addContent((display(requires) || display(indirectModules)) |
47850 | 954 |
? Links.createLink(SectionName.MODULES, contents.navModules) |
40303 | 955 |
: contents.navModules); |
39670
9d1eafbf29c6
8154261: Module summary page should display directives for the module
bpatel
parents:
38911
diff
changeset
|
956 |
addNavGap(liNav); |
48325 | 957 |
liNav.addContent((display(packages) |
44564 | 958 |
|| display(indirectPackages) || display(indirectOpenPackages)) |
47850 | 959 |
? Links.createLink(SectionName.PACKAGES, contents.navPackages) |
40303 | 960 |
: contents.navPackages); |
39670
9d1eafbf29c6
8154261: Module summary page should display directives for the module
bpatel
parents:
38911
diff
changeset
|
961 |
addNavGap(liNav); |
46082
c65be9fae87b
8185151: doclet may create a link to a missing anchor/id
pmuthuswamy
parents:
45417
diff
changeset
|
962 |
liNav.addContent((displayServices(uses, usesTrees) || displayServices(provides.keySet(), providesTrees)) |
47850 | 963 |
? Links.createLink(SectionName.SERVICES, contents.navServices) |
40303 | 964 |
: contents.navServices); |
39670
9d1eafbf29c6
8154261: Module summary page should display directives for the module
bpatel
parents:
38911
diff
changeset
|
965 |
ulNav.addContent(liNav); |
9d1eafbf29c6
8154261: Module summary page should display directives for the module
bpatel
parents:
38911
diff
changeset
|
966 |
return ulNav; |
9d1eafbf29c6
8154261: Module summary page should display directives for the module
bpatel
parents:
38911
diff
changeset
|
967 |
} |
9d1eafbf29c6
8154261: Module summary page should display directives for the module
bpatel
parents:
38911
diff
changeset
|
968 |
|
9d1eafbf29c6
8154261: Module summary page should display directives for the module
bpatel
parents:
38911
diff
changeset
|
969 |
/** |
36526 | 970 |
* {@inheritDoc} |
971 |
*/ |
|
42407
f3702cff2933
8169069: Module system implementation refresh (11/2016)
alanb
parents:
41452
diff
changeset
|
972 |
@Override |
36526 | 973 |
public void addModuleContent(Content contentTree, Content moduleContentTree) { |
974 |
if (configuration.allowTag(HtmlTag.MAIN)) { |
|
975 |
mainTree.addContent(moduleContentTree); |
|
976 |
contentTree.addContent(mainTree); |
|
977 |
} else { |
|
978 |
contentTree.addContent(moduleContentTree); |
|
979 |
} |
|
980 |
} |
|
981 |
||
982 |
/** |
|
983 |
* {@inheritDoc} |
|
984 |
*/ |
|
42407
f3702cff2933
8169069: Module system implementation refresh (11/2016)
alanb
parents:
41452
diff
changeset
|
985 |
@Override |
36526 | 986 |
public void addModuleFooter(Content contentTree) { |
987 |
Content htmlTree = (configuration.allowTag(HtmlTag.FOOTER)) |
|
988 |
? HtmlTree.FOOTER() |
|
989 |
: contentTree; |
|
990 |
addNavLinks(false, htmlTree); |
|
991 |
addBottom(htmlTree); |
|
992 |
if (configuration.allowTag(HtmlTag.FOOTER)) { |
|
993 |
contentTree.addContent(htmlTree); |
|
994 |
} |
|
995 |
} |
|
996 |
||
997 |
/** |
|
998 |
* {@inheritDoc} |
|
42831
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42816
diff
changeset
|
999 |
* |
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42816
diff
changeset
|
1000 |
* @throws jdk.javadoc.internal.doclets.toolkit.util.DocFileIOException |
36526 | 1001 |
*/ |
40587 | 1002 |
@Override |
1003 |
public void printDocument(Content contentTree) throws DocFileIOException { |
|
36526 | 1004 |
printHtmlDocument(configuration.metakeywords.getMetaKeywordsForModule(mdle), |
1005 |
true, contentTree); |
|
1006 |
} |
|
1007 |
||
1008 |
/** |
|
1009 |
* Add the module package deprecation information to the documentation tree. |
|
1010 |
* |
|
1011 |
* @param li the content tree to which the deprecation information will be added |
|
1012 |
* @param pkg the PackageDoc that is added |
|
1013 |
*/ |
|
1014 |
public void addPackageDeprecationInfo(Content li, PackageElement pkg) { |
|
1015 |
List<? extends DocTree> deprs; |
|
1016 |
if (utils.isDeprecated(pkg)) { |
|
1017 |
deprs = utils.getDeprecatedTrees(pkg); |
|
1018 |
HtmlTree deprDiv = new HtmlTree(HtmlTag.DIV); |
|
47846 | 1019 |
deprDiv.setStyle(HtmlStyle.deprecationBlock); |
42816
3638773ff1b0
8162674: change javadoc output text and style emitted by for-removal deprecations
bpatel
parents:
42407
diff
changeset
|
1020 |
Content deprPhrase = HtmlTree.SPAN(HtmlStyle.deprecatedLabel, getDeprecatedPhrase(pkg)); |
36526 | 1021 |
deprDiv.addContent(deprPhrase); |
1022 |
if (!deprs.isEmpty()) { |
|
1023 |
CommentHelper ch = utils.getCommentHelper(pkg); |
|
1024 |
List<? extends DocTree> commentTags = ch.getDescription(configuration, deprs.get(0)); |
|
1025 |
if (!commentTags.isEmpty()) { |
|
1026 |
addInlineDeprecatedComment(pkg, deprs.get(0), deprDiv); |
|
1027 |
} |
|
1028 |
} |
|
1029 |
li.addContent(deprDiv); |
|
1030 |
} |
|
1031 |
} |
|
1032 |
||
1033 |
/** |
|
37943
2efb75c09230
8154262: Navigation bar in javadoc generated pages needs to be updated to display module information
bpatel
parents:
37747
diff
changeset
|
1034 |
* Get this module link. |
2efb75c09230
8154262: Navigation bar in javadoc generated pages needs to be updated to display module information
bpatel
parents:
37747
diff
changeset
|
1035 |
* |
2efb75c09230
8154262: Navigation bar in javadoc generated pages needs to be updated to display module information
bpatel
parents:
37747
diff
changeset
|
1036 |
* @return a content tree for the module link |
2efb75c09230
8154262: Navigation bar in javadoc generated pages needs to be updated to display module information
bpatel
parents:
37747
diff
changeset
|
1037 |
*/ |
2efb75c09230
8154262: Navigation bar in javadoc generated pages needs to be updated to display module information
bpatel
parents:
37747
diff
changeset
|
1038 |
@Override |
2efb75c09230
8154262: Navigation bar in javadoc generated pages needs to be updated to display module information
bpatel
parents:
37747
diff
changeset
|
1039 |
protected Content getNavLinkModule() { |
40303 | 1040 |
Content li = HtmlTree.LI(HtmlStyle.navBarCell1Rev, contents.moduleLabel); |
37943
2efb75c09230
8154262: Navigation bar in javadoc generated pages needs to be updated to display module information
bpatel
parents:
37747
diff
changeset
|
1041 |
return li; |
2efb75c09230
8154262: Navigation bar in javadoc generated pages needs to be updated to display module information
bpatel
parents:
37747
diff
changeset
|
1042 |
} |
2efb75c09230
8154262: Navigation bar in javadoc generated pages needs to be updated to display module information
bpatel
parents:
37747
diff
changeset
|
1043 |
|
2efb75c09230
8154262: Navigation bar in javadoc generated pages needs to be updated to display module information
bpatel
parents:
37747
diff
changeset
|
1044 |
/** |
36526 | 1045 |
* Get "PREV MODULE" link in the navigation bar. |
1046 |
* |
|
1047 |
* @return a content tree for the previous link |
|
1048 |
*/ |
|
42407
f3702cff2933
8169069: Module system implementation refresh (11/2016)
alanb
parents:
41452
diff
changeset
|
1049 |
@Override |
36526 | 1050 |
public Content getNavLinkPrevious() { |
1051 |
Content li; |
|
1052 |
if (prevModule == null) { |
|
40303 | 1053 |
li = HtmlTree.LI(contents.prevModuleLabel); |
36526 | 1054 |
} else { |
47850 | 1055 |
li = HtmlTree.LI(Links.createLink(pathToRoot.resolve(DocPaths.moduleSummary( |
40303 | 1056 |
prevModule)), contents.prevModuleLabel, "", "")); |
36526 | 1057 |
} |
1058 |
return li; |
|
1059 |
} |
|
1060 |
||
1061 |
/** |
|
1062 |
* Get "NEXT MODULE" link in the navigation bar. |
|
1063 |
* |
|
1064 |
* @return a content tree for the next link |
|
1065 |
*/ |
|
42407
f3702cff2933
8169069: Module system implementation refresh (11/2016)
alanb
parents:
41452
diff
changeset
|
1066 |
@Override |
36526 | 1067 |
public Content getNavLinkNext() { |
1068 |
Content li; |
|
1069 |
if (nextModule == null) { |
|
40303 | 1070 |
li = HtmlTree.LI(contents.nextModuleLabel); |
36526 | 1071 |
} else { |
47850 | 1072 |
li = HtmlTree.LI(Links.createLink(pathToRoot.resolve(DocPaths.moduleSummary( |
40303 | 1073 |
nextModule)), contents.nextModuleLabel, "", "")); |
36526 | 1074 |
} |
1075 |
return li; |
|
1076 |
} |
|
1077 |
} |