src/share/classes/com/sun/tools/doclets/formats/html/HtmlDocletWriter.java

changeset 1373
4a1c57a1c410
parent 1372
78962d89f283
child 1381
23fe1a96bc0f
     1.1 --- a/src/share/classes/com/sun/tools/doclets/formats/html/HtmlDocletWriter.java	Tue Oct 23 13:20:37 2012 -0700
     1.2 +++ b/src/share/classes/com/sun/tools/doclets/formats/html/HtmlDocletWriter.java	Tue Oct 23 13:58:56 2012 -0700
     1.3 @@ -287,7 +287,7 @@
     1.4       */
     1.5      public Content getTargetPackageLink(PackageDoc pd, String target,
     1.6              Content label) {
     1.7 -        return getHyperLink(pathString(pd, DocPaths.PACKAGE_SUMMARY), "", label, "", target);
     1.8 +        return getHyperLink(pathString(pd, DocPaths.PACKAGE_SUMMARY), label, "", target);
     1.9      }
    1.10  
    1.11      /**
    1.12 @@ -407,9 +407,10 @@
    1.13                  allClassesId += "navbar_top";
    1.14                  Content a = getMarkerAnchor("navbar_top");
    1.15                  navDiv.addContent(a);
    1.16 -                Content skipLinkContent = getHyperLink("",
    1.17 -                        "skip-navbar_top", HtmlTree.EMPTY, configuration.getText(
    1.18 -                        "doclet.Skip_navigation_links"), "");
    1.19 +                Content skipLinkContent = getHyperLink(DocLink.fragment("skip-navbar_top"),
    1.20 +                        HtmlTree.EMPTY,
    1.21 +                        configuration.getText("doclet.Skip_navigation_links"),
    1.22 +                        "");
    1.23                  navDiv.addContent(skipLinkContent);
    1.24              } else {
    1.25                  body.addContent(HtmlConstants.START_OF_BOTTOM_NAVBAR);
    1.26 @@ -417,9 +418,10 @@
    1.27                  allClassesId += "navbar_bottom";
    1.28                  Content a = getMarkerAnchor("navbar_bottom");
    1.29                  navDiv.addContent(a);
    1.30 -                Content skipLinkContent = getHyperLink("",
    1.31 -                        "skip-navbar_bottom", HtmlTree.EMPTY, configuration.getText(
    1.32 -                        "doclet.Skip_navigation_links"), "");
    1.33 +                Content skipLinkContent = getHyperLink(DocLink.fragment("skip-navbar_bottom"),
    1.34 +                        HtmlTree.EMPTY,
    1.35 +                        configuration.getText("doclet.Skip_navigation_links"),
    1.36 +                        "");
    1.37                  navDiv.addContent(skipLinkContent);
    1.38              }
    1.39              if (header) {
    1.40 @@ -515,7 +517,7 @@
    1.41       */
    1.42      protected Content getNavLinkContents() {
    1.43          Content linkContent = getHyperLink(pathToRoot.resolve(DocPaths.OVERVIEW_SUMMARY),
    1.44 -                "", overviewLabel, "", "");
    1.45 +                overviewLabel, "", "");
    1.46          Content li = HtmlTree.LI(linkContent);
    1.47          return li;
    1.48      }
    1.49 @@ -562,7 +564,7 @@
    1.50      public Content getNavLinkPrevious(DocPath prev) {
    1.51          Content li;
    1.52          if (prev != null) {
    1.53 -            li = HtmlTree.LI(getHyperLink(prev, "", prevLabel, "", ""));
    1.54 +            li = HtmlTree.LI(getHyperLink(prev, prevLabel, "", ""));
    1.55          }
    1.56          else
    1.57              li = HtmlTree.LI(prevLabel);
    1.58 @@ -579,7 +581,7 @@
    1.59      public Content getNavLinkNext(DocPath next) {
    1.60          Content li;
    1.61          if (next != null) {
    1.62 -            li = HtmlTree.LI(getHyperLink(next, "", nextLabel, "", ""));
    1.63 +            li = HtmlTree.LI(getHyperLink(next, nextLabel, "", ""));
    1.64          }
    1.65          else
    1.66              li = HtmlTree.LI(nextLabel);
    1.67 @@ -593,8 +595,8 @@
    1.68       * @return a content tree for the link
    1.69       */
    1.70      protected Content getNavShowLists(DocPath link) {
    1.71 -        Content framesContent = getHyperLink(link.getPath() + "?" + path.getPath(),
    1.72 -                "", framesLabel, "", "_top");
    1.73 +        DocLink dl = new DocLink(link, path.getPath(), null);
    1.74 +        Content framesContent = getHyperLink(dl, framesLabel, "", "_top");
    1.75          Content li = HtmlTree.LI(framesContent);
    1.76          return li;
    1.77      }
    1.78 @@ -615,7 +617,7 @@
    1.79       * @return a content tree for the link
    1.80       */
    1.81      protected Content getNavHideLists(DocPath link) {
    1.82 -        Content noFramesContent = getHyperLink(link, "", noframesLabel, "", "_top");
    1.83 +        Content noFramesContent = getHyperLink(link, noframesLabel, "", "_top");
    1.84          Content li = HtmlTree.LI(noFramesContent);
    1.85          return li;
    1.86      }
    1.87 @@ -633,11 +635,11 @@
    1.88          PackageDoc[] packages = configuration.root.specifiedPackages();
    1.89          if (packages.length == 1 && configuration.root.specifiedClasses().length == 0) {
    1.90              treeLinkContent = getHyperLink(pathString(packages[0],
    1.91 -                    DocPaths.PACKAGE_TREE), "", treeLabel,
    1.92 +                    DocPaths.PACKAGE_TREE), treeLabel,
    1.93                      "", "");
    1.94          } else {
    1.95              treeLinkContent = getHyperLink(pathToRoot.resolve(DocPaths.OVERVIEW_TREE),
    1.96 -                    "", treeLabel, "", "");
    1.97 +                    treeLabel, "", "");
    1.98          }
    1.99          Content li = HtmlTree.LI(treeLinkContent);
   1.100          return li;
   1.101 @@ -673,7 +675,7 @@
   1.102       */
   1.103      protected Content getNavLinkDeprecated() {
   1.104          Content linkContent = getHyperLink(pathToRoot.resolve(DocPaths.DEPRECATED_LIST),
   1.105 -                "", deprecatedLabel, "", "");
   1.106 +                deprecatedLabel, "", "");
   1.107          Content li = HtmlTree.LI(linkContent);
   1.108          return li;
   1.109      }
   1.110 @@ -687,7 +689,7 @@
   1.111       */
   1.112      protected Content getNavLinkClassIndex() {
   1.113          Content allClassesContent = getHyperLink(pathToRoot.resolve(
   1.114 -                DocPaths.ALLCLASSES_NOFRAME), "",
   1.115 +                DocPaths.ALLCLASSES_NOFRAME),
   1.116                  allclassesLabel, "", "");
   1.117          Content li = HtmlTree.LI(allClassesContent);
   1.118          return li;
   1.119 @@ -702,7 +704,7 @@
   1.120          Content linkContent = getHyperLink(pathToRoot.resolve(
   1.121                  (configuration.splitindex
   1.122                      ? DocPaths.INDEX_FILES.resolve(DocPaths.indexN(1))
   1.123 -                    : DocPaths.INDEX_ALL)), "",
   1.124 +                    : DocPaths.INDEX_ALL)),
   1.125              indexLabel, "", "");
   1.126          Content li = HtmlTree.LI(linkContent);
   1.127          return li;
   1.128 @@ -723,7 +725,7 @@
   1.129          } else {
   1.130              helpfilenm = DocPath.create(new File(helpfile).getName());
   1.131          }
   1.132 -        Content linkContent = getHyperLink(pathToRoot.resolve(helpfilenm), "",
   1.133 +        Content linkContent = getHyperLink(pathToRoot.resolve(helpfilenm),
   1.134                  helpLabel, "", "");
   1.135          Content li = HtmlTree.LI(linkContent);
   1.136          return li;
   1.137 @@ -917,11 +919,11 @@
   1.138          }
   1.139          if (included || pkg == null) {
   1.140              return getHyperLinkString(pathString(pkg, DocPaths.PACKAGE_SUMMARY),
   1.141 -                                "", label, isStrong, style);
   1.142 +                                label, isStrong, style);
   1.143          } else {
   1.144 -            String crossPkgLink = getCrossPackageLink(Util.getPackageName(pkg));
   1.145 +            DocLink crossPkgLink = getCrossPackageLink(Util.getPackageName(pkg));
   1.146              if (crossPkgLink != null) {
   1.147 -                return getHyperLinkString(/*TEMP*/ DocPath.create(crossPkgLink), "", label, isStrong, style);
   1.148 +                return getHyperLinkString(crossPkgLink, label, isStrong, style);
   1.149              } else {
   1.150                  return label;
   1.151              }
   1.152 @@ -948,11 +950,11 @@
   1.153          }
   1.154          if (included || pkg == null) {
   1.155              return getHyperLink(pathString(pkg, DocPaths.PACKAGE_SUMMARY),
   1.156 -                                "", label);
   1.157 +                    label);
   1.158          } else {
   1.159 -            String crossPkgLink = getCrossPackageLink(Util.getPackageName(pkg));
   1.160 +            DocLink crossPkgLink = getCrossPackageLink(Util.getPackageName(pkg));
   1.161              if (crossPkgLink != null) {
   1.162 -                return getHyperLink(/*TEMP*/ DocPath.create(crossPkgLink), "", label);
   1.163 +                return getHyperLink(crossPkgLink, label);
   1.164              } else {
   1.165                  return label;
   1.166              }
   1.167 @@ -983,7 +985,7 @@
   1.168          DocPath href = pathToRoot
   1.169                  .resolve(DocPaths.SOURCE_OUTPUT)
   1.170                  .resolve(DocPath.forClass(cd));
   1.171 -        Content linkContent = getHyperLink(href, SourceToHTMLConverter.getAnchorName(doc), label, "", "");
   1.172 +        Content linkContent = getHyperLink(href.fragment(SourceToHTMLConverter.getAnchorName(doc)), label, "", "");
   1.173          htmltree.addContent(linkContent);
   1.174      }
   1.175  
   1.176 @@ -996,7 +998,7 @@
   1.177       */
   1.178      public String getLink(LinkInfoImpl linkInfo) {
   1.179          LinkFactoryImpl factory = new LinkFactoryImpl(this);
   1.180 -        String link = ((LinkOutputImpl) factory.getLinkOutput(linkInfo)).toString();
   1.181 +        String link = factory.getLinkOutput(linkInfo).toString();
   1.182          displayLength += linkInfo.displayLength;
   1.183          return link;
   1.184      }
   1.185 @@ -1009,8 +1011,7 @@
   1.186       */
   1.187      public String getTypeParameterLinks(LinkInfoImpl linkInfo) {
   1.188          LinkFactoryImpl factory = new LinkFactoryImpl(this);
   1.189 -        return ((LinkOutputImpl)
   1.190 -            factory.getTypeParameterLinks(linkInfo, false)).toString();
   1.191 +        return factory.getTypeParameterLinks(linkInfo, false).toString();
   1.192      }
   1.193  
   1.194      /*************************************************************
   1.195 @@ -1030,10 +1031,10 @@
   1.196      public String getCrossClassLink(String qualifiedClassName, String refMemName,
   1.197                                      String label, boolean strong, String style,
   1.198                                      boolean code) {
   1.199 -        String className = "",
   1.200 -            packageName = qualifiedClassName == null ? "" : qualifiedClassName;
   1.201 +        String className = "";
   1.202 +        String packageName = qualifiedClassName == null ? "" : qualifiedClassName;
   1.203          int periodIndex;
   1.204 -        while((periodIndex = packageName.lastIndexOf('.')) != -1) {
   1.205 +        while ((periodIndex = packageName.lastIndexOf('.')) != -1) {
   1.206              className = packageName.substring(periodIndex + 1, packageName.length()) +
   1.207                  (className.length() > 0 ? "." + className : "");
   1.208              String defaultLabel = code ? codeText(className) : className;
   1.209 @@ -1044,11 +1045,12 @@
   1.210                  //the -link option.  There are ways to determine if an external package
   1.211                  //exists, but no way to determine if the external class exists.  We just
   1.212                  //have to assume that it does.
   1.213 -                return getHyperLinkString(
   1.214 -                    configuration.extern.getExternalLink(packageName, pathToRoot,
   1.215 -                                className + ".html?is-external=true"),
   1.216 -                    refMemName == null ? "" : refMemName,
   1.217 -                    label == null || label.length() == 0 ? defaultLabel : label,
   1.218 +                DocLink link = configuration.extern.getExternalLink(packageName, pathToRoot,
   1.219 +                                className + ".html", refMemName);
   1.220 +                return getHyperLinkString(link,
   1.221 +                    (label == null) || label.length() == 0 ? defaultLabel : label,
   1.222 +
   1.223 +
   1.224                      strong, style,
   1.225                      configuration.getText("doclet.Href_Class_Or_Interface_Title", packageName),
   1.226                      "");
   1.227 @@ -1064,9 +1066,9 @@
   1.228          return configuration.extern.isExternal(cd);
   1.229      }
   1.230  
   1.231 -    public String getCrossPackageLink(String pkgName) {
   1.232 +    public DocLink getCrossPackageLink(String pkgName) {
   1.233          return configuration.extern.getExternalLink(pkgName, pathToRoot,
   1.234 -            "package-summary.html?is-external=true");
   1.235 +            DocPaths.PACKAGE_SUMMARY.getPath());
   1.236      }
   1.237  
   1.238      /**
   1.239 @@ -1094,7 +1096,7 @@
   1.240  
   1.241      /**
   1.242       * Retrieve the class link with the package portion of the label in
   1.243 -     * plain text.  If the qualifier is excluded, it willnot be included in the
   1.244 +     * plain text.  If the qualifier is excluded, it will not be included in the
   1.245       * link label.
   1.246       *
   1.247       * @param cd the class to link to.
   1.248 @@ -1278,10 +1280,11 @@
   1.249                  return getPackageLinkString(refPackage, label, false);
   1.250              } else {
   1.251                  //@see is not referencing an included class or package.  Check for cross links.
   1.252 -                String classCrossLink, packageCrossLink = getCrossPackageLink(refClassName);
   1.253 +                String classCrossLink;
   1.254 +                DocLink packageCrossLink = getCrossPackageLink(refClassName);
   1.255                  if (packageCrossLink != null) {
   1.256                      //Package cross link found
   1.257 -                    return getHyperLinkString(/*TEMP*/ DocPath.create(packageCrossLink), "",
   1.258 +                    return getHyperLinkString(packageCrossLink,
   1.259                          (label.isEmpty() ? text : label), false);
   1.260                  } else if ((classCrossLink = getCrossClassLink(refClassName,
   1.261                          refMemName, label, false, "", !plain)) != null) {

mercurial