Ejemplo n.º 1
0
  /**
   * Build the filename for a doc object and returns it
   *
   * @param doc
   * @param className
   * @return
   */
  String buildFileName(Doc doc, String className) {
    String type;

    if (doc.isMethod()) {
      type = "_method_";
    } else if (doc.isClass()) {
      type = "_class_";
    } else if (doc.isField()) {
      type = "_field_";
    } else {
      type = "_";
    }
    return className.toLowerCase() + type + doc.name().toLowerCase();
  }
Ejemplo n.º 2
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;
  }
Ejemplo n.º 3
0
 /** Overrides {@link HtmlStandardWriter#generateTagInfo} to include Plugged In's tags. */
 public void generateTagInfo(Doc doc) {
   Tag[] sinces = doc.tags("since");
   Tag[] sees = doc.seeTags();
   Tag[] authors;
   Tag[] versions;
   Tag[] copyrights;
   Tag[] createds;
   Tag[] modifieds;
   Tag[] licences;
   if (configuration.showauthor) {
     authors = doc.tags("author");
   } else {
     authors = new Tag[0];
   }
   if (configuration.showversion) {
     versions = doc.tags("version");
   } else {
     versions = new Tag[0];
   }
   if (configuration.nosince) {
     sinces = new Tag[0];
   }
   copyrights = doc.tags("copyright");
   createds = doc.tags("created");
   licences = doc.tags("licence");
   modifieds = doc.tags("modified");
   if (sinces.length > 0
       || sees.length > 0
       || authors.length > 0
       || versions.length > 0
       || copyrights.length > 0
       || createds.length > 0
       || licences.length > 0
       || modifieds.length > 0
       || (doc.isClass() && ((ClassDoc) doc).isSerializable())) {
     dl();
     printSinceTag(doc);
     if (versions.length > 0) {
       // There is going to be only one Version tag.
       dt();
       boldText("doclet.Version");
       dd();
       printInlineComment(versions[0]);
       ddEnd();
     }
     if (authors.length > 0) {
       dt();
       boldText("doclet.Author");
       dd();
       for (int i = 0; i < authors.length; ++i) {
         if (i > 0) {
           print(", ");
         }
         printInlineComment(authors[i]);
       }
       ddEnd();
     }
     if (createds.length > 0) {
       // There is going to be only one Created tag.
       dt();
       write("<b>Created:</b>");
       dd();
       printInlineComment(createds[0]);
       ddEnd();
     }
     if (modifieds.length > 0) {
       dt();
       write("<b>Modified:</b>");
       dd();
       for (int i = 0; i < modifieds.length; ++i) {
         if (i > 0) {
           print(", ");
         }
         printInlineComment(modifieds[i]);
       }
       ddEnd();
     }
     if (copyrights.length > 0) {
       dt();
       write("<b>Copyright:</b>");
       dd();
       for (int i = 0; i < copyrights.length; ++i) {
         if (i > 0) {
           print(", ");
         }
         printInlineComment(copyrights[i]);
       }
       ddEnd();
     }
     if (licences.length > 0) {
       // There is going to be only one Licence tag.
       dt();
       write("<b>Licence:</b>");
       dd();
       printInlineComment(licences[0]);
       ddEnd();
     }
     // printSeeTags(doc);  // This method vanished in 1.4 beta 3
     dlEnd();
   }
 }
Ejemplo n.º 4
0
 public boolean isClass() {
   return mDoc.isClass();
 }
 /**
  * Return true if the given Doc should be included in the serialized form.
  *
  * @param doc the Doc object to check for serializability.
  */
 public static boolean serialInclude(Doc doc) {
   if (doc == null) {
     return false;
   }
   return doc.isClass() ? serialClassInclude((ClassDoc) doc) : serialDocInclude(doc);
 }