285 * @param label tag for the link |
285 * @param label tag for the link |
286 * @return a content for the target package link |
286 * @return a content for the target package link |
287 */ |
287 */ |
288 public Content getTargetPackageLink(PackageDoc pd, String target, |
288 public Content getTargetPackageLink(PackageDoc pd, String target, |
289 Content label) { |
289 Content label) { |
290 return getHyperLink(pathString(pd, DocPaths.PACKAGE_SUMMARY), "", label, "", target); |
290 return getHyperLink(pathString(pd, DocPaths.PACKAGE_SUMMARY), label, "", target); |
291 } |
291 } |
292 |
292 |
293 /** |
293 /** |
294 * Generates the HTML document tree and prints it out. |
294 * Generates the HTML document tree and prints it out. |
295 * |
295 * |
405 body.addContent(HtmlConstants.START_OF_TOP_NAVBAR); |
405 body.addContent(HtmlConstants.START_OF_TOP_NAVBAR); |
406 navDiv.addStyle(HtmlStyle.topNav); |
406 navDiv.addStyle(HtmlStyle.topNav); |
407 allClassesId += "navbar_top"; |
407 allClassesId += "navbar_top"; |
408 Content a = getMarkerAnchor("navbar_top"); |
408 Content a = getMarkerAnchor("navbar_top"); |
409 navDiv.addContent(a); |
409 navDiv.addContent(a); |
410 Content skipLinkContent = getHyperLink("", |
410 Content skipLinkContent = getHyperLink(DocLink.fragment("skip-navbar_top"), |
411 "skip-navbar_top", HtmlTree.EMPTY, configuration.getText( |
411 HtmlTree.EMPTY, |
412 "doclet.Skip_navigation_links"), ""); |
412 configuration.getText("doclet.Skip_navigation_links"), |
|
413 ""); |
413 navDiv.addContent(skipLinkContent); |
414 navDiv.addContent(skipLinkContent); |
414 } else { |
415 } else { |
415 body.addContent(HtmlConstants.START_OF_BOTTOM_NAVBAR); |
416 body.addContent(HtmlConstants.START_OF_BOTTOM_NAVBAR); |
416 navDiv.addStyle(HtmlStyle.bottomNav); |
417 navDiv.addStyle(HtmlStyle.bottomNav); |
417 allClassesId += "navbar_bottom"; |
418 allClassesId += "navbar_bottom"; |
418 Content a = getMarkerAnchor("navbar_bottom"); |
419 Content a = getMarkerAnchor("navbar_bottom"); |
419 navDiv.addContent(a); |
420 navDiv.addContent(a); |
420 Content skipLinkContent = getHyperLink("", |
421 Content skipLinkContent = getHyperLink(DocLink.fragment("skip-navbar_bottom"), |
421 "skip-navbar_bottom", HtmlTree.EMPTY, configuration.getText( |
422 HtmlTree.EMPTY, |
422 "doclet.Skip_navigation_links"), ""); |
423 configuration.getText("doclet.Skip_navigation_links"), |
|
424 ""); |
423 navDiv.addContent(skipLinkContent); |
425 navDiv.addContent(skipLinkContent); |
424 } |
426 } |
425 if (header) { |
427 if (header) { |
426 navDiv.addContent(getMarkerAnchor("navbar_top_firstrow")); |
428 navDiv.addContent(getMarkerAnchor("navbar_top_firstrow")); |
427 } else { |
429 } else { |
513 * |
515 * |
514 * @return a content tree for the link |
516 * @return a content tree for the link |
515 */ |
517 */ |
516 protected Content getNavLinkContents() { |
518 protected Content getNavLinkContents() { |
517 Content linkContent = getHyperLink(pathToRoot.resolve(DocPaths.OVERVIEW_SUMMARY), |
519 Content linkContent = getHyperLink(pathToRoot.resolve(DocPaths.OVERVIEW_SUMMARY), |
518 "", overviewLabel, "", ""); |
520 overviewLabel, "", ""); |
519 Content li = HtmlTree.LI(linkContent); |
521 Content li = HtmlTree.LI(linkContent); |
520 return li; |
522 return li; |
521 } |
523 } |
522 |
524 |
523 /** |
525 /** |
591 * |
593 * |
592 * @param link File to be linked, "index.html" |
594 * @param link File to be linked, "index.html" |
593 * @return a content tree for the link |
595 * @return a content tree for the link |
594 */ |
596 */ |
595 protected Content getNavShowLists(DocPath link) { |
597 protected Content getNavShowLists(DocPath link) { |
596 Content framesContent = getHyperLink(link.getPath() + "?" + path.getPath(), |
598 DocLink dl = new DocLink(link, path.getPath(), null); |
597 "", framesLabel, "", "_top"); |
599 Content framesContent = getHyperLink(dl, framesLabel, "", "_top"); |
598 Content li = HtmlTree.LI(framesContent); |
600 Content li = HtmlTree.LI(framesContent); |
599 return li; |
601 return li; |
600 } |
602 } |
601 |
603 |
602 /** |
604 /** |
613 * |
615 * |
614 * @param link File to be linked |
616 * @param link File to be linked |
615 * @return a content tree for the link |
617 * @return a content tree for the link |
616 */ |
618 */ |
617 protected Content getNavHideLists(DocPath link) { |
619 protected Content getNavHideLists(DocPath link) { |
618 Content noFramesContent = getHyperLink(link, "", noframesLabel, "", "_top"); |
620 Content noFramesContent = getHyperLink(link, noframesLabel, "", "_top"); |
619 Content li = HtmlTree.LI(noFramesContent); |
621 Content li = HtmlTree.LI(noFramesContent); |
620 return li; |
622 return li; |
621 } |
623 } |
622 |
624 |
623 /** |
625 /** |
631 protected Content getNavLinkTree() { |
633 protected Content getNavLinkTree() { |
632 Content treeLinkContent; |
634 Content treeLinkContent; |
633 PackageDoc[] packages = configuration.root.specifiedPackages(); |
635 PackageDoc[] packages = configuration.root.specifiedPackages(); |
634 if (packages.length == 1 && configuration.root.specifiedClasses().length == 0) { |
636 if (packages.length == 1 && configuration.root.specifiedClasses().length == 0) { |
635 treeLinkContent = getHyperLink(pathString(packages[0], |
637 treeLinkContent = getHyperLink(pathString(packages[0], |
636 DocPaths.PACKAGE_TREE), "", treeLabel, |
638 DocPaths.PACKAGE_TREE), treeLabel, |
637 "", ""); |
639 "", ""); |
638 } else { |
640 } else { |
639 treeLinkContent = getHyperLink(pathToRoot.resolve(DocPaths.OVERVIEW_TREE), |
641 treeLinkContent = getHyperLink(pathToRoot.resolve(DocPaths.OVERVIEW_TREE), |
640 "", treeLabel, "", ""); |
642 treeLabel, "", ""); |
641 } |
643 } |
642 Content li = HtmlTree.LI(treeLinkContent); |
644 Content li = HtmlTree.LI(treeLinkContent); |
643 return li; |
645 return li; |
644 } |
646 } |
645 |
647 |
671 * |
673 * |
672 * @return a content tree for the link |
674 * @return a content tree for the link |
673 */ |
675 */ |
674 protected Content getNavLinkDeprecated() { |
676 protected Content getNavLinkDeprecated() { |
675 Content linkContent = getHyperLink(pathToRoot.resolve(DocPaths.DEPRECATED_LIST), |
677 Content linkContent = getHyperLink(pathToRoot.resolve(DocPaths.DEPRECATED_LIST), |
676 "", deprecatedLabel, "", ""); |
678 deprecatedLabel, "", ""); |
677 Content li = HtmlTree.LI(linkContent); |
679 Content li = HtmlTree.LI(linkContent); |
678 return li; |
680 return li; |
679 } |
681 } |
680 |
682 |
681 /** |
683 /** |
685 * |
687 * |
686 * @return a content tree for the link |
688 * @return a content tree for the link |
687 */ |
689 */ |
688 protected Content getNavLinkClassIndex() { |
690 protected Content getNavLinkClassIndex() { |
689 Content allClassesContent = getHyperLink(pathToRoot.resolve( |
691 Content allClassesContent = getHyperLink(pathToRoot.resolve( |
690 DocPaths.ALLCLASSES_NOFRAME), "", |
692 DocPaths.ALLCLASSES_NOFRAME), |
691 allclassesLabel, "", ""); |
693 allclassesLabel, "", ""); |
692 Content li = HtmlTree.LI(allClassesContent); |
694 Content li = HtmlTree.LI(allClassesContent); |
693 return li; |
695 return li; |
694 } |
696 } |
695 |
697 |
700 */ |
702 */ |
701 protected Content getNavLinkIndex() { |
703 protected Content getNavLinkIndex() { |
702 Content linkContent = getHyperLink(pathToRoot.resolve( |
704 Content linkContent = getHyperLink(pathToRoot.resolve( |
703 (configuration.splitindex |
705 (configuration.splitindex |
704 ? DocPaths.INDEX_FILES.resolve(DocPaths.indexN(1)) |
706 ? DocPaths.INDEX_FILES.resolve(DocPaths.indexN(1)) |
705 : DocPaths.INDEX_ALL)), "", |
707 : DocPaths.INDEX_ALL)), |
706 indexLabel, "", ""); |
708 indexLabel, "", ""); |
707 Content li = HtmlTree.LI(linkContent); |
709 Content li = HtmlTree.LI(linkContent); |
708 return li; |
710 return li; |
709 } |
711 } |
710 |
712 |
915 } |
917 } |
916 } |
918 } |
917 } |
919 } |
918 if (included || pkg == null) { |
920 if (included || pkg == null) { |
919 return getHyperLinkString(pathString(pkg, DocPaths.PACKAGE_SUMMARY), |
921 return getHyperLinkString(pathString(pkg, DocPaths.PACKAGE_SUMMARY), |
920 "", label, isStrong, style); |
922 label, isStrong, style); |
921 } else { |
923 } else { |
922 String crossPkgLink = getCrossPackageLink(Util.getPackageName(pkg)); |
924 DocLink crossPkgLink = getCrossPackageLink(Util.getPackageName(pkg)); |
923 if (crossPkgLink != null) { |
925 if (crossPkgLink != null) { |
924 return getHyperLinkString(/*TEMP*/ DocPath.create(crossPkgLink), "", label, isStrong, style); |
926 return getHyperLinkString(crossPkgLink, label, isStrong, style); |
925 } else { |
927 } else { |
926 return label; |
928 return label; |
927 } |
929 } |
928 } |
930 } |
929 } |
931 } |
946 } |
948 } |
947 } |
949 } |
948 } |
950 } |
949 if (included || pkg == null) { |
951 if (included || pkg == null) { |
950 return getHyperLink(pathString(pkg, DocPaths.PACKAGE_SUMMARY), |
952 return getHyperLink(pathString(pkg, DocPaths.PACKAGE_SUMMARY), |
951 "", label); |
953 label); |
952 } else { |
954 } else { |
953 String crossPkgLink = getCrossPackageLink(Util.getPackageName(pkg)); |
955 DocLink crossPkgLink = getCrossPackageLink(Util.getPackageName(pkg)); |
954 if (crossPkgLink != null) { |
956 if (crossPkgLink != null) { |
955 return getHyperLink(/*TEMP*/ DocPath.create(crossPkgLink), "", label); |
957 return getHyperLink(crossPkgLink, label); |
956 } else { |
958 } else { |
957 return label; |
959 return label; |
958 } |
960 } |
959 } |
961 } |
960 } |
962 } |
981 cd = (ClassDoc) doc; |
983 cd = (ClassDoc) doc; |
982 } |
984 } |
983 DocPath href = pathToRoot |
985 DocPath href = pathToRoot |
984 .resolve(DocPaths.SOURCE_OUTPUT) |
986 .resolve(DocPaths.SOURCE_OUTPUT) |
985 .resolve(DocPath.forClass(cd)); |
987 .resolve(DocPath.forClass(cd)); |
986 Content linkContent = getHyperLink(href, SourceToHTMLConverter.getAnchorName(doc), label, "", ""); |
988 Content linkContent = getHyperLink(href.fragment(SourceToHTMLConverter.getAnchorName(doc)), label, "", ""); |
987 htmltree.addContent(linkContent); |
989 htmltree.addContent(linkContent); |
988 } |
990 } |
989 |
991 |
990 /** |
992 /** |
991 * Return the link to the given class. |
993 * Return the link to the given class. |
1007 * @param linkInfo the information about the link. |
1009 * @param linkInfo the information about the link. |
1008 * @return the type for the given class. |
1010 * @return the type for the given class. |
1009 */ |
1011 */ |
1010 public String getTypeParameterLinks(LinkInfoImpl linkInfo) { |
1012 public String getTypeParameterLinks(LinkInfoImpl linkInfo) { |
1011 LinkFactoryImpl factory = new LinkFactoryImpl(this); |
1013 LinkFactoryImpl factory = new LinkFactoryImpl(this); |
1012 return ((LinkOutputImpl) |
1014 return factory.getTypeParameterLinks(linkInfo, false).toString(); |
1013 factory.getTypeParameterLinks(linkInfo, false)).toString(); |
|
1014 } |
1015 } |
1015 |
1016 |
1016 /************************************************************* |
1017 /************************************************************* |
1017 * Return a class cross link to external class documentation. |
1018 * Return a class cross link to external class documentation. |
1018 * The name must be fully qualified to determine which package |
1019 * The name must be fully qualified to determine which package |
1028 * @param code true if the label should be code font. |
1029 * @param code true if the label should be code font. |
1029 */ |
1030 */ |
1030 public String getCrossClassLink(String qualifiedClassName, String refMemName, |
1031 public String getCrossClassLink(String qualifiedClassName, String refMemName, |
1031 String label, boolean strong, String style, |
1032 String label, boolean strong, String style, |
1032 boolean code) { |
1033 boolean code) { |
1033 String className = "", |
1034 String className = ""; |
1034 packageName = qualifiedClassName == null ? "" : qualifiedClassName; |
1035 String packageName = qualifiedClassName == null ? "" : qualifiedClassName; |
1035 int periodIndex; |
1036 int periodIndex; |
1036 while((periodIndex = packageName.lastIndexOf('.')) != -1) { |
1037 while ((periodIndex = packageName.lastIndexOf('.')) != -1) { |
1037 className = packageName.substring(periodIndex + 1, packageName.length()) + |
1038 className = packageName.substring(periodIndex + 1, packageName.length()) + |
1038 (className.length() > 0 ? "." + className : ""); |
1039 (className.length() > 0 ? "." + className : ""); |
1039 String defaultLabel = code ? codeText(className) : className; |
1040 String defaultLabel = code ? codeText(className) : className; |
1040 packageName = packageName.substring(0, periodIndex); |
1041 packageName = packageName.substring(0, periodIndex); |
1041 if (getCrossPackageLink(packageName) != null) { |
1042 if (getCrossPackageLink(packageName) != null) { |
1042 //The package exists in external documentation, so link to the external |
1043 //The package exists in external documentation, so link to the external |
1043 //class (assuming that it exists). This is definitely a limitation of |
1044 //class (assuming that it exists). This is definitely a limitation of |
1044 //the -link option. There are ways to determine if an external package |
1045 //the -link option. There are ways to determine if an external package |
1045 //exists, but no way to determine if the external class exists. We just |
1046 //exists, but no way to determine if the external class exists. We just |
1046 //have to assume that it does. |
1047 //have to assume that it does. |
1047 return getHyperLinkString( |
1048 DocLink link = configuration.extern.getExternalLink(packageName, pathToRoot, |
1048 configuration.extern.getExternalLink(packageName, pathToRoot, |
1049 className + ".html", refMemName); |
1049 className + ".html?is-external=true"), |
1050 return getHyperLinkString(link, |
1050 refMemName == null ? "" : refMemName, |
1051 (label == null) || label.length() == 0 ? defaultLabel : label, |
1051 label == null || label.length() == 0 ? defaultLabel : label, |
1052 |
|
1053 |
1052 strong, style, |
1054 strong, style, |
1053 configuration.getText("doclet.Href_Class_Or_Interface_Title", packageName), |
1055 configuration.getText("doclet.Href_Class_Or_Interface_Title", packageName), |
1054 ""); |
1056 ""); |
1055 } |
1057 } |
1056 } |
1058 } |
1062 return configuration.isGeneratedDoc(cd); |
1064 return configuration.isGeneratedDoc(cd); |
1063 } |
1065 } |
1064 return configuration.extern.isExternal(cd); |
1066 return configuration.extern.isExternal(cd); |
1065 } |
1067 } |
1066 |
1068 |
1067 public String getCrossPackageLink(String pkgName) { |
1069 public DocLink getCrossPackageLink(String pkgName) { |
1068 return configuration.extern.getExternalLink(pkgName, pathToRoot, |
1070 return configuration.extern.getExternalLink(pkgName, pathToRoot, |
1069 "package-summary.html?is-external=true"); |
1071 DocPaths.PACKAGE_SUMMARY.getPath()); |
1070 } |
1072 } |
1071 |
1073 |
1072 /** |
1074 /** |
1073 * Get the class link. |
1075 * Get the class link. |
1074 * |
1076 * |
1092 addPreQualifiedClassLink(context, cd, false, contentTree); |
1094 addPreQualifiedClassLink(context, cd, false, contentTree); |
1093 } |
1095 } |
1094 |
1096 |
1095 /** |
1097 /** |
1096 * Retrieve the class link with the package portion of the label in |
1098 * Retrieve the class link with the package portion of the label in |
1097 * plain text. If the qualifier is excluded, it willnot be included in the |
1099 * plain text. If the qualifier is excluded, it will not be included in the |
1098 * link label. |
1100 * link label. |
1099 * |
1101 * |
1100 * @param cd the class to link to. |
1102 * @param cd the class to link to. |
1101 * @param isStrong true if the link should be strong. |
1103 * @param isStrong true if the link should be strong. |
1102 * @return the link with the package portion of the label in plain text. |
1104 * @return the link with the package portion of the label in plain text. |
1276 if (label.isEmpty()) |
1278 if (label.isEmpty()) |
1277 label = plainOrCodeText(plain, refPackage.name()); |
1279 label = plainOrCodeText(plain, refPackage.name()); |
1278 return getPackageLinkString(refPackage, label, false); |
1280 return getPackageLinkString(refPackage, label, false); |
1279 } else { |
1281 } else { |
1280 //@see is not referencing an included class or package. Check for cross links. |
1282 //@see is not referencing an included class or package. Check for cross links. |
1281 String classCrossLink, packageCrossLink = getCrossPackageLink(refClassName); |
1283 String classCrossLink; |
|
1284 DocLink packageCrossLink = getCrossPackageLink(refClassName); |
1282 if (packageCrossLink != null) { |
1285 if (packageCrossLink != null) { |
1283 //Package cross link found |
1286 //Package cross link found |
1284 return getHyperLinkString(/*TEMP*/ DocPath.create(packageCrossLink), "", |
1287 return getHyperLinkString(packageCrossLink, |
1285 (label.isEmpty() ? text : label), false); |
1288 (label.isEmpty() ? text : label), false); |
1286 } else if ((classCrossLink = getCrossClassLink(refClassName, |
1289 } else if ((classCrossLink = getCrossClassLink(refClassName, |
1287 refMemName, label, false, "", !plain)) != null) { |
1290 refMemName, label, false, "", !plain)) != null) { |
1288 //Class cross link found (possibly to a member in the class) |
1291 //Class cross link found (possibly to a member in the class) |
1289 return classCrossLink; |
1292 return classCrossLink; |