langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/PackageWriterImpl.java
equal
deleted
inserted
replaced
23 * questions. |
23 * questions. |
24 */ |
24 */ |
25 |
25 |
26 package jdk.javadoc.internal.doclets.formats.html; |
26 package jdk.javadoc.internal.doclets.formats.html; |
27 |
27 |
28 import java.io.*; |
|
29 import java.util.*; |
28 import java.util.*; |
30 |
29 |
31 import javax.lang.model.element.ModuleElement; |
30 import javax.lang.model.element.ModuleElement; |
32 import javax.lang.model.element.PackageElement; |
31 import javax.lang.model.element.PackageElement; |
33 import javax.lang.model.element.TypeElement; |
32 import javax.lang.model.element.TypeElement; |
40 import jdk.javadoc.internal.doclets.formats.html.markup.RawHtml; |
39 import jdk.javadoc.internal.doclets.formats.html.markup.RawHtml; |
41 import jdk.javadoc.internal.doclets.formats.html.markup.StringContent; |
40 import jdk.javadoc.internal.doclets.formats.html.markup.StringContent; |
42 import jdk.javadoc.internal.doclets.toolkit.Content; |
41 import jdk.javadoc.internal.doclets.toolkit.Content; |
43 import jdk.javadoc.internal.doclets.toolkit.PackageSummaryWriter; |
42 import jdk.javadoc.internal.doclets.toolkit.PackageSummaryWriter; |
44 import jdk.javadoc.internal.doclets.toolkit.util.CommentHelper; |
43 import jdk.javadoc.internal.doclets.toolkit.util.CommentHelper; |
|
44 import jdk.javadoc.internal.doclets.toolkit.util.DocFileIOException; |
45 import jdk.javadoc.internal.doclets.toolkit.util.DocPath; |
45 import jdk.javadoc.internal.doclets.toolkit.util.DocPath; |
46 import jdk.javadoc.internal.doclets.toolkit.util.DocPaths; |
46 import jdk.javadoc.internal.doclets.toolkit.util.DocPaths; |
47 |
47 |
48 /** |
48 /** |
49 * Class to generate file for each package contents in the right-hand |
49 * Class to generate file for each package contents in the right-hand |
110 } |
110 } |
111 |
111 |
112 /** |
112 /** |
113 * {@inheritDoc} |
113 * {@inheritDoc} |
114 */ |
114 */ |
|
115 @Override |
115 public Content getPackageHeader(String heading) { |
116 public Content getPackageHeader(String heading) { |
116 HtmlTree bodyTree = getBody(true, getWindowTitle(utils.getPackageName(packageElement))); |
117 HtmlTree bodyTree = getBody(true, getWindowTitle(utils.getPackageName(packageElement))); |
117 HtmlTree htmlTree = (configuration.allowTag(HtmlTag.HEADER)) |
118 HtmlTree htmlTree = (configuration.allowTag(HtmlTag.HEADER)) |
118 ? HtmlTree.HEADER() |
119 ? HtmlTree.HEADER() |
119 : bodyTree; |
120 : bodyTree; |
164 } |
165 } |
165 |
166 |
166 /** |
167 /** |
167 * {@inheritDoc} |
168 * {@inheritDoc} |
168 */ |
169 */ |
|
170 @Override |
169 public Content getContentHeader() { |
171 public Content getContentHeader() { |
170 HtmlTree div = new HtmlTree(HtmlTag.DIV); |
172 HtmlTree div = new HtmlTree(HtmlTag.DIV); |
171 div.addStyle(HtmlStyle.contentContainer); |
173 div.addStyle(HtmlStyle.contentContainer); |
172 return div; |
174 return div; |
173 } |
175 } |
196 } |
198 } |
197 |
199 |
198 /** |
200 /** |
199 * {@inheritDoc} |
201 * {@inheritDoc} |
200 */ |
202 */ |
|
203 @Override |
201 public Content getSummaryHeader() { |
204 public Content getSummaryHeader() { |
202 HtmlTree ul = new HtmlTree(HtmlTag.UL); |
205 HtmlTree ul = new HtmlTree(HtmlTag.UL); |
203 ul.addStyle(HtmlStyle.blockList); |
206 ul.addStyle(HtmlStyle.blockList); |
204 return ul; |
207 return ul; |
205 } |
208 } |
206 |
209 |
207 /** |
210 /** |
208 * {@inheritDoc} |
211 * {@inheritDoc} |
209 */ |
212 */ |
|
213 @Override |
210 public void addClassesSummary(SortedSet<TypeElement> classes, String label, |
214 public void addClassesSummary(SortedSet<TypeElement> classes, String label, |
211 String tableSummary, List<String> tableHeader, Content summaryContentTree) { |
215 String tableSummary, List<String> tableHeader, Content summaryContentTree) { |
212 if(!classes.isEmpty()) { |
216 if(!classes.isEmpty()) { |
213 Content caption = getTableCaption(new RawHtml(label)); |
217 Content caption = getTableCaption(new RawHtml(label)); |
214 Content table = (configuration.isOutputHtml5()) |
218 Content table = (configuration.isOutputHtml5()) |
250 } |
254 } |
251 |
255 |
252 /** |
256 /** |
253 * {@inheritDoc} |
257 * {@inheritDoc} |
254 */ |
258 */ |
|
259 @Override |
255 public void addPackageDescription(Content packageContentTree) { |
260 public void addPackageDescription(Content packageContentTree) { |
256 if (!utils.getBody(packageElement).isEmpty()) { |
261 if (!utils.getBody(packageElement).isEmpty()) { |
257 packageContentTree.addContent( |
262 packageContentTree.addContent( |
258 getMarkerAnchor(SectionName.PACKAGE_DESCRIPTION)); |
263 getMarkerAnchor(SectionName.PACKAGE_DESCRIPTION)); |
259 Content h2Content = new StringContent( |
264 Content h2Content = new StringContent( |
271 } |
276 } |
272 |
277 |
273 /** |
278 /** |
274 * {@inheritDoc} |
279 * {@inheritDoc} |
275 */ |
280 */ |
|
281 @Override |
276 public void addPackageTags(Content packageContentTree) { |
282 public void addPackageTags(Content packageContentTree) { |
277 Content htmlTree = (configuration.allowTag(HtmlTag.SECTION)) |
283 Content htmlTree = (configuration.allowTag(HtmlTag.SECTION)) |
278 ? sectionTree |
284 ? sectionTree |
279 : packageContentTree; |
285 : packageContentTree; |
280 addTagsInfo(packageElement, htmlTree); |
286 addTagsInfo(packageElement, htmlTree); |
281 } |
287 } |
282 |
288 |
283 /** |
289 /** |
284 * {@inheritDoc} |
290 * {@inheritDoc} |
285 */ |
291 */ |
|
292 @Override |
286 public void addPackageContent(Content contentTree, Content packageContentTree) { |
293 public void addPackageContent(Content contentTree, Content packageContentTree) { |
287 if (configuration.allowTag(HtmlTag.MAIN)) { |
294 if (configuration.allowTag(HtmlTag.MAIN)) { |
288 packageContentTree.addContent(sectionTree); |
295 packageContentTree.addContent(sectionTree); |
289 mainTree.addContent(packageContentTree); |
296 mainTree.addContent(packageContentTree); |
290 contentTree.addContent(mainTree); |
297 contentTree.addContent(mainTree); |
294 } |
301 } |
295 |
302 |
296 /** |
303 /** |
297 * {@inheritDoc} |
304 * {@inheritDoc} |
298 */ |
305 */ |
|
306 @Override |
299 public void addPackageFooter(Content contentTree) { |
307 public void addPackageFooter(Content contentTree) { |
300 Content htmlTree = (configuration.allowTag(HtmlTag.FOOTER)) |
308 Content htmlTree = (configuration.allowTag(HtmlTag.FOOTER)) |
301 ? HtmlTree.FOOTER() |
309 ? HtmlTree.FOOTER() |
302 : contentTree; |
310 : contentTree; |
303 addNavLinks(false, htmlTree); |
311 addNavLinks(false, htmlTree); |
308 } |
316 } |
309 |
317 |
310 /** |
318 /** |
311 * {@inheritDoc} |
319 * {@inheritDoc} |
312 */ |
320 */ |
313 public void printDocument(Content contentTree) throws IOException { |
321 @Override |
|
322 public void printDocument(Content contentTree) throws DocFileIOException { |
314 printHtmlDocument(configuration.metakeywords.getMetaKeywords(packageElement), |
323 printHtmlDocument(configuration.metakeywords.getMetaKeywords(packageElement), |
315 true, contentTree); |
324 true, contentTree); |
316 } |
325 } |
317 |
326 |
318 /** |
327 /** |
319 * Get "Use" link for this pacakge in the navigation bar. |
328 * Get "Use" link for this pacakge in the navigation bar. |
320 * |
329 * |
321 * @return a content tree for the class use link |
330 * @return a content tree for the class use link |
322 */ |
331 */ |
|
332 @Override |
323 protected Content getNavLinkClassUse() { |
333 protected Content getNavLinkClassUse() { |
324 Content useLink = getHyperLink(DocPaths.PACKAGE_USE, |
334 Content useLink = getHyperLink(DocPaths.PACKAGE_USE, |
325 contents.useLabel, "", ""); |
335 contents.useLabel, "", ""); |
326 Content li = HtmlTree.LI(useLink); |
336 Content li = HtmlTree.LI(useLink); |
327 return li; |
337 return li; |
330 /** |
340 /** |
331 * Get "PREV PACKAGE" link in the navigation bar. |
341 * Get "PREV PACKAGE" link in the navigation bar. |
332 * |
342 * |
333 * @return a content tree for the previous link |
343 * @return a content tree for the previous link |
334 */ |
344 */ |
|
345 @Override |
335 public Content getNavLinkPrevious() { |
346 public Content getNavLinkPrevious() { |
336 Content li; |
347 Content li; |
337 if (prev == null) { |
348 if (prev == null) { |
338 li = HtmlTree.LI(contents.prevPackageLabel); |
349 li = HtmlTree.LI(contents.prevPackageLabel); |
339 } else { |
350 } else { |
347 /** |
358 /** |
348 * Get "NEXT PACKAGE" link in the navigation bar. |
359 * Get "NEXT PACKAGE" link in the navigation bar. |
349 * |
360 * |
350 * @return a content tree for the next link |
361 * @return a content tree for the next link |
351 */ |
362 */ |
|
363 @Override |
352 public Content getNavLinkNext() { |
364 public Content getNavLinkNext() { |
353 Content li; |
365 Content li; |
354 if (next == null) { |
366 if (next == null) { |
355 li = HtmlTree.LI(contents.nextPackageLabel); |
367 li = HtmlTree.LI(contents.nextPackageLabel); |
356 } else { |
368 } else { |
365 * Get "Tree" link in the navigation bar. This will be link to the package |
377 * Get "Tree" link in the navigation bar. This will be link to the package |
366 * tree file. |
378 * tree file. |
367 * |
379 * |
368 * @return a content tree for the tree link |
380 * @return a content tree for the tree link |
369 */ |
381 */ |
|
382 @Override |
370 protected Content getNavLinkTree() { |
383 protected Content getNavLinkTree() { |
371 Content useLink = getHyperLink(DocPaths.PACKAGE_TREE, |
384 Content useLink = getHyperLink(DocPaths.PACKAGE_TREE, |
372 contents.treeLabel, "", ""); |
385 contents.treeLabel, "", ""); |
373 Content li = HtmlTree.LI(useLink); |
386 Content li = HtmlTree.LI(useLink); |
374 return li; |
387 return li; |
390 /** |
403 /** |
391 * Highlight "Package" in the navigation bar, as this is the package page. |
404 * Highlight "Package" in the navigation bar, as this is the package page. |
392 * |
405 * |
393 * @return a content tree for the package link |
406 * @return a content tree for the package link |
394 */ |
407 */ |
|
408 @Override |
395 protected Content getNavLinkPackage() { |
409 protected Content getNavLinkPackage() { |
396 Content li = HtmlTree.LI(HtmlStyle.navBarCell1Rev, contents.packageLabel); |
410 Content li = HtmlTree.LI(HtmlStyle.navBarCell1Rev, contents.packageLabel); |
397 return li; |
411 return li; |
398 } |
412 } |
399 } |
413 } |