コード例 #1
0
ファイル: BasicTemplate.java プロジェクト: noncom/prodoc
 /**
  * Adds a parameter and its description to parametersection of the doc
  *
  * @param parametername
  * @param parameterdescription
  */
 private void addParameter(String parametername, String parameterdescription) {
   PARAMETER_NAME_TAG.setContent(parametername);
   memberParameter.insertTagContent(PARAMETER_NAME_TAG);
   PARAMETER_DESCRIPTION_TAG.setContent(parameterdescription);
   memberParameter.insertTagContent(PARAMETER_DESCRIPTION_TAG);
   PARAMETER_TAG.addContent(memberParameter.getTemplateContent());
 }
コード例 #2
0
ファイル: BasicTemplate.java プロジェクト: noncom/prodoc
  /**
   * Reads the example file specified by the example tag of a doc member and adds it to the example
   * section of the doc
   *
   * @param doc
   * @throws IOException
   */
  void setExample(Doc doc) throws IOException {
    Tag[] exampleTag = doc.tags("@example");
    if (exampleTag.length > 0) {
      StringBuffer exampleBuffer = new StringBuffer();
      FileReader in;
      int c;
      String[] pathComponents = exampleTag[0].text().split("/");
      String filePath =
          exampleTag[0].text() + "/" + pathComponents[pathComponents.length - 1] + ".pde";
      in = new FileReader(new File(exampleFolder, filePath));

      while ((c = in.read()) != -1) {
        if ((char) c == '<') {
          exampleBuffer.append("&lt;");
        } else {
          exampleBuffer.append((char) c);
        }
      }

      in.close();

      String exampleString = exampleBuffer.toString();

      EXAMPLE_TAG.setContent(exampleString);

    } else {
      EXAMPLE_TAG.setContent("None available");
    }
  }
コード例 #3
0
ファイル: BasicTemplate.java プロジェクト: noncom/prodoc
 /**
  * Sets the usage for a doc item
  *
  * @param doc
  */
 void setUsage(Doc doc) {
   Tag[] usageTag = doc.tags("@usage");
   if (usageTag.length > 0) {
     USAGE_TAG.setContent(usageTag[0].text());
   } else {
     USAGE_TAG.setContent("Web & Application");
   }
 }
コード例 #4
0
  private void set(final Object instance, final TemplateTag templateTag, final Tag htmlTag) {
    Map<String, String> map = templateTag.match(htmlTag);

    for (Entry<String, String> entry : map.entrySet()) {

      log.trace("setting [" + entry.getValue() + "] on " + entry.getKey());
      if (!setUsingSetter(instance, entry)) {
        setUsingField(instance, entry);
      }
    }
  }
コード例 #5
0
ファイル: BasicTemplate.java プロジェクト: noncom/prodoc
  BasicTemplate(String templateFileName) throws IOException, MissingTagException {
    LIBNAME_TAG.setContent(libName);
    fileTemplate = new HTML_Template(templateFileName, getFileTemplateDevideWords());

    List<TemplateTag> memberParametersDevideWords = new ArrayList<TemplateTag>();
    memberParametersDevideWords.add(PARAMETER_TAG);
    memberParameters = new HTML_Template("memberparameters.htm", memberParametersDevideWords);

    List<TemplateTag> memberParameterDevideWords = new ArrayList<TemplateTag>();
    memberParameterDevideWords.add(PARAMETER_NAME_TAG);
    memberParameterDevideWords.add(PARAMETER_DESCRIPTION_TAG);
    memberParameter = new HTML_Template("memberparameter.htm", memberParameterDevideWords);
  }
コード例 #6
0
ファイル: BasicTemplate.java プロジェクト: noncom/prodoc
  /**
   * Adds all parameters of an executable doc member to the documentation
   *
   * @param doc
   */
  void addParameters(Doc doc) {
    if (doc.isConstructor() || doc.isMethod()) {
      ExecutableMemberDoc memberDoc = (ExecutableMemberDoc) doc;

      ParamTag[] tags = memberDoc.paramTags();

      for (int i = 0; i < tags.length; ++i) {
        addParameter(tags[i].parameterName(), tags[i].parameterComment());
      }

      if (tags.length > 0) {
        memberParameters.insertTagContent(PARAMETER_TAG);
        PARAMETERS_TAG.setContent(memberParameters.getTemplateContent());
      }
    }
  }
コード例 #7
0
ファイル: BasicTemplate.java プロジェクト: noncom/prodoc
 /**
  * Adds all related members of a doc item to the related section of the doc
  *
  * @param doc
  */
 void addRelatedmember(
     Doc doc, HashMap<String, String> fieldLinks, HashMap<String, String> methodLinks) {
   Tag[] relatedTags = doc.tags("@related");
   for (Tag relatedTag : relatedTags) {
     String link = "";
     if (fieldLinks.containsKey(relatedTag.text())) {
       link = fieldLinks.get(relatedTag.text());
     } else if (methodLinks.containsKey(relatedTag.text())) {
       link = methodLinks.get(relatedTag.text());
     } else if (StartDoclet.classLinks.containsKey(relatedTag.text())) {
       link = StartDoclet.classLinks.get(relatedTag.text());
     } else {
       System.out.println("No related member found for @related " + relatedTag.text());
     }
     StringBuffer relatedBuffer = new StringBuffer();
     relatedBuffer.append("<A href=\"");
     relatedBuffer.append(link);
     relatedBuffer.append(".html\">");
     relatedBuffer.append(relatedTag.text());
     relatedBuffer.append("</A><BR>\n");
     RELATED_TAG.addContent(relatedBuffer.toString());
   }
 }
コード例 #8
0
ファイル: BasicTemplate.java プロジェクト: noncom/prodoc
 void reset() {
   TITLE_TAG.resetContent();
   NAME_TAG.resetContent();
   EXAMPLE_TAG.resetContent();
   DESCRIPTION_TAG.resetContent();
   SYNTAX_TAG.resetContent();
   PARAMETERS_TAG.resetContent();
   PARAMETER_TAG.resetContent();
   PARAMETER_NAME_TAG.resetContent();
   PARAMETER_DESCRIPTION_TAG.resetContent();
   USAGE_TAG.resetContent();
   RELATED_TAG.resetContent();
   RETURN_TAG.resetContent();
   LINKS_TAG.resetContent();
   FIELDS_TAG.resetContent();
   METHODS_TAG.resetContent();
   FIELD_TAG.resetContent();
   METHOD_TAG.resetContent();
   METHOD_LINK_TAG.resetContent();
   METHOD_NAME_TAG.resetContent();
   METHOD_DESCRIPTION_TAG.resetContent();
   FIELD_KIND_TAG.resetContent();
   FIELD_LINK_TAG.resetContent();
   FIELD_NAME_TAG.resetContent();
   FIELD_DESCRIPTION_TAG.resetContent();
   METHOD_KIND_TAG.resetContent();
   fileName = "";
 }
コード例 #9
0
ファイル: BasicTemplate.java プロジェクト: noncom/prodoc
 void setName(String memberName) {
   NAME_TAG.setContent(memberName);
 }
コード例 #10
0
ファイル: BasicTemplate.java プロジェクト: noncom/prodoc
 /**
  * Sets the title for a doc item
  *
  * @param title
  */
 void setTitle(String memberTitle) {
   TITLE_TAG.setContent(memberTitle);
 }
コード例 #11
0
ファイル: BasicTemplate.java プロジェクト: noncom/prodoc
 /**
  * Adds a methods signature to the Syntaxsection of the doc
  *
  * @param memberSyntaxString Method Signature to add to the Syntaxsection
  */
 private void addSyntax(String memberSyntaxString) {
   StringBuffer memberSyntaxBuffer = new StringBuffer();
   memberSyntaxBuffer.append(memberSyntaxString);
   memberSyntaxBuffer.append("\n");
   SYNTAX_TAG.addContent(memberSyntaxBuffer.toString());
 }
コード例 #12
0
ファイル: BasicTemplate.java プロジェクト: noncom/prodoc
 /**
  * Sets the description of the doc member
  *
  * @param description, description that has to be add to the doc
  */
 void setDescription(String description) {
   DESCRIPTION_TAG.setContent(description);
 }