125 } |
141 } |
126 return bodyTree; |
142 return bodyTree; |
127 } |
143 } |
128 |
144 |
129 /** |
145 /** |
130 * {@inheritDoc} |
146 * Get the content header. |
131 */ |
147 */ |
132 public Content getContentHeader() { |
148 public Content getContentHeader() { |
133 HtmlTree div = new HtmlTree(HtmlTag.DIV); |
149 HtmlTree div = new HtmlTree(HtmlTag.DIV); |
134 div.addStyle(HtmlStyle.contentContainer); |
150 div.addStyle(HtmlStyle.contentContainer); |
135 return div; |
151 return div; |
136 } |
152 } |
137 |
153 |
138 /** |
154 /** |
139 * {@inheritDoc} |
155 * Get the summary section header. |
140 */ |
156 */ |
141 public Content getSummaryHeader() { |
157 public Content getSummaryHeader() { |
142 HtmlTree li = new HtmlTree(HtmlTag.LI); |
158 HtmlTree li = new HtmlTree(HtmlTag.LI); |
143 li.addStyle(HtmlStyle.blockList); |
159 li.addStyle(HtmlStyle.blockList); |
144 return li; |
160 return li; |
145 } |
161 } |
146 |
162 |
147 /** |
163 /** |
148 * {@inheritDoc} |
164 * Get the summary tree. |
|
165 * |
|
166 * @param summaryContentTree the content tree to be added to the summary tree. |
149 */ |
167 */ |
150 public Content getSummaryTree(Content summaryContentTree) { |
168 public Content getSummaryTree(Content summaryContentTree) { |
151 HtmlTree ul = HtmlTree.UL(HtmlStyle.blockList, summaryContentTree); |
169 HtmlTree ul = HtmlTree.UL(HtmlStyle.blockList, summaryContentTree); |
152 return ul; |
170 return ul; |
153 } |
171 } |
154 |
172 |
155 /** |
173 /** |
156 * {@inheritDoc} |
174 * Generate the directive map for the directives on the module. |
157 */ |
175 */ |
158 public void addPackagesSummary(Set<PackageElement> packages, String text, |
176 public void generateDirectiveMap() { |
159 String tableSummary, Content summaryContentTree) { |
177 for (ModuleElement.Directive d : mdle.getDirectives()) { |
|
178 if (directiveMap.containsKey(d.getKind())) { |
|
179 List<ModuleElement.Directive> dir = directiveMap.get(d.getKind()); |
|
180 dir.add(d); |
|
181 directiveMap.put(d.getKind(), dir); |
|
182 } else { |
|
183 List<ModuleElement.Directive> dir = new ArrayList<>(); |
|
184 dir.add(d); |
|
185 directiveMap.put(d.getKind(), dir); |
|
186 } |
|
187 } |
|
188 } |
|
189 |
|
190 /** |
|
191 * Add the summary header. |
|
192 * |
|
193 * @param startMarker the marker comment |
|
194 * @param markerAnchor the marker anchor for the section |
|
195 * @param heading the heading for the section |
|
196 * @param htmltree the content tree to which the information is added |
|
197 */ |
|
198 public void addSummaryHeader(Content startMarker, SectionName markerAnchor, Content heading, Content htmltree) { |
|
199 htmltree.addContent(startMarker); |
|
200 htmltree.addContent(getMarkerAnchor(markerAnchor)); |
|
201 htmltree.addContent(HtmlTree.HEADING(HtmlTag.H3, heading)); |
|
202 } |
|
203 |
|
204 /** |
|
205 * Add the summary for the module. |
|
206 * |
|
207 * @param text the table caption |
|
208 * @param tableSummary the summary for the table |
|
209 * @param htmltree the content tree to which the table will be added |
|
210 * @param tableStyle the table style |
|
211 * @param tableHeader the table header |
|
212 * @param dirs the list of module directives |
|
213 */ |
|
214 public void addSummary(String text, String tableSummary, Content htmltree, HtmlStyle tableStyle, |
|
215 List<String> tableHeader, List<ModuleElement.Directive> dirs) { |
160 Content table = (configuration.isOutputHtml5()) |
216 Content table = (configuration.isOutputHtml5()) |
161 ? HtmlTree.TABLE(HtmlStyle.overviewSummary, getTableCaption(new RawHtml(text))) |
217 ? HtmlTree.TABLE(tableStyle, getTableCaption(new RawHtml(text))) |
162 : HtmlTree.TABLE(HtmlStyle.overviewSummary, tableSummary, getTableCaption(new RawHtml(text))); |
218 : HtmlTree.TABLE(tableStyle, tableSummary, getTableCaption(new RawHtml(text))); |
163 table.addContent(getSummaryTableHeader(packageTableHeader, "col")); |
219 table.addContent(getSummaryTableHeader(tableHeader, "col")); |
164 Content tbody = new HtmlTree(HtmlTag.TBODY); |
220 Content tbody = new HtmlTree(HtmlTag.TBODY); |
165 addPackagesList(packages, tbody); |
221 addList(dirs, tbody); |
166 table.addContent(tbody); |
222 table.addContent(tbody); |
167 summaryContentTree.addContent(table); |
223 htmltree.addContent(table); |
|
224 } |
|
225 |
|
226 /** |
|
227 * Add the list of directives for the module. |
|
228 * |
|
229 * @param dirs the list of module directives |
|
230 * @params tbody the content tree to which the list is added |
|
231 */ |
|
232 public void addList(List<ModuleElement.Directive> dirs, Content tbody) { |
|
233 boolean altColor = true; |
|
234 for (ModuleElement.Directive direct : dirs) { |
|
235 DirectiveKind kind = direct.getKind(); |
|
236 switch (kind) { |
|
237 case REQUIRES: |
|
238 addRequiresList((ModuleElement.RequiresDirective) direct, tbody, altColor); |
|
239 break; |
|
240 case EXPORTS: |
|
241 addExportedPackagesList((ModuleElement.ExportsDirective) direct, tbody, altColor); |
|
242 break; |
|
243 case USES: |
|
244 addUsesList((ModuleElement.UsesDirective) direct, tbody, altColor); |
|
245 break; |
|
246 case PROVIDES: |
|
247 addProvidesList((ModuleElement.ProvidesDirective) direct, tbody, altColor); |
|
248 break; |
|
249 default: |
|
250 throw new AssertionError("unknown directive kind: " + kind); |
|
251 } |
|
252 altColor = !altColor; |
|
253 } |
|
254 } |
|
255 |
|
256 /** |
|
257 * {@inheritDoc} |
|
258 */ |
|
259 public void addModulesSummary(Content summaryContentTree) { |
|
260 List<ModuleElement.Directive> dirs = directiveMap.get(DirectiveKind.REQUIRES); |
|
261 if (dirs != null && !dirs.isEmpty()) { |
|
262 HtmlTree li = new HtmlTree(HtmlTag.LI); |
|
263 li.addStyle(HtmlStyle.blockList); |
|
264 addSummaryHeader(HtmlConstants.START_OF_MODULES_SUMMARY, SectionName.MODULES, |
|
265 getResource("doclet.navModules"), li); |
|
266 String text = configuration.getText("doclet.Requires_Summary"); |
|
267 String tableSummary = configuration.getText("doclet.Member_Table_Summary", |
|
268 configuration.getText("doclet.Requires_Summary"), |
|
269 configuration.getText("doclet.modules")); |
|
270 addRequiresSummary(text, tableSummary, dirs, li); |
|
271 HtmlTree ul = HtmlTree.UL(HtmlStyle.blockList, li); |
|
272 summaryContentTree.addContent(ul); |
|
273 } |
|
274 } |
|
275 |
|
276 /** |
|
277 * Add the requires summary for the module. |
|
278 * |
|
279 * @param text the table caption |
|
280 * @param tableSummary the summary for the table |
|
281 * @param dirs the list of module directives |
|
282 * @param htmltree the content tree to which the table will be added |
|
283 */ |
|
284 public void addRequiresSummary(String text, String tableSummary, List<ModuleElement.Directive> dirs, |
|
285 Content htmltree) { |
|
286 addSummary(text, tableSummary, htmltree, HtmlStyle.requiresSummary, requiresTableHeader, dirs); |
|
287 } |
|
288 |
|
289 /** |
|
290 * Add the requires directive list for the module. |
|
291 * |
|
292 * @param direct the requires directive |
|
293 * @param tbody the content tree to which the directive will be added |
|
294 * @param altColor true if altColor style should be used or false if rowColor style should be used |
|
295 */ |
|
296 public void addRequiresList(ModuleElement.RequiresDirective direct, Content tbody, boolean altColor) { |
|
297 ModuleElement m = direct.getDependency(); |
|
298 Content moduleLinkContent = getModuleLink(m, new StringContent(m.getQualifiedName().toString())); |
|
299 Content tdPackage = HtmlTree.TD(HtmlStyle.colFirst, moduleLinkContent); |
|
300 HtmlTree tdSummary = new HtmlTree(HtmlTag.TD); |
|
301 tdSummary.addStyle(HtmlStyle.colLast); |
|
302 addSummaryComment(m, tdSummary); |
|
303 HtmlTree tr = HtmlTree.TR(tdPackage); |
|
304 tr.addContent(tdSummary); |
|
305 tr.addStyle(altColor ? HtmlStyle.altColor : HtmlStyle.rowColor); |
|
306 tbody.addContent(tr); |
|
307 } |
|
308 |
|
309 /** |
|
310 * {@inheritDoc} |
|
311 */ |
|
312 public void addPackagesSummary(Content summaryContentTree) { |
|
313 List<ModuleElement.Directive> dirs = directiveMap.get(DirectiveKind.EXPORTS); |
|
314 if (dirs != null && !dirs.isEmpty()) { |
|
315 HtmlTree li = new HtmlTree(HtmlTag.LI); |
|
316 li.addStyle(HtmlStyle.blockList); |
|
317 addSummaryHeader(HtmlConstants.START_OF_PACKAGES_SUMMARY, SectionName.PACKAGES, |
|
318 getResource("doclet.navPackages"), li); |
|
319 String text = configuration.getText("doclet.Exported_Packages_Summary"); |
|
320 String tableSummary = configuration.getText("doclet.Member_Table_Summary", |
|
321 configuration.getText("doclet.Exported_Packages_Summary"), |
|
322 configuration.getText("doclet.packages")); |
|
323 addExportedPackagesSummary(text, tableSummary, dirs, li); |
|
324 HtmlTree ul = HtmlTree.UL(HtmlStyle.blockList, li); |
|
325 summaryContentTree.addContent(ul); |
|
326 } |
|
327 } |
|
328 |
|
329 /** |
|
330 * Add the exported packages summary for the module. |
|
331 * |
|
332 * @param text the table caption |
|
333 * @param tableSummary the summary for the table |
|
334 * @param dirs the list of module directives |
|
335 * @param htmltree the content tree to which the table will be added |
|
336 */ |
|
337 public void addExportedPackagesSummary(String text, String tableSummary, List<ModuleElement.Directive> dirs, |
|
338 Content htmltree) { |
|
339 addSummary(text, tableSummary, htmltree, HtmlStyle.packagesSummary, exportedPackagesTableHeader, dirs); |
|
340 } |
|
341 |
|
342 /** |
|
343 * Add the exported packages list for the module. |
|
344 * |
|
345 * @param direct the requires directive |
|
346 * @param tbody the content tree to which the directive will be added |
|
347 * @param altColor true if altColor style should be used or false if rowColor style should be used |
|
348 */ |
|
349 public void addExportedPackagesList(ModuleElement.ExportsDirective direct, Content tbody, boolean altColor) { |
|
350 PackageElement pkg = direct.getPackage(); |
|
351 Content pkgLinkContent = getPackageLink(pkg, new StringContent(utils.getPackageName(pkg))); |
|
352 Content tdPackage = HtmlTree.TD(HtmlStyle.colFirst, pkgLinkContent); |
|
353 HtmlTree tdModules = new HtmlTree(HtmlTag.TD); |
|
354 tdModules.addStyle(HtmlStyle.colSecond); |
|
355 List<? extends ModuleElement> targetModules = direct.getTargetModules(); |
|
356 if (targetModules != null) { |
|
357 List<? extends ModuleElement> mElements = direct.getTargetModules(); |
|
358 for (int i = 0; i < mElements.size(); i++) { |
|
359 if (i > 0) { |
|
360 tdModules.addContent(new HtmlTree(HtmlTag.BR)); |
|
361 } |
|
362 ModuleElement m = mElements.get(i); |
|
363 tdModules.addContent(new StringContent(m.getQualifiedName().toString())); |
|
364 } |
|
365 } else { |
|
366 tdModules.addContent(configuration.getText("doclet.All_Modules")); |
|
367 } |
|
368 HtmlTree tdSummary = new HtmlTree(HtmlTag.TD); |
|
369 tdSummary.addStyle(HtmlStyle.colLast); |
|
370 addSummaryComment(pkg, tdSummary); |
|
371 HtmlTree tr = HtmlTree.TR(tdPackage); |
|
372 tr.addContent(tdModules); |
|
373 tr.addContent(tdSummary); |
|
374 tr.addStyle(altColor ? HtmlStyle.altColor : HtmlStyle.rowColor); |
|
375 tbody.addContent(tr); |
|
376 } |
|
377 |
|
378 /** |
|
379 * {@inheritDoc} |
|
380 */ |
|
381 public void addServicesSummary(Content summaryContentTree) { |
|
382 List<ModuleElement.Directive> usesDirs = directiveMap.get(DirectiveKind.USES); |
|
383 List<ModuleElement.Directive> providesDirs = directiveMap.get(DirectiveKind.PROVIDES); |
|
384 if ((usesDirs != null && !usesDirs.isEmpty()) || (providesDirs != null && !providesDirs.isEmpty())) { |
|
385 HtmlTree li = new HtmlTree(HtmlTag.LI); |
|
386 li.addStyle(HtmlStyle.blockList); |
|
387 addSummaryHeader(HtmlConstants.START_OF_SERVICES_SUMMARY, SectionName.SERVICES, |
|
388 getResource("doclet.navServices"), li); |
|
389 String text; |
|
390 String tableSummary; |
|
391 if (usesDirs != null && !usesDirs.isEmpty()) { |
|
392 text = configuration.getText("doclet.Uses_Summary"); |
|
393 tableSummary = configuration.getText("doclet.Member_Table_Summary", |
|
394 configuration.getText("doclet.Uses_Summary"), |
|
395 configuration.getText("doclet.types")); |
|
396 addUsesSummary(text, tableSummary, usesDirs, li); |
|
397 } |
|
398 if (providesDirs != null && !providesDirs.isEmpty()) { |
|
399 text = configuration.getText("doclet.Provides_Summary"); |
|
400 tableSummary = configuration.getText("doclet.Member_Table_Summary", |
|
401 configuration.getText("doclet.Provides_Summary"), |
|
402 configuration.getText("doclet.types")); |
|
403 addProvidesSummary(text, tableSummary, providesDirs, li); |
|
404 } |
|
405 HtmlTree ul = HtmlTree.UL(HtmlStyle.blockList, li); |
|
406 summaryContentTree.addContent(ul); |
|
407 } |
|
408 } |
|
409 |
|
410 /** |
|
411 * Add the uses summary for the module. |
|
412 * |
|
413 * @param text the table caption |
|
414 * @param tableSummary the summary for the table |
|
415 * @param dirs the list of module directives |
|
416 * @param htmltree the content tree to which the table will be added |
|
417 */ |
|
418 public void addUsesSummary(String text, String tableSummary, List<ModuleElement.Directive> dirs, |
|
419 Content htmltree) { |
|
420 addSummary(text, tableSummary, htmltree, HtmlStyle.usesSummary, usesTableHeader, dirs); |
|
421 } |
|
422 |
|
423 /** |
|
424 * Add the uses list for the module. |
|
425 * |
|
426 * @param direct the requires directive |
|
427 * @param tbody the content tree to which the directive will be added |
|
428 * @param altColor true if altColor style should be used or false if rowColor style should be used |
|
429 */ |
|
430 public void addUsesList(ModuleElement.UsesDirective direct, Content tbody, boolean altColor) { |
|
431 TypeElement type = direct.getService(); |
|
432 Content typeLinkContent = getLink(new LinkInfoImpl(configuration, LinkInfoImpl.Kind.PACKAGE, type)); |
|
433 Content tdPackage = HtmlTree.TD(HtmlStyle.colFirst, typeLinkContent); |
|
434 HtmlTree tdSummary = new HtmlTree(HtmlTag.TD); |
|
435 tdSummary.addStyle(HtmlStyle.colLast); |
|
436 addSummaryComment(type, tdSummary); |
|
437 HtmlTree tr = HtmlTree.TR(tdPackage); |
|
438 tr.addContent(tdSummary); |
|
439 tr.addStyle(altColor ? HtmlStyle.altColor : HtmlStyle.rowColor); |
|
440 tbody.addContent(tr); |
|
441 } |
|
442 |
|
443 /** |
|
444 * Add the provides summary for the module. |
|
445 * |
|
446 * @param text the table caption |
|
447 * @param tableSummary the summary for the table |
|
448 * @param dirs the list of module directives |
|
449 * @param htmltree the content tree to which the table will be added |
|
450 */ |
|
451 public void addProvidesSummary(String text, String tableSummary, List<ModuleElement.Directive> dirs, |
|
452 Content htmltree) { |
|
453 addSummary(text, tableSummary, htmltree, HtmlStyle.providesSummary, providesTableHeader, dirs); |
|
454 } |
|
455 |
|
456 /** |
|
457 * Add the exported packages list for the module. |
|
458 * |
|
459 * @param direct the requires directive |
|
460 * @param tbody the content tree to which the directive will be added |
|
461 * @param altColor true if altColor style should be used or false if rowColor style should be used |
|
462 */ |
|
463 public void addProvidesList(ModuleElement.ProvidesDirective direct, Content tbody, boolean altColor) { |
|
464 TypeElement impl = direct.getImplementation(); |
|
465 TypeElement srv = direct.getService(); |
|
466 Content implLinkContent = getLink(new LinkInfoImpl(configuration, LinkInfoImpl.Kind.PACKAGE, impl)); |
|
467 Content srvLinkContent = getLink(new LinkInfoImpl(configuration, LinkInfoImpl.Kind.PACKAGE, srv)); |
|
468 HtmlTree tdType = HtmlTree.TD(HtmlStyle.colFirst, srvLinkContent); |
|
469 tdType.addContent(new HtmlTree(HtmlTag.BR)); |
|
470 tdType.addContent("("); |
|
471 HtmlTree implSpan = HtmlTree.SPAN(HtmlStyle.implementationLabel, getResource("doclet.Implementation")); |
|
472 tdType.addContent(implSpan); |
|
473 tdType.addContent(getSpace()); |
|
474 tdType.addContent(implLinkContent); |
|
475 tdType.addContent(")"); |
|
476 HtmlTree tdDesc = new HtmlTree(HtmlTag.TD); |
|
477 tdDesc.addStyle(HtmlStyle.colLast); |
|
478 addSummaryComment(srv, tdDesc); |
|
479 HtmlTree tr = HtmlTree.TR(tdType); |
|
480 tr.addContent(tdDesc); |
|
481 tr.addStyle(altColor ? HtmlStyle.altColor : HtmlStyle.rowColor); |
|
482 tbody.addContent(tr); |
168 } |
483 } |
169 |
484 |
170 /** |
485 /** |
171 * {@inheritDoc} |
486 * {@inheritDoc} |
172 */ |
487 */ |