Esempio n. 1
0
 /** {@inheritDoc} */
 public Content simpleTagOutput(Tag simpleTag, String header) {
   ContentBuilder result = new ContentBuilder();
   result.addContent(HtmlTree.DT(HtmlTree.SPAN(HtmlStyle.simpleTagLabel, new RawHtml(header))));
   Content body = htmlWriter.commentTagsToContent(simpleTag, null, simpleTag.inlineTags(), false);
   result.addContent(HtmlTree.DD(body));
   return result;
 }
Esempio n. 2
0
 /** {@inheritDoc} */
 public Content paramTagOutput(ParamTag paramTag, String paramName) {
   ContentBuilder body = new ContentBuilder();
   body.addContent(HtmlTree.CODE(new RawHtml(paramName)));
   body.addContent(" - ");
   body.addContent(htmlWriter.commentTagsToContent(paramTag, null, paramTag.inlineTags(), false));
   HtmlTree result = HtmlTree.DD(body);
   return result;
 }
Esempio n. 3
0
 /** {@inheritDoc} */
 public Content returnTagOutput(Tag returnTag) {
   ContentBuilder result = new ContentBuilder();
   result.addContent(
       HtmlTree.DT(
           HtmlTree.SPAN(
               HtmlStyle.returnLabel,
               new StringContent(configuration.getText("doclet.Returns")))));
   result.addContent(
       HtmlTree.DD(
           htmlWriter.commentTagsToContent(returnTag, null, returnTag.inlineTags(), false)));
   return result;
 }
Esempio n. 4
0
 /** {@inheritDoc} */
 public Content throwsTagOutput(ThrowsTag throwsTag) {
   ContentBuilder body = new ContentBuilder();
   Content excName =
       (throwsTag.exceptionType() == null)
           ? new RawHtml(throwsTag.exceptionName())
           : htmlWriter.getLink(
               new LinkInfoImpl(
                   configuration, LinkInfoImpl.Kind.MEMBER, throwsTag.exceptionType()));
   body.addContent(HtmlTree.CODE(excName));
   Content desc = htmlWriter.commentTagsToContent(throwsTag, null, throwsTag.inlineTags(), false);
   if (desc != null && !desc.isEmpty()) {
     body.addContent(" - ");
     body.addContent(desc);
   }
   HtmlTree result = HtmlTree.DD(body);
   return result;
 }
Esempio n. 5
0
 /** {@inheritDoc} */
 public Content deprecatedTagOutput(Doc doc) {
   ContentBuilder result = new ContentBuilder();
   Tag[] deprs = doc.tags("deprecated");
   if (doc instanceof ClassDoc) {
     if (Util.isDeprecated((ProgramElementDoc) doc)) {
       result.addContent(
           HtmlTree.SPAN(
               HtmlStyle.deprecatedLabel,
               new StringContent(configuration.getText("doclet.Deprecated"))));
       result.addContent(RawHtml.nbsp);
       if (deprs.length > 0) {
         Tag[] commentTags = deprs[0].inlineTags();
         if (commentTags.length > 0) {
           result.addContent(commentTagsToOutput(null, doc, deprs[0].inlineTags(), false));
         }
       }
     }
   } else {
     MemberDoc member = (MemberDoc) doc;
     if (Util.isDeprecated((ProgramElementDoc) doc)) {
       result.addContent(
           HtmlTree.SPAN(
               HtmlStyle.deprecatedLabel,
               new StringContent(configuration.getText("doclet.Deprecated"))));
       result.addContent(RawHtml.nbsp);
       if (deprs.length > 0) {
         Content body = commentTagsToOutput(null, doc, deprs[0].inlineTags(), false);
         if (!body.isEmpty()) result.addContent(HtmlTree.SPAN(HtmlStyle.deprecationComment, body));
       }
     } else {
       if (Util.isDeprecated(member.containingClass())) {
         result.addContent(
             HtmlTree.SPAN(
                 HtmlStyle.deprecatedLabel,
                 new StringContent(configuration.getText("doclet.Deprecated"))));
         result.addContent(RawHtml.nbsp);
       }
     }
   }
   return result;
 }
Esempio n. 6
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;
  }
Esempio n. 7
0
 /** {@inheritDoc} */
 public Content simpleTagOutput(Tag[] simpleTags, String header) {
   ContentBuilder result = new ContentBuilder();
   result.addContent(HtmlTree.DT(HtmlTree.SPAN(HtmlStyle.simpleTagLabel, new RawHtml(header))));
   ContentBuilder body = new ContentBuilder();
   for (int i = 0; i < simpleTags.length; i++) {
     if (i > 0) {
       body.addContent(", ");
     }
     body.addContent(
         htmlWriter.commentTagsToContent(simpleTags[i], null, simpleTags[i].inlineTags(), false));
   }
   result.addContent(HtmlTree.DD(body));
   return result;
 }
Esempio n. 8
0
 private void appendSeparatorIfNotEmpty(ContentBuilder body) {
   if (!body.isEmpty()) {
     body.addContent(", ");
     body.addContent(DocletConstants.NL);
   }
 }