author | pmuthuswamy |
Mon, 20 May 2019 14:42:32 +0530 | |
changeset 54936 | 8c63164bd540 |
parent 54060 | 53a95878619f |
child 59294 | 48b88b9c11eb |
permissions | -rw-r--r-- |
36526 | 1 |
/* |
54060
53a95878619f
8220202: Simplify/standardize method naming for HtmlTree
jjg
parents:
48029
diff
changeset
|
2 |
* Copyright (c) 2013, 2019, 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.toolkit.builders; |
|
27 |
||
28 |
import javax.lang.model.element.ModuleElement; |
|
29 |
||
30 |
import jdk.javadoc.internal.doclets.toolkit.Content; |
|
54936 | 31 |
import jdk.javadoc.internal.doclets.toolkit.DocFilesHandler; |
40587 | 32 |
import jdk.javadoc.internal.doclets.toolkit.DocletException; |
36526 | 33 |
import jdk.javadoc.internal.doclets.toolkit.ModuleSummaryWriter; |
34 |
||
35 |
||
36 |
/** |
|
37 |
* Builds the summary for a given module. |
|
38 |
* |
|
39 |
* <p><b>This is NOT part of any supported API. |
|
40 |
* If you write code that depends on this, you do so at your own risk. |
|
41 |
* This code and its internal interfaces are subject to change or |
|
42 |
* deletion without notice.</b> |
|
43 |
* |
|
44 |
* @author Bhavesh Patel |
|
45 |
*/ |
|
46 |
public class ModuleSummaryBuilder extends AbstractBuilder { |
|
47 |
||
48 |
/** |
|
49 |
* The module being documented. |
|
50 |
*/ |
|
51 |
private final ModuleElement mdle; |
|
52 |
||
53 |
/** |
|
54 |
* The doclet specific writer that will output the result. |
|
55 |
*/ |
|
56 |
private final ModuleSummaryWriter moduleWriter; |
|
57 |
||
58 |
/** |
|
59 |
* The content that will be added to the module summary documentation tree. |
|
60 |
*/ |
|
61 |
private Content contentTree; |
|
62 |
||
63 |
/** |
|
64 |
* Construct a new ModuleSummaryBuilder. |
|
65 |
* |
|
66 |
* @param context the build context. |
|
67 |
* @param mdle the module being documented. |
|
68 |
* @param moduleWriter the doclet specific writer that will output the |
|
69 |
* result. |
|
70 |
*/ |
|
71 |
private ModuleSummaryBuilder(Context context, |
|
72 |
ModuleElement mdle, ModuleSummaryWriter moduleWriter) { |
|
73 |
super(context); |
|
74 |
this.mdle = mdle; |
|
75 |
this.moduleWriter = moduleWriter; |
|
76 |
} |
|
77 |
||
78 |
/** |
|
79 |
* Construct a new ModuleSummaryBuilder. |
|
80 |
* |
|
81 |
* @param context the build context. |
|
82 |
* @param mdle the module being documented. |
|
83 |
* @param moduleWriter the doclet specific writer that will output the |
|
84 |
* result. |
|
85 |
* |
|
86 |
* @return an instance of a ModuleSummaryBuilder. |
|
87 |
*/ |
|
88 |
public static ModuleSummaryBuilder getInstance(Context context, |
|
89 |
ModuleElement mdle, ModuleSummaryWriter moduleWriter) { |
|
90 |
return new ModuleSummaryBuilder(context, mdle, moduleWriter); |
|
91 |
} |
|
92 |
||
93 |
/** |
|
94 |
* Build the module summary. |
|
40587 | 95 |
* |
96 |
* @throws DocletException if there is a problem while building the documentation |
|
36526 | 97 |
*/ |
40587 | 98 |
@Override |
99 |
public void build() throws DocletException { |
|
36526 | 100 |
if (moduleWriter == null) { |
101 |
//Doclet does not support this output. |
|
102 |
return; |
|
103 |
} |
|
45599 | 104 |
buildModuleDoc(contentTree); |
36526 | 105 |
} |
106 |
||
107 |
/** |
|
108 |
* Build the module documentation. |
|
109 |
* |
|
110 |
* @param contentTree the content tree to which the documentation will be added |
|
40587 | 111 |
* @throws DocletException if there is a problem while building the documentation |
36526 | 112 |
*/ |
45599 | 113 |
protected void buildModuleDoc(Content contentTree) throws DocletException { |
45771
e447c20c3ff9
8182736: javadoc generates bad names and broken module graph links
jjg
parents:
40605
diff
changeset
|
114 |
contentTree = moduleWriter.getModuleHeader(mdle.getQualifiedName().toString()); |
45599 | 115 |
|
116 |
buildContent(contentTree); |
|
117 |
||
36526 | 118 |
moduleWriter.addModuleFooter(contentTree); |
119 |
moduleWriter.printDocument(contentTree); |
|
54936 | 120 |
DocFilesHandler docFilesHandler = configuration.getWriterFactory().getDocFilesHandler(mdle); |
121 |
docFilesHandler.copyDocFiles(); |
|
36526 | 122 |
} |
123 |
||
124 |
/** |
|
125 |
* Build the content for the module doc. |
|
126 |
* |
|
127 |
* @param contentTree the content tree to which the module contents |
|
128 |
* will be added |
|
40587 | 129 |
* @throws DocletException if there is a problem while building the documentation |
36526 | 130 |
*/ |
45599 | 131 |
protected void buildContent(Content contentTree) throws DocletException { |
36526 | 132 |
Content moduleContentTree = moduleWriter.getContentHeader(); |
45599 | 133 |
|
134 |
buildModuleDescription(moduleContentTree); |
|
135 |
buildModuleTags(moduleContentTree); |
|
136 |
buildSummary(moduleContentTree); |
|
137 |
||
36526 | 138 |
moduleWriter.addModuleContent(contentTree, moduleContentTree); |
139 |
} |
|
140 |
||
141 |
/** |
|
142 |
* Build the module summary. |
|
143 |
* |
|
144 |
* @param moduleContentTree the module content tree to which the summaries will |
|
145 |
* be added |
|
40587 | 146 |
* @throws DocletException if there is a problem while building the documentation |
36526 | 147 |
*/ |
45599 | 148 |
protected void buildSummary(Content moduleContentTree) throws DocletException { |
36526 | 149 |
Content summaryContentTree = moduleWriter.getSummaryHeader(); |
45599 | 150 |
|
151 |
buildPackagesSummary(summaryContentTree); |
|
152 |
buildModulesSummary(summaryContentTree); |
|
153 |
buildServicesSummary(summaryContentTree); |
|
154 |
||
54060
53a95878619f
8220202: Simplify/standardize method naming for HtmlTree
jjg
parents:
48029
diff
changeset
|
155 |
moduleContentTree.add(moduleWriter.getSummaryTree(summaryContentTree)); |
36526 | 156 |
} |
157 |
||
158 |
/** |
|
39670
9d1eafbf29c6
8154261: Module summary page should display directives for the module
bpatel
parents:
38911
diff
changeset
|
159 |
* Build the modules summary. |
36526 | 160 |
* |
161 |
* @param summaryContentTree the content tree to which the summaries will |
|
162 |
* be added |
|
163 |
*/ |
|
45599 | 164 |
protected void buildModulesSummary(Content summaryContentTree) { |
39670
9d1eafbf29c6
8154261: Module summary page should display directives for the module
bpatel
parents:
38911
diff
changeset
|
165 |
moduleWriter.addModulesSummary(summaryContentTree); |
9d1eafbf29c6
8154261: Module summary page should display directives for the module
bpatel
parents:
38911
diff
changeset
|
166 |
} |
9d1eafbf29c6
8154261: Module summary page should display directives for the module
bpatel
parents:
38911
diff
changeset
|
167 |
|
9d1eafbf29c6
8154261: Module summary page should display directives for the module
bpatel
parents:
38911
diff
changeset
|
168 |
/** |
9d1eafbf29c6
8154261: Module summary page should display directives for the module
bpatel
parents:
38911
diff
changeset
|
169 |
* Build the package summary. |
9d1eafbf29c6
8154261: Module summary page should display directives for the module
bpatel
parents:
38911
diff
changeset
|
170 |
* |
9d1eafbf29c6
8154261: Module summary page should display directives for the module
bpatel
parents:
38911
diff
changeset
|
171 |
* @param summaryContentTree the content tree to which the summaries will be added |
9d1eafbf29c6
8154261: Module summary page should display directives for the module
bpatel
parents:
38911
diff
changeset
|
172 |
*/ |
45599 | 173 |
protected void buildPackagesSummary(Content summaryContentTree) { |
39670
9d1eafbf29c6
8154261: Module summary page should display directives for the module
bpatel
parents:
38911
diff
changeset
|
174 |
moduleWriter.addPackagesSummary(summaryContentTree); |
45599 | 175 |
} |
39670
9d1eafbf29c6
8154261: Module summary page should display directives for the module
bpatel
parents:
38911
diff
changeset
|
176 |
|
9d1eafbf29c6
8154261: Module summary page should display directives for the module
bpatel
parents:
38911
diff
changeset
|
177 |
/** |
9d1eafbf29c6
8154261: Module summary page should display directives for the module
bpatel
parents:
38911
diff
changeset
|
178 |
* Build the services summary. |
9d1eafbf29c6
8154261: Module summary page should display directives for the module
bpatel
parents:
38911
diff
changeset
|
179 |
* |
9d1eafbf29c6
8154261: Module summary page should display directives for the module
bpatel
parents:
38911
diff
changeset
|
180 |
* @param summaryContentTree the content tree to which the summaries will be added |
9d1eafbf29c6
8154261: Module summary page should display directives for the module
bpatel
parents:
38911
diff
changeset
|
181 |
*/ |
45599 | 182 |
protected void buildServicesSummary(Content summaryContentTree) { |
39670
9d1eafbf29c6
8154261: Module summary page should display directives for the module
bpatel
parents:
38911
diff
changeset
|
183 |
moduleWriter.addServicesSummary(summaryContentTree); |
36526 | 184 |
} |
37747
878801512393
8154119: Module summary page should display module description
bpatel
parents:
36526
diff
changeset
|
185 |
|
878801512393
8154119: Module summary page should display module description
bpatel
parents:
36526
diff
changeset
|
186 |
/** |
878801512393
8154119: Module summary page should display module description
bpatel
parents:
36526
diff
changeset
|
187 |
* Build the description for the module. |
878801512393
8154119: Module summary page should display module description
bpatel
parents:
36526
diff
changeset
|
188 |
* |
878801512393
8154119: Module summary page should display module description
bpatel
parents:
36526
diff
changeset
|
189 |
* @param moduleContentTree the tree to which the module description will |
878801512393
8154119: Module summary page should display module description
bpatel
parents:
36526
diff
changeset
|
190 |
* be added |
878801512393
8154119: Module summary page should display module description
bpatel
parents:
36526
diff
changeset
|
191 |
*/ |
45599 | 192 |
protected void buildModuleDescription(Content moduleContentTree) { |
37747
878801512393
8154119: Module summary page should display module description
bpatel
parents:
36526
diff
changeset
|
193 |
if (!configuration.nocomment) { |
878801512393
8154119: Module summary page should display module description
bpatel
parents:
36526
diff
changeset
|
194 |
moduleWriter.addModuleDescription(moduleContentTree); |
878801512393
8154119: Module summary page should display module description
bpatel
parents:
36526
diff
changeset
|
195 |
} |
878801512393
8154119: Module summary page should display module description
bpatel
parents:
36526
diff
changeset
|
196 |
} |
38911
48a00b5ee366
8156077: Support javadoc tags in module documentation
bpatel
parents:
37747
diff
changeset
|
197 |
|
48a00b5ee366
8156077: Support javadoc tags in module documentation
bpatel
parents:
37747
diff
changeset
|
198 |
/** |
48a00b5ee366
8156077: Support javadoc tags in module documentation
bpatel
parents:
37747
diff
changeset
|
199 |
* Build the tags of the summary. |
48a00b5ee366
8156077: Support javadoc tags in module documentation
bpatel
parents:
37747
diff
changeset
|
200 |
* |
48a00b5ee366
8156077: Support javadoc tags in module documentation
bpatel
parents:
37747
diff
changeset
|
201 |
* @param moduleContentTree the tree to which the module tags will be added |
48a00b5ee366
8156077: Support javadoc tags in module documentation
bpatel
parents:
37747
diff
changeset
|
202 |
*/ |
45599 | 203 |
protected void buildModuleTags(Content moduleContentTree) { |
38911
48a00b5ee366
8156077: Support javadoc tags in module documentation
bpatel
parents:
37747
diff
changeset
|
204 |
if (!configuration.nocomment) { |
48a00b5ee366
8156077: Support javadoc tags in module documentation
bpatel
parents:
37747
diff
changeset
|
205 |
moduleWriter.addModuleTags(moduleContentTree); |
48a00b5ee366
8156077: Support javadoc tags in module documentation
bpatel
parents:
37747
diff
changeset
|
206 |
} |
48a00b5ee366
8156077: Support javadoc tags in module documentation
bpatel
parents:
37747
diff
changeset
|
207 |
} |
36526 | 208 |
} |