author | jjg |
Wed, 07 Feb 2018 11:28:23 -0800 | |
changeset 48759 | ffa68af7da87 |
parent 48654 | 36f58bd6269f |
child 49551 | 0d4786e42471 |
permissions | -rw-r--r-- |
10 | 1 |
/* |
48654
36f58bd6269f
8195796: Reduce the size of relative URLs in generated docs
jjg
parents:
47850
diff
changeset
|
2 |
* Copyright (c) 1998, 2018, Oracle and/or its affiliates. All rights reserved. |
10 | 3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 |
* |
|
5 |
* This code is free software; you can redistribute it and/or modify it |
|
6 |
* under the terms of the GNU General Public License version 2 only, as |
|
5520 | 7 |
* published by the Free Software Foundation. Oracle designates this |
10 | 8 |
* particular file as subject to the "Classpath" exception as provided |
5520 | 9 |
* by Oracle in the LICENSE file that accompanied this code. |
10 | 10 |
* |
11 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
|
12 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
13 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
14 |
* version 2 for more details (a copy is included in the LICENSE file that |
|
15 |
* accompanied this code). |
|
16 |
* |
|
17 |
* You should have received a copy of the GNU General Public License version |
|
18 |
* 2 along with this work; if not, write to the Free Software Foundation, |
|
19 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
|
20 |
* |
|
5520 | 21 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
22 |
* or visit www.oracle.com if you need additional information or have any |
|
23 |
* questions. |
|
10 | 24 |
*/ |
25 |
||
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
29957
diff
changeset
|
26 |
package jdk.javadoc.internal.doclets.formats.html; |
10 | 27 |
|
47846 | 28 |
import jdk.javadoc.internal.doclets.formats.html.markup.Table; |
29 |
import jdk.javadoc.internal.doclets.formats.html.markup.TableHeader; |
|
30 |
||
10 | 31 |
import java.util.*; |
14258 | 32 |
|
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
29957
diff
changeset
|
33 |
import javax.lang.model.element.PackageElement; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
29957
diff
changeset
|
34 |
import javax.lang.model.element.TypeElement; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
29957
diff
changeset
|
35 |
|
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
29957
diff
changeset
|
36 |
import jdk.javadoc.internal.doclets.formats.html.markup.ContentBuilder; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
29957
diff
changeset
|
37 |
import jdk.javadoc.internal.doclets.formats.html.markup.HtmlConstants; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
29957
diff
changeset
|
38 |
import jdk.javadoc.internal.doclets.formats.html.markup.HtmlStyle; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
29957
diff
changeset
|
39 |
import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTag; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
29957
diff
changeset
|
40 |
import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTree; |
47850 | 41 |
import jdk.javadoc.internal.doclets.formats.html.markup.Links; |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
29957
diff
changeset
|
42 |
import jdk.javadoc.internal.doclets.formats.html.markup.StringContent; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
29957
diff
changeset
|
43 |
import jdk.javadoc.internal.doclets.toolkit.Content; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
29957
diff
changeset
|
44 |
import jdk.javadoc.internal.doclets.toolkit.util.ClassUseMapper; |
40587 | 45 |
import jdk.javadoc.internal.doclets.toolkit.util.DocFileIOException; |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
29957
diff
changeset
|
46 |
import jdk.javadoc.internal.doclets.toolkit.util.DocPath; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
29957
diff
changeset
|
47 |
import jdk.javadoc.internal.doclets.toolkit.util.DocPaths; |
10 | 48 |
|
49 |
/** |
|
50 |
* Generate package usage information. |
|
51 |
* |
|
14260
727a84636f12
8000665: fix "internal API" comments on javadoc files
jjg
parents:
14258
diff
changeset
|
52 |
* <p><b>This is NOT part of any supported API. |
727a84636f12
8000665: fix "internal API" comments on javadoc files
jjg
parents:
14258
diff
changeset
|
53 |
* If you write code that depends on this, you do so at your own risk. |
727a84636f12
8000665: fix "internal API" comments on javadoc files
jjg
parents:
14258
diff
changeset
|
54 |
* This code and its internal interfaces are subject to change or |
727a84636f12
8000665: fix "internal API" comments on javadoc files
jjg
parents:
14258
diff
changeset
|
55 |
* deletion without notice.</b> |
727a84636f12
8000665: fix "internal API" comments on javadoc files
jjg
parents:
14258
diff
changeset
|
56 |
* |
10 | 57 |
* @author Robert G. Field |
2320
5b8c377175f4
6786688: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - Table must have captions and headers
bpatel
parents:
1789
diff
changeset
|
58 |
* @author Bhavesh Patel (Modified) |
10 | 59 |
*/ |
60 |
public class PackageUseWriter extends SubWriterHolderWriter { |
|
61 |
||
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
29957
diff
changeset
|
62 |
final PackageElement packageElement; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
29957
diff
changeset
|
63 |
final SortedMap<String, Set<TypeElement>> usingPackageToUsedClasses = new TreeMap<>(); |
29957
7740f9657f56
8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents:
26900
diff
changeset
|
64 |
protected HtmlTree mainTree = HtmlTree.MAIN(); |
47427 | 65 |
final String packageUseTableSummary; |
10 | 66 |
|
67 |
/** |
|
68 |
* Constructor. |
|
69 |
* |
|
47427 | 70 |
* @param configuration the configuration |
71 |
* @param mapper a mapper to provide details of where elements are used |
|
72 |
* @param filename the file to be generated |
|
73 |
* @param pkgElement the package element to be documented |
|
10 | 74 |
*/ |
45417 | 75 |
public PackageUseWriter(HtmlConfiguration configuration, |
14357
faf9cde2817b
8000741: refactor javadoc to use abstraction to handle relative paths
jjg
parents:
14260
diff
changeset
|
76 |
ClassUseMapper mapper, DocPath filename, |
40587 | 77 |
PackageElement pkgElement) { |
48759
ffa68af7da87
8195795: Organize output files by module/package, not just package
jjg
parents:
48654
diff
changeset
|
78 |
super(configuration, configuration.docPaths.forPackage(pkgElement).resolve(filename)); |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
29957
diff
changeset
|
79 |
this.packageElement = pkgElement; |
10 | 80 |
|
81 |
// by examining all classes in this package, find what packages |
|
82 |
// use these classes - produce a map between using package and |
|
83 |
// used classes. |
|
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
29957
diff
changeset
|
84 |
for (TypeElement usedClass : utils.getEnclosedTypeElements(pkgElement)) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
29957
diff
changeset
|
85 |
Set<TypeElement> usingClasses = mapper.classToClass.get(usedClass); |
10 | 86 |
if (usingClasses != null) { |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
29957
diff
changeset
|
87 |
for (TypeElement usingClass : usingClasses) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
29957
diff
changeset
|
88 |
PackageElement usingPackage = utils.containingPackage(usingClass); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
29957
diff
changeset
|
89 |
Set<TypeElement> usedClasses = usingPackageToUsedClasses |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
29957
diff
changeset
|
90 |
.get(utils.getPackageName(usingPackage)); |
10 | 91 |
if (usedClasses == null) { |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
29957
diff
changeset
|
92 |
usedClasses = new TreeSet<>(utils.makeGeneralPurposeComparator()); |
25454
376a52c9540c
8039028: [javadoc] refactor the usage of Util.java
ksrini
parents:
24221
diff
changeset
|
93 |
usingPackageToUsedClasses.put(utils.getPackageName(usingPackage), |
10 | 94 |
usedClasses); |
95 |
} |
|
96 |
usedClasses.add(usedClass); |
|
97 |
} |
|
98 |
} |
|
99 |
} |
|
47427 | 100 |
|
101 |
packageUseTableSummary = resources.getText("doclet.Use_Table_Summary", |
|
102 |
resources.getText("doclet.packages")); |
|
10 | 103 |
} |
104 |
||
105 |
/** |
|
106 |
* Generate a class page. |
|
107 |
* |
|
108 |
* @param configuration the current configuration of the doclet. |
|
109 |
* @param mapper the mapping of the class usage. |
|
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
29957
diff
changeset
|
110 |
* @param pkgElement the package being documented. |
40587 | 111 |
* @throws DocFileIOException if there is a problem generating the package use page |
10 | 112 |
*/ |
45417 | 113 |
public static void generate(HtmlConfiguration configuration, |
40587 | 114 |
ClassUseMapper mapper, PackageElement pkgElement) |
115 |
throws DocFileIOException { |
|
14357
faf9cde2817b
8000741: refactor javadoc to use abstraction to handle relative paths
jjg
parents:
14260
diff
changeset
|
116 |
DocPath filename = DocPaths.PACKAGE_USE; |
40587 | 117 |
PackageUseWriter pkgusegen = new PackageUseWriter(configuration, mapper, filename, pkgElement); |
118 |
pkgusegen.generatePackageUseFile(); |
|
10 | 119 |
} |
120 |
||
121 |
/** |
|
7614
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
122 |
* Generate the package use list. |
40587 | 123 |
* @throws DocFileIOException if there is a problem generating the package use page |
10 | 124 |
*/ |
40587 | 125 |
protected void generatePackageUseFile() throws DocFileIOException { |
29957
7740f9657f56
8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents:
26900
diff
changeset
|
126 |
HtmlTree body = getPackageUseHeader(); |
7614
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
127 |
HtmlTree div = new HtmlTree(HtmlTag.DIV); |
47846 | 128 |
div.setStyle(HtmlStyle.contentContainer); |
10 | 129 |
if (usingPackageToUsedClasses.isEmpty()) { |
40303 | 130 |
div.addContent(contents.getContent("doclet.ClassUse_No.usage.of.0", utils.getPackageName(packageElement))); |
10 | 131 |
} else { |
7614
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
132 |
addPackageUse(div); |
10 | 133 |
} |
29957
7740f9657f56
8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents:
26900
diff
changeset
|
134 |
if (configuration.allowTag(HtmlTag.MAIN)) { |
7740f9657f56
8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents:
26900
diff
changeset
|
135 |
mainTree.addContent(div); |
7740f9657f56
8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents:
26900
diff
changeset
|
136 |
body.addContent(mainTree); |
7740f9657f56
8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents:
26900
diff
changeset
|
137 |
} else { |
7740f9657f56
8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents:
26900
diff
changeset
|
138 |
body.addContent(div); |
7740f9657f56
8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents:
26900
diff
changeset
|
139 |
} |
7740f9657f56
8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents:
26900
diff
changeset
|
140 |
HtmlTree tree = (configuration.allowTag(HtmlTag.FOOTER)) |
7740f9657f56
8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents:
26900
diff
changeset
|
141 |
? HtmlTree.FOOTER() |
7740f9657f56
8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents:
26900
diff
changeset
|
142 |
: body; |
7740f9657f56
8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents:
26900
diff
changeset
|
143 |
addNavLinks(false, tree); |
7740f9657f56
8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents:
26900
diff
changeset
|
144 |
addBottom(tree); |
7740f9657f56
8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents:
26900
diff
changeset
|
145 |
if (configuration.allowTag(HtmlTag.FOOTER)) { |
7740f9657f56
8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents:
26900
diff
changeset
|
146 |
body.addContent(tree); |
7740f9657f56
8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents:
26900
diff
changeset
|
147 |
} |
7614
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
148 |
printHtmlDocument(null, true, body); |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
149 |
} |
10 | 150 |
|
7614
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
151 |
/** |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
152 |
* Add the package use information. |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
153 |
* |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
154 |
* @param contentTree the content tree to which the package use information will be added |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
155 |
*/ |
40587 | 156 |
protected void addPackageUse(Content contentTree) { |
7614
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
157 |
HtmlTree ul = new HtmlTree(HtmlTag.UL); |
47846 | 158 |
ul.setStyle(HtmlStyle.blockList); |
24221
2376793dd33b
8038583: [javadoc] Refactor uses of arrays to Collections
ksrini
parents:
22163
diff
changeset
|
159 |
if (configuration.packages.size() > 1) { |
7614
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
160 |
addPackageList(ul); |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
161 |
} |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
162 |
addClassList(ul); |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
163 |
contentTree.addContent(ul); |
10 | 164 |
} |
165 |
||
166 |
/** |
|
7614
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
167 |
* Add the list of packages that use the given package. |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
168 |
* |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
169 |
* @param contentTree the content tree to which the package list will be added |
10 | 170 |
*/ |
40587 | 171 |
protected void addPackageList(Content contentTree) { |
47846 | 172 |
Content caption = contents.getContent( |
7614
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
173 |
"doclet.ClassUse_Packages.that.use.0", |
47846 | 174 |
getPackageLink(packageElement, utils.getPackageName(packageElement))); |
175 |
Table table = new Table(configuration.htmlVersion, HtmlStyle.useSummary) |
|
176 |
.setSummary(packageUseTableSummary) |
|
177 |
.setCaption(caption) |
|
178 |
.setHeader(getPackageTableHeader()) |
|
179 |
.setColumnStyles(HtmlStyle.colFirst, HtmlStyle.colLast); |
|
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
29957
diff
changeset
|
180 |
for (String pkgname: usingPackageToUsedClasses.keySet()) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
29957
diff
changeset
|
181 |
PackageElement pkg = utils.elementUtils.getPackageElement(pkgname); |
47850 | 182 |
Content packageLink = links.createLink(utils.getPackageName(pkg), |
47846 | 183 |
new StringContent(utils.getPackageName(pkg))); |
184 |
Content summary = new ContentBuilder(); |
|
185 |
if (pkg != null && !pkg.isUnnamed()) { |
|
186 |
addSummaryComment(pkg, summary); |
|
187 |
} else { |
|
188 |
summary.addContent(Contents.SPACE); |
|
189 |
} |
|
190 |
table.addRow(packageLink, summary); |
|
10 | 191 |
} |
47846 | 192 |
Content li = HtmlTree.LI(HtmlStyle.blockList, table.toContent()); |
7614
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
193 |
contentTree.addContent(li); |
10 | 194 |
} |
195 |
||
7614
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
196 |
/** |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
197 |
* Add the list of classes that use the given package. |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
198 |
* |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
199 |
* @param contentTree the content tree to which the class list will be added |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
200 |
*/ |
40587 | 201 |
protected void addClassList(Content contentTree) { |
47427 | 202 |
TableHeader classTableHeader = new TableHeader( |
203 |
contents.classLabel, contents.descriptionLabel); |
|
22159
682da512ec17
8030253: Update langtools to use strings-in-switch
briangoetz
parents:
20613
diff
changeset
|
204 |
for (String packageName : usingPackageToUsedClasses.keySet()) { |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
29957
diff
changeset
|
205 |
PackageElement usingPackage = utils.elementUtils.getPackageElement(packageName); |
7614
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
206 |
HtmlTree li = new HtmlTree(HtmlTag.LI); |
47846 | 207 |
li.setStyle(HtmlStyle.blockList); |
10 | 208 |
if (usingPackage != null) { |
47850 | 209 |
li.addContent(links.createAnchor(utils.getPackageName(usingPackage))); |
10 | 210 |
} |
47846 | 211 |
String tableSummary = resources.getText("doclet.Use_Table_Summary", |
212 |
resources.getText("doclet.classes")); |
|
213 |
Content caption = contents.getContent( |
|
29957
7740f9657f56
8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents:
26900
diff
changeset
|
214 |
"doclet.ClassUse_Classes.in.0.used.by.1", |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
29957
diff
changeset
|
215 |
getPackageLink(packageElement, utils.getPackageName(packageElement)), |
47846 | 216 |
getPackageLink(usingPackage, utils.getPackageName(usingPackage))); |
217 |
Table table = new Table(configuration.htmlVersion, HtmlStyle.useSummary) |
|
218 |
.setSummary(tableSummary) |
|
219 |
.setCaption(caption) |
|
220 |
.setHeader(classTableHeader) |
|
221 |
.setColumnStyles(HtmlStyle.colFirst, HtmlStyle.colLast); |
|
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
29957
diff
changeset
|
222 |
for (TypeElement te : usingPackageToUsedClasses.get(packageName)) { |
47846 | 223 |
DocPath dp = pathString(te, |
48759
ffa68af7da87
8195795: Organize output files by module/package, not just package
jjg
parents:
48654
diff
changeset
|
224 |
DocPaths.CLASS_USE.resolve(docPaths.forName(te))); |
47846 | 225 |
Content stringContent = new StringContent(utils.getSimpleName(te)); |
48654
36f58bd6269f
8195796: Reduce the size of relative URLs in generated docs
jjg
parents:
47850
diff
changeset
|
226 |
Content typeContent = links.createLink(dp.fragment(getPackageAnchorName(usingPackage)), |
47846 | 227 |
stringContent); |
228 |
Content summary = new ContentBuilder(); |
|
229 |
addIndexComment(te, summary); |
|
230 |
||
231 |
table.addRow(typeContent, summary); |
|
10 | 232 |
} |
47846 | 233 |
li.addContent(table.toContent()); |
7614
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
234 |
contentTree.addContent(li); |
10 | 235 |
} |
236 |
} |
|
237 |
||
7614
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
238 |
/** |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
239 |
* Get the header for the package use listing. |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
240 |
* |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
241 |
* @return a content tree representing the package use header |
10 | 242 |
*/ |
47846 | 243 |
private HtmlTree getPackageUseHeader() { |
244 |
String packageText = resources.getText("doclet.Package"); |
|
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
29957
diff
changeset
|
245 |
String name = packageElement.isUnnamed() ? "" : utils.getPackageName(packageElement); |
47846 | 246 |
String title = resources.getText("doclet.Window_ClassUse_Header", packageText, name); |
29957
7740f9657f56
8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents:
26900
diff
changeset
|
247 |
HtmlTree bodyTree = getBody(true, getWindowTitle(title)); |
7740f9657f56
8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents:
26900
diff
changeset
|
248 |
HtmlTree htmlTree = (configuration.allowTag(HtmlTag.HEADER)) |
7740f9657f56
8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents:
26900
diff
changeset
|
249 |
? HtmlTree.HEADER() |
7740f9657f56
8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents:
26900
diff
changeset
|
250 |
: bodyTree; |
7740f9657f56
8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents:
26900
diff
changeset
|
251 |
addTop(htmlTree); |
7740f9657f56
8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents:
26900
diff
changeset
|
252 |
addNavLinks(true, htmlTree); |
7740f9657f56
8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents:
26900
diff
changeset
|
253 |
if (configuration.allowTag(HtmlTag.HEADER)) { |
7740f9657f56
8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents:
26900
diff
changeset
|
254 |
bodyTree.addContent(htmlTree); |
7740f9657f56
8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents:
26900
diff
changeset
|
255 |
} |
17562
c84f1d7fa11d
8011662: Remove single instance of resource with HTML from doclet resource bundle
jjg
parents:
17559
diff
changeset
|
256 |
ContentBuilder headContent = new ContentBuilder(); |
40303 | 257 |
headContent.addContent(contents.getContent("doclet.ClassUse_Title", packageText)); |
17562
c84f1d7fa11d
8011662: Remove single instance of resource with HTML from doclet resource bundle
jjg
parents:
17559
diff
changeset
|
258 |
headContent.addContent(new HtmlTree(HtmlTag.BR)); |
c84f1d7fa11d
8011662: Remove single instance of resource with HTML from doclet resource bundle
jjg
parents:
17559
diff
changeset
|
259 |
headContent.addContent(name); |
7614
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
260 |
Content heading = HtmlTree.HEADING(HtmlConstants.TITLE_HEADING, true, |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
261 |
HtmlStyle.title, headContent); |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
262 |
Content div = HtmlTree.DIV(HtmlStyle.header, heading); |
29957
7740f9657f56
8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents:
26900
diff
changeset
|
263 |
if (configuration.allowTag(HtmlTag.MAIN)) { |
7740f9657f56
8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents:
26900
diff
changeset
|
264 |
mainTree.addContent(div); |
7740f9657f56
8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents:
26900
diff
changeset
|
265 |
} else { |
7740f9657f56
8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents:
26900
diff
changeset
|
266 |
bodyTree.addContent(div); |
7740f9657f56
8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents:
26900
diff
changeset
|
267 |
} |
7614
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
268 |
return bodyTree; |
10 | 269 |
} |
270 |
||
271 |
/** |
|
37943
2efb75c09230
8154262: Navigation bar in javadoc generated pages needs to be updated to display module information
bpatel
parents:
35426
diff
changeset
|
272 |
* Get the module link. |
2efb75c09230
8154262: Navigation bar in javadoc generated pages needs to be updated to display module information
bpatel
parents:
35426
diff
changeset
|
273 |
* |
2efb75c09230
8154262: Navigation bar in javadoc generated pages needs to be updated to display module information
bpatel
parents:
35426
diff
changeset
|
274 |
* @return a content tree for the module link |
2efb75c09230
8154262: Navigation bar in javadoc generated pages needs to be updated to display module information
bpatel
parents:
35426
diff
changeset
|
275 |
*/ |
2efb75c09230
8154262: Navigation bar in javadoc generated pages needs to be updated to display module information
bpatel
parents:
35426
diff
changeset
|
276 |
@Override |
2efb75c09230
8154262: Navigation bar in javadoc generated pages needs to be updated to display module information
bpatel
parents:
35426
diff
changeset
|
277 |
protected Content getNavLinkModule() { |
2efb75c09230
8154262: Navigation bar in javadoc generated pages needs to be updated to display module information
bpatel
parents:
35426
diff
changeset
|
278 |
Content linkContent = getModuleLink(utils.elementUtils.getModuleOf(packageElement), |
40303 | 279 |
contents.moduleLabel); |
37943
2efb75c09230
8154262: Navigation bar in javadoc generated pages needs to be updated to display module information
bpatel
parents:
35426
diff
changeset
|
280 |
Content li = HtmlTree.LI(linkContent); |
2efb75c09230
8154262: Navigation bar in javadoc generated pages needs to be updated to display module information
bpatel
parents:
35426
diff
changeset
|
281 |
return li; |
2efb75c09230
8154262: Navigation bar in javadoc generated pages needs to be updated to display module information
bpatel
parents:
35426
diff
changeset
|
282 |
} |
2efb75c09230
8154262: Navigation bar in javadoc generated pages needs to be updated to display module information
bpatel
parents:
35426
diff
changeset
|
283 |
|
2efb75c09230
8154262: Navigation bar in javadoc generated pages needs to be updated to display module information
bpatel
parents:
35426
diff
changeset
|
284 |
/** |
7614
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
285 |
* Get this package link. |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
286 |
* |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
287 |
* @return a content tree for the package link |
10 | 288 |
*/ |
40587 | 289 |
@Override |
7614
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
290 |
protected Content getNavLinkPackage() { |
48654
36f58bd6269f
8195796: Reduce the size of relative URLs in generated docs
jjg
parents:
47850
diff
changeset
|
291 |
Content linkContent = links.createLink(DocPaths.PACKAGE_SUMMARY, |
40303 | 292 |
contents.packageLabel); |
7614
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
293 |
Content li = HtmlTree.LI(linkContent); |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
294 |
return li; |
10 | 295 |
} |
296 |
||
7614
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
297 |
/** |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
298 |
* Get the use link. |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
299 |
* |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
300 |
* @return a content tree for the use link |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
301 |
*/ |
40587 | 302 |
@Override |
7614
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
303 |
protected Content getNavLinkClassUse() { |
40303 | 304 |
Content li = HtmlTree.LI(HtmlStyle.navBarCell1Rev, contents.useLabel); |
7614
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
305 |
return li; |
10 | 306 |
} |
307 |
||
7614
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
308 |
/** |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
309 |
* Get the tree link. |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
310 |
* |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
311 |
* @return a content tree for the tree link |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
312 |
*/ |
40587 | 313 |
@Override |
7614
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
314 |
protected Content getNavLinkTree() { |
48654
36f58bd6269f
8195796: Reduce the size of relative URLs in generated docs
jjg
parents:
47850
diff
changeset
|
315 |
Content linkContent = links.createLink(DocPaths.PACKAGE_TREE, |
40303 | 316 |
contents.treeLabel); |
7614
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
317 |
Content li = HtmlTree.LI(linkContent); |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
318 |
return li; |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
319 |
} |
10 | 320 |
} |