author | bpatel |
Thu, 17 May 2018 12:59:53 -0700 | |
changeset 50167 | cc705c956798 |
parent 49551 | 0d4786e42471 |
child 53562 | 0d9dee001667 |
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) 1997, 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 |
||
7614
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
31 |
import java.util.*; |
14258 | 32 |
|
36526 | 33 |
import javax.lang.model.element.ModuleElement; |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
29957
diff
changeset
|
34 |
import javax.lang.model.element.PackageElement; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
29957
diff
changeset
|
35 |
import javax.lang.model.element.TypeElement; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
29957
diff
changeset
|
36 |
|
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
29957
diff
changeset
|
37 |
import com.sun.source.doctree.DocTree; |
47846 | 38 |
import jdk.javadoc.internal.doclets.formats.html.markup.ContentBuilder; |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
29957
diff
changeset
|
39 |
import jdk.javadoc.internal.doclets.formats.html.markup.HtmlConstants; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
29957
diff
changeset
|
40 |
import jdk.javadoc.internal.doclets.formats.html.markup.HtmlStyle; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
29957
diff
changeset
|
41 |
import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTag; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
29957
diff
changeset
|
42 |
import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTree; |
49551
0d4786e42471
8196200: Implement a navigation builder in javadoc
bpatel
parents:
48759
diff
changeset
|
43 |
import jdk.javadoc.internal.doclets.formats.html.markup.Navigation; |
0d4786e42471
8196200: Implement a navigation builder in javadoc
bpatel
parents:
48759
diff
changeset
|
44 |
import jdk.javadoc.internal.doclets.formats.html.markup.Navigation.PageMode; |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
29957
diff
changeset
|
45 |
import jdk.javadoc.internal.doclets.formats.html.markup.StringContent; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
29957
diff
changeset
|
46 |
import jdk.javadoc.internal.doclets.toolkit.Content; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
29957
diff
changeset
|
47 |
import jdk.javadoc.internal.doclets.toolkit.PackageSummaryWriter; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
29957
diff
changeset
|
48 |
import jdk.javadoc.internal.doclets.toolkit.util.CommentHelper; |
40587 | 49 |
import jdk.javadoc.internal.doclets.toolkit.util.DocFileIOException; |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
29957
diff
changeset
|
50 |
import jdk.javadoc.internal.doclets.toolkit.util.DocPaths; |
10 | 51 |
|
52 |
/** |
|
53 |
* Class to generate file for each package contents in the right-hand |
|
54 |
* frame. This will list all the Class Kinds in the package. A click on any |
|
55 |
* class-kind will update the frame with the clicked class-kind page. |
|
56 |
* |
|
14260
727a84636f12
8000665: fix "internal API" comments on javadoc files
jjg
parents:
14258
diff
changeset
|
57 |
* <p><b>This is NOT part of any supported API. |
727a84636f12
8000665: fix "internal API" comments on javadoc files
jjg
parents:
14258
diff
changeset
|
58 |
* 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
|
59 |
* 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
|
60 |
* deletion without notice.</b> |
727a84636f12
8000665: fix "internal API" comments on javadoc files
jjg
parents:
14258
diff
changeset
|
61 |
* |
10 | 62 |
* @author Atul M Dambalkar |
2320
5b8c377175f4
6786688: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - Table must have captions and headers
bpatel
parents:
1787
diff
changeset
|
63 |
* @author Bhavesh Patel (Modified) |
10 | 64 |
*/ |
65 |
public class PackageWriterImpl extends HtmlDocletWriter |
|
66 |
implements PackageSummaryWriter { |
|
67 |
||
68 |
/** |
|
69 |
* The package being documented. |
|
70 |
*/ |
|
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
29957
diff
changeset
|
71 |
protected PackageElement packageElement; |
10 | 72 |
|
73 |
/** |
|
29957
7740f9657f56
8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents:
26664
diff
changeset
|
74 |
* The HTML tree for main tag. |
7740f9657f56
8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents:
26664
diff
changeset
|
75 |
*/ |
7740f9657f56
8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents:
26664
diff
changeset
|
76 |
protected HtmlTree mainTree = HtmlTree.MAIN(); |
7740f9657f56
8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents:
26664
diff
changeset
|
77 |
|
7740f9657f56
8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents:
26664
diff
changeset
|
78 |
/** |
7740f9657f56
8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents:
26664
diff
changeset
|
79 |
* The HTML tree for section tag. |
7740f9657f56
8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents:
26664
diff
changeset
|
80 |
*/ |
7740f9657f56
8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents:
26664
diff
changeset
|
81 |
protected HtmlTree sectionTree = HtmlTree.SECTION(); |
7740f9657f56
8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents:
26664
diff
changeset
|
82 |
|
49551
0d4786e42471
8196200: Implement a navigation builder in javadoc
bpatel
parents:
48759
diff
changeset
|
83 |
private final Navigation navBar; |
0d4786e42471
8196200: Implement a navigation builder in javadoc
bpatel
parents:
48759
diff
changeset
|
84 |
|
29957
7740f9657f56
8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents:
26664
diff
changeset
|
85 |
/** |
10 | 86 |
* Constructor to construct PackageWriter object and to generate |
87 |
* "package-summary.html" file in the respective package directory. |
|
88 |
* For example for package "java.lang" this will generate file |
|
89 |
* "package-summary.html" file in the "java/lang" directory. It will also |
|
90 |
* create "java/lang" directory in the current or the destination directory |
|
14357
faf9cde2817b
8000741: refactor javadoc to use abstraction to handle relative paths
jjg
parents:
14265
diff
changeset
|
91 |
* if it doesn't exist. |
10 | 92 |
* |
93 |
* @param configuration the configuration of the doclet. |
|
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
29957
diff
changeset
|
94 |
* @param packageElement PackageElement under consideration. |
10 | 95 |
*/ |
48756
ce608a09a666
8196027: Remove "Prev" and "Next" links from the javadoc navigation
bpatel
parents:
48654
diff
changeset
|
96 |
public PackageWriterImpl(HtmlConfiguration configuration, PackageElement packageElement) { |
48759
ffa68af7da87
8195795: Organize output files by module/package, not just package
jjg
parents:
48756
diff
changeset
|
97 |
super(configuration, |
ffa68af7da87
8195795: Organize output files by module/package, not just package
jjg
parents:
48756
diff
changeset
|
98 |
configuration.docPaths.forPackage(packageElement) |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
29957
diff
changeset
|
99 |
.resolve(DocPaths.PACKAGE_SUMMARY)); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
29957
diff
changeset
|
100 |
this.packageElement = packageElement; |
49551
0d4786e42471
8196200: Implement a navigation builder in javadoc
bpatel
parents:
48759
diff
changeset
|
101 |
this.navBar = new Navigation(packageElement, configuration, fixedNavDiv, PageMode.PACKAGE, path); |
10 | 102 |
} |
103 |
||
104 |
/** |
|
105 |
* {@inheritDoc} |
|
106 |
*/ |
|
40587 | 107 |
@Override |
7614
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
108 |
public Content getPackageHeader(String heading) { |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
29957
diff
changeset
|
109 |
HtmlTree bodyTree = getBody(true, getWindowTitle(utils.getPackageName(packageElement))); |
29957
7740f9657f56
8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents:
26664
diff
changeset
|
110 |
HtmlTree htmlTree = (configuration.allowTag(HtmlTag.HEADER)) |
7740f9657f56
8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents:
26664
diff
changeset
|
111 |
? HtmlTree.HEADER() |
7740f9657f56
8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents:
26664
diff
changeset
|
112 |
: bodyTree; |
7740f9657f56
8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents:
26664
diff
changeset
|
113 |
addTop(htmlTree); |
49551
0d4786e42471
8196200: Implement a navigation builder in javadoc
bpatel
parents:
48759
diff
changeset
|
114 |
Content linkContent = getModuleLink(utils.elementUtils.getModuleOf(packageElement), |
0d4786e42471
8196200: Implement a navigation builder in javadoc
bpatel
parents:
48759
diff
changeset
|
115 |
contents.moduleLabel); |
0d4786e42471
8196200: Implement a navigation builder in javadoc
bpatel
parents:
48759
diff
changeset
|
116 |
navBar.setNavLinkModule(linkContent); |
0d4786e42471
8196200: Implement a navigation builder in javadoc
bpatel
parents:
48759
diff
changeset
|
117 |
navBar.setUserHeader(getUserHeaderFooter(true)); |
0d4786e42471
8196200: Implement a navigation builder in javadoc
bpatel
parents:
48759
diff
changeset
|
118 |
htmlTree.addContent(navBar.getContent(true)); |
29957
7740f9657f56
8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents:
26664
diff
changeset
|
119 |
if (configuration.allowTag(HtmlTag.HEADER)) { |
7740f9657f56
8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents:
26664
diff
changeset
|
120 |
bodyTree.addContent(htmlTree); |
7740f9657f56
8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents:
26664
diff
changeset
|
121 |
} |
7614
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
122 |
HtmlTree div = new HtmlTree(HtmlTag.DIV); |
47846 | 123 |
div.setStyle(HtmlStyle.header); |
40503
cb34fd6e8071
8135291: [javadoc] broken link in Package com.sun.tools.jconsole
bpatel
parents:
40303
diff
changeset
|
124 |
if (configuration.showModules) { |
42824 | 125 |
ModuleElement mdle = configuration.docEnv.getElementUtils().getModuleOf(packageElement); |
44196
f88c0e9cb102
8174974: Annotation type pages generated by javadoc is missing module information
bpatel
parents:
42824
diff
changeset
|
126 |
Content classModuleLabel = HtmlTree.SPAN(HtmlStyle.moduleLabelInPackage, contents.moduleLabel); |
36526 | 127 |
Content moduleNameDiv = HtmlTree.DIV(HtmlStyle.subTitle, classModuleLabel); |
40303 | 128 |
moduleNameDiv.addContent(Contents.SPACE); |
36526 | 129 |
moduleNameDiv.addContent(getModuleLink(mdle, |
130 |
new StringContent(mdle.getQualifiedName().toString()))); |
|
131 |
div.addContent(moduleNameDiv); |
|
132 |
} |
|
7614
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
133 |
Content annotationContent = new HtmlTree(HtmlTag.P); |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
29957
diff
changeset
|
134 |
addAnnotationInfo(packageElement, annotationContent); |
7614
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
135 |
div.addContent(annotationContent); |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
136 |
Content tHeading = HtmlTree.HEADING(HtmlConstants.TITLE_HEADING, true, |
40303 | 137 |
HtmlStyle.title, contents.packageLabel); |
138 |
tHeading.addContent(Contents.SPACE); |
|
17569 | 139 |
Content packageHead = new StringContent(heading); |
7614
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
140 |
tHeading.addContent(packageHead); |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
141 |
div.addContent(tHeading); |
29957
7740f9657f56
8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents:
26664
diff
changeset
|
142 |
if (configuration.allowTag(HtmlTag.MAIN)) { |
7740f9657f56
8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents:
26664
diff
changeset
|
143 |
mainTree.addContent(div); |
7740f9657f56
8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents:
26664
diff
changeset
|
144 |
} else { |
7740f9657f56
8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents:
26664
diff
changeset
|
145 |
bodyTree.addContent(div); |
7740f9657f56
8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents:
26664
diff
changeset
|
146 |
} |
7614
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
147 |
return bodyTree; |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
148 |
} |
10 | 149 |
|
150 |
/** |
|
151 |
* {@inheritDoc} |
|
152 |
*/ |
|
40587 | 153 |
@Override |
7614
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
154 |
public Content getContentHeader() { |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
155 |
HtmlTree div = new HtmlTree(HtmlTag.DIV); |
47846 | 156 |
div.setStyle(HtmlStyle.contentContainer); |
7614
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
157 |
return div; |
10 | 158 |
} |
159 |
||
160 |
/** |
|
9606
e5a619cb5dd3
6492694: @deprecated tag doesn't work in package-info files.
bpatel
parents:
9068
diff
changeset
|
161 |
* Add the package deprecation information to the documentation tree. |
e5a619cb5dd3
6492694: @deprecated tag doesn't work in package-info files.
bpatel
parents:
9068
diff
changeset
|
162 |
* |
e5a619cb5dd3
6492694: @deprecated tag doesn't work in package-info files.
bpatel
parents:
9068
diff
changeset
|
163 |
* @param div the content tree to which the deprecation information will be added |
e5a619cb5dd3
6492694: @deprecated tag doesn't work in package-info files.
bpatel
parents:
9068
diff
changeset
|
164 |
*/ |
e5a619cb5dd3
6492694: @deprecated tag doesn't work in package-info files.
bpatel
parents:
9068
diff
changeset
|
165 |
public void addDeprecationInfo(Content div) { |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
29957
diff
changeset
|
166 |
List<? extends DocTree> deprs = utils.getBlockTags(packageElement, DocTree.Kind.DEPRECATED); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
29957
diff
changeset
|
167 |
if (utils.isDeprecated(packageElement)) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
29957
diff
changeset
|
168 |
CommentHelper ch = utils.getCommentHelper(packageElement); |
9606
e5a619cb5dd3
6492694: @deprecated tag doesn't work in package-info files.
bpatel
parents:
9068
diff
changeset
|
169 |
HtmlTree deprDiv = new HtmlTree(HtmlTag.DIV); |
47846 | 170 |
deprDiv.setStyle(HtmlStyle.deprecationBlock); |
42816
3638773ff1b0
8162674: change javadoc output text and style emitted by for-removal deprecations
bpatel
parents:
41453
diff
changeset
|
171 |
Content deprPhrase = HtmlTree.SPAN(HtmlStyle.deprecatedLabel, getDeprecatedPhrase(packageElement)); |
9606
e5a619cb5dd3
6492694: @deprecated tag doesn't work in package-info files.
bpatel
parents:
9068
diff
changeset
|
172 |
deprDiv.addContent(deprPhrase); |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
29957
diff
changeset
|
173 |
if (!deprs.isEmpty()) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
29957
diff
changeset
|
174 |
List<? extends DocTree> commentTags = ch.getDescription(configuration, deprs.get(0)); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
29957
diff
changeset
|
175 |
if (!commentTags.isEmpty()) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
29957
diff
changeset
|
176 |
addInlineDeprecatedComment(packageElement, deprs.get(0), deprDiv); |
9606
e5a619cb5dd3
6492694: @deprecated tag doesn't work in package-info files.
bpatel
parents:
9068
diff
changeset
|
177 |
} |
e5a619cb5dd3
6492694: @deprecated tag doesn't work in package-info files.
bpatel
parents:
9068
diff
changeset
|
178 |
} |
e5a619cb5dd3
6492694: @deprecated tag doesn't work in package-info files.
bpatel
parents:
9068
diff
changeset
|
179 |
div.addContent(deprDiv); |
e5a619cb5dd3
6492694: @deprecated tag doesn't work in package-info files.
bpatel
parents:
9068
diff
changeset
|
180 |
} |
e5a619cb5dd3
6492694: @deprecated tag doesn't work in package-info files.
bpatel
parents:
9068
diff
changeset
|
181 |
} |
e5a619cb5dd3
6492694: @deprecated tag doesn't work in package-info files.
bpatel
parents:
9068
diff
changeset
|
182 |
|
e5a619cb5dd3
6492694: @deprecated tag doesn't work in package-info files.
bpatel
parents:
9068
diff
changeset
|
183 |
/** |
10 | 184 |
* {@inheritDoc} |
185 |
*/ |
|
40587 | 186 |
@Override |
7614
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
187 |
public Content getSummaryHeader() { |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
188 |
HtmlTree ul = new HtmlTree(HtmlTag.UL); |
47846 | 189 |
ul.setStyle(HtmlStyle.blockList); |
7614
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
190 |
return ul; |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
191 |
} |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
192 |
|
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
193 |
/** |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
194 |
* {@inheritDoc} |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
195 |
*/ |
40587 | 196 |
@Override |
47427 | 197 |
public void addInterfaceSummary(SortedSet<TypeElement> interfaces, Content summaryContentTree) { |
198 |
TableHeader tableHeader= new TableHeader(contents.interfaceLabel, contents.descriptionLabel); |
|
50167
cc705c956798
8196201: Generate pages to list all classes and all packages in javadoc output
bpatel
parents:
49551
diff
changeset
|
199 |
addClassesSummary(interfaces, resources.interfaceSummary, resources.interfaceTableSummary, |
cc705c956798
8196201: Generate pages to list all classes and all packages in javadoc output
bpatel
parents:
49551
diff
changeset
|
200 |
tableHeader, summaryContentTree); |
47427 | 201 |
} |
202 |
||
203 |
/** |
|
204 |
* {@inheritDoc} |
|
205 |
*/ |
|
206 |
@Override |
|
207 |
public void addClassSummary(SortedSet<TypeElement> classes, Content summaryContentTree) { |
|
208 |
TableHeader tableHeader= new TableHeader(contents.classLabel, contents.descriptionLabel); |
|
50167
cc705c956798
8196201: Generate pages to list all classes and all packages in javadoc output
bpatel
parents:
49551
diff
changeset
|
209 |
addClassesSummary(classes, resources.classSummary, resources.classTableSummary, |
cc705c956798
8196201: Generate pages to list all classes and all packages in javadoc output
bpatel
parents:
49551
diff
changeset
|
210 |
tableHeader, summaryContentTree); |
47427 | 211 |
} |
212 |
||
213 |
/** |
|
214 |
* {@inheritDoc} |
|
215 |
*/ |
|
216 |
@Override |
|
217 |
public void addEnumSummary(SortedSet<TypeElement> enums, Content summaryContentTree) { |
|
218 |
TableHeader tableHeader= new TableHeader(contents.enum_, contents.descriptionLabel); |
|
50167
cc705c956798
8196201: Generate pages to list all classes and all packages in javadoc output
bpatel
parents:
49551
diff
changeset
|
219 |
addClassesSummary(enums, resources.enumSummary, resources.enumTableSummary, |
cc705c956798
8196201: Generate pages to list all classes and all packages in javadoc output
bpatel
parents:
49551
diff
changeset
|
220 |
tableHeader, summaryContentTree); |
47427 | 221 |
} |
222 |
||
223 |
/** |
|
224 |
* {@inheritDoc} |
|
225 |
*/ |
|
226 |
@Override |
|
227 |
public void addExceptionSummary(SortedSet<TypeElement> exceptions, Content summaryContentTree) { |
|
228 |
TableHeader tableHeader= new TableHeader(contents.exception, contents.descriptionLabel); |
|
50167
cc705c956798
8196201: Generate pages to list all classes and all packages in javadoc output
bpatel
parents:
49551
diff
changeset
|
229 |
addClassesSummary(exceptions, resources.exceptionSummary, resources.exceptionTableSummary, |
cc705c956798
8196201: Generate pages to list all classes and all packages in javadoc output
bpatel
parents:
49551
diff
changeset
|
230 |
tableHeader, summaryContentTree); |
47427 | 231 |
} |
232 |
||
233 |
/** |
|
234 |
* {@inheritDoc} |
|
235 |
*/ |
|
236 |
@Override |
|
237 |
public void addErrorSummary(SortedSet<TypeElement> errors, Content summaryContentTree) { |
|
238 |
TableHeader tableHeader= new TableHeader(contents.error, contents.descriptionLabel); |
|
50167
cc705c956798
8196201: Generate pages to list all classes and all packages in javadoc output
bpatel
parents:
49551
diff
changeset
|
239 |
addClassesSummary(errors, resources.errorSummary, resources.errorTableSummary, |
cc705c956798
8196201: Generate pages to list all classes and all packages in javadoc output
bpatel
parents:
49551
diff
changeset
|
240 |
tableHeader, summaryContentTree); |
47427 | 241 |
} |
242 |
||
243 |
/** |
|
244 |
* {@inheritDoc} |
|
245 |
*/ |
|
246 |
@Override |
|
247 |
public void addAnnotationTypeSummary(SortedSet<TypeElement> annoTypes, Content summaryContentTree) { |
|
248 |
TableHeader tableHeader= new TableHeader(contents.annotationType, contents.descriptionLabel); |
|
50167
cc705c956798
8196201: Generate pages to list all classes and all packages in javadoc output
bpatel
parents:
49551
diff
changeset
|
249 |
addClassesSummary(annoTypes, resources.annotationTypeSummary, resources.annotationTypeTableSummary, |
cc705c956798
8196201: Generate pages to list all classes and all packages in javadoc output
bpatel
parents:
49551
diff
changeset
|
250 |
tableHeader, summaryContentTree); |
47427 | 251 |
} |
252 |
||
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
29957
diff
changeset
|
253 |
public void addClassesSummary(SortedSet<TypeElement> classes, String label, |
47427 | 254 |
String tableSummary, TableHeader tableHeader, Content summaryContentTree) { |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
29957
diff
changeset
|
255 |
if(!classes.isEmpty()) { |
47846 | 256 |
Table table = new Table(configuration.htmlVersion, HtmlStyle.typeSummary) |
257 |
.setSummary(tableSummary) |
|
258 |
.setCaption(getTableCaption(new StringContent(label))) |
|
259 |
.setHeader(tableHeader) |
|
260 |
.setColumnStyles(HtmlStyle.colFirst, HtmlStyle.colLast); |
|
261 |
||
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
29957
diff
changeset
|
262 |
for (TypeElement klass : classes) { |
47846 | 263 |
if (!utils.isCoreClass(klass) || !configuration.isGeneratedDoc(klass)) { |
7614
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
264 |
continue; |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
265 |
} |
47846 | 266 |
Content classLink = getLink(new LinkInfoImpl( |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
29957
diff
changeset
|
267 |
configuration, LinkInfoImpl.Kind.PACKAGE, klass)); |
47846 | 268 |
ContentBuilder description = new ContentBuilder(); |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
29957
diff
changeset
|
269 |
if (utils.isDeprecated(klass)) { |
47846 | 270 |
description.addContent(getDeprecatedPhrase(klass)); |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
29957
diff
changeset
|
271 |
List<? extends DocTree> tags = utils.getDeprecatedTrees(klass); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
29957
diff
changeset
|
272 |
if (!tags.isEmpty()) { |
47846 | 273 |
addSummaryDeprecatedComment(klass, tags.get(0), description); |
7614
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
274 |
} |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
29957
diff
changeset
|
275 |
} else { |
47846 | 276 |
addSummaryComment(klass, description); |
7614
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
277 |
} |
47846 | 278 |
table.addRow(classLink, description); |
7614
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
279 |
} |
47846 | 280 |
Content li = HtmlTree.LI(HtmlStyle.blockList, table.toContent()); |
7614
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
281 |
summaryContentTree.addContent(li); |
10 | 282 |
} |
283 |
} |
|
284 |
||
285 |
/** |
|
286 |
* {@inheritDoc} |
|
287 |
*/ |
|
40587 | 288 |
@Override |
7614
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
289 |
public void addPackageDescription(Content packageContentTree) { |
41453
5429549751ad
4649116: Add option to include full package description at top, before interface table
bpatel
parents:
41452
diff
changeset
|
290 |
if (!utils.getBody(packageElement).isEmpty()) { |
5429549751ad
4649116: Add option to include full package description at top, before interface table
bpatel
parents:
41452
diff
changeset
|
291 |
Content tree = configuration.allowTag(HtmlTag.SECTION) ? sectionTree : packageContentTree; |
47850 | 292 |
tree.addContent(links.createAnchor(SectionName.PACKAGE_DESCRIPTION)); |
41453
5429549751ad
4649116: Add option to include full package description at top, before interface table
bpatel
parents:
41452
diff
changeset
|
293 |
addDeprecationInfo(tree); |
5429549751ad
4649116: Add option to include full package description at top, before interface table
bpatel
parents:
41452
diff
changeset
|
294 |
addInlineComment(packageElement, tree); |
10 | 295 |
} |
296 |
} |
|
297 |
||
298 |
/** |
|
299 |
* {@inheritDoc} |
|
300 |
*/ |
|
40587 | 301 |
@Override |
7614
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
302 |
public void addPackageTags(Content packageContentTree) { |
29957
7740f9657f56
8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents:
26664
diff
changeset
|
303 |
Content htmlTree = (configuration.allowTag(HtmlTag.SECTION)) |
7740f9657f56
8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents:
26664
diff
changeset
|
304 |
? sectionTree |
7740f9657f56
8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents:
26664
diff
changeset
|
305 |
: packageContentTree; |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
29957
diff
changeset
|
306 |
addTagsInfo(packageElement, htmlTree); |
41453
5429549751ad
4649116: Add option to include full package description at top, before interface table
bpatel
parents:
41452
diff
changeset
|
307 |
if (configuration.allowTag(HtmlTag.SECTION)) { |
5429549751ad
4649116: Add option to include full package description at top, before interface table
bpatel
parents:
41452
diff
changeset
|
308 |
packageContentTree.addContent(sectionTree); |
5429549751ad
4649116: Add option to include full package description at top, before interface table
bpatel
parents:
41452
diff
changeset
|
309 |
} |
29957
7740f9657f56
8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents:
26664
diff
changeset
|
310 |
} |
7740f9657f56
8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents:
26664
diff
changeset
|
311 |
|
7740f9657f56
8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents:
26664
diff
changeset
|
312 |
/** |
7740f9657f56
8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents:
26664
diff
changeset
|
313 |
* {@inheritDoc} |
7740f9657f56
8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents:
26664
diff
changeset
|
314 |
*/ |
40587 | 315 |
@Override |
29957
7740f9657f56
8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents:
26664
diff
changeset
|
316 |
public void addPackageContent(Content contentTree, Content packageContentTree) { |
7740f9657f56
8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents:
26664
diff
changeset
|
317 |
if (configuration.allowTag(HtmlTag.MAIN)) { |
7740f9657f56
8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents:
26664
diff
changeset
|
318 |
mainTree.addContent(packageContentTree); |
7740f9657f56
8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents:
26664
diff
changeset
|
319 |
contentTree.addContent(mainTree); |
7740f9657f56
8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents:
26664
diff
changeset
|
320 |
} else { |
7740f9657f56
8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents:
26664
diff
changeset
|
321 |
contentTree.addContent(packageContentTree); |
7740f9657f56
8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents:
26664
diff
changeset
|
322 |
} |
7614
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
323 |
} |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
324 |
|
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
325 |
/** |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
326 |
* {@inheritDoc} |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
327 |
*/ |
40587 | 328 |
@Override |
7614
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
329 |
public void addPackageFooter(Content contentTree) { |
29957
7740f9657f56
8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents:
26664
diff
changeset
|
330 |
Content htmlTree = (configuration.allowTag(HtmlTag.FOOTER)) |
7740f9657f56
8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents:
26664
diff
changeset
|
331 |
? HtmlTree.FOOTER() |
7740f9657f56
8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents:
26664
diff
changeset
|
332 |
: contentTree; |
49551
0d4786e42471
8196200: Implement a navigation builder in javadoc
bpatel
parents:
48759
diff
changeset
|
333 |
navBar.setUserFooter(getUserHeaderFooter(false)); |
0d4786e42471
8196200: Implement a navigation builder in javadoc
bpatel
parents:
48759
diff
changeset
|
334 |
htmlTree.addContent(navBar.getContent(false)); |
29957
7740f9657f56
8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents:
26664
diff
changeset
|
335 |
addBottom(htmlTree); |
7740f9657f56
8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents:
26664
diff
changeset
|
336 |
if (configuration.allowTag(HtmlTag.FOOTER)) { |
7740f9657f56
8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents:
26664
diff
changeset
|
337 |
contentTree.addContent(htmlTree); |
7740f9657f56
8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents:
26664
diff
changeset
|
338 |
} |
7614
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
339 |
} |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
340 |
|
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
341 |
/** |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
342 |
* {@inheritDoc} |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
343 |
*/ |
40587 | 344 |
@Override |
345 |
public void printDocument(Content contentTree) throws DocFileIOException { |
|
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
29957
diff
changeset
|
346 |
printHtmlDocument(configuration.metakeywords.getMetaKeywords(packageElement), |
7614
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
347 |
true, contentTree); |
10 | 348 |
} |
349 |
} |