author | bpatel |
Thu, 17 May 2018 12:59:53 -0700 | |
changeset 50167 | cc705c956798 |
parent 49551 | 0d4786e42471 |
child 51862 | c319db69099c |
permissions | -rw-r--r-- |
36526 | 1 |
/* |
48654
36f58bd6269f
8195796: Reduce the size of relative URLs in generated docs
jjg
parents:
48437
diff
changeset
|
2 |
* Copyright (c) 2016, 2018, 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; |
|
49551
0d4786e42471
8196200: Implement a navigation builder in javadoc
bpatel
parents:
48759
diff
changeset
|
53 |
import jdk.javadoc.internal.doclets.formats.html.markup.Navigation; |
0d4786e42471
8196200: Implement a navigation builder in javadoc
bpatel
parents:
48759
diff
changeset
|
54 |
import jdk.javadoc.internal.doclets.formats.html.markup.Navigation.PageMode; |
36526 | 55 |
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
|
56 |
import jdk.javadoc.internal.doclets.formats.html.markup.StringContent; |
36526 | 57 |
import jdk.javadoc.internal.doclets.toolkit.Content; |
58 |
import jdk.javadoc.internal.doclets.toolkit.ModuleSummaryWriter; |
|
59 |
import jdk.javadoc.internal.doclets.toolkit.util.CommentHelper; |
|
40587 | 60 |
import jdk.javadoc.internal.doclets.toolkit.util.DocFileIOException; |
36526 | 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 module being documented. |
|
78 |
*/ |
|
79 |
protected ModuleElement mdle; |
|
80 |
||
42831
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42816
diff
changeset
|
81 |
/** |
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42816
diff
changeset
|
82 |
* 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
|
83 |
*/ |
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42816
diff
changeset
|
84 |
private final ModuleMode moduleMode; |
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42816
diff
changeset
|
85 |
|
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42816
diff
changeset
|
86 |
/** |
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42816
diff
changeset
|
87 |
* 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
|
88 |
*/ |
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42816
diff
changeset
|
89 |
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
|
90 |
= new TreeMap<>(utils.makeModuleComparator()); |
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 |
/** |
44564 | 93 |
* 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
|
94 |
*/ |
44564 | 95 |
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
|
96 |
= new TreeMap<>(utils.makeModuleComparator()); |
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42816
diff
changeset
|
97 |
|
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42816
diff
changeset
|
98 |
/** |
48325 | 99 |
* Details about a package in a module. |
100 |
* A package may be not exported, or exported to some modules, or exported to all modules. |
|
101 |
* A package may be not opened, or opened to some modules, or opened to all modules. |
|
102 |
* A package that is neither exported or opened to any modules is a concealed package. |
|
103 |
* 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
|
104 |
*/ |
48325 | 105 |
class PackageEntry { |
106 |
/** |
|
107 |
* Summary of package exports: |
|
108 |
* If null, the package is not exported to any modules; |
|
109 |
* if empty, the package is exported to all modules; |
|
110 |
* otherwise, the package is exported to these modules. |
|
111 |
*/ |
|
112 |
Set<ModuleElement> exportedTo; |
|
113 |
||
114 |
/** |
|
115 |
* Summary of package opens: |
|
116 |
* If null, the package is not opened to any modules; |
|
117 |
* if empty, the package is opened to all modules; |
|
118 |
* otherwise, the package is opened to these modules. |
|
119 |
*/ |
|
120 |
Set<ModuleElement> openedTo; |
|
121 |
} |
|
42831
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42816
diff
changeset
|
122 |
|
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42816
diff
changeset
|
123 |
/** |
48325 | 124 |
* 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
|
125 |
*/ |
48325 | 126 |
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
|
127 |
|
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42816
diff
changeset
|
128 |
/** |
44564 | 129 |
* 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
|
130 |
*/ |
44564 | 131 |
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
|
132 |
= new TreeMap<>(utils.makeModuleComparator()); |
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42816
diff
changeset
|
133 |
|
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42816
diff
changeset
|
134 |
/** |
44564 | 135 |
* 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
|
136 |
*/ |
44564 | 137 |
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
|
138 |
= new TreeMap<>(utils.makeModuleComparator()); |
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42816
diff
changeset
|
139 |
|
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42816
diff
changeset
|
140 |
/** |
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42816
diff
changeset
|
141 |
* 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
|
142 |
*/ |
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42816
diff
changeset
|
143 |
private final SortedSet<TypeElement> uses |
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42816
diff
changeset
|
144 |
= new TreeSet<>(utils.makeAllClassesComparator()); |
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42816
diff
changeset
|
145 |
|
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42816
diff
changeset
|
146 |
/** |
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42816
diff
changeset
|
147 |
* 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
|
148 |
*/ |
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42816
diff
changeset
|
149 |
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
|
150 |
= new TreeMap<>(utils.makeAllClassesComparator()); |
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42816
diff
changeset
|
151 |
|
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 |
* 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
|
154 |
*/ |
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42816
diff
changeset
|
155 |
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
|
156 |
= new TreeMap<>(utils.makeAllClassesComparator()); |
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42816
diff
changeset
|
157 |
|
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 |
* 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
|
160 |
* description. |
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 |
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
|
163 |
= new TreeMap<>(utils.makeAllClassesComparator()); |
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42816
diff
changeset
|
164 |
|
36526 | 165 |
/** |
166 |
* The HTML tree for main tag. |
|
167 |
*/ |
|
168 |
protected HtmlTree mainTree = HtmlTree.MAIN(); |
|
169 |
||
170 |
/** |
|
39670
9d1eafbf29c6
8154261: Module summary page should display directives for the module
bpatel
parents:
38911
diff
changeset
|
171 |
* The HTML tree for section tag. |
9d1eafbf29c6
8154261: Module summary page should display directives for the module
bpatel
parents:
38911
diff
changeset
|
172 |
*/ |
9d1eafbf29c6
8154261: Module summary page should display directives for the module
bpatel
parents:
38911
diff
changeset
|
173 |
protected HtmlTree sectionTree = HtmlTree.SECTION(); |
9d1eafbf29c6
8154261: Module summary page should display directives for the module
bpatel
parents:
38911
diff
changeset
|
174 |
|
49551
0d4786e42471
8196200: Implement a navigation builder in javadoc
bpatel
parents:
48759
diff
changeset
|
175 |
private final Navigation navBar; |
0d4786e42471
8196200: Implement a navigation builder in javadoc
bpatel
parents:
48759
diff
changeset
|
176 |
|
39670
9d1eafbf29c6
8154261: Module summary page should display directives for the module
bpatel
parents:
38911
diff
changeset
|
177 |
/** |
42831
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42816
diff
changeset
|
178 |
* Constructor to construct ModuleWriter object and to generate "moduleName-summary.html" file. |
36526 | 179 |
* |
180 |
* @param configuration the configuration of the doclet. |
|
39670
9d1eafbf29c6
8154261: Module summary page should display directives for the module
bpatel
parents:
38911
diff
changeset
|
181 |
* @param mdle Module under consideration. |
36526 | 182 |
*/ |
48756
ce608a09a666
8196027: Remove "Prev" and "Next" links from the javadoc navigation
bpatel
parents:
48654
diff
changeset
|
183 |
public ModuleWriterImpl(HtmlConfiguration configuration, ModuleElement mdle) { |
48759
ffa68af7da87
8195795: Organize output files by module/package, not just package
jjg
parents:
48756
diff
changeset
|
184 |
super(configuration, configuration.docPaths.moduleSummary(mdle)); |
36526 | 185 |
this.mdle = mdle; |
42831
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42816
diff
changeset
|
186 |
this.moduleMode = configuration.docEnv.getModuleMode(); |
49551
0d4786e42471
8196200: Implement a navigation builder in javadoc
bpatel
parents:
48759
diff
changeset
|
187 |
this.navBar = new Navigation(mdle, configuration, fixedNavDiv, PageMode.MODULE, path); |
42831
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42816
diff
changeset
|
188 |
computeModulesData(); |
36526 | 189 |
} |
190 |
||
191 |
/** |
|
39670
9d1eafbf29c6
8154261: Module summary page should display directives for the module
bpatel
parents:
38911
diff
changeset
|
192 |
* Get the module header. |
9d1eafbf29c6
8154261: Module summary page should display directives for the module
bpatel
parents:
38911
diff
changeset
|
193 |
* |
9d1eafbf29c6
8154261: Module summary page should display directives for the module
bpatel
parents:
38911
diff
changeset
|
194 |
* @param heading the heading for the section |
36526 | 195 |
*/ |
42407
f3702cff2933
8169069: Module system implementation refresh (11/2016)
alanb
parents:
41452
diff
changeset
|
196 |
@Override |
36526 | 197 |
public Content getModuleHeader(String heading) { |
198 |
HtmlTree bodyTree = getBody(true, getWindowTitle(mdle.getQualifiedName().toString())); |
|
199 |
HtmlTree htmlTree = (configuration.allowTag(HtmlTag.HEADER)) |
|
200 |
? HtmlTree.HEADER() |
|
201 |
: bodyTree; |
|
202 |
addTop(htmlTree); |
|
49551
0d4786e42471
8196200: Implement a navigation builder in javadoc
bpatel
parents:
48759
diff
changeset
|
203 |
navBar.setDisplaySummaryModuleDescLink(!utils.getFullBody(mdle).isEmpty() && !configuration.nocomment); |
0d4786e42471
8196200: Implement a navigation builder in javadoc
bpatel
parents:
48759
diff
changeset
|
204 |
navBar.setDisplaySummaryModulesLink(display(requires) || display(indirectModules)); |
0d4786e42471
8196200: Implement a navigation builder in javadoc
bpatel
parents:
48759
diff
changeset
|
205 |
navBar.setDisplaySummaryPackagesLink(display(packages) || display(indirectPackages) |
0d4786e42471
8196200: Implement a navigation builder in javadoc
bpatel
parents:
48759
diff
changeset
|
206 |
|| display(indirectOpenPackages)); |
0d4786e42471
8196200: Implement a navigation builder in javadoc
bpatel
parents:
48759
diff
changeset
|
207 |
navBar.setDisplaySummaryServicesLink(displayServices(uses, usesTrees) || displayServices(provides.keySet(), providesTrees)); |
0d4786e42471
8196200: Implement a navigation builder in javadoc
bpatel
parents:
48759
diff
changeset
|
208 |
navBar.setUserHeader(getUserHeaderFooter(true)); |
0d4786e42471
8196200: Implement a navigation builder in javadoc
bpatel
parents:
48759
diff
changeset
|
209 |
htmlTree.addContent(navBar.getContent(true)); |
36526 | 210 |
if (configuration.allowTag(HtmlTag.HEADER)) { |
211 |
bodyTree.addContent(htmlTree); |
|
212 |
} |
|
213 |
HtmlTree div = new HtmlTree(HtmlTag.DIV); |
|
47846 | 214 |
div.setStyle(HtmlStyle.header); |
42407
f3702cff2933
8169069: Module system implementation refresh (11/2016)
alanb
parents:
41452
diff
changeset
|
215 |
Content annotationContent = new HtmlTree(HtmlTag.P); |
f3702cff2933
8169069: Module system implementation refresh (11/2016)
alanb
parents:
41452
diff
changeset
|
216 |
addAnnotationInfo(mdle, annotationContent); |
f3702cff2933
8169069: Module system implementation refresh (11/2016)
alanb
parents:
41452
diff
changeset
|
217 |
div.addContent(annotationContent); |
44564 | 218 |
Content label = mdle.isOpen() && (configuration.docEnv.getModuleMode() == ModuleMode.ALL) |
219 |
? contents.openModuleLabel : contents.moduleLabel; |
|
36526 | 220 |
Content tHeading = HtmlTree.HEADING(HtmlConstants.TITLE_HEADING, true, |
44564 | 221 |
HtmlStyle.title, label); |
40303 | 222 |
tHeading.addContent(Contents.SPACE); |
36526 | 223 |
Content moduleHead = new RawHtml(heading); |
224 |
tHeading.addContent(moduleHead); |
|
225 |
div.addContent(tHeading); |
|
226 |
if (configuration.allowTag(HtmlTag.MAIN)) { |
|
227 |
mainTree.addContent(div); |
|
228 |
} else { |
|
229 |
bodyTree.addContent(div); |
|
230 |
} |
|
231 |
return bodyTree; |
|
232 |
} |
|
233 |
||
234 |
/** |
|
39670
9d1eafbf29c6
8154261: Module summary page should display directives for the module
bpatel
parents:
38911
diff
changeset
|
235 |
* Get the content header. |
36526 | 236 |
*/ |
42407
f3702cff2933
8169069: Module system implementation refresh (11/2016)
alanb
parents:
41452
diff
changeset
|
237 |
@Override |
36526 | 238 |
public Content getContentHeader() { |
239 |
HtmlTree div = new HtmlTree(HtmlTag.DIV); |
|
47846 | 240 |
div.setStyle(HtmlStyle.contentContainer); |
36526 | 241 |
return div; |
242 |
} |
|
243 |
||
244 |
/** |
|
39670
9d1eafbf29c6
8154261: Module summary page should display directives for the module
bpatel
parents:
38911
diff
changeset
|
245 |
* Get the summary section header. |
36526 | 246 |
*/ |
42407
f3702cff2933
8169069: Module system implementation refresh (11/2016)
alanb
parents:
41452
diff
changeset
|
247 |
@Override |
36526 | 248 |
public Content getSummaryHeader() { |
249 |
HtmlTree li = new HtmlTree(HtmlTag.LI); |
|
47846 | 250 |
li.setStyle(HtmlStyle.blockList); |
36526 | 251 |
return li; |
252 |
} |
|
253 |
||
254 |
/** |
|
39670
9d1eafbf29c6
8154261: Module summary page should display directives for the module
bpatel
parents:
38911
diff
changeset
|
255 |
* Get the summary tree. |
9d1eafbf29c6
8154261: Module summary page should display directives for the module
bpatel
parents:
38911
diff
changeset
|
256 |
* |
9d1eafbf29c6
8154261: Module summary page should display directives for the module
bpatel
parents:
38911
diff
changeset
|
257 |
* @param summaryContentTree the content tree to be added to the summary tree. |
36526 | 258 |
*/ |
42407
f3702cff2933
8169069: Module system implementation refresh (11/2016)
alanb
parents:
41452
diff
changeset
|
259 |
@Override |
36526 | 260 |
public Content getSummaryTree(Content summaryContentTree) { |
261 |
HtmlTree ul = HtmlTree.UL(HtmlStyle.blockList, summaryContentTree); |
|
262 |
return ul; |
|
263 |
} |
|
264 |
||
265 |
/** |
|
42831
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42816
diff
changeset
|
266 |
* 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
|
267 |
*/ |
42831
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42816
diff
changeset
|
268 |
public void computeModulesData() { |
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42816
diff
changeset
|
269 |
CommentHelper ch = utils.getCommentHelper(mdle); |
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42816
diff
changeset
|
270 |
// 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
|
271 |
Map<ModuleElement, String> dependentModules = utils.getDependentModules(mdle); |
44564 | 272 |
// Add all dependent modules to indirect modules set. We will remove the modules, |
273 |
// 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
|
274 |
// required modules. |
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42816
diff
changeset
|
275 |
dependentModules.forEach((module, mod) -> { |
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42816
diff
changeset
|
276 |
if (shouldDocument(module)) { |
44564 | 277 |
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
|
278 |
} |
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42816
diff
changeset
|
279 |
}); |
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42816
diff
changeset
|
280 |
(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
|
281 |
ModuleElement m = directive.getDependency(); |
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42816
diff
changeset
|
282 |
if (shouldDocument(m)) { |
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42816
diff
changeset
|
283 |
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
|
284 |
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
|
285 |
} else { |
44564 | 286 |
// For api mode, just keep the public requires in dependentModules for display of |
287 |
// 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
|
288 |
dependentModules.remove(m); |
44564 | 289 |
} |
290 |
indirectModules.remove(m); |
|
42831
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42816
diff
changeset
|
291 |
} |
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42816
diff
changeset
|
292 |
}); |
44293
2f47b2c16612
8176778: javadoc does not produce summary pages for aggregated modules
ksrini
parents:
42831
diff
changeset
|
293 |
|
48325 | 294 |
// Get all packages if module is open or if displaying concealed modules |
295 |
for (PackageElement pkg : utils.getModulePackageMap().getOrDefault(mdle, Collections.emptySet())) { |
|
296 |
if (shouldDocument(pkg) && (mdle.isOpen() || moduleMode == ModuleMode.ALL)) { |
|
297 |
PackageEntry e = new PackageEntry(); |
|
298 |
if (mdle.isOpen()) { |
|
299 |
e.openedTo = Collections.emptySet(); |
|
300 |
} |
|
301 |
packages.put(pkg, e); |
|
42831
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42816
diff
changeset
|
302 |
} |
48325 | 303 |
}; |
44293
2f47b2c16612
8176778: javadoc does not produce summary pages for aggregated modules
ksrini
parents:
42831
diff
changeset
|
304 |
|
48325 | 305 |
// Get all exported packages for the module, using the exports directive for the module. |
306 |
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
|
307 |
PackageElement p = directive.getPackage(); |
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42816
diff
changeset
|
308 |
if (shouldDocument(p)) { |
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42816
diff
changeset
|
309 |
List<? extends ModuleElement> targetMdles = directive.getTargetModules(); |
48325 | 310 |
// Include package if in details mode, or exported to all (i.e. targetModules == null) |
311 |
if (moduleMode == ModuleMode.ALL || targetMdles == null) { |
|
312 |
PackageEntry packageEntry = packages.computeIfAbsent(p, pkg -> new PackageEntry()); |
|
313 |
SortedSet<ModuleElement> mdleList = new TreeSet<>(utils.makeModuleComparator()); |
|
314 |
if (targetMdles != null) { |
|
315 |
mdleList.addAll(targetMdles); |
|
316 |
} |
|
317 |
packageEntry.exportedTo = mdleList; |
|
44689
53c703004306
8175823: doclet crashes when documenting a single class in a module.
bpatel
parents:
44684
diff
changeset
|
318 |
} |
42831
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42816
diff
changeset
|
319 |
} |
48325 | 320 |
} |
321 |
||
322 |
// Get all opened packages for the module, using the opens directive for the module. |
|
323 |
// If it is an open module, there will be no separate opens directives. |
|
324 |
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
|
325 |
PackageElement p = directive.getPackage(); |
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42816
diff
changeset
|
326 |
if (shouldDocument(p)) { |
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42816
diff
changeset
|
327 |
List<? extends ModuleElement> targetMdles = directive.getTargetModules(); |
48325 | 328 |
// Include package if in details mode, or opened to all (i.e. targetModules == null) |
329 |
if (moduleMode == ModuleMode.ALL || targetMdles == null) { |
|
330 |
PackageEntry packageEntry = packages.computeIfAbsent(p, pkg -> new PackageEntry()); |
|
331 |
SortedSet<ModuleElement> mdleList = new TreeSet<>(utils.makeModuleComparator()); |
|
332 |
if (targetMdles != null) { |
|
333 |
mdleList.addAll(targetMdles); |
|
334 |
} |
|
335 |
packageEntry.openedTo = mdleList; |
|
44689
53c703004306
8175823: doclet crashes when documenting a single class in a module.
bpatel
parents:
44684
diff
changeset
|
336 |
} |
42831
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42816
diff
changeset
|
337 |
} |
48325 | 338 |
} |
339 |
||
42831
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42816
diff
changeset
|
340 |
// Get all the exported and opened packages, for the transitive closure of the module, to be displayed in |
44564 | 341 |
// the indirect packages tables. |
42831
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42816
diff
changeset
|
342 |
dependentModules.forEach((module, mod) -> { |
44807
47e09e3f1829
8178339: javadoc includes qualified opens in "Additional Opened Packages" section
ksrini
parents:
44689
diff
changeset
|
343 |
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
|
344 |
(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
|
345 |
PackageElement pkg = directive.getPackage(); |
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42816
diff
changeset
|
346 |
if (shouldDocument(pkg)) { |
44807
47e09e3f1829
8178339: javadoc includes qualified opens in "Additional Opened Packages" section
ksrini
parents:
44689
diff
changeset
|
347 |
// Qualified exports are not displayed in API mode |
47e09e3f1829
8178339: javadoc includes qualified opens in "Additional Opened Packages" section
ksrini
parents:
44689
diff
changeset
|
348 |
if (moduleMode == ModuleMode.ALL || directive.getTargetModules() == null) { |
47e09e3f1829
8178339: javadoc includes qualified opens in "Additional Opened Packages" section
ksrini
parents:
44689
diff
changeset
|
349 |
exportPkgList.add(pkg); |
47e09e3f1829
8178339: javadoc includes qualified opens in "Additional Opened Packages" section
ksrini
parents:
44689
diff
changeset
|
350 |
} |
42831
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42816
diff
changeset
|
351 |
} |
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42816
diff
changeset
|
352 |
}); |
44807
47e09e3f1829
8178339: javadoc includes qualified opens in "Additional Opened Packages" section
ksrini
parents:
44689
diff
changeset
|
353 |
// 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
|
354 |
// 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
|
355 |
if (!exportPkgList.isEmpty()) { |
47e09e3f1829
8178339: javadoc includes qualified opens in "Additional Opened Packages" section
ksrini
parents:
44689
diff
changeset
|
356 |
indirectPackages.put(module, exportPkgList); |
39670
9d1eafbf29c6
8154261: Module summary page should display directives for the module
bpatel
parents:
38911
diff
changeset
|
357 |
} |
42831
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42816
diff
changeset
|
358 |
SortedSet<PackageElement> openPkgList = new TreeSet<>(utils.makePackageComparator()); |
48325 | 359 |
if (module.isOpen()) { |
360 |
openPkgList.addAll(utils.getModulePackageMap().getOrDefault(module, Collections.emptySet())); |
|
361 |
} else { |
|
362 |
(ElementFilter.opensIn(module.getDirectives())).forEach((directive) -> { |
|
363 |
PackageElement pkg = directive.getPackage(); |
|
364 |
if (shouldDocument(pkg)) { |
|
365 |
// Qualified opens are not displayed in API mode |
|
366 |
if (moduleMode == ModuleMode.ALL || directive.getTargetModules() == null) { |
|
367 |
openPkgList.add(pkg); |
|
368 |
} |
|
44807
47e09e3f1829
8178339: javadoc includes qualified opens in "Additional Opened Packages" section
ksrini
parents:
44689
diff
changeset
|
369 |
} |
48325 | 370 |
}); |
371 |
} |
|
44807
47e09e3f1829
8178339: javadoc includes qualified opens in "Additional Opened Packages" section
ksrini
parents:
44689
diff
changeset
|
372 |
// 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
|
373 |
// 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
|
374 |
if (!openPkgList.isEmpty()) { |
44564 | 375 |
indirectOpenPackages.put(module, openPkgList); |
42831
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42816
diff
changeset
|
376 |
} |
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42816
diff
changeset
|
377 |
}); |
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42816
diff
changeset
|
378 |
// 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
|
379 |
(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
|
380 |
TypeElement u = directive.getService(); |
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42816
diff
changeset
|
381 |
if (shouldDocument(u)) { |
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42816
diff
changeset
|
382 |
uses.add(u); |
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 |
}); |
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42816
diff
changeset
|
385 |
// 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
|
386 |
(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
|
387 |
TypeElement u = directive.getService(); |
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42816
diff
changeset
|
388 |
if (shouldDocument(u)) { |
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42816
diff
changeset
|
389 |
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
|
390 |
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
|
391 |
implSet.addAll(implList); |
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42816
diff
changeset
|
392 |
provides.put(u, implSet); |
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42816
diff
changeset
|
393 |
} |
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42816
diff
changeset
|
394 |
}); |
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42816
diff
changeset
|
395 |
// 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
|
396 |
(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
|
397 |
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
|
398 |
if (t != null) { |
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42816
diff
changeset
|
399 |
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
|
400 |
} |
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42816
diff
changeset
|
401 |
}); |
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42816
diff
changeset
|
402 |
// 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
|
403 |
(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
|
404 |
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
|
405 |
if (t != null) { |
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42816
diff
changeset
|
406 |
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
|
407 |
} |
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42816
diff
changeset
|
408 |
}); |
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42816
diff
changeset
|
409 |
} |
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42816
diff
changeset
|
410 |
|
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42816
diff
changeset
|
411 |
/** |
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42816
diff
changeset
|
412 |
* 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
|
413 |
* |
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42816
diff
changeset
|
414 |
* @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
|
415 |
* @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
|
416 |
*/ |
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42816
diff
changeset
|
417 |
public boolean shouldDocument(Element element) { |
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42816
diff
changeset
|
418 |
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
|
419 |
} |
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42816
diff
changeset
|
420 |
|
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42816
diff
changeset
|
421 |
/** |
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42816
diff
changeset
|
422 |
* 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
|
423 |
* |
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42816
diff
changeset
|
424 |
* @param section set of elements |
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42816
diff
changeset
|
425 |
* @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
|
426 |
*/ |
44684
6ce4d52084e8
8178067: support for @uses/@provides tags is broken
ksrini
parents:
44564
diff
changeset
|
427 |
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
|
428 |
return section != null && !section.isEmpty(); |
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 |
|
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42816
diff
changeset
|
431 |
/** |
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42816
diff
changeset
|
432 |
* 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
|
433 |
* |
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42816
diff
changeset
|
434 |
* @param section map of elements. |
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42816
diff
changeset
|
435 |
* @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
|
436 |
*/ |
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42816
diff
changeset
|
437 |
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
|
438 |
return section != null && !section.isEmpty(); |
39670
9d1eafbf29c6
8154261: Module summary page should display directives for the module
bpatel
parents:
38911
diff
changeset
|
439 |
} |
9d1eafbf29c6
8154261: Module summary page should display directives for the module
bpatel
parents:
38911
diff
changeset
|
440 |
|
44684
6ce4d52084e8
8178067: support for @uses/@provides tags is broken
ksrini
parents:
44564
diff
changeset
|
441 |
/* |
6ce4d52084e8
8178067: support for @uses/@provides tags is broken
ksrini
parents:
44564
diff
changeset
|
442 |
* 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
|
443 |
* 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
|
444 |
*/ |
6ce4d52084e8
8178067: support for @uses/@provides tags is broken
ksrini
parents:
44564
diff
changeset
|
445 |
private boolean displayServices(Set<TypeElement> typeElements, |
6ce4d52084e8
8178067: support for @uses/@provides tags is broken
ksrini
parents:
44564
diff
changeset
|
446 |
Map<TypeElement, Content> tagsMap) { |
6ce4d52084e8
8178067: support for @uses/@provides tags is broken
ksrini
parents:
44564
diff
changeset
|
447 |
return typeElements != null && |
6ce4d52084e8
8178067: support for @uses/@provides tags is broken
ksrini
parents:
44564
diff
changeset
|
448 |
typeElements.stream().anyMatch((v) -> displayServiceDirective(v, tagsMap)); |
6ce4d52084e8
8178067: support for @uses/@provides tags is broken
ksrini
parents:
44564
diff
changeset
|
449 |
} |
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 |
/* |
6ce4d52084e8
8178067: support for @uses/@provides tags is broken
ksrini
parents:
44564
diff
changeset
|
452 |
* 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
|
453 |
* from a javadoc tag in tagsMap. |
6ce4d52084e8
8178067: support for @uses/@provides tags is broken
ksrini
parents:
44564
diff
changeset
|
454 |
*/ |
6ce4d52084e8
8178067: support for @uses/@provides tags is broken
ksrini
parents:
44564
diff
changeset
|
455 |
private boolean displayServiceDirective(TypeElement typeElement, |
6ce4d52084e8
8178067: support for @uses/@provides tags is broken
ksrini
parents:
44564
diff
changeset
|
456 |
Map<TypeElement, Content> tagsMap) { |
6ce4d52084e8
8178067: support for @uses/@provides tags is broken
ksrini
parents:
44564
diff
changeset
|
457 |
return moduleMode == ModuleMode.ALL || tagsMap.containsKey(typeElement); |
6ce4d52084e8
8178067: support for @uses/@provides tags is broken
ksrini
parents:
44564
diff
changeset
|
458 |
} |
6ce4d52084e8
8178067: support for @uses/@provides tags is broken
ksrini
parents:
44564
diff
changeset
|
459 |
|
39670
9d1eafbf29c6
8154261: Module summary page should display directives for the module
bpatel
parents:
38911
diff
changeset
|
460 |
/** |
9d1eafbf29c6
8154261: Module summary page should display directives for the module
bpatel
parents:
38911
diff
changeset
|
461 |
* Add the summary header. |
9d1eafbf29c6
8154261: Module summary page should display directives for the module
bpatel
parents:
38911
diff
changeset
|
462 |
* |
9d1eafbf29c6
8154261: Module summary page should display directives for the module
bpatel
parents:
38911
diff
changeset
|
463 |
* @param startMarker the marker comment |
9d1eafbf29c6
8154261: Module summary page should display directives for the module
bpatel
parents:
38911
diff
changeset
|
464 |
* @param markerAnchor the marker anchor for the section |
9d1eafbf29c6
8154261: Module summary page should display directives for the module
bpatel
parents:
38911
diff
changeset
|
465 |
* @param heading the heading for the section |
9d1eafbf29c6
8154261: Module summary page should display directives for the module
bpatel
parents:
38911
diff
changeset
|
466 |
* @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
|
467 |
*/ |
47427 | 468 |
public void addSummaryHeader(Content startMarker, SectionName markerAnchor, Content heading, |
469 |
Content htmltree) { |
|
39670
9d1eafbf29c6
8154261: Module summary page should display directives for the module
bpatel
parents:
38911
diff
changeset
|
470 |
htmltree.addContent(startMarker); |
47850 | 471 |
htmltree.addContent(links.createAnchor(markerAnchor)); |
39670
9d1eafbf29c6
8154261: Module summary page should display directives for the module
bpatel
parents:
38911
diff
changeset
|
472 |
htmltree.addContent(HtmlTree.HEADING(HtmlTag.H3, heading)); |
9d1eafbf29c6
8154261: Module summary page should display directives for the module
bpatel
parents:
38911
diff
changeset
|
473 |
} |
9d1eafbf29c6
8154261: Module summary page should display directives for the module
bpatel
parents:
38911
diff
changeset
|
474 |
|
9d1eafbf29c6
8154261: Module summary page should display directives for the module
bpatel
parents:
38911
diff
changeset
|
475 |
/** |
47846 | 476 |
* 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
|
477 |
* |
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42816
diff
changeset
|
478 |
* @param caption the table caption |
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42816
diff
changeset
|
479 |
* @param tableSummary the summary for the table |
39670
9d1eafbf29c6
8154261: Module summary page should display directives for the module
bpatel
parents:
38911
diff
changeset
|
480 |
* @param tableStyle the table style |
9d1eafbf29c6
8154261: Module summary page should display directives for the module
bpatel
parents:
38911
diff
changeset
|
481 |
* @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
|
482 |
* @return a content object |
39670
9d1eafbf29c6
8154261: Module summary page should display directives for the module
bpatel
parents:
38911
diff
changeset
|
483 |
*/ |
47846 | 484 |
private Table getTable2(Content caption, String tableSummary, HtmlStyle tableStyle, |
47427 | 485 |
TableHeader tableHeader) { |
47846 | 486 |
return new Table(configuration.htmlVersion, tableStyle) |
487 |
.setSummary(tableSummary) |
|
488 |
.setCaption(caption) |
|
489 |
.setHeader(tableHeader) |
|
490 |
.setColumnStyles(HtmlStyle.colFirst, HtmlStyle.colLast); |
|
491 |
} |
|
492 |
||
493 |
/** |
|
494 |
* Get a table, with three columns, with the second column being the defining column. |
|
495 |
* |
|
496 |
* @param caption the table caption |
|
497 |
* @param tableSummary the summary for the table |
|
498 |
* @param tableStyle the table style |
|
499 |
* @param tableHeader the table header |
|
500 |
* @return a content object |
|
501 |
*/ |
|
502 |
private Table getTable3(Content caption, String tableSummary, HtmlStyle tableStyle, |
|
503 |
TableHeader tableHeader) { |
|
504 |
return new Table(configuration.htmlVersion, tableStyle) |
|
505 |
.setSummary(tableSummary) |
|
506 |
.setCaption(caption) |
|
507 |
.setHeader(tableHeader) |
|
508 |
.setRowScopeColumn(1) |
|
509 |
.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
|
510 |
} |
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42816
diff
changeset
|
511 |
|
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42816
diff
changeset
|
512 |
/** |
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42816
diff
changeset
|
513 |
* {@inheritDoc} |
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42816
diff
changeset
|
514 |
*/ |
47427 | 515 |
@Override |
42831
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42816
diff
changeset
|
516 |
public void addModulesSummary(Content summaryContentTree) { |
44564 | 517 |
if (display(requires) || display(indirectModules)) { |
47427 | 518 |
TableHeader requiresTableHeader = |
519 |
new TableHeader(contents.modifierLabel, contents.moduleLabel, |
|
520 |
contents.descriptionLabel); |
|
42831
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42816
diff
changeset
|
521 |
HtmlTree li = new HtmlTree(HtmlTag.LI); |
47846 | 522 |
li.setStyle(HtmlStyle.blockList); |
42831
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42816
diff
changeset
|
523 |
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
|
524 |
contents.navModules, li); |
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42816
diff
changeset
|
525 |
if (display(requires)) { |
47846 | 526 |
String text = resources.getText("doclet.Requires_Summary"); |
527 |
String tableSummary = resources.getText("doclet.Member_Table_Summary", |
|
47427 | 528 |
text, |
47846 | 529 |
resources.getText("doclet.modules")); |
530 |
Content caption = getTableCaption(new StringContent(text)); |
|
531 |
Table table = getTable3(caption, tableSummary, HtmlStyle.requiresSummary, |
|
532 |
requiresTableHeader); |
|
533 |
addModulesList(requires, table); |
|
534 |
li.addContent(table.toContent()); |
|
42831
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42816
diff
changeset
|
535 |
} |
44564 | 536 |
// Display indirect modules table in both "api" and "all" mode. |
537 |
if (display(indirectModules)) { |
|
47846 | 538 |
String amrText = resources.getText("doclet.Indirect_Requires_Summary"); |
539 |
String amrTableSummary = resources.getText("doclet.Member_Table_Summary", |
|
47427 | 540 |
amrText, |
42831
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42816
diff
changeset
|
541 |
configuration.getText("doclet.modules")); |
47846 | 542 |
Content amrCaption = getTableCaption(new StringContent(amrText)); |
543 |
Table amrTable = getTable3(amrCaption, amrTableSummary, HtmlStyle.requiresSummary, |
|
544 |
requiresTableHeader); |
|
545 |
addModulesList(indirectModules, amrTable); |
|
546 |
li.addContent(amrTable.toContent()); |
|
42831
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42816
diff
changeset
|
547 |
} |
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42816
diff
changeset
|
548 |
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
|
549 |
summaryContentTree.addContent(ul); |
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42816
diff
changeset
|
550 |
} |
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42816
diff
changeset
|
551 |
} |
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42816
diff
changeset
|
552 |
|
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 |
* Add the list of modules. |
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42816
diff
changeset
|
555 |
* |
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42816
diff
changeset
|
556 |
* @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
|
557 |
* @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
|
558 |
*/ |
47846 | 559 |
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
|
560 |
for (ModuleElement m : mdleMap.keySet()) { |
47846 | 561 |
Content modifiers = mdleMap.get(m); |
562 |
Content moduleLink = getModuleLink(m, new StringContent(m.getQualifiedName())); |
|
563 |
Content moduleSummary = new ContentBuilder(); |
|
564 |
addSummaryComment(m, moduleSummary); |
|
565 |
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
|
566 |
} |
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42816
diff
changeset
|
567 |
} |
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42816
diff
changeset
|
568 |
|
47427 | 569 |
@Override |
42831
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42816
diff
changeset
|
570 |
public void addPackagesSummary(Content summaryContentTree) { |
48325 | 571 |
if (display(packages) |
44564 | 572 |
|| display(indirectPackages) || display(indirectOpenPackages)) { |
42831
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42816
diff
changeset
|
573 |
HtmlTree li = new HtmlTree(HtmlTag.LI); |
47846 | 574 |
li.setStyle(HtmlStyle.blockList); |
42831
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42816
diff
changeset
|
575 |
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
|
576 |
contents.navPackages, li); |
48325 | 577 |
if (display(packages)) { |
47846 | 578 |
String tableSummary = resources.getText("doclet.Member_Table_Summary", |
579 |
resources.getText("doclet.Packages_Summary"), |
|
580 |
resources.getText("doclet.packages")); |
|
42831
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42816
diff
changeset
|
581 |
addPackageSummary(tableSummary, li); |
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42816
diff
changeset
|
582 |
} |
47427 | 583 |
TableHeader indirectPackagesHeader = |
584 |
new TableHeader(contents.fromLabel, contents.packagesLabel); |
|
44564 | 585 |
if (display(indirectPackages)) { |
47846 | 586 |
String aepText = resources.getText("doclet.Indirect_Exports_Summary"); |
587 |
String aepTableSummary = resources.getText("doclet.Indirect_Packages_Table_Summary", |
|
47427 | 588 |
aepText, |
47846 | 589 |
resources.getText("doclet.modules"), |
590 |
resources.getText("doclet.packages")); |
|
591 |
Table aepTable = getTable2(new StringContent(aepText), aepTableSummary, |
|
592 |
HtmlStyle.packagesSummary, indirectPackagesHeader); |
|
593 |
addIndirectPackages(aepTable, indirectPackages); |
|
594 |
li.addContent(aepTable.toContent()); |
|
42831
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42816
diff
changeset
|
595 |
} |
44564 | 596 |
if (display(indirectOpenPackages)) { |
47846 | 597 |
String aopText = resources.getText("doclet.Indirect_Opens_Summary"); |
598 |
String aopTableSummary = resources.getText("doclet.Indirect_Packages_Table_Summary", |
|
47427 | 599 |
aopText, |
47846 | 600 |
resources.getText("doclet.modules"), |
601 |
resources.getText("doclet.packages")); |
|
602 |
Table aopTable = getTable2(new StringContent(aopText), aopTableSummary, |
|
603 |
HtmlStyle.packagesSummary, indirectPackagesHeader); |
|
604 |
addIndirectPackages(aopTable, indirectOpenPackages); |
|
605 |
li.addContent(aopTable.toContent()); |
|
42831
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42816
diff
changeset
|
606 |
} |
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42816
diff
changeset
|
607 |
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
|
608 |
summaryContentTree.addContent(ul); |
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42816
diff
changeset
|
609 |
} |
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42816
diff
changeset
|
610 |
} |
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42816
diff
changeset
|
611 |
|
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 |
* 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
|
614 |
* |
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42816
diff
changeset
|
615 |
* @param tableSummary |
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42816
diff
changeset
|
616 |
* @param li |
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 |
public void addPackageSummary(String tableSummary, HtmlTree li) { |
47846 | 619 |
Table table = new Table(configuration.htmlVersion, HtmlStyle.packagesSummary) |
620 |
.setSummary(tableSummary) |
|
621 |
.setDefaultTab(resources.getText("doclet.All_Packages")) |
|
48325 | 622 |
.addTab(resources.getText("doclet.Exported_Packages_Summary"), this::isExported) |
623 |
.addTab(resources.getText("doclet.Opened_Packages_Summary"), this::isOpened) |
|
624 |
.addTab(resources.getText("doclet.Concealed_Packages_Summary"), this::isConcealed) |
|
50167
cc705c956798
8196201: Generate pages to list all classes and all packages in javadoc output
bpatel
parents:
49551
diff
changeset
|
625 |
.setTabScript(i -> String.format("show(%d);", i)); |
42831
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42816
diff
changeset
|
626 |
|
48325 | 627 |
// Determine whether to show the "Exported To" and "Opened To" columns, |
628 |
// based on whether such columns would provide "useful" info. |
|
629 |
int numExports = 0; |
|
630 |
int numUnqualifiedExports = 0; |
|
631 |
int numOpens = 0; |
|
632 |
int numUnqualifiedOpens = 0; |
|
633 |
||
634 |
for (PackageEntry e : packages.values()) { |
|
635 |
if (e.exportedTo != null) { |
|
636 |
numExports++; |
|
637 |
if (e.exportedTo.isEmpty()) { |
|
638 |
numUnqualifiedExports++; |
|
639 |
} |
|
640 |
} |
|
641 |
if (e.openedTo != null) { |
|
642 |
numOpens++; |
|
643 |
if (e.openedTo.isEmpty()) { |
|
644 |
numUnqualifiedOpens++; |
|
645 |
} |
|
646 |
} |
|
42831
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42816
diff
changeset
|
647 |
} |
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42816
diff
changeset
|
648 |
|
48325 | 649 |
boolean showExportedTo = numExports > 0 && (numOpens > 0 || numUnqualifiedExports < packages.size()); |
650 |
boolean showOpenedTo = numOpens > 0 && (numExports > 0 || numUnqualifiedOpens < packages.size()); |
|
651 |
||
652 |
// Create the table header and column styles. |
|
653 |
List<Content> colHeaders = new ArrayList<>(); |
|
654 |
List<HtmlStyle> colStyles = new ArrayList<>(); |
|
655 |
colHeaders.add(contents.packageLabel); |
|
656 |
colStyles.add(HtmlStyle.colFirst); |
|
657 |
||
658 |
if (showExportedTo) { |
|
659 |
colHeaders.add(contents.exportedTo); |
|
660 |
colStyles.add(HtmlStyle.colSecond); |
|
661 |
} |
|
662 |
||
663 |
if (showOpenedTo) { |
|
664 |
colHeaders.add(contents.openedTo); |
|
665 |
colStyles.add(HtmlStyle.colSecond); |
|
666 |
} |
|
667 |
||
668 |
colHeaders.add(contents.descriptionLabel); |
|
669 |
colStyles.add(HtmlStyle.colLast); |
|
670 |
||
671 |
table.setHeader(new TableHeader(colHeaders).styles(colStyles)) |
|
672 |
.setColumnStyles(colStyles); |
|
673 |
||
674 |
// Add the table rows, based on the "packages" map. |
|
675 |
for (Map.Entry<PackageElement, PackageEntry> e : packages.entrySet()) { |
|
676 |
PackageElement pkg = e.getKey(); |
|
677 |
PackageEntry entry = e.getValue(); |
|
678 |
List<Content> row = new ArrayList<>(); |
|
679 |
Content pkgLinkContent = getPackageLink(pkg, new StringContent(utils.getPackageName(pkg))); |
|
680 |
row.add(pkgLinkContent); |
|
681 |
||
682 |
if (showExportedTo) { |
|
683 |
row.add(getPackageExportOpensTo(entry.exportedTo)); |
|
684 |
} |
|
685 |
if (showOpenedTo) { |
|
686 |
row.add(getPackageExportOpensTo(entry.openedTo)); |
|
687 |
} |
|
688 |
Content summary = new ContentBuilder(); |
|
689 |
addSummaryComment(pkg, summary); |
|
690 |
row.add(summary); |
|
691 |
||
692 |
table.addRow(pkg, row); |
|
693 |
} |
|
694 |
||
47846 | 695 |
li.addContent(table.toContent()); |
696 |
if (table.needsScript()) { |
|
47847 | 697 |
mainBodyScript.append(table.getScript()); |
47846 | 698 |
} |
42831
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42816
diff
changeset
|
699 |
} |
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42816
diff
changeset
|
700 |
|
48325 | 701 |
private boolean isExported(Element e) { |
702 |
PackageEntry entry = packages.get((PackageElement) e); |
|
703 |
return (entry != null) && (entry.exportedTo != null); |
|
704 |
} |
|
705 |
||
706 |
private boolean isOpened(Element e) { |
|
707 |
PackageEntry entry = packages.get((PackageElement) e); |
|
708 |
return (entry != null) && (entry.openedTo != null); |
|
709 |
} |
|
710 |
||
711 |
private boolean isConcealed(Element e) { |
|
712 |
PackageEntry entry = packages.get((PackageElement) e); |
|
713 |
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
|
714 |
} |
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42816
diff
changeset
|
715 |
|
48325 | 716 |
private Content getPackageExportOpensTo(Set<ModuleElement> modules) { |
717 |
if (modules == null) { |
|
718 |
return new StringContent(resources.getText("doclet.None")); |
|
719 |
} else if (modules.isEmpty()) { |
|
720 |
return new StringContent(resources.getText("doclet.All_Modules")); |
|
721 |
} else { |
|
722 |
Content list = new ContentBuilder(); |
|
723 |
for (ModuleElement m : modules) { |
|
724 |
if (!list.isEmpty()) { |
|
725 |
list.addContent(new StringContent(", ")); |
|
42831
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42816
diff
changeset
|
726 |
} |
48325 | 727 |
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
|
728 |
} |
48325 | 729 |
return list; |
42831
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42816
diff
changeset
|
730 |
} |
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42816
diff
changeset
|
731 |
} |
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42816
diff
changeset
|
732 |
|
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42816
diff
changeset
|
733 |
/** |
44564 | 734 |
* 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
|
735 |
* |
47846 | 736 |
* @param table the table to which the content rows will be added |
44564 | 737 |
* @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
|
738 |
*/ |
47846 | 739 |
public void addIndirectPackages(Table table, Map<ModuleElement, SortedSet<PackageElement>> ip) { |
44564 | 740 |
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
|
741 |
ModuleElement m = entry.getKey(); |
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42816
diff
changeset
|
742 |
SortedSet<PackageElement> pkgList = entry.getValue(); |
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42816
diff
changeset
|
743 |
Content moduleLinkContent = getModuleLink(m, new StringContent(m.getQualifiedName())); |
48325 | 744 |
Content list = new ContentBuilder(); |
42831
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42816
diff
changeset
|
745 |
String sep = ""; |
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42816
diff
changeset
|
746 |
for (PackageElement pkg : pkgList) { |
48325 | 747 |
list.addContent(sep); |
748 |
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
|
749 |
sep = " "; |
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42816
diff
changeset
|
750 |
} |
48325 | 751 |
table.addRow(moduleLinkContent, list); |
39670
9d1eafbf29c6
8154261: Module summary page should display directives for the module
bpatel
parents:
38911
diff
changeset
|
752 |
} |
9d1eafbf29c6
8154261: Module summary page should display directives for the module
bpatel
parents:
38911
diff
changeset
|
753 |
} |
9d1eafbf29c6
8154261: Module summary page should display directives for the module
bpatel
parents:
38911
diff
changeset
|
754 |
|
9d1eafbf29c6
8154261: Module summary page should display directives for the module
bpatel
parents:
38911
diff
changeset
|
755 |
/** |
9d1eafbf29c6
8154261: Module summary page should display directives for the module
bpatel
parents:
38911
diff
changeset
|
756 |
* {@inheritDoc} |
9d1eafbf29c6
8154261: Module summary page should display directives for the module
bpatel
parents:
38911
diff
changeset
|
757 |
*/ |
47427 | 758 |
@Override |
39670
9d1eafbf29c6
8154261: Module summary page should display directives for the module
bpatel
parents:
38911
diff
changeset
|
759 |
public void addServicesSummary(Content summaryContentTree) { |
44684
6ce4d52084e8
8178067: support for @uses/@provides tags is broken
ksrini
parents:
44564
diff
changeset
|
760 |
|
6ce4d52084e8
8178067: support for @uses/@provides tags is broken
ksrini
parents:
44564
diff
changeset
|
761 |
boolean haveUses = displayServices(uses, usesTrees); |
6ce4d52084e8
8178067: support for @uses/@provides tags is broken
ksrini
parents:
44564
diff
changeset
|
762 |
boolean haveProvides = displayServices(provides.keySet(), providesTrees); |
6ce4d52084e8
8178067: support for @uses/@provides tags is broken
ksrini
parents:
44564
diff
changeset
|
763 |
|
6ce4d52084e8
8178067: support for @uses/@provides tags is broken
ksrini
parents:
44564
diff
changeset
|
764 |
if (haveProvides || haveUses) { |
39670
9d1eafbf29c6
8154261: Module summary page should display directives for the module
bpatel
parents:
38911
diff
changeset
|
765 |
HtmlTree li = new HtmlTree(HtmlTag.LI); |
47846 | 766 |
li.setStyle(HtmlStyle.blockList); |
39670
9d1eafbf29c6
8154261: Module summary page should display directives for the module
bpatel
parents:
38911
diff
changeset
|
767 |
addSummaryHeader(HtmlConstants.START_OF_SERVICES_SUMMARY, SectionName.SERVICES, |
40303 | 768 |
contents.navServices, li); |
47427 | 769 |
TableHeader usesProvidesTableHeader = |
770 |
new TableHeader(contents.typeLabel, contents.descriptionLabel); |
|
44684
6ce4d52084e8
8178067: support for @uses/@provides tags is broken
ksrini
parents:
44564
diff
changeset
|
771 |
if (haveProvides) { |
47427 | 772 |
String label = resources.getText("doclet.Provides_Summary"); |
773 |
String tableSummary = resources.getText("doclet.Member_Table_Summary", |
|
47846 | 774 |
label, |
775 |
resources.getText("doclet.types")); |
|
776 |
Table table = getTable2(new StringContent(label), tableSummary, HtmlStyle.providesSummary, |
|
47427 | 777 |
usesProvidesTableHeader); |
47846 | 778 |
addProvidesList(table); |
779 |
if (!table.isEmpty()) { |
|
780 |
li.addContent(table.toContent()); |
|
44564 | 781 |
} |
782 |
} |
|
44684
6ce4d52084e8
8178067: support for @uses/@provides tags is broken
ksrini
parents:
44564
diff
changeset
|
783 |
if (haveUses){ |
47427 | 784 |
String label = resources.getText("doclet.Uses_Summary"); |
785 |
String tableSummary = resources.getText("doclet.Member_Table_Summary", |
|
47846 | 786 |
label, |
787 |
resources.getText("doclet.types")); |
|
788 |
Table table = getTable2(new StringContent(label), tableSummary, HtmlStyle.usesSummary, |
|
47427 | 789 |
usesProvidesTableHeader); |
47846 | 790 |
addUsesList(table); |
791 |
if (!table.isEmpty()) { |
|
792 |
li.addContent(table.toContent()); |
|
42831
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42816
diff
changeset
|
793 |
} |
39670
9d1eafbf29c6
8154261: Module summary page should display directives for the module
bpatel
parents:
38911
diff
changeset
|
794 |
} |
9d1eafbf29c6
8154261: Module summary page should display directives for the module
bpatel
parents:
38911
diff
changeset
|
795 |
HtmlTree ul = HtmlTree.UL(HtmlStyle.blockList, li); |
9d1eafbf29c6
8154261: Module summary page should display directives for the module
bpatel
parents:
38911
diff
changeset
|
796 |
summaryContentTree.addContent(ul); |
9d1eafbf29c6
8154261: Module summary page should display directives for the module
bpatel
parents:
38911
diff
changeset
|
797 |
} |
9d1eafbf29c6
8154261: Module summary page should display directives for the module
bpatel
parents:
38911
diff
changeset
|
798 |
} |
9d1eafbf29c6
8154261: Module summary page should display directives for the module
bpatel
parents:
38911
diff
changeset
|
799 |
|
9d1eafbf29c6
8154261: Module summary page should display directives for the module
bpatel
parents:
38911
diff
changeset
|
800 |
/** |
9d1eafbf29c6
8154261: Module summary page should display directives for the module
bpatel
parents:
38911
diff
changeset
|
801 |
* Add the uses list for the module. |
9d1eafbf29c6
8154261: Module summary page should display directives for the module
bpatel
parents:
38911
diff
changeset
|
802 |
* |
47846 | 803 |
* @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
|
804 |
*/ |
47846 | 805 |
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
|
806 |
Content typeLinkContent; |
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42816
diff
changeset
|
807 |
Content description; |
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42816
diff
changeset
|
808 |
for (TypeElement t : uses) { |
44684
6ce4d52084e8
8178067: support for @uses/@provides tags is broken
ksrini
parents:
44564
diff
changeset
|
809 |
if (!displayServiceDirective(t, usesTrees)) { |
42831
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42816
diff
changeset
|
810 |
continue; |
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42816
diff
changeset
|
811 |
} |
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42816
diff
changeset
|
812 |
typeLinkContent = getLink(new LinkInfoImpl(configuration, LinkInfoImpl.Kind.PACKAGE, t)); |
47846 | 813 |
Content summary = new ContentBuilder(); |
42831
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42816
diff
changeset
|
814 |
if (display(usesTrees)) { |
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42816
diff
changeset
|
815 |
description = usesTrees.get(t); |
48437
dd3b97564ed7
8192007: javadoc @uses and @provides tags in the modules documentation appears before the first-sentence summary of the service type.
bpatel
parents:
48325
diff
changeset
|
816 |
if (description != null && !description.isEmpty()) { |
dd3b97564ed7
8192007: javadoc @uses and @provides tags in the modules documentation appears before the first-sentence summary of the service type.
bpatel
parents:
48325
diff
changeset
|
817 |
summary.addContent(HtmlTree.DIV(HtmlStyle.block, description)); |
dd3b97564ed7
8192007: javadoc @uses and @provides tags in the modules documentation appears before the first-sentence summary of the service type.
bpatel
parents:
48325
diff
changeset
|
818 |
} else { |
dd3b97564ed7
8192007: javadoc @uses and @provides tags in the modules documentation appears before the first-sentence summary of the service type.
bpatel
parents:
48325
diff
changeset
|
819 |
addSummaryComment(t, summary); |
42831
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42816
diff
changeset
|
820 |
} |
48437
dd3b97564ed7
8192007: javadoc @uses and @provides tags in the modules documentation appears before the first-sentence summary of the service type.
bpatel
parents:
48325
diff
changeset
|
821 |
} else { |
dd3b97564ed7
8192007: javadoc @uses and @provides tags in the modules documentation appears before the first-sentence summary of the service type.
bpatel
parents:
48325
diff
changeset
|
822 |
summary.addContent(Contents.SPACE); |
42831
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42816
diff
changeset
|
823 |
} |
47846 | 824 |
table.addRow(typeLinkContent, summary); |
42831
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42816
diff
changeset
|
825 |
} |
39670
9d1eafbf29c6
8154261: Module summary page should display directives for the module
bpatel
parents:
38911
diff
changeset
|
826 |
} |
9d1eafbf29c6
8154261: Module summary page should display directives for the module
bpatel
parents:
38911
diff
changeset
|
827 |
|
9d1eafbf29c6
8154261: Module summary page should display directives for the module
bpatel
parents:
38911
diff
changeset
|
828 |
/** |
42831
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42816
diff
changeset
|
829 |
* Add the provides list for the module. |
39670
9d1eafbf29c6
8154261: Module summary page should display directives for the module
bpatel
parents:
38911
diff
changeset
|
830 |
* |
47846 | 831 |
* @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
|
832 |
*/ |
47846 | 833 |
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
|
834 |
SortedSet<TypeElement> implSet; |
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42816
diff
changeset
|
835 |
Content description; |
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42816
diff
changeset
|
836 |
for (Map.Entry<TypeElement, SortedSet<TypeElement>> entry : provides.entrySet()) { |
44684
6ce4d52084e8
8178067: support for @uses/@provides tags is broken
ksrini
parents:
44564
diff
changeset
|
837 |
TypeElement srv = entry.getKey(); |
6ce4d52084e8
8178067: support for @uses/@provides tags is broken
ksrini
parents:
44564
diff
changeset
|
838 |
if (!displayServiceDirective(srv, providesTrees)) { |
42831
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42816
diff
changeset
|
839 |
continue; |
44684
6ce4d52084e8
8178067: support for @uses/@provides tags is broken
ksrini
parents:
44564
diff
changeset
|
840 |
} |
42831
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42816
diff
changeset
|
841 |
implSet = entry.getValue(); |
42407
f3702cff2933
8169069: Module system implementation refresh (11/2016)
alanb
parents:
41452
diff
changeset
|
842 |
Content srvLinkContent = getLink(new LinkInfoImpl(configuration, LinkInfoImpl.Kind.PACKAGE, srv)); |
47846 | 843 |
Content desc = new ContentBuilder(); |
42831
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42816
diff
changeset
|
844 |
if (display(providesTrees)) { |
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42816
diff
changeset
|
845 |
description = providesTrees.get(srv); |
48437
dd3b97564ed7
8192007: javadoc @uses and @provides tags in the modules documentation appears before the first-sentence summary of the service type.
bpatel
parents:
48325
diff
changeset
|
846 |
desc.addContent((description != null && !description.isEmpty()) |
dd3b97564ed7
8192007: javadoc @uses and @provides tags in the modules documentation appears before the first-sentence summary of the service type.
bpatel
parents:
48325
diff
changeset
|
847 |
? HtmlTree.DIV(HtmlStyle.block, description) |
dd3b97564ed7
8192007: javadoc @uses and @provides tags in the modules documentation appears before the first-sentence summary of the service type.
bpatel
parents:
48325
diff
changeset
|
848 |
: Contents.SPACE); |
dd3b97564ed7
8192007: javadoc @uses and @provides tags in the modules documentation appears before the first-sentence summary of the service type.
bpatel
parents:
48325
diff
changeset
|
849 |
} else { |
dd3b97564ed7
8192007: javadoc @uses and @provides tags in the modules documentation appears before the first-sentence summary of the service type.
bpatel
parents:
48325
diff
changeset
|
850 |
desc.addContent(Contents.SPACE); |
42831
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42816
diff
changeset
|
851 |
} |
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42816
diff
changeset
|
852 |
// 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
|
853 |
if (moduleMode == ModuleMode.ALL && !implSet.isEmpty()) { |
47846 | 854 |
desc.addContent(new HtmlTree(HtmlTag.BR)); |
855 |
desc.addContent("("); |
|
42831
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42816
diff
changeset
|
856 |
HtmlTree implSpan = HtmlTree.SPAN(HtmlStyle.implementationLabel, contents.implementation); |
47846 | 857 |
desc.addContent(implSpan); |
858 |
desc.addContent(Contents.SPACE); |
|
42831
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42816
diff
changeset
|
859 |
String sep = ""; |
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42816
diff
changeset
|
860 |
for (TypeElement impl : implSet) { |
47846 | 861 |
desc.addContent(sep); |
862 |
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
|
863 |
sep = ", "; |
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42816
diff
changeset
|
864 |
} |
47846 | 865 |
desc.addContent(")"); |
42831
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42816
diff
changeset
|
866 |
} |
47846 | 867 |
table.addRow(srvLinkContent, desc); |
42407
f3702cff2933
8169069: Module system implementation refresh (11/2016)
alanb
parents:
41452
diff
changeset
|
868 |
} |
f3702cff2933
8169069: Module system implementation refresh (11/2016)
alanb
parents:
41452
diff
changeset
|
869 |
} |
f3702cff2933
8169069: Module system implementation refresh (11/2016)
alanb
parents:
41452
diff
changeset
|
870 |
|
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 |
* Add the module deprecation information to the documentation tree. |
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 |
* @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
|
875 |
*/ |
f3702cff2933
8169069: Module system implementation refresh (11/2016)
alanb
parents:
41452
diff
changeset
|
876 |
public void addDeprecationInfo(Content div) { |
f3702cff2933
8169069: Module system implementation refresh (11/2016)
alanb
parents:
41452
diff
changeset
|
877 |
List<? extends DocTree> deprs = utils.getBlockTags(mdle, DocTree.Kind.DEPRECATED); |
f3702cff2933
8169069: Module system implementation refresh (11/2016)
alanb
parents:
41452
diff
changeset
|
878 |
if (utils.isDeprecated(mdle)) { |
f3702cff2933
8169069: Module system implementation refresh (11/2016)
alanb
parents:
41452
diff
changeset
|
879 |
CommentHelper ch = utils.getCommentHelper(mdle); |
f3702cff2933
8169069: Module system implementation refresh (11/2016)
alanb
parents:
41452
diff
changeset
|
880 |
HtmlTree deprDiv = new HtmlTree(HtmlTag.DIV); |
47846 | 881 |
deprDiv.setStyle(HtmlStyle.deprecationBlock); |
42816
3638773ff1b0
8162674: change javadoc output text and style emitted by for-removal deprecations
bpatel
parents:
42407
diff
changeset
|
882 |
Content deprPhrase = HtmlTree.SPAN(HtmlStyle.deprecatedLabel, getDeprecatedPhrase(mdle)); |
42407
f3702cff2933
8169069: Module system implementation refresh (11/2016)
alanb
parents:
41452
diff
changeset
|
883 |
deprDiv.addContent(deprPhrase); |
f3702cff2933
8169069: Module system implementation refresh (11/2016)
alanb
parents:
41452
diff
changeset
|
884 |
if (!deprs.isEmpty()) { |
f3702cff2933
8169069: Module system implementation refresh (11/2016)
alanb
parents:
41452
diff
changeset
|
885 |
List<? extends DocTree> commentTags = ch.getDescription(configuration, deprs.get(0)); |
f3702cff2933
8169069: Module system implementation refresh (11/2016)
alanb
parents:
41452
diff
changeset
|
886 |
if (!commentTags.isEmpty()) { |
f3702cff2933
8169069: Module system implementation refresh (11/2016)
alanb
parents:
41452
diff
changeset
|
887 |
addInlineDeprecatedComment(mdle, deprs.get(0), deprDiv); |
f3702cff2933
8169069: Module system implementation refresh (11/2016)
alanb
parents:
41452
diff
changeset
|
888 |
} |
f3702cff2933
8169069: Module system implementation refresh (11/2016)
alanb
parents:
41452
diff
changeset
|
889 |
} |
f3702cff2933
8169069: Module system implementation refresh (11/2016)
alanb
parents:
41452
diff
changeset
|
890 |
div.addContent(deprDiv); |
f3702cff2933
8169069: Module system implementation refresh (11/2016)
alanb
parents:
41452
diff
changeset
|
891 |
} |
36526 | 892 |
} |
893 |
||
894 |
/** |
|
37747
878801512393
8154119: Module summary page should display module description
bpatel
parents:
36526
diff
changeset
|
895 |
* {@inheritDoc} |
878801512393
8154119: Module summary page should display module description
bpatel
parents:
36526
diff
changeset
|
896 |
*/ |
42407
f3702cff2933
8169069: Module system implementation refresh (11/2016)
alanb
parents:
41452
diff
changeset
|
897 |
@Override |
37747
878801512393
8154119: Module summary page should display module description
bpatel
parents:
36526
diff
changeset
|
898 |
public void addModuleDescription(Content moduleContentTree) { |
41452 | 899 |
if (!utils.getFullBody(mdle).isEmpty()) { |
37747
878801512393
8154119: Module summary page should display module description
bpatel
parents:
36526
diff
changeset
|
900 |
Content tree = configuration.allowTag(HtmlTag.SECTION) ? HtmlTree.SECTION() : moduleContentTree; |
42407
f3702cff2933
8169069: Module system implementation refresh (11/2016)
alanb
parents:
41452
diff
changeset
|
901 |
addDeprecationInfo(tree); |
37747
878801512393
8154119: Module summary page should display module description
bpatel
parents:
36526
diff
changeset
|
902 |
tree.addContent(HtmlConstants.START_OF_MODULE_DESCRIPTION); |
47850 | 903 |
tree.addContent(links.createAnchor(SectionName.MODULE_DESCRIPTION)); |
37747
878801512393
8154119: Module summary page should display module description
bpatel
parents:
36526
diff
changeset
|
904 |
addInlineComment(mdle, tree); |
878801512393
8154119: Module summary page should display module description
bpatel
parents:
36526
diff
changeset
|
905 |
if (configuration.allowTag(HtmlTag.SECTION)) { |
878801512393
8154119: Module summary page should display module description
bpatel
parents:
36526
diff
changeset
|
906 |
moduleContentTree.addContent(tree); |
878801512393
8154119: Module summary page should display module description
bpatel
parents:
36526
diff
changeset
|
907 |
} |
878801512393
8154119: Module summary page should display module description
bpatel
parents:
36526
diff
changeset
|
908 |
} |
878801512393
8154119: Module summary page should display module description
bpatel
parents:
36526
diff
changeset
|
909 |
} |
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 |
/** |
38911
48a00b5ee366
8156077: Support javadoc tags in module documentation
bpatel
parents:
37943
diff
changeset
|
912 |
* {@inheritDoc} |
48a00b5ee366
8156077: Support javadoc tags in module documentation
bpatel
parents:
37943
diff
changeset
|
913 |
*/ |
42407
f3702cff2933
8169069: Module system implementation refresh (11/2016)
alanb
parents:
41452
diff
changeset
|
914 |
@Override |
38911
48a00b5ee366
8156077: Support javadoc tags in module documentation
bpatel
parents:
37943
diff
changeset
|
915 |
public void addModuleTags(Content moduleContentTree) { |
48a00b5ee366
8156077: Support javadoc tags in module documentation
bpatel
parents:
37943
diff
changeset
|
916 |
Content tree = (configuration.allowTag(HtmlTag.SECTION)) |
48a00b5ee366
8156077: Support javadoc tags in module documentation
bpatel
parents:
37943
diff
changeset
|
917 |
? HtmlTree.SECTION() |
48a00b5ee366
8156077: Support javadoc tags in module documentation
bpatel
parents:
37943
diff
changeset
|
918 |
: moduleContentTree; |
48a00b5ee366
8156077: Support javadoc tags in module documentation
bpatel
parents:
37943
diff
changeset
|
919 |
addTagsInfo(mdle, tree); |
48a00b5ee366
8156077: Support javadoc tags in module documentation
bpatel
parents:
37943
diff
changeset
|
920 |
if (configuration.allowTag(HtmlTag.SECTION)) { |
48a00b5ee366
8156077: Support javadoc tags in module documentation
bpatel
parents:
37943
diff
changeset
|
921 |
moduleContentTree.addContent(tree); |
48a00b5ee366
8156077: Support javadoc tags in module documentation
bpatel
parents:
37943
diff
changeset
|
922 |
} |
48a00b5ee366
8156077: Support javadoc tags in module documentation
bpatel
parents:
37943
diff
changeset
|
923 |
} |
48a00b5ee366
8156077: Support javadoc tags in module documentation
bpatel
parents:
37943
diff
changeset
|
924 |
|
48a00b5ee366
8156077: Support javadoc tags in module documentation
bpatel
parents:
37943
diff
changeset
|
925 |
/** |
36526 | 926 |
* {@inheritDoc} |
927 |
*/ |
|
42407
f3702cff2933
8169069: Module system implementation refresh (11/2016)
alanb
parents:
41452
diff
changeset
|
928 |
@Override |
36526 | 929 |
public void addModuleContent(Content contentTree, Content moduleContentTree) { |
930 |
if (configuration.allowTag(HtmlTag.MAIN)) { |
|
931 |
mainTree.addContent(moduleContentTree); |
|
932 |
contentTree.addContent(mainTree); |
|
933 |
} else { |
|
934 |
contentTree.addContent(moduleContentTree); |
|
935 |
} |
|
936 |
} |
|
937 |
||
938 |
/** |
|
939 |
* {@inheritDoc} |
|
940 |
*/ |
|
42407
f3702cff2933
8169069: Module system implementation refresh (11/2016)
alanb
parents:
41452
diff
changeset
|
941 |
@Override |
36526 | 942 |
public void addModuleFooter(Content contentTree) { |
943 |
Content htmlTree = (configuration.allowTag(HtmlTag.FOOTER)) |
|
944 |
? HtmlTree.FOOTER() |
|
945 |
: contentTree; |
|
49551
0d4786e42471
8196200: Implement a navigation builder in javadoc
bpatel
parents:
48759
diff
changeset
|
946 |
navBar.setUserFooter(getUserHeaderFooter(false)); |
0d4786e42471
8196200: Implement a navigation builder in javadoc
bpatel
parents:
48759
diff
changeset
|
947 |
htmlTree.addContent(navBar.getContent(false)); |
36526 | 948 |
addBottom(htmlTree); |
949 |
if (configuration.allowTag(HtmlTag.FOOTER)) { |
|
950 |
contentTree.addContent(htmlTree); |
|
951 |
} |
|
952 |
} |
|
953 |
||
954 |
/** |
|
955 |
* {@inheritDoc} |
|
42831
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42816
diff
changeset
|
956 |
* |
feff6f296019
8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents:
42816
diff
changeset
|
957 |
* @throws jdk.javadoc.internal.doclets.toolkit.util.DocFileIOException |
36526 | 958 |
*/ |
40587 | 959 |
@Override |
960 |
public void printDocument(Content contentTree) throws DocFileIOException { |
|
36526 | 961 |
printHtmlDocument(configuration.metakeywords.getMetaKeywordsForModule(mdle), |
962 |
true, contentTree); |
|
963 |
} |
|
964 |
||
965 |
/** |
|
966 |
* Add the module package deprecation information to the documentation tree. |
|
967 |
* |
|
968 |
* @param li the content tree to which the deprecation information will be added |
|
969 |
* @param pkg the PackageDoc that is added |
|
970 |
*/ |
|
971 |
public void addPackageDeprecationInfo(Content li, PackageElement pkg) { |
|
972 |
List<? extends DocTree> deprs; |
|
973 |
if (utils.isDeprecated(pkg)) { |
|
974 |
deprs = utils.getDeprecatedTrees(pkg); |
|
975 |
HtmlTree deprDiv = new HtmlTree(HtmlTag.DIV); |
|
47846 | 976 |
deprDiv.setStyle(HtmlStyle.deprecationBlock); |
42816
3638773ff1b0
8162674: change javadoc output text and style emitted by for-removal deprecations
bpatel
parents:
42407
diff
changeset
|
977 |
Content deprPhrase = HtmlTree.SPAN(HtmlStyle.deprecatedLabel, getDeprecatedPhrase(pkg)); |
36526 | 978 |
deprDiv.addContent(deprPhrase); |
979 |
if (!deprs.isEmpty()) { |
|
980 |
CommentHelper ch = utils.getCommentHelper(pkg); |
|
981 |
List<? extends DocTree> commentTags = ch.getDescription(configuration, deprs.get(0)); |
|
982 |
if (!commentTags.isEmpty()) { |
|
983 |
addInlineDeprecatedComment(pkg, deprs.get(0), deprDiv); |
|
984 |
} |
|
985 |
} |
|
986 |
li.addContent(deprDiv); |
|
987 |
} |
|
988 |
} |
|
989 |
} |