190 boolean strong) { |
195 boolean strong) { |
191 script(); |
196 script(); |
192 println(" <!--"); |
197 println(" <!--"); |
193 println(" if(window==top) {"); |
198 println(" if(window==top) {"); |
194 println(" document.writeln('" |
199 println(" document.writeln('" |
195 + getHyperLink(link, where, label, strong, "", "", target) + "');"); |
200 + getHyperLinkString(link, where, label, strong, "", "", target) + "');"); |
196 println(" }"); |
201 println(" }"); |
197 println(" //-->"); |
202 println(" //-->"); |
198 scriptEnd(); |
203 scriptEnd(); |
199 noScript(); |
204 noScript(); |
200 println(" " + getHyperLink(link, where, label, strong, "", "", target)); |
205 println(" " + getHyperLinkString(link, where, label, strong, "", "", target)); |
201 noScriptEnd(); |
206 noScriptEnd(); |
202 println(DocletConstants.NL); |
207 println(DocletConstants.NL); |
203 } |
208 } |
204 |
209 |
205 private void printMethodInfo(MethodDoc method) { |
210 /** |
|
211 * Get the script to show or hide the All classes link. |
|
212 * |
|
213 * @param id id of the element to show or hide |
|
214 * @return a content tree for the script |
|
215 */ |
|
216 public Content getAllClassesLinkScript(String id) { |
|
217 HtmlTree script = new HtmlTree(HtmlTag.SCRIPT); |
|
218 script.addAttr(HtmlAttr.TYPE, "text/javascript"); |
|
219 String scriptCode = "<!--\n" + |
|
220 " allClassesLink = document.getElementById(\"" + id + "\");\n" + |
|
221 " if(window==top) {\n" + |
|
222 " allClassesLink.style.display = \"block\";\n" + |
|
223 " }\n" + |
|
224 " else {\n" + |
|
225 " allClassesLink.style.display = \"none\";\n" + |
|
226 " }\n" + |
|
227 " //-->\n"; |
|
228 Content scriptContent = new RawHtml(scriptCode); |
|
229 script.addContent(scriptContent); |
|
230 Content div = HtmlTree.DIV(script); |
|
231 return div; |
|
232 } |
|
233 |
|
234 /** |
|
235 * Add method information. |
|
236 * |
|
237 * @param method the method to be documented |
|
238 * @param dl the content tree to which the method information will be added |
|
239 */ |
|
240 private void addMethodInfo(MethodDoc method, Content dl) { |
206 ClassDoc[] intfacs = method.containingClass().interfaces(); |
241 ClassDoc[] intfacs = method.containingClass().interfaces(); |
207 MethodDoc overriddenMethod = method.overriddenMethod(); |
242 MethodDoc overriddenMethod = method.overriddenMethod(); |
208 // Check whether there is any implementation or overridden info to be |
243 // Check whether there is any implementation or overridden info to be |
209 // printed. If no overridden or implementation info needs to be |
244 // printed. If no overridden or implementation info needs to be |
210 // printed, do not print this section. |
245 // printed, do not print this section. |
211 if ((intfacs.length > 0 && |
246 if ((intfacs.length > 0 && |
212 new ImplementedMethods(method, this.configuration).build().length > 0) || |
247 new ImplementedMethods(method, this.configuration).build().length > 0) || |
213 overriddenMethod != null) { |
248 overriddenMethod != null) { |
214 printMemberDetailsListStartTag(); |
249 MethodWriterImpl.addImplementsInfo(this, method, dl); |
215 dd(); |
|
216 printTagsInfoHeader(); |
|
217 MethodWriterImpl.printImplementsInfo(this, method); |
|
218 if (overriddenMethod != null) { |
250 if (overriddenMethod != null) { |
219 MethodWriterImpl.printOverridden(this, |
251 MethodWriterImpl.addOverridden(this, |
220 method.overriddenType(), overriddenMethod); |
252 method.overriddenType(), overriddenMethod, dl); |
221 } |
253 } |
222 printTagsInfoFooter(); |
254 } |
223 ddEnd(); |
255 } |
224 } |
256 |
225 } |
257 /** |
226 |
258 * Adds the tags information. |
227 protected void printTags(Doc doc) { |
259 * |
228 if(configuration.nocomment){ |
260 * @param doc the doc for which the tags will be generated |
|
261 * @param htmltree the documentation tree to which the tags will be added |
|
262 */ |
|
263 protected void addTagsInfo(Doc doc, Content htmltree) { |
|
264 if (configuration.nocomment) { |
229 return; |
265 return; |
230 } |
266 } |
|
267 Content dl = new HtmlTree(HtmlTag.DL); |
231 if (doc instanceof MethodDoc) { |
268 if (doc instanceof MethodDoc) { |
232 printMethodInfo((MethodDoc) doc); |
269 addMethodInfo((MethodDoc) doc, dl); |
233 } |
270 } |
234 TagletOutputImpl output = new TagletOutputImpl(""); |
271 TagletOutputImpl output = new TagletOutputImpl(""); |
235 TagletWriter.genTagOuput(configuration.tagletManager, doc, |
272 TagletWriter.genTagOuput(configuration.tagletManager, doc, |
236 configuration.tagletManager.getCustomTags(doc), |
273 configuration.tagletManager.getCustomTags(doc), |
237 getTagletWriterInstance(false), output); |
274 getTagletWriterInstance(false), output); |
238 String outputString = output.toString().trim(); |
275 String outputString = output.toString().trim(); |
239 // For RootDoc, ClassDoc and PackageDoc, this section is not the |
|
240 // definition description but the start of definition list. |
|
241 if (!outputString.isEmpty()) { |
276 if (!outputString.isEmpty()) { |
242 if (!(doc instanceof RootDoc || doc instanceof ClassDoc || |
277 Content resultString = new RawHtml(outputString); |
243 doc instanceof PackageDoc)) { |
278 dl.addContent(resultString); |
244 printMemberDetailsListStartTag(); |
279 } |
245 dd(); |
280 htmltree.addContent(dl); |
246 } |
|
247 printTagsInfoHeader(); |
|
248 print(outputString); |
|
249 printTagsInfoFooter(); |
|
250 if (!(doc instanceof RootDoc || doc instanceof ClassDoc || |
|
251 doc instanceof PackageDoc)) |
|
252 ddEnd(); |
|
253 } |
|
254 } |
281 } |
255 |
282 |
256 /** |
283 /** |
257 * Check whether there are any tags for Serialization Overview |
284 * Check whether there are any tags for Serialization Overview |
258 * section to be printed. |
285 * section to be printed. |
284 protected void printTagsInfoFooter() { |
311 protected void printTagsInfoFooter() { |
285 dlEnd(); |
312 dlEnd(); |
286 } |
313 } |
287 |
314 |
288 /** |
315 /** |
289 * Print Package link, with target frame. |
316 * Get Package link, with target frame. |
290 * |
317 * |
291 * @param pd The link will be to the "package-summary.html" page for this |
318 * @param pd The link will be to the "package-summary.html" page for this package |
292 * package. |
319 * @param target name of the target frame |
293 * @param target Name of the target frame. |
320 * @param label tag for the link |
294 * @param label Tag for the link. |
321 * @return a content for the target package link |
295 */ |
322 */ |
296 public void printTargetPackageLink(PackageDoc pd, String target, |
323 public Content getTargetPackageLink(PackageDoc pd, String target, |
297 String label) { |
324 Content label) { |
298 print(getHyperLink(pathString(pd, "package-summary.html"), "", label, |
325 return getHyperLink(pathString(pd, "package-summary.html"), "", label, "", target); |
299 false, "", "", target)); |
|
300 } |
326 } |
301 |
327 |
302 /** |
328 /** |
303 * Print the html file header. Also print Html page title and stylesheet |
329 * Print the html file header. Also print Html page title and stylesheet |
304 * default properties. |
330 * default properties. |
358 println(""); |
384 println(""); |
359 body("white", includeScript); |
385 body("white", includeScript); |
360 } |
386 } |
361 |
387 |
362 /** |
388 /** |
|
389 * Generates the HTML document tree and prints it out. |
|
390 * |
|
391 * @param metakeywords Array of String keywords for META tag. Each element |
|
392 * of the array is assigned to a separate META tag. |
|
393 * Pass in null for no array |
|
394 * @param includeScript true if printing windowtitle script |
|
395 * false for files that appear in the left-hand frames |
|
396 * @param body the body htmltree to be included in the document |
|
397 */ |
|
398 public void printHtmlDocument(String[] metakeywords, boolean includeScript, |
|
399 Content body) { |
|
400 Content htmlDocType = DocType.Transitional(); |
|
401 Content htmlComment = new Comment(configuration.getText("doclet.New_Page")); |
|
402 Content head = new HtmlTree(HtmlTag.HEAD); |
|
403 if (!configuration.notimestamp) { |
|
404 Content headComment = new Comment("Generated by javadoc (version " + |
|
405 ConfigurationImpl.BUILD_DATE + ") on " + today()); |
|
406 head.addContent(headComment); |
|
407 } |
|
408 if (configuration.charset.length() > 0) { |
|
409 Content meta = HtmlTree.META("Content-Type", "text/html", |
|
410 configuration.charset); |
|
411 head.addContent(meta); |
|
412 } |
|
413 head.addContent(getTitle()); |
|
414 if (!configuration.notimestamp) { |
|
415 SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd"); |
|
416 Content meta = HtmlTree.META("date", dateFormat.format(new Date())); |
|
417 head.addContent(meta); |
|
418 } |
|
419 if (metakeywords != null) { |
|
420 for (int i=0; i < metakeywords.length; i++) { |
|
421 Content meta = HtmlTree.META("keywords", metakeywords[i]); |
|
422 head.addContent(meta); |
|
423 } |
|
424 } |
|
425 head.addContent(getStyleSheetProperties()); |
|
426 Content htmlTree = HtmlTree.HTML(configuration.getLocale().getLanguage(), |
|
427 head, body); |
|
428 Content htmlDocument = new HtmlDocument(htmlDocType, |
|
429 htmlComment, htmlTree); |
|
430 print(htmlDocument.toString()); |
|
431 } |
|
432 |
|
433 /** |
|
434 * Get the window title. |
|
435 * |
|
436 * @param title the title string to construct the complete window title |
|
437 * @return the window title string |
|
438 */ |
|
439 public String getWindowTitle(String title) { |
|
440 if (configuration.windowtitle.length() > 0) { |
|
441 title += " (" + configuration.windowtitle + ")"; |
|
442 } |
|
443 return title; |
|
444 } |
|
445 |
|
446 /** |
363 * Print user specified header and the footer. |
447 * Print user specified header and the footer. |
364 * |
448 * |
365 * @param header if true print the user provided header else print the |
449 * @param header if true print the user provided header else print the |
366 * user provided footer. |
450 * user provided footer. |
367 */ |
451 */ |
378 } |
462 } |
379 emEnd(); |
463 emEnd(); |
380 } |
464 } |
381 |
465 |
382 /** |
466 /** |
|
467 * Get user specified header and the footer. |
|
468 * |
|
469 * @param header if true print the user provided header else print the |
|
470 * user provided footer. |
|
471 */ |
|
472 public Content getUserHeaderFooter(boolean header) { |
|
473 String content; |
|
474 if (header) { |
|
475 content = replaceDocRootDir(configuration.header); |
|
476 } else { |
|
477 if (configuration.footer.length() != 0) { |
|
478 content = replaceDocRootDir(configuration.footer); |
|
479 } else { |
|
480 content = replaceDocRootDir(configuration.header); |
|
481 } |
|
482 } |
|
483 Content rawContent = new RawHtml(content); |
|
484 Content em = HtmlTree.EM(rawContent); |
|
485 return em; |
|
486 } |
|
487 |
|
488 /** |
383 * Print the user specified top. |
489 * Print the user specified top. |
384 */ |
490 */ |
385 public void printTop() { |
491 public void printTop() { |
386 print(replaceDocRootDir(configuration.top)); |
492 print(replaceDocRootDir(configuration.top)); |
387 hr(); |
493 hr(); |
388 } |
494 } |
389 |
495 |
390 /** |
496 /** |
|
497 * Adds the user specified top. |
|
498 * |
|
499 * @param body the content tree to which user specified top will be added |
|
500 */ |
|
501 public void addTop(Content body) { |
|
502 Content top = new RawHtml(replaceDocRootDir(configuration.top)); |
|
503 body.addContent(top); |
|
504 } |
|
505 |
|
506 /** |
391 * Print the user specified bottom. |
507 * Print the user specified bottom. |
392 */ |
508 */ |
393 public void printBottom() { |
509 public void printBottom() { |
394 hr(); |
510 hr(); |
395 print(replaceDocRootDir(configuration.bottom)); |
511 print(replaceDocRootDir(configuration.bottom)); |
|
512 } |
|
513 |
|
514 /** |
|
515 * Adds the user specified bottom. |
|
516 * |
|
517 * @param body the content tree to which user specified bottom will be added |
|
518 */ |
|
519 public void addBottom(Content body) { |
|
520 Content bottom = new RawHtml(replaceDocRootDir(configuration.bottom)); |
|
521 Content small = HtmlTree.SMALL(bottom); |
|
522 Content p = HtmlTree.P(HtmlStyle.legalCopy, small); |
|
523 body.addContent(p); |
396 } |
524 } |
397 |
525 |
398 /** |
526 /** |
399 * Print the navigation bar for the Html page at the top and and the bottom. |
527 * Print the navigation bar for the Html page at the top and and the bottom. |
400 * |
528 * |
406 if (!configuration.nonavbar) { |
534 if (!configuration.nonavbar) { |
407 if (header) { |
535 if (header) { |
408 println(DocletConstants.NL + "<!-- ========= START OF TOP NAVBAR ======= -->"); |
536 println(DocletConstants.NL + "<!-- ========= START OF TOP NAVBAR ======= -->"); |
409 anchor("navbar_top"); |
537 anchor("navbar_top"); |
410 println(); |
538 println(); |
411 print(getHyperLink("", "skip-navbar_top", "", false, "", |
539 print(getHyperLinkString("", "skip-navbar_top", "", false, "", |
412 configuration.getText("doclet.Skip_navigation_links"), "")); |
540 configuration.getText("doclet.Skip_navigation_links"), "")); |
413 } else { |
541 } else { |
414 println(DocletConstants.NL + "<!-- ======= START OF BOTTOM NAVBAR ====== -->"); |
542 println(DocletConstants.NL + "<!-- ======= START OF BOTTOM NAVBAR ====== -->"); |
415 anchor("navbar_bottom"); |
543 anchor("navbar_bottom"); |
416 println(); |
544 println(); |
417 print(getHyperLink("", "skip-navbar_bottom", "", false, "", |
545 print(getHyperLinkString("", "skip-navbar_bottom", "", false, "", |
418 configuration.getText("doclet.Skip_navigation_links"), "")); |
546 configuration.getText("doclet.Skip_navigation_links"), "")); |
419 } |
547 } |
420 table(0, "100%", 1, 0); |
548 table(0, "100%", 1, 0); |
421 tr(); |
549 tr(); |
422 tdColspanBgcolorStyle(2, "#EEEEFF", "NavBarCell1"); |
550 tdColspanBgcolorStyle(2, "#EEEEFF", "NavBarCell1"); |
516 println(""); |
644 println(""); |
517 } |
645 } |
518 } |
646 } |
519 |
647 |
520 /** |
648 /** |
|
649 * Adds the navigation bar for the Html page at the top and and the bottom. |
|
650 * |
|
651 * @param header If true print navigation bar at the top of the page else |
|
652 * @param body the HtmlTree to which the nav links will be added |
|
653 */ |
|
654 protected void addNavLinks(boolean header, Content body) { |
|
655 if (!configuration.nonavbar) { |
|
656 String allClassesId = "allclasses_"; |
|
657 HtmlTree navDiv = new HtmlTree(HtmlTag.DIV); |
|
658 if (header) { |
|
659 body.addContent(HtmlConstants.START_OF_TOP_NAVBAR); |
|
660 navDiv.addStyle(HtmlStyle.topNav); |
|
661 allClassesId += "navbar_top"; |
|
662 Content a = getMarkerAnchor("navbar_top"); |
|
663 navDiv.addContent(a); |
|
664 Content skipLinkContent = getHyperLink("", |
|
665 "skip-navbar_top", HtmlTree.EMPTY, configuration.getText( |
|
666 "doclet.Skip_navigation_links"), ""); |
|
667 navDiv.addContent(skipLinkContent); |
|
668 } else { |
|
669 body.addContent(HtmlConstants.START_OF_BOTTOM_NAVBAR); |
|
670 navDiv.addStyle(HtmlStyle.bottomNav); |
|
671 allClassesId += "navbar_bottom"; |
|
672 Content a = getMarkerAnchor("navbar_bottom"); |
|
673 navDiv.addContent(a); |
|
674 Content skipLinkContent = getHyperLink("", |
|
675 "skip-navbar_bottom", HtmlTree.EMPTY, configuration.getText( |
|
676 "doclet.Skip_navigation_links"), ""); |
|
677 navDiv.addContent(skipLinkContent); |
|
678 } |
|
679 if (header) { |
|
680 navDiv.addContent(getMarkerAnchor("navbar_top_firstrow")); |
|
681 } else { |
|
682 navDiv.addContent(getMarkerAnchor("navbar_bottom_firstrow")); |
|
683 } |
|
684 HtmlTree navList = new HtmlTree(HtmlTag.UL); |
|
685 navList.addStyle(HtmlStyle.navList); |
|
686 navList.addAttr(HtmlAttr.TITLE, "Navigation"); |
|
687 if (configuration.createoverview) { |
|
688 navList.addContent(getNavLinkContents()); |
|
689 } |
|
690 if (configuration.packages.length == 1) { |
|
691 navList.addContent(getNavLinkPackage(configuration.packages[0])); |
|
692 } else if (configuration.packages.length > 1) { |
|
693 navList.addContent(getNavLinkPackage()); |
|
694 } |
|
695 navList.addContent(getNavLinkClass()); |
|
696 if(configuration.classuse) { |
|
697 navList.addContent(getNavLinkClassUse()); |
|
698 } |
|
699 if(configuration.createtree) { |
|
700 navList.addContent(getNavLinkTree()); |
|
701 } |
|
702 if(!(configuration.nodeprecated || |
|
703 configuration.nodeprecatedlist)) { |
|
704 navList.addContent(getNavLinkDeprecated()); |
|
705 } |
|
706 if(configuration.createindex) { |
|
707 navList.addContent(getNavLinkIndex()); |
|
708 } |
|
709 if (!configuration.nohelp) { |
|
710 navList.addContent(getNavLinkHelp()); |
|
711 } |
|
712 navDiv.addContent(navList); |
|
713 Content aboutDiv = HtmlTree.DIV(HtmlStyle.aboutLanguage, getUserHeaderFooter(header)); |
|
714 navDiv.addContent(aboutDiv); |
|
715 body.addContent(navDiv); |
|
716 Content ulNav = HtmlTree.UL(HtmlStyle.navList, getNavLinkPrevious()); |
|
717 ulNav.addContent(getNavLinkNext()); |
|
718 Content subDiv = HtmlTree.DIV(HtmlStyle.subNav, ulNav); |
|
719 Content ulFrames = HtmlTree.UL(HtmlStyle.navList, getNavShowLists()); |
|
720 ulFrames.addContent(getNavHideLists(filename)); |
|
721 subDiv.addContent(ulFrames); |
|
722 HtmlTree ulAllClasses = HtmlTree.UL(HtmlStyle.navList, getNavLinkClassIndex()); |
|
723 ulAllClasses.addAttr(HtmlAttr.ID, allClassesId.toString()); |
|
724 subDiv.addContent(ulAllClasses); |
|
725 subDiv.addContent(getAllClassesLinkScript(allClassesId.toString())); |
|
726 addSummaryDetailLinks(subDiv); |
|
727 if (header) { |
|
728 subDiv.addContent(getMarkerAnchor("skip-navbar_top")); |
|
729 body.addContent(subDiv); |
|
730 body.addContent(HtmlConstants.END_OF_TOP_NAVBAR); |
|
731 } else { |
|
732 subDiv.addContent(getMarkerAnchor("skip-navbar_bottom")); |
|
733 body.addContent(subDiv); |
|
734 body.addContent(HtmlConstants.END_OF_BOTTOM_NAVBAR); |
|
735 } |
|
736 } |
|
737 } |
|
738 |
|
739 /** |
521 * Print the word "NEXT" to indicate that no link is available. Override |
740 * Print the word "NEXT" to indicate that no link is available. Override |
522 * this method to customize next link. |
741 * this method to customize next link. |
523 */ |
742 */ |
524 protected void navLinkNext() { |
743 protected void navLinkNext() { |
525 navLinkNext(null); |
744 navLinkNext(null); |
526 } |
745 } |
527 |
746 |
528 /** |
747 /** |
|
748 * Get the word "NEXT" to indicate that no link is available. Override |
|
749 * this method to customize next link. |
|
750 * |
|
751 * @return a content tree for the link |
|
752 */ |
|
753 protected Content getNavLinkNext() { |
|
754 return getNavLinkNext(null); |
|
755 } |
|
756 |
|
757 /** |
529 * Print the word "PREV" to indicate that no link is available. Override |
758 * Print the word "PREV" to indicate that no link is available. Override |
530 * this method to customize prev link. |
759 * this method to customize prev link. |
531 */ |
760 */ |
532 protected void navLinkPrevious() { |
761 protected void navLinkPrevious() { |
533 navLinkPrevious(null); |
762 navLinkPrevious(null); |
534 } |
763 } |
535 |
764 |
536 /** |
765 /** |
|
766 * Get the word "PREV" to indicate that no link is available. Override |
|
767 * this method to customize prev link. |
|
768 * |
|
769 * @return a content tree for the link |
|
770 */ |
|
771 protected Content getNavLinkPrevious() { |
|
772 return getNavLinkPrevious(null); |
|
773 } |
|
774 |
|
775 /** |
537 * Do nothing. This is the default method. |
776 * Do nothing. This is the default method. |
538 */ |
777 */ |
539 protected void printSummaryDetailLinks() { |
778 protected void printSummaryDetailLinks() { |
|
779 } |
|
780 |
|
781 /** |
|
782 * Do nothing. This is the default method. |
|
783 */ |
|
784 protected void addSummaryDetailLinks(Content navDiv) { |
540 } |
785 } |
541 |
786 |
542 /** |
787 /** |
543 * Print link to the "overview-summary.html" page. |
788 * Print link to the "overview-summary.html" page. |
544 */ |
789 */ |
641 print(tag); |
947 print(tag); |
642 } |
948 } |
643 } |
949 } |
644 |
950 |
645 /** |
951 /** |
|
952 * Get link for next file. If next is null, just print the label |
|
953 * without linking it anywhere. |
|
954 * |
|
955 * @param next File name for the next link |
|
956 * @return a content tree for the link |
|
957 */ |
|
958 public Content getNavLinkNext(String next) { |
|
959 Content li; |
|
960 if (next != null) { |
|
961 li = HtmlTree.LI(getHyperLink(next, "", nextLabel, "", "")); |
|
962 } |
|
963 else |
|
964 li = HtmlTree.LI(nextLabel); |
|
965 return li; |
|
966 } |
|
967 |
|
968 /** |
646 * Print "FRAMES" link, to switch to the frame version of the output. |
969 * Print "FRAMES" link, to switch to the frame version of the output. |
647 * |
970 * |
648 * @param link File to be linked, "index.html". |
971 * @param link File to be linked, "index.html". |
649 */ |
972 */ |
650 protected void navShowLists(String link) { |
973 protected void navShowLists(String link) { |
651 print(getHyperLink(link + "?" + path + filename, "", |
974 print(getHyperLinkString(link + "?" + path + filename, "", |
652 configuration.getText("doclet.FRAMES"), true, "", "", "_top")); |
975 configuration.getText("doclet.FRAMES"), true, "", "", "_top")); |
|
976 } |
|
977 |
|
978 /** |
|
979 * Get "FRAMES" link, to switch to the frame version of the output. |
|
980 * |
|
981 * @param link File to be linked, "index.html" |
|
982 * @return a content tree for the link |
|
983 */ |
|
984 protected Content getNavShowLists(String link) { |
|
985 Content framesContent = getHyperLink(link + "?" + path + |
|
986 filename, "", framesLabel, "", "_top"); |
|
987 Content li = HtmlTree.LI(framesContent); |
|
988 return li; |
653 } |
989 } |
654 |
990 |
655 /** |
991 /** |
656 * Print "FRAMES" link, to switch to the frame version of the output. |
992 * Print "FRAMES" link, to switch to the frame version of the output. |
657 */ |
993 */ |
658 protected void navShowLists() { |
994 protected void navShowLists() { |
659 navShowLists(relativePath + "index.html"); |
995 navShowLists(relativePath + "index.html"); |
660 } |
996 } |
661 |
997 |
662 /** |
998 /** |
|
999 * Get "FRAMES" link, to switch to the frame version of the output. |
|
1000 * |
|
1001 * @return a content tree for the link |
|
1002 */ |
|
1003 protected Content getNavShowLists() { |
|
1004 return getNavShowLists(relativePath + "index.html"); |
|
1005 } |
|
1006 |
|
1007 /** |
663 * Print "NO FRAMES" link, to switch to the non-frame version of the output. |
1008 * Print "NO FRAMES" link, to switch to the non-frame version of the output. |
664 * |
1009 * |
665 * @param link File to be linked. |
1010 * @param link File to be linked. |
666 */ |
1011 */ |
667 protected void navHideLists(String link) { |
1012 protected void navHideLists(String link) { |
668 print(getHyperLink(link, "", configuration.getText("doclet.NO_FRAMES"), |
1013 print(getHyperLinkString(link, "", configuration.getText("doclet.NO_FRAMES"), |
669 true, "", "", "_top")); |
1014 true, "", "", "_top")); |
|
1015 } |
|
1016 |
|
1017 /** |
|
1018 * Get "NO FRAMES" link, to switch to the non-frame version of the output. |
|
1019 * |
|
1020 * @param link File to be linked |
|
1021 * @return a content tree for the link |
|
1022 */ |
|
1023 protected Content getNavHideLists(String link) { |
|
1024 Content noFramesContent = getHyperLink(link, "", noframesLabel, "", "_top"); |
|
1025 Content li = HtmlTree.LI(noFramesContent); |
|
1026 return li; |
670 } |
1027 } |
671 |
1028 |
672 /** |
1029 /** |
673 * Print "Tree" link in the navigation bar. If there is only one package |
1030 * Print "Tree" link in the navigation bar. If there is only one package |
674 * specified on the command line, then the "Tree" link will be to the |
1031 * specified on the command line, then the "Tree" link will be to the |
687 } |
1044 } |
688 navCellEnd(); |
1045 navCellEnd(); |
689 } |
1046 } |
690 |
1047 |
691 /** |
1048 /** |
692 * Print "Tree" link to the "overview-tree.html" file. |
1049 * Get "Tree" link in the navigation bar. If there is only one package |
693 */ |
1050 * specified on the command line, then the "Tree" link will be to the |
694 protected void navLinkMainTree(String label) { |
1051 * only "package-tree.html" file otherwise it will be to the |
695 printHyperLink(relativePath + "overview-tree.html", label); |
1052 * "overview-tree.html" file. |
|
1053 * |
|
1054 * @return a content tree for the link |
|
1055 */ |
|
1056 protected Content getNavLinkTree() { |
|
1057 Content treeLinkContent; |
|
1058 PackageDoc[] packages = configuration.root.specifiedPackages(); |
|
1059 if (packages.length == 1 && configuration.root.specifiedClasses().length == 0) { |
|
1060 treeLinkContent = getHyperLink(pathString(packages[0], |
|
1061 "package-tree.html"), "", treeLabel, |
|
1062 "", ""); |
|
1063 } else { |
|
1064 treeLinkContent = getHyperLink(relativePath + "overview-tree.html", |
|
1065 "", treeLabel, "", ""); |
|
1066 } |
|
1067 Content li = HtmlTree.LI(treeLinkContent); |
|
1068 return li; |
|
1069 } |
|
1070 |
|
1071 /** |
|
1072 * Get the overview tree link for the main tree. |
|
1073 * |
|
1074 * @param label the label for the link |
|
1075 * @return a content tree for the link |
|
1076 */ |
|
1077 protected Content getNavLinkMainTree(String label) { |
|
1078 Content mainTreeContent = getHyperLink(relativePath + "overview-tree.html", |
|
1079 new StringContent(label)); |
|
1080 Content li = HtmlTree.LI(mainTreeContent); |
|
1081 return li; |
696 } |
1082 } |
697 |
1083 |
698 /** |
1084 /** |
699 * Print the word "Class" in the navigation bar cell, to indicate that |
1085 * Print the word "Class" in the navigation bar cell, to indicate that |
700 * class link is not available. |
1086 * class link is not available. |
706 fontEnd(); |
1092 fontEnd(); |
707 navCellEnd(); |
1093 navCellEnd(); |
708 } |
1094 } |
709 |
1095 |
710 /** |
1096 /** |
|
1097 * Get the word "Class", to indicate that class link is not available. |
|
1098 * |
|
1099 * @return a content tree for the link |
|
1100 */ |
|
1101 protected Content getNavLinkClass() { |
|
1102 Content li = HtmlTree.LI(classLabel); |
|
1103 return li; |
|
1104 } |
|
1105 |
|
1106 /** |
711 * Print "Deprecated" API link in the navigation bar. |
1107 * Print "Deprecated" API link in the navigation bar. |
712 */ |
1108 */ |
713 protected void navLinkDeprecated() { |
1109 protected void navLinkDeprecated() { |
714 navCellStart(); |
1110 navCellStart(); |
715 printHyperLink(relativePath + "deprecated-list.html", "", |
1111 printHyperLink(relativePath + "deprecated-list.html", "", |
716 configuration.getText("doclet.navDeprecated"), true, "NavBarFont1"); |
1112 configuration.getText("doclet.navDeprecated"), true, "NavBarFont1"); |
717 navCellEnd(); |
1113 navCellEnd(); |
718 } |
1114 } |
719 |
1115 |
720 /** |
1116 /** |
|
1117 * Get "Deprecated" API link in the navigation bar. |
|
1118 * |
|
1119 * @return a content tree for the link |
|
1120 */ |
|
1121 protected Content getNavLinkDeprecated() { |
|
1122 Content linkContent = getHyperLink(relativePath + |
|
1123 "deprecated-list.html", "", deprecatedLabel, "", ""); |
|
1124 Content li = HtmlTree.LI(linkContent); |
|
1125 return li; |
|
1126 } |
|
1127 |
|
1128 /** |
721 * Print link for generated index. If the user has used "-splitindex" |
1129 * Print link for generated index. If the user has used "-splitindex" |
722 * command line option, then link to file "index-files/index-1.html" is |
1130 * command line option, then link to file "index-files/index-1.html" is |
723 * generated otherwise link to file "index-all.html" is generated. |
1131 * generated otherwise link to file "index-all.html" is generated. |
724 */ |
1132 */ |
725 protected void navLinkClassIndex() { |
1133 protected void navLinkClassIndex() { |
726 printNoFramesTargetHyperLink(relativePath + |
1134 printNoFramesTargetHyperLink(relativePath + |
727 AllClassesFrameWriter.OUTPUT_FILE_NAME_NOFRAMES, |
1135 AllClassesFrameWriter.OUTPUT_FILE_NAME_NOFRAMES, |
728 "", "", configuration.getText("doclet.All_Classes"), true); |
1136 "", "", configuration.getText("doclet.All_Classes"), true); |
|
1137 } |
|
1138 |
|
1139 /** |
|
1140 * Get link for generated index. If the user has used "-splitindex" |
|
1141 * command line option, then link to file "index-files/index-1.html" is |
|
1142 * generated otherwise link to file "index-all.html" is generated. |
|
1143 * |
|
1144 * @return a content tree for the link |
|
1145 */ |
|
1146 protected Content getNavLinkClassIndex() { |
|
1147 Content allClassesContent = getHyperLink(relativePath + |
|
1148 AllClassesFrameWriter.OUTPUT_FILE_NAME_NOFRAMES, "", |
|
1149 allclassesLabel, "", ""); |
|
1150 Content li = HtmlTree.LI(allClassesContent); |
|
1151 return li; |
729 } |
1152 } |
730 /** |
1153 /** |
731 * Print link for generated class index. |
1154 * Print link for generated class index. |
732 */ |
1155 */ |
733 protected void navLinkIndex() { |
1156 protected void navLinkIndex() { |
843 } |
1303 } |
844 trEnd(); |
1304 trEnd(); |
845 } |
1305 } |
846 |
1306 |
847 /** |
1307 /** |
|
1308 * Get summary table header. |
|
1309 * |
|
1310 * @param header the header for the table |
|
1311 * @param scope the scope of the headers |
|
1312 * @return a content tree for the header |
|
1313 */ |
|
1314 public Content getSummaryTableHeader(String[] header, String scope) { |
|
1315 Content tr = new HtmlTree(HtmlTag.TR); |
|
1316 int size = header.length; |
|
1317 Content tableHeader; |
|
1318 if (size == 1) { |
|
1319 tableHeader = new StringContent(header[0]); |
|
1320 tr.addContent(HtmlTree.TH(HtmlStyle.colOne, scope, tableHeader)); |
|
1321 return tr; |
|
1322 } |
|
1323 for (int i = 0; i < size; i++) { |
|
1324 tableHeader = new StringContent(header[i]); |
|
1325 if(i == 0) |
|
1326 tr.addContent(HtmlTree.TH(HtmlStyle.colFirst, scope, tableHeader)); |
|
1327 else if(i == (size - 1)) |
|
1328 tr.addContent(HtmlTree.TH(HtmlStyle.colLast, scope, tableHeader)); |
|
1329 else |
|
1330 tr.addContent(HtmlTree.TH(scope, tableHeader)); |
|
1331 } |
|
1332 return tr; |
|
1333 } |
|
1334 |
|
1335 /** |
|
1336 * Get table caption. |
|
1337 * |
|
1338 * @param rawText the caption for the table which could be raw Html |
|
1339 * @return a content tree for the caption |
|
1340 */ |
|
1341 public Content getTableCaption(String rawText) { |
|
1342 Content title = new RawHtml(rawText); |
|
1343 Content captionSpan = HtmlTree.SPAN(title); |
|
1344 Content space = getSpace(); |
|
1345 Content tabSpan = HtmlTree.SPAN(HtmlStyle.tabEnd, space); |
|
1346 Content caption = HtmlTree.CAPTION(captionSpan); |
|
1347 caption.addContent(tabSpan); |
|
1348 return caption; |
|
1349 } |
|
1350 |
|
1351 /** |
|
1352 * Get the marker anchor which will be added to the documentation tree. |
|
1353 * |
|
1354 * @param anchorName the anchor name attribute |
|
1355 * @return a content tree for the marker anchor |
|
1356 */ |
|
1357 public Content getMarkerAnchor(String anchorName) { |
|
1358 return getMarkerAnchor(anchorName, null); |
|
1359 } |
|
1360 |
|
1361 /** |
|
1362 * Get the marker anchor which will be added to the documentation tree. |
|
1363 * |
|
1364 * @param anchorName the anchor name attribute |
|
1365 * @param anchorContent the content that should be added to the anchor |
|
1366 * @return a content tree for the marker anchor |
|
1367 */ |
|
1368 public Content getMarkerAnchor(String anchorName, Content anchorContent) { |
|
1369 if (anchorContent == null) |
|
1370 anchorContent = new Comment(" "); |
|
1371 Content markerAnchor = HtmlTree.A_NAME(anchorName, anchorContent); |
|
1372 return markerAnchor; |
|
1373 } |
|
1374 |
|
1375 /** |
|
1376 * Returns a packagename content. |
|
1377 * |
|
1378 * @param packageDoc the package to check |
|
1379 * @return package name content |
|
1380 */ |
|
1381 public Content getPackageName(PackageDoc packageDoc) { |
|
1382 return packageDoc == null || packageDoc.name().length() == 0 ? |
|
1383 defaultPackageLabel : |
|
1384 getPackageLabel(packageDoc.name()); |
|
1385 } |
|
1386 |
|
1387 /** |
|
1388 * Returns a package name label. |
|
1389 * |
|
1390 * @param parsedName the package name |
|
1391 * @return the package name content |
|
1392 */ |
|
1393 public Content getPackageLabel(String packageName) { |
|
1394 return new StringContent(packageName); |
|
1395 } |
|
1396 |
|
1397 /** |
848 * Prine table header information about color, column span and the font. |
1398 * Prine table header information about color, column span and the font. |
849 * |
1399 * |
850 * @param color Background color. |
1400 * @param color Background color. |
851 * @param span Column span. |
1401 * @param span Column span. |
852 */ |
1402 */ |
1039 * @param isStrong true if the label should be strong. |
1589 * @param isStrong true if the label should be strong. |
1040 * @param style the font of the package link label. |
1590 * @param style the font of the package link label. |
1041 */ |
1591 */ |
1042 public void printPackageLink(PackageDoc pkg, String label, boolean isStrong, |
1592 public void printPackageLink(PackageDoc pkg, String label, boolean isStrong, |
1043 String style) { |
1593 String style) { |
1044 print(getPackageLink(pkg, label, isStrong, style)); |
1594 print(getPackageLinkString(pkg, label, isStrong, style)); |
1045 } |
1595 } |
1046 |
1596 |
1047 /** |
1597 /** |
1048 * Return the link to the given package. |
1598 * Return the link to the given package. |
1049 * |
1599 * |
1050 * @param pkg the package to link to. |
1600 * @param pkg the package to link to. |
1051 * @param label the label for the link. |
1601 * @param label the label for the link. |
1052 * @param isStrong true if the label should be strong. |
1602 * @param isStrong true if the label should be strong. |
1053 * @return the link to the given package. |
1603 * @return the link to the given package. |
1054 */ |
1604 */ |
1055 public String getPackageLink(PackageDoc pkg, String label, |
1605 public String getPackageLinkString(PackageDoc pkg, String label, |
1056 boolean isStrong) { |
1606 boolean isStrong) { |
1057 return getPackageLink(pkg, label, isStrong, ""); |
1607 return getPackageLinkString(pkg, label, isStrong, ""); |
1058 } |
1608 } |
1059 |
1609 |
1060 /** |
1610 /** |
1061 * Return the link to the given package. |
1611 * Return the link to the given package. |
1062 * |
1612 * |
1077 break; |
1627 break; |
1078 } |
1628 } |
1079 } |
1629 } |
1080 } |
1630 } |
1081 if (included || pkg == null) { |
1631 if (included || pkg == null) { |
1082 return getHyperLink(pathString(pkg, "package-summary.html"), |
1632 return getHyperLinkString(pathString(pkg, "package-summary.html"), |
1083 "", label, isStrong, style); |
1633 "", label, isStrong, style); |
1084 } else { |
1634 } else { |
1085 String crossPkgLink = getCrossPackageLink(Util.getPackageName(pkg)); |
1635 String crossPkgLink = getCrossPackageLink(Util.getPackageName(pkg)); |
1086 if (crossPkgLink != null) { |
1636 if (crossPkgLink != null) { |
1087 return getHyperLink(crossPkgLink, "", label, isStrong, style); |
1637 return getHyperLinkString(crossPkgLink, "", label, isStrong, style); |
|
1638 } else { |
|
1639 return label; |
|
1640 } |
|
1641 } |
|
1642 } |
|
1643 |
|
1644 /** |
|
1645 * Return the link to the given package. |
|
1646 * |
|
1647 * @param pkg the package to link to. |
|
1648 * @param label the label for the link. |
|
1649 * @return a content tree for the package link. |
|
1650 */ |
|
1651 public Content getPackageLink(PackageDoc pkg, Content label) { |
|
1652 boolean included = pkg != null && pkg.isIncluded(); |
|
1653 if (! included) { |
|
1654 PackageDoc[] packages = configuration.packages; |
|
1655 for (int i = 0; i < packages.length; i++) { |
|
1656 if (packages[i].equals(pkg)) { |
|
1657 included = true; |
|
1658 break; |
|
1659 } |
|
1660 } |
|
1661 } |
|
1662 if (included || pkg == null) { |
|
1663 return getHyperLink(pathString(pkg, "package-summary.html"), |
|
1664 "", label); |
|
1665 } else { |
|
1666 String crossPkgLink = getCrossPackageLink(Util.getPackageName(pkg)); |
|
1667 if (crossPkgLink != null) { |
|
1668 return getHyperLink(crossPkgLink, "", label); |
1088 } else { |
1669 } else { |
1089 return label; |
1670 return label; |
1090 } |
1671 } |
1091 } |
1672 } |
1092 } |
1673 } |
1107 } |
1688 } |
1108 String href = relativePath + DocletConstants.SOURCE_OUTPUT_DIR_NAME |
1689 String href = relativePath + DocletConstants.SOURCE_OUTPUT_DIR_NAME |
1109 + DirectoryManager.getDirectoryPath(cd.containingPackage()) |
1690 + DirectoryManager.getDirectoryPath(cd.containingPackage()) |
1110 + cd.name() + ".html#" + SourceToHTMLConverter.getAnchorName(d); |
1691 + cd.name() + ".html#" + SourceToHTMLConverter.getAnchorName(d); |
1111 printHyperLink(href, "", label, true); |
1692 printHyperLink(href, "", label, true); |
|
1693 } |
|
1694 |
|
1695 /** |
|
1696 * Add the link to the content tree. |
|
1697 * |
|
1698 * @param doc program element doc for which the link will be added |
|
1699 * @param label label for the link |
|
1700 * @param htmltree the content tree to which the link will be added |
|
1701 */ |
|
1702 public void addSrcLink(ProgramElementDoc doc, Content label, Content htmltree) { |
|
1703 if (doc == null) { |
|
1704 return; |
|
1705 } |
|
1706 ClassDoc cd = doc.containingClass(); |
|
1707 if (cd == null) { |
|
1708 //d must be a class doc since in has no containing class. |
|
1709 cd = (ClassDoc) doc; |
|
1710 } |
|
1711 String href = relativePath + DocletConstants.SOURCE_OUTPUT_DIR_NAME |
|
1712 + DirectoryManager.getDirectoryPath(cd.containingPackage()) |
|
1713 + cd.name() + ".html#" + SourceToHTMLConverter.getAnchorName(doc); |
|
1714 Content linkContent = getHyperLink(href, "", label, "", ""); |
|
1715 htmltree.addContent(linkContent); |
1112 } |
1716 } |
1113 |
1717 |
1114 /** |
1718 /** |
1115 * Return the link to the given class. |
1719 * Return the link to the given class. |
1116 * |
1720 * |
1173 //The package exists in external documentation, so link to the external |
1777 //The package exists in external documentation, so link to the external |
1174 //class (assuming that it exists). This is definitely a limitation of |
1778 //class (assuming that it exists). This is definitely a limitation of |
1175 //the -link option. There are ways to determine if an external package |
1779 //the -link option. There are ways to determine if an external package |
1176 //exists, but no way to determine if the external class exists. We just |
1780 //exists, but no way to determine if the external class exists. We just |
1177 //have to assume that it does. |
1781 //have to assume that it does. |
1178 return getHyperLink( |
1782 return getHyperLinkString( |
1179 configuration.extern.getExternalLink(packageName, relativePath, |
1783 configuration.extern.getExternalLink(packageName, relativePath, |
1180 className + ".html?is-external=true"), |
1784 className + ".html?is-external=true"), |
1181 refMemName == null ? "" : refMemName, |
1785 refMemName == null ? "" : refMemName, |
1182 label == null || label.length() == 0 ? defaultLabel : label, |
1786 label == null || label.length() == 0 ? defaultLabel : label, |
1183 strong, style, |
1787 strong, style, |
1198 public String getCrossPackageLink(String pkgName) { |
1802 public String getCrossPackageLink(String pkgName) { |
1199 return configuration.extern.getExternalLink(pkgName, relativePath, |
1803 return configuration.extern.getExternalLink(pkgName, relativePath, |
1200 "package-summary.html?is-external=true"); |
1804 "package-summary.html?is-external=true"); |
1201 } |
1805 } |
1202 |
1806 |
1203 public void printQualifiedClassLink(int context, ClassDoc cd) { |
1807 /** |
1204 printLink(new LinkInfoImpl(context, cd, |
1808 * Get the class link. |
1205 configuration.getClassName(cd), "")); |
1809 * |
1206 } |
1810 * @param context the id of the context where the link will be added |
1207 |
1811 * @param cd the class doc to link to |
1208 /** |
1812 * @return a content tree for the link |
1209 * Print Class link, with only class name as the link and prefixing |
1813 */ |
1210 * plain package name. |
1814 public Content getQualifiedClassLink(int context, ClassDoc cd) { |
1211 */ |
1815 return new RawHtml(getLink(new LinkInfoImpl(context, cd, |
1212 public void printPreQualifiedClassLink(int context, ClassDoc cd) { |
1816 configuration.getClassName(cd), ""))); |
1213 print(getPreQualifiedClassLink(context, cd, false)); |
1817 } |
|
1818 |
|
1819 /** |
|
1820 * Add the class link. |
|
1821 * |
|
1822 * @param context the id of the context where the link will be added |
|
1823 * @param cd the class doc to link to |
|
1824 * @param contentTree the content tree to which the link will be added |
|
1825 */ |
|
1826 public void addPreQualifiedClassLink(int context, ClassDoc cd, Content contentTree) { |
|
1827 addPreQualifiedClassLink(context, cd, false, contentTree); |
1214 } |
1828 } |
1215 |
1829 |
1216 /** |
1830 /** |
1217 * Retrieve the class link with the package portion of the label in |
1831 * Retrieve the class link with the package portion of the label in |
1218 * plain text. If the qualifier is excluded, it willnot be included in the |
1832 * plain text. If the qualifier is excluded, it willnot be included in the |
1231 } |
1845 } |
1232 classlink += getLink(new LinkInfoImpl(context, cd, cd.name(), isStrong)); |
1846 classlink += getLink(new LinkInfoImpl(context, cd, cd.name(), isStrong)); |
1233 return classlink; |
1847 return classlink; |
1234 } |
1848 } |
1235 |
1849 |
1236 |
1850 /** |
1237 /** |
1851 * Add the class link with the package portion of the label in |
1238 * Print Class link, with only class name as the strong link and prefixing |
1852 * plain text. If the qualifier is excluded, it will not be included in the |
|
1853 * link label. |
|
1854 * |
|
1855 * @param context the id of the context where the link will be added |
|
1856 * @param cd the class to link to |
|
1857 * @param isStrong true if the link should be strong |
|
1858 * @param contentTree the content tree to which the link with be added |
|
1859 */ |
|
1860 public void addPreQualifiedClassLink(int context, |
|
1861 ClassDoc cd, boolean isStrong, Content contentTree) { |
|
1862 PackageDoc pd = cd.containingPackage(); |
|
1863 if(pd != null && ! configuration.shouldExcludeQualifier(pd.name())) { |
|
1864 contentTree.addContent(getPkgName(cd)); |
|
1865 } |
|
1866 contentTree.addContent(new RawHtml(getLink(new LinkInfoImpl( |
|
1867 context, cd, cd.name(), isStrong)))); |
|
1868 } |
|
1869 |
|
1870 /** |
|
1871 * Add the class link, with only class name as the strong link and prefixing |
1239 * plain package name. |
1872 * plain package name. |
1240 */ |
1873 * |
1241 public void printPreQualifiedStrongClassLink(int context, ClassDoc cd) { |
1874 * @param context the id of the context where the link will be added |
1242 print(getPreQualifiedClassLink(context, cd, true)); |
1875 * @param cd the class to link to |
|
1876 * @param contentTree the content tree to which the link with be added |
|
1877 */ |
|
1878 public void addPreQualifiedStrongClassLink(int context, ClassDoc cd, Content contentTree) { |
|
1879 addPreQualifiedClassLink(context, cd, true, contentTree); |
1243 } |
1880 } |
1244 |
1881 |
1245 public void printText(String key) { |
1882 public void printText(String key) { |
1246 print(configuration.getText(key)); |
1883 print(configuration.getText(key)); |
1247 } |
1884 } |
1265 public void strongText(String key, String a1, String a2) { |
1902 public void strongText(String key, String a1, String a2) { |
1266 strong(configuration.getText(key, a1, a2)); |
1903 strong(configuration.getText(key, a1, a2)); |
1267 } |
1904 } |
1268 |
1905 |
1269 /** |
1906 /** |
1270 * Print the link for the given member. |
1907 * Get the link for the given member. |
1271 * |
1908 * |
1272 * @param context the id of the context where the link will be printed. |
1909 * @param context the id of the context where the link will be added |
1273 * @param doc the member being linked to. |
1910 * @param doc the member being linked to |
1274 * @param label the label for the link. |
1911 * @param label the label for the link |
1275 * @param strong true if the link should be strong. |
1912 * @return a content tree for the doc link |
1276 */ |
1913 */ |
1277 public void printDocLink(int context, MemberDoc doc, String label, |
1914 public Content getDocLink(int context, MemberDoc doc, String label) { |
1278 boolean strong) { |
1915 return getDocLink(context, doc.containingClass(), doc, label); |
1279 print(getDocLink(context, doc, label, strong)); |
|
1280 } |
1916 } |
1281 |
1917 |
1282 /** |
1918 /** |
1283 * Print the link for the given member. |
1919 * Print the link for the given member. |
1284 * |
1920 * |
1336 } else { |
1972 } else { |
1337 return label; |
1973 return label; |
1338 } |
1974 } |
1339 } |
1975 } |
1340 |
1976 |
|
1977 /** |
|
1978 * Return the link for the given member. |
|
1979 * |
|
1980 * @param context the id of the context where the link will be added |
|
1981 * @param classDoc the classDoc that we should link to. This is not |
|
1982 * necessarily equal to doc.containingClass(). We may be |
|
1983 * inheriting comments |
|
1984 * @param doc the member being linked to |
|
1985 * @param label the label for the link |
|
1986 * @return the link for the given member |
|
1987 */ |
|
1988 public Content getDocLink(int context, ClassDoc classDoc, MemberDoc doc, |
|
1989 String label) { |
|
1990 if (! (doc.isIncluded() || |
|
1991 Util.isLinkable(classDoc, configuration()))) { |
|
1992 return new StringContent(label); |
|
1993 } else if (doc instanceof ExecutableMemberDoc) { |
|
1994 ExecutableMemberDoc emd = (ExecutableMemberDoc)doc; |
|
1995 return new RawHtml(getLink(new LinkInfoImpl(context, classDoc, |
|
1996 getAnchor(emd), label, false))); |
|
1997 } else if (doc instanceof MemberDoc) { |
|
1998 return new RawHtml(getLink(new LinkInfoImpl(context, classDoc, |
|
1999 doc.name(), label, false))); |
|
2000 } else { |
|
2001 return new StringContent(label); |
|
2002 } |
|
2003 } |
|
2004 |
1341 public void anchor(ExecutableMemberDoc emd) { |
2005 public void anchor(ExecutableMemberDoc emd) { |
1342 anchor(getAnchor(emd)); |
2006 anchor(getAnchor(emd)); |
1343 } |
2007 } |
1344 |
2008 |
1345 public String getAnchor(ExecutableMemberDoc emd) { |
2009 public String getAnchor(ExecutableMemberDoc emd) { |
1390 PackageDoc refPackage = see.referencedPackage(); |
2054 PackageDoc refPackage = see.referencedPackage(); |
1391 if (refPackage != null && refPackage.isIncluded()) { |
2055 if (refPackage != null && refPackage.isIncluded()) { |
1392 //@see is referencing an included package |
2056 //@see is referencing an included package |
1393 String packageName = isplaintext ? refPackage.name() : |
2057 String packageName = isplaintext ? refPackage.name() : |
1394 getCode() + refPackage.name() + getCodeEnd(); |
2058 getCode() + refPackage.name() + getCodeEnd(); |
1395 result.append(getPackageLink(refPackage, |
2059 result.append(getPackageLinkString(refPackage, |
1396 label.length() == 0 ? packageName : label, false)); |
2060 label.length() == 0 ? packageName : label, false)); |
1397 } else { |
2061 } else { |
1398 //@see is not referencing an included class or package. Check for cross links. |
2062 //@see is not referencing an included class or package. Check for cross links. |
1399 String classCrossLink, packageCrossLink = getCrossPackageLink(refClassName); |
2063 String classCrossLink, packageCrossLink = getCrossPackageLink(refClassName); |
1400 if (packageCrossLink != null) { |
2064 if (packageCrossLink != null) { |
1401 //Package cross link found |
2065 //Package cross link found |
1402 result.append(getHyperLink(packageCrossLink, "", |
2066 result.append(getHyperLinkString(packageCrossLink, "", |
1403 (label.length() == 0)? text : label, false)); |
2067 (label.length() == 0)? text : label, false)); |
1404 } else if ((classCrossLink = getCrossClassLink(refClassName, |
2068 } else if ((classCrossLink = getCrossClassLink(refClassName, |
1405 refMemName, label, false, "", ! isplaintext)) != null) { |
2069 refMemName, label, false, "", ! isplaintext)) != null) { |
1406 //Class cross link found (possiblly to a member in the class) |
2070 //Class cross link found (possiblly to a member in the class) |
1407 result.append(classCrossLink); |
2071 result.append(classCrossLink); |
1466 |
2130 |
1467 public void printInlineComment(Doc doc, Tag tag) { |
2131 public void printInlineComment(Doc doc, Tag tag) { |
1468 printCommentTags(doc, tag.inlineTags(), false, false); |
2132 printCommentTags(doc, tag.inlineTags(), false, false); |
1469 } |
2133 } |
1470 |
2134 |
|
2135 /** |
|
2136 * Add the inline comment. |
|
2137 * |
|
2138 * @param doc the doc for which the inline comment will be added |
|
2139 * @param tag the inline tag to be added |
|
2140 * @param htmltree the content tree to which the comment will be added |
|
2141 */ |
|
2142 public void addInlineComment(Doc doc, Tag tag, Content htmltree) { |
|
2143 addCommentTags(doc, tag.inlineTags(), false, false, htmltree); |
|
2144 } |
|
2145 |
1471 public void printInlineDeprecatedComment(Doc doc, Tag tag) { |
2146 public void printInlineDeprecatedComment(Doc doc, Tag tag) { |
1472 printCommentTags(doc, tag.inlineTags(), true, false); |
2147 printCommentTags(doc, tag.inlineTags(), true, false); |
1473 } |
2148 } |
1474 |
2149 |
|
2150 /** |
|
2151 * Add the inline deprecated comment. |
|
2152 * |
|
2153 * @param doc the doc for which the inline deprecated comment will be added |
|
2154 * @param tag the inline tag to be added |
|
2155 * @param htmltree the content tree to which the comment will be added |
|
2156 */ |
|
2157 public void addInlineDeprecatedComment(Doc doc, Tag tag, Content htmltree) { |
|
2158 addCommentTags(doc, tag.inlineTags(), true, false, htmltree); |
|
2159 } |
|
2160 |
1475 public void printSummaryComment(Doc doc) { |
2161 public void printSummaryComment(Doc doc) { |
1476 printSummaryComment(doc, doc.firstSentenceTags()); |
2162 printSummaryComment(doc, doc.firstSentenceTags()); |
1477 } |
2163 } |
1478 |
2164 |
|
2165 /** |
|
2166 * Adds the summary content. |
|
2167 * |
|
2168 * @param doc the doc for which the summary will be generated |
|
2169 * @param htmltree the documentation tree to which the summary will be added |
|
2170 */ |
|
2171 public void addSummaryComment(Doc doc, Content htmltree) { |
|
2172 addSummaryComment(doc, doc.firstSentenceTags(), htmltree); |
|
2173 } |
|
2174 |
1479 public void printSummaryComment(Doc doc, Tag[] firstSentenceTags) { |
2175 public void printSummaryComment(Doc doc, Tag[] firstSentenceTags) { |
1480 printCommentTags(doc, firstSentenceTags, false, true); |
2176 printCommentTags(doc, firstSentenceTags, false, true); |
1481 } |
2177 } |
1482 |
2178 |
|
2179 /** |
|
2180 * Adds the summary content. |
|
2181 * |
|
2182 * @param doc the doc for which the summary will be generated |
|
2183 * @param firstSentenceTags the first sentence tags for the doc |
|
2184 * @param htmltree the documentation tree to which the summary will be added |
|
2185 */ |
|
2186 public void addSummaryComment(Doc doc, Tag[] firstSentenceTags, Content htmltree) { |
|
2187 addCommentTags(doc, firstSentenceTags, false, true, htmltree); |
|
2188 } |
|
2189 |
1483 public void printSummaryDeprecatedComment(Doc doc) { |
2190 public void printSummaryDeprecatedComment(Doc doc) { |
1484 printCommentTags(doc, doc.firstSentenceTags(), true, true); |
2191 printCommentTags(doc, doc.firstSentenceTags(), true, true); |
1485 } |
2192 } |
1486 |
2193 |
1487 public void printSummaryDeprecatedComment(Doc doc, Tag tag) { |
2194 public void printSummaryDeprecatedComment(Doc doc, Tag tag) { |
1488 printCommentTags(doc, tag.firstSentenceTags(), true, true); |
2195 printCommentTags(doc, tag.firstSentenceTags(), true, true); |
|
2196 } |
|
2197 |
|
2198 public void addSummaryDeprecatedComment(Doc doc, Tag tag, Content htmltree) { |
|
2199 addCommentTags(doc, tag.firstSentenceTags(), true, true, htmltree); |
1489 } |
2200 } |
1490 |
2201 |
1491 public void printInlineComment(Doc doc) { |
2202 public void printInlineComment(Doc doc) { |
1492 printCommentTags(doc, doc.inlineTags(), false, false); |
2203 printCommentTags(doc, doc.inlineTags(), false, false); |
1493 p(); |
2204 p(); |
|
2205 } |
|
2206 |
|
2207 /** |
|
2208 * Adds the inline comment. |
|
2209 * |
|
2210 * @param doc the doc for which the inline comments will be generated |
|
2211 * @param htmltree the documentation tree to which the inline comments will be added |
|
2212 */ |
|
2213 public void addInlineComment(Doc doc, Content htmltree) { |
|
2214 addCommentTags(doc, doc.inlineTags(), false, false, htmltree); |
1494 } |
2215 } |
1495 |
2216 |
1496 public void printInlineDeprecatedComment(Doc doc) { |
2217 public void printInlineDeprecatedComment(Doc doc) { |
1497 printCommentTags(doc, doc.inlineTags(), true, false); |
2218 printCommentTags(doc, doc.inlineTags(), true, false); |
1498 } |
2219 } |
1509 if (depr) { |
2230 if (depr) { |
1510 italicEnd(); |
2231 italicEnd(); |
1511 } |
2232 } |
1512 if (tags.length == 0) { |
2233 if (tags.length == 0) { |
1513 space(); |
2234 space(); |
|
2235 } |
|
2236 } |
|
2237 |
|
2238 /** |
|
2239 * Adds the comment tags. |
|
2240 * |
|
2241 * @param doc the doc for which the comment tags will be generated |
|
2242 * @param tags the first sentence tags for the doc |
|
2243 * @param depr true if it is deprecated |
|
2244 * @param first true if the first sentenge tags should be added |
|
2245 * @param htmltree the documentation tree to which the comment tags will be added |
|
2246 */ |
|
2247 private void addCommentTags(Doc doc, Tag[] tags, boolean depr, |
|
2248 boolean first, Content htmltree) { |
|
2249 if(configuration.nocomment){ |
|
2250 return; |
|
2251 } |
|
2252 Content div; |
|
2253 Content result = new RawHtml(commentTagsToString(null, doc, tags, first)); |
|
2254 if (depr) { |
|
2255 Content italic = HtmlTree.I(result); |
|
2256 div = HtmlTree.DIV(HtmlStyle.block, italic); |
|
2257 htmltree.addContent(div); |
|
2258 } |
|
2259 else { |
|
2260 div = HtmlTree.DIV(HtmlStyle.block, result); |
|
2261 htmltree.addContent(div); |
|
2262 } |
|
2263 if (tags.length == 0) { |
|
2264 htmltree.addContent(getSpace()); |
1514 } |
2265 } |
1515 } |
2266 } |
1516 |
2267 |
1517 /** |
2268 /** |
1518 * Converts inline tags and text to text strings, expanding the |
2269 * Converts inline tags and text to text strings, expanding the |
1749 link("REL =\"stylesheet\" TYPE=\"text/css\" HREF=\"" + |
2500 link("REL =\"stylesheet\" TYPE=\"text/css\" HREF=\"" + |
1750 filename + "\" " + "TITLE=\"Style\""); |
2501 filename + "\" " + "TITLE=\"Style\""); |
1751 } |
2502 } |
1752 |
2503 |
1753 /** |
2504 /** |
|
2505 * Returns a link to the stylesheet file. |
|
2506 * |
|
2507 * @return an HtmlTree for the lINK tag which provides the stylesheet location |
|
2508 */ |
|
2509 public HtmlTree getStyleSheetProperties() { |
|
2510 String filename = configuration.stylesheetfile; |
|
2511 if (filename.length() > 0) { |
|
2512 File stylefile = new File(filename); |
|
2513 String parent = stylefile.getParent(); |
|
2514 filename = (parent == null)? |
|
2515 filename: |
|
2516 filename.substring(parent.length() + 1); |
|
2517 } else { |
|
2518 filename = "stylesheet.css"; |
|
2519 } |
|
2520 filename = relativePath + filename; |
|
2521 HtmlTree link = HtmlTree.LINK("stylesheet", "text/css", filename, "Style"); |
|
2522 return link; |
|
2523 } |
|
2524 |
|
2525 /** |
1754 * According to the Java Language Specifications, all the outer classes |
2526 * According to the Java Language Specifications, all the outer classes |
1755 * and static nested classes are core classes. |
2527 * and static nested classes are core classes. |
1756 */ |
2528 */ |
1757 public boolean isCoreClass(ClassDoc cd) { |
2529 public boolean isCoreClass(ClassDoc cd) { |
1758 return cd.containingClass() == null || cd.isStatic(); |
2530 return cd.containingClass() == null || cd.isStatic(); |
1766 public void writeAnnotationInfo(PackageDoc packageDoc) { |
2538 public void writeAnnotationInfo(PackageDoc packageDoc) { |
1767 writeAnnotationInfo(packageDoc, packageDoc.annotations()); |
2539 writeAnnotationInfo(packageDoc, packageDoc.annotations()); |
1768 } |
2540 } |
1769 |
2541 |
1770 /** |
2542 /** |
|
2543 * Adds the annotatation types for the given packageDoc. |
|
2544 * |
|
2545 * @param packageDoc the package to write annotations for. |
|
2546 * @param htmltree the documentation tree to which the annotation info will be |
|
2547 * added |
|
2548 */ |
|
2549 public void addAnnotationInfo(PackageDoc packageDoc, Content htmltree) { |
|
2550 addAnnotationInfo(packageDoc, packageDoc.annotations(), htmltree); |
|
2551 } |
|
2552 |
|
2553 /** |
1771 * Write the annotatation types for the given doc. |
2554 * Write the annotatation types for the given doc. |
1772 * |
2555 * |
1773 * @param doc the doc to write annotations for. |
2556 * @param doc the doc to write annotations for. |
1774 */ |
2557 */ |
1775 public void writeAnnotationInfo(ProgramElementDoc doc) { |
2558 public void writeAnnotationInfo(ProgramElementDoc doc) { |
1776 writeAnnotationInfo(doc, doc.annotations()); |
2559 writeAnnotationInfo(doc, doc.annotations()); |
|
2560 } |
|
2561 |
|
2562 /** |
|
2563 * Adds the annotatation types for the given doc. |
|
2564 * |
|
2565 * @param packageDoc the package to write annotations for |
|
2566 * @param htmltree the content tree to which the annotation types will be added |
|
2567 */ |
|
2568 public void addAnnotationInfo(ProgramElementDoc doc, Content htmltree) { |
|
2569 addAnnotationInfo(doc, doc.annotations(), htmltree); |
1777 } |
2570 } |
1778 |
2571 |
1779 /** |
2572 /** |
1780 * Write the annotatation types for the given doc and parameter. |
2573 * Write the annotatation types for the given doc and parameter. |
1781 * |
2574 * |
1786 public boolean writeAnnotationInfo(int indent, Doc doc, Parameter param) { |
2579 public boolean writeAnnotationInfo(int indent, Doc doc, Parameter param) { |
1787 return writeAnnotationInfo(indent, doc, param.annotations(), false); |
2580 return writeAnnotationInfo(indent, doc, param.annotations(), false); |
1788 } |
2581 } |
1789 |
2582 |
1790 /** |
2583 /** |
|
2584 * Add the annotatation types for the given doc and parameter. |
|
2585 * |
|
2586 * @param indent the number of spaces to indent the parameters. |
|
2587 * @param doc the doc to write annotations for. |
|
2588 * @param param the parameter to write annotations for. |
|
2589 * @param tree the content tree to which the annotation types will be added |
|
2590 */ |
|
2591 public boolean addAnnotationInfo(int indent, Doc doc, Parameter param, |
|
2592 Content tree) { |
|
2593 return addAnnotationInfo(indent, doc, param.annotations(), false, tree); |
|
2594 } |
|
2595 |
|
2596 /** |
1791 * Write the annotatation types for the given doc. |
2597 * Write the annotatation types for the given doc. |
1792 * |
2598 * |
1793 * @param doc the doc to write annotations for. |
2599 * @param doc the doc to write annotations for. |
1794 * @param descList the array of {@link AnnotationDesc}. |
2600 * @param descList the array of {@link AnnotationDesc}. |
1795 */ |
2601 */ |
1796 private void writeAnnotationInfo(Doc doc, AnnotationDesc[] descList) { |
2602 private void writeAnnotationInfo(Doc doc, AnnotationDesc[] descList) { |
1797 writeAnnotationInfo(0, doc, descList, true); |
2603 writeAnnotationInfo(0, doc, descList, true); |
|
2604 } |
|
2605 |
|
2606 /** |
|
2607 * Adds the annotatation types for the given doc. |
|
2608 * |
|
2609 * @param doc the doc to write annotations for. |
|
2610 * @param descList the array of {@link AnnotationDesc}. |
|
2611 * @param htmltree the documentation tree to which the annotation info will be |
|
2612 * added |
|
2613 */ |
|
2614 private void addAnnotationInfo(Doc doc, AnnotationDesc[] descList, |
|
2615 Content htmltree) { |
|
2616 addAnnotationInfo(0, doc, descList, true, htmltree); |
1798 } |
2617 } |
1799 |
2618 |
1800 /** |
2619 /** |
1801 * Write the annotatation types for the given doc. |
2620 * Write the annotatation types for the given doc. |
1802 * |
2621 * |