Exemplo n.º 1
0
  /** {@inheritDoc} */
  public Content seeTagOutput(Doc holder, SeeTag[] seeTags) {
    ContentBuilder body = new ContentBuilder();
    if (seeTags.length > 0) {
      for (int i = 0; i < seeTags.length; ++i) {
        appendSeparatorIfNotEmpty(body);
        body.addContent(htmlWriter.seeTagToContent(seeTags[i]));
      }
    }
    if (holder.isField()
        && ((FieldDoc) holder).constantValue() != null
        && htmlWriter instanceof ClassWriterImpl) {
      // Automatically add link to constant values page for constant fields.
      appendSeparatorIfNotEmpty(body);
      DocPath constantsPath = htmlWriter.pathToRoot.resolve(DocPaths.CONSTANT_VALUES);
      String whichConstant =
          ((ClassWriterImpl) htmlWriter).getClassDoc().qualifiedName()
              + "."
              + ((FieldDoc) holder).name();
      DocLink link = constantsPath.fragment(whichConstant);
      body.addContent(
          htmlWriter.getHyperLink(
              link, new StringContent(configuration.getText("doclet.Constants_Summary"))));
    }
    if (holder.isClass() && ((ClassDoc) holder).isSerializable()) {
      // Automatically add link to serialized form page for serializable classes.
      if ((SerializedFormBuilder.serialInclude(holder)
          && SerializedFormBuilder.serialInclude(((ClassDoc) holder).containingPackage()))) {
        appendSeparatorIfNotEmpty(body);
        DocPath serialPath = htmlWriter.pathToRoot.resolve(DocPaths.SERIALIZED_FORM);
        DocLink link = serialPath.fragment(((ClassDoc) holder).qualifiedName());
        body.addContent(
            htmlWriter.getHyperLink(
                link, new StringContent(configuration.getText("doclet.Serialized_Form"))));
      }
    }
    if (body.isEmpty()) return body;

    ContentBuilder result = new ContentBuilder();
    result.addContent(
        HtmlTree.DT(
            HtmlTree.SPAN(
                HtmlStyle.seeLabel, new StringContent(configuration.getText("doclet.See_Also")))));
    result.addContent(HtmlTree.DD(body));
    return result;
  }
Exemplo n.º 2
0
 private void appendSeparatorIfNotEmpty(ContentBuilder body) {
   if (!body.isEmpty()) {
     body.addContent(", ");
     body.addContent(DocletConstants.NL);
   }
 }