/**
  * Add deprecated information to the documentation tree
  *
  * @param deprmembers list of deprecated members
  * @param headingKey the caption for the deprecated members table
  * @param tableSummary the summary for the deprecated members table
  * @param tableHeader table headers for the deprecated members table
  * @param contentTree the content tree to which the deprecated members table will be added
  */
 protected void addDeprecatedAPI(
     List<Doc> deprmembers,
     String headingKey,
     String tableSummary,
     String[] tableHeader,
     Content contentTree) {
   if (deprmembers.size() > 0) {
     Content caption = writer.getTableCaption(configuration.getResource(headingKey));
     Content table =
         (configuration.isOutputHtml5())
             ? HtmlTree.TABLE(HtmlStyle.deprecatedSummary, caption)
             : HtmlTree.TABLE(HtmlStyle.deprecatedSummary, tableSummary, caption);
     table.addContent(writer.getSummaryTableHeader(tableHeader, "col"));
     Content tbody = new HtmlTree(HtmlTag.TBODY);
     for (int i = 0; i < deprmembers.size(); i++) {
       ProgramElementDoc member = (ProgramElementDoc) deprmembers.get(i);
       HtmlTree td = HtmlTree.TD(HtmlStyle.colOne, getDeprecatedLink(member));
       if (member.tags("deprecated").length > 0)
         writer.addInlineDeprecatedComment(member, member.tags("deprecated")[0], td);
       HtmlTree tr = HtmlTree.TR(td);
       if (i % 2 == 0) tr.addStyle(HtmlStyle.altColor);
       else tr.addStyle(HtmlStyle.rowColor);
       tbody.addContent(tr);
     }
     table.addContent(tbody);
     Content li = HtmlTree.LI(HtmlStyle.blockList, table);
     Content ul = HtmlTree.UL(HtmlStyle.blockList, li);
     contentTree.addContent(ul);
   }
 }
 /**
  * Add the list of packages that use the given package.
  *
  * @param contentTree the content tree to which the package list will be added
  */
 protected void addPackageList(Content contentTree) throws IOException {
   Content table =
       HtmlTree.TABLE(
           HtmlStyle.useSummary,
           0,
           3,
           0,
           useTableSummary,
           getTableCaption(
               configuration.getResource(
                   "doclet.ClassUse_Packages.that.use.0",
                   getPackageLink(pkgdoc, Util.getPackageName(pkgdoc)))));
   table.addContent(getSummaryTableHeader(packageTableHeader, "col"));
   Content tbody = new HtmlTree(HtmlTag.TBODY);
   Iterator<String> it = usingPackageToUsedClasses.keySet().iterator();
   for (int i = 0; it.hasNext(); i++) {
     PackageDoc pkg = configuration.root.packageNamed(it.next());
     HtmlTree tr = new HtmlTree(HtmlTag.TR);
     if (i % 2 == 0) {
       tr.addStyle(HtmlStyle.altColor);
     } else {
       tr.addStyle(HtmlStyle.rowColor);
     }
     addPackageUse(pkg, tr);
     tbody.addContent(tr);
   }
   table.addContent(tbody);
   Content li = HtmlTree.LI(HtmlStyle.blockList, table);
   contentTree.addContent(li);
 }
 /**
  * Build the summaries for the methods that belong to the given class.
  *
  * @param node the XML element that specifies which components to document
  * @param classContentTree content tree to which the documentation will be added
  */
 public void buildSerializableMethods(XMLNode node, Content classContentTree) {
   Content serializableMethodTree = methodWriter.getSerializableMethodsHeader();
   MemberDoc[] members = currentClass.serializationMethods();
   int membersLength = members.length;
   if (membersLength > 0) {
     for (int i = 0; i < membersLength; i++) {
       currentMember = members[i];
       Content methodsContentTree = methodWriter.getMethodsContentHeader((i == membersLength - 1));
       buildChildren(node, methodsContentTree);
       serializableMethodTree.addContent(methodsContentTree);
     }
   }
   if (currentClass.serializationMethods().length > 0) {
     classContentTree.addContent(
         methodWriter.getSerializableMethods(
             configuration.getText("doclet.Serialized_Form_methods"), serializableMethodTree));
     if (currentClass.isSerializable() && !currentClass.isExternalizable()) {
       if (currentClass.serializationMethods().length == 0) {
         Content noCustomizationMsg =
             methodWriter.getNoCustomizationMsg(
                 configuration.getText("doclet.Serializable_no_customization"));
         classContentTree.addContent(
             methodWriter.getSerializableMethods(
                 configuration.getText("doclet.Serialized_Form_methods"), noCustomizationMsg));
       }
     }
   }
 }
 /** {@inheritDoc} */
 protected void addNavDetailLink(boolean link, Content liNav) {
   if (link) {
     liNav.addContent(
         writer.getHyperLink(
             SectionName.CONSTRUCTOR_DETAIL, writer.getResource("doclet.navConstructor")));
   } else {
     liNav.addContent(writer.getResource("doclet.navConstructor"));
   }
 }
 /** {@inheritDoc} */
 public Content getConstructorDetailsTreeHeader(ClassDoc classDoc, Content memberDetailsTree) {
   memberDetailsTree.addContent(HtmlConstants.START_OF_CONSTRUCTOR_DETAILS);
   Content constructorDetailsTree = writer.getMemberTreeHeader();
   constructorDetailsTree.addContent(writer.getMarkerAnchor(SectionName.CONSTRUCTOR_DETAIL));
   Content heading =
       HtmlTree.HEADING(HtmlConstants.DETAILS_HEADING, writer.constructorDetailsLabel);
   constructorDetailsTree.addContent(heading);
   return constructorDetailsTree;
 }
 /**
  * Add use information to the documentation tree.
  *
  * @param mems list of program elements for which the use information will be added
  * @param heading the section heading
  * @param tableSummary the summary for the use table
  * @param contentTree the content tree to which the use information will be added
  */
 protected void addUseInfo(
     List<? extends ProgramElementDoc> mems,
     Content heading,
     String tableSummary,
     Content contentTree) {
   if (mems == null) {
     return;
   }
   List<? extends ProgramElementDoc> members = mems;
   boolean printedUseTableHeader = false;
   if (members.size() > 0) {
     Content caption = writer.getTableCaption(heading);
     Content table =
         (configuration.isOutputHtml5())
             ? HtmlTree.TABLE(HtmlStyle.useSummary, caption)
             : HtmlTree.TABLE(HtmlStyle.useSummary, tableSummary, caption);
     Content tbody = new HtmlTree(HtmlTag.TBODY);
     Iterator<? extends ProgramElementDoc> it = members.iterator();
     for (int i = 0; it.hasNext(); i++) {
       ProgramElementDoc pgmdoc = it.next();
       ClassDoc cd = pgmdoc.containingClass();
       if (!printedUseTableHeader) {
         table.addContent(writer.getSummaryTableHeader(this.getSummaryTableHeader(pgmdoc), "col"));
         printedUseTableHeader = true;
       }
       HtmlTree tr = new HtmlTree(HtmlTag.TR);
       if (i % 2 == 0) {
         tr.addStyle(HtmlStyle.altColor);
       } else {
         tr.addStyle(HtmlStyle.rowColor);
       }
       HtmlTree tdFirst = new HtmlTree(HtmlTag.TD);
       tdFirst.addStyle(HtmlStyle.colFirst);
       writer.addSummaryType(this, pgmdoc, tdFirst);
       tr.addContent(tdFirst);
       HtmlTree tdLast = new HtmlTree(HtmlTag.TD);
       tdLast.addStyle(HtmlStyle.colLast);
       if (cd != null && !(pgmdoc instanceof ConstructorDoc) && !(pgmdoc instanceof ClassDoc)) {
         HtmlTree name = new HtmlTree(HtmlTag.SPAN);
         name.addStyle(HtmlStyle.typeNameLabel);
         name.addContent(cd.name() + ".");
         tdLast.addContent(name);
       }
       addSummaryLink(
           pgmdoc instanceof ClassDoc ? LinkInfoImpl.Kind.CLASS_USE : LinkInfoImpl.Kind.MEMBER,
           cd,
           pgmdoc,
           tdLast);
       writer.addSummaryLinkComment(this, pgmdoc, tdLast);
       tr.addContent(tdLast);
       tbody.addContent(tr);
     }
     table.addContent(tbody);
     contentTree.addContent(table);
   }
 }
 /**
  * Build the member details contents of the page.
  *
  * @param node the XML element that specifies which components to document
  * @param annotationContentTree the content tree to which the documentation will be added
  */
 public void buildAnnotationTypeMemberDetails(XMLNode node, Content annotationContentTree) {
   Content memberDetailsTree = writer.getMemberTreeHeader();
   buildChildren(node, memberDetailsTree);
   if (memberDetailsTree.isValid()) {
     Content memberDetails = writer.getMemberTreeHeader();
     writer.addAnnotationDetailsMarker(memberDetails);
     memberDetails.addContent(writer.getMemberTree(memberDetailsTree));
     annotationContentTree.addContent(writer.getMemberDetailsTree(memberDetails));
   }
 }
 /** {@inheritDoc} */
 public Content getConstructorDocTreeHeader(
     ConstructorDoc constructor, Content constructorDetailsTree) {
   String erasureAnchor;
   if ((erasureAnchor = getErasureAnchor(constructor)) != null) {
     constructorDetailsTree.addContent(writer.getMarkerAnchor((erasureAnchor)));
   }
   constructorDetailsTree.addContent(writer.getMarkerAnchor(writer.getAnchor(constructor)));
   Content constructorDocTree = writer.getMemberTreeHeader();
   Content heading = new HtmlTree(HtmlConstants.MEMBER_HEADING);
   heading.addContent(constructor.name());
   constructorDocTree.addContent(heading);
   return constructorDocTree;
 }
 /**
  * Add the list of classes that use the given package.
  *
  * @param contentTree the content tree to which the class list will be added
  */
 protected void addClassList(Content contentTree) throws IOException {
   String[] classTableHeader =
       new String[] {
         configuration.getText(
             "doclet.0_and_1",
             configuration.getText("doclet.Class"),
             configuration.getText("doclet.Description"))
       };
   Iterator<String> itp = usingPackageToUsedClasses.keySet().iterator();
   while (itp.hasNext()) {
     String packageName = itp.next();
     PackageDoc usingPackage = configuration.root.packageNamed(packageName);
     HtmlTree li = new HtmlTree(HtmlTag.LI);
     li.addStyle(HtmlStyle.blockList);
     if (usingPackage != null) {
       li.addContent(getMarkerAnchor(usingPackage.name()));
     }
     String tableSummary =
         configuration.getText(
             "doclet.Use_Table_Summary", configuration.getText("doclet.classes"));
     Content table =
         HtmlTree.TABLE(
             HtmlStyle.useSummary,
             0,
             3,
             0,
             tableSummary,
             getTableCaption(
                 configuration.getResource(
                     "doclet.ClassUse_Classes.in.0.used.by.1",
                     getPackageLink(pkgdoc, Util.getPackageName(pkgdoc)),
                     getPackageLink(usingPackage, Util.getPackageName(usingPackage)))));
     table.addContent(getSummaryTableHeader(classTableHeader, "col"));
     Content tbody = new HtmlTree(HtmlTag.TBODY);
     Iterator<ClassDoc> itc = usingPackageToUsedClasses.get(packageName).iterator();
     for (int i = 0; itc.hasNext(); i++) {
       HtmlTree tr = new HtmlTree(HtmlTag.TR);
       if (i % 2 == 0) {
         tr.addStyle(HtmlStyle.altColor);
       } else {
         tr.addStyle(HtmlStyle.rowColor);
       }
       addClassRow(itc.next(), packageName, tr);
       tbody.addContent(tr);
     }
     table.addContent(tbody);
     li.addContent(table);
     contentTree.addContent(li);
   }
 }
 /**
  * Add the package use information.
  *
  * @param pkg the package that used the given package
  * @param contentTree the content tree to which the information will be added
  */
 protected void addPackageUse(PackageDoc pkg, Content contentTree) throws IOException {
   Content tdFirst =
       HtmlTree.TD(
           HtmlStyle.colFirst,
           getHyperLink(Util.getPackageName(pkg), new StringContent(Util.getPackageName(pkg))));
   contentTree.addContent(tdFirst);
   HtmlTree tdLast = new HtmlTree(HtmlTag.TD);
   tdLast.addStyle(HtmlStyle.colLast);
   if (pkg != null && pkg.name().length() != 0) {
     addSummaryComment(pkg, tdLast);
   } else {
     tdLast.addContent(getSpace());
   }
   contentTree.addContent(tdLast);
 }
 /** {@inheritDoc} */
 protected void addSummaryType(ProgramElementDoc member, Content tdSummaryType) {
   if (foundNonPubConstructor) {
     Content code = new HtmlTree(HtmlTag.CODE);
     if (member.isProtected()) {
       code.addContent("protected ");
     } else if (member.isPrivate()) {
       code.addContent("private ");
     } else if (member.isPublic()) {
       code.addContent(writer.getSpace());
     } else {
       code.addContent(configuration.getText("doclet.Package_private"));
     }
     tdSummaryType.addContent(code);
   }
 }
 /**
  * Add the modifier and type for the member in the member summary.
  *
  * @param member the member to add the type for
  * @param type the type to add
  * @param tdSummaryType the content tree to which the modified and type will be added
  */
 protected void addModifierAndType(ProgramElementDoc member, Type type, Content tdSummaryType) {
   HtmlTree code = new HtmlTree(HtmlTag.CODE);
   addModifier(member, code);
   if (type == null) {
     if (member.isClass()) {
       code.addContent("class");
     } else {
       code.addContent("interface");
     }
     code.addContent(writer.getSpace());
   } else {
     if (member instanceof ExecutableMemberDoc
         && ((ExecutableMemberDoc) member).typeParameters().length > 0) {
       Content typeParameters =
           ((AbstractExecutableMemberWriter) this).getTypeParameters((ExecutableMemberDoc) member);
       code.addContent(typeParameters);
       // Code to avoid ugly wrapping in member summary table.
       if (typeParameters.charCount() > 10) {
         code.addContent(new HtmlTree(HtmlTag.BR));
       } else {
         code.addContent(writer.getSpace());
       }
       code.addContent(
           writer.getLink(
               new LinkInfoImpl(configuration, LinkInfoImpl.Kind.SUMMARY_RETURN_TYPE, type)));
     } else {
       code.addContent(
           writer.getLink(
               new LinkInfoImpl(configuration, LinkInfoImpl.Kind.SUMMARY_RETURN_TYPE, type)));
     }
   }
   tdSummaryType.addContent(code);
 }
 /**
  * Add the navigation summary link.
  *
  * @param members members to be linked
  * @param visibleMemberMap the visible inherited members map
  * @param liNav the content tree to which the navigation summary link will be added
  */
 protected void addNavSummaryLink(
     List<?> members, VisibleMemberMap visibleMemberMap, Content liNav) {
   if (members.size() > 0) {
     liNav.addContent(getNavSummaryLink(null, true));
     return;
   }
   ClassDoc icd = classdoc.superclass();
   while (icd != null) {
     List<?> inhmembers = visibleMemberMap.getMembersFor(icd);
     if (inhmembers.size() > 0) {
       liNav.addContent(getNavSummaryLink(icd, true));
       return;
     }
     icd = icd.superclass();
   }
   liNav.addContent(getNavSummaryLink(null, false));
 }
 /**
  * Build the member summary contents of the page.
  *
  * @param node the XML element that specifies which components to document
  * @param annotationContentTree the content tree to which the documentation will be added
  */
 public void buildMemberSummary(XMLNode node, Content annotationContentTree) throws Exception {
   Content memberSummaryTree = writer.getMemberTreeHeader();
   configuration
       .getBuilderFactory()
       .getMemberSummaryBuilder(writer)
       .buildChildren(node, memberSummaryTree);
   annotationContentTree.addContent(writer.getMemberSummaryTree(memberSummaryTree));
 }
 /**
  * Add the modifier for the member.
  *
  * @param member the member to add the type for
  * @param code the content tree to which the modified will be added
  */
 private void addModifier(ProgramElementDoc member, Content code) {
   if (member.isProtected()) {
     code.addContent("protected ");
   } else if (member.isPrivate()) {
     code.addContent("private ");
   } else if (!member.isPublic()) { // Package private
     code.addContent(configuration.getText("doclet.Package_private"));
     code.addContent(" ");
   }
   if (member.isMethod()) {
     if (!(member.containingClass().isInterface()) && ((MethodDoc) member).isAbstract()) {
       code.addContent("abstract ");
     }
     // This check for isDefault() and the default modifier needs to be
     // added for it to appear on the "Modifier and Type" column in the
     // method summary section. Once the default modifier is added
     // to the Modifier list on DocEnv and once it is updated to use the
     // javax.lang.model.element.Modifier, we will need to remove this.
     if (((MethodDoc) member).isDefault()) {
       code.addContent("default ");
     }
   }
   if (member.isStatic()) {
     code.addContent("static ");
   }
 }
 /**
  * Add a row for the class that uses the given package.
  *
  * @param usedClass the class that uses the given package
  * @param packageName the name of the package to which the class belongs
  * @param contentTree the content tree to which the row will be added
  */
 protected void addClassRow(ClassDoc usedClass, String packageName, Content contentTree) {
   DocPath dp = pathString(usedClass, DocPaths.CLASS_USE.resolve(DocPath.forName(usedClass)));
   Content td =
       HtmlTree.TD(
           HtmlStyle.colOne,
           getHyperLink(dp.fragment(packageName), new StringContent(usedClass.name())));
   addIndexComment(usedClass, td);
   contentTree.addContent(td);
 }
 /**
  * Add the package use information.
  *
  * @param contentTree the content tree to which the package use information will be added
  */
 protected void addPackageUse(Content contentTree) throws IOException {
   HtmlTree ul = new HtmlTree(HtmlTag.UL);
   ul.addStyle(HtmlStyle.blockList);
   if (configuration.packages.length > 1) {
     addPackageList(ul);
   }
   addClassList(ul);
   contentTree.addContent(ul);
 }
示例#18
0
 /**
  * Build the field documentation.
  *
  * @param node the XML element that specifies which components to document
  * @param memberDetailsTree the content tree to which the documentation will be added
  */
 public void buildFieldDoc(XMLNode node, Content memberDetailsTree) {
   if (writer == null) {
     return;
   }
   int size = fields.size();
   if (size > 0) {
     Content fieldDetailsTree = writer.getFieldDetailsTreeHeader(classDoc, memberDetailsTree);
     for (currentFieldIndex = 0; currentFieldIndex < size; currentFieldIndex++) {
       Content fieldDocTree =
           writer.getFieldDocTreeHeader(
               (FieldDoc) fields.get(currentFieldIndex), fieldDetailsTree);
       buildChildren(node, fieldDocTree);
       fieldDetailsTree.addContent(
           writer.getFieldDoc(fieldDocTree, (currentFieldIndex == size - 1)));
     }
     memberDetailsTree.addContent(writer.getFieldDetails(fieldDetailsTree));
   }
 }
示例#19
0
 /**
  * Build the method documentation.
  *
  * @param node the XML element that specifies which components to document
  * @param memberDetailsTree the content tree to which the documentation will be added
  */
 public void buildMethodDoc(XMLNode node, Content memberDetailsTree) {
   if (writer == null) {
     return;
   }
   int size = methods.size();
   if (size > 0) {
     Content methodDetailsTree = writer.getMethodDetailsTreeHeader(classDoc, memberDetailsTree);
     for (currentMethodIndex = 0; currentMethodIndex < size; currentMethodIndex++) {
       Content methodDocTree =
           writer.getMethodDocTreeHeader(
               (MethodDoc) methods.get(currentMethodIndex), methodDetailsTree);
       buildChildren(node, methodDocTree);
       methodDetailsTree.addContent(
           writer.getMethodDoc(methodDocTree, (currentMethodIndex == size - 1)));
     }
     memberDetailsTree.addContent(writer.getMethodDetails(methodDetailsTree));
   }
 }
 /**
  * Add the deprecated information for the given member.
  *
  * @param member the member being documented.
  * @param contentTree the content tree to which the deprecated information will be added.
  */
 protected void addDeprecatedInfo(ProgramElementDoc member, Content contentTree) {
   Content output =
       (new DeprecatedTaglet()).getTagletOutput(member, writer.getTagletWriterInstance(false));
   if (!output.isEmpty()) {
     Content deprecatedContent = output;
     Content div = HtmlTree.DIV(HtmlStyle.block, deprecatedContent);
     contentTree.addContent(div);
   }
 }
 /**
  * Build the serialized form summaries.
  *
  * @param node the XML element that specifies which components to document
  * @param serializedTree content tree to which the documentation will be added
  */
 public void buildSerializedFormSummaries(XMLNode node, Content serializedTree) {
   Content serializedSummariesTree = writer.getSerializedSummariesHeader();
   PackageDoc[] packages = configuration.packages;
   for (int i = 0; i < packages.length; i++) {
     currentPackage = packages[i];
     buildChildren(node, serializedSummariesTree);
   }
   serializedTree.addContent(writer.getSerializedContent(serializedSummariesTree));
 }
 /**
  * Build the class serialized form.
  *
  * @param node the XML element that specifies which components to document
  * @param packageSerializedTree content tree to which the documentation will be added
  */
 public void buildClassSerializedForm(XMLNode node, Content packageSerializedTree) {
   Content classSerializedTree = writer.getClassSerializedHeader();
   ClassDoc[] classes = currentPackage.allClasses(false);
   Arrays.sort(classes);
   for (int j = 0; j < classes.length; j++) {
     currentClass = classes[j];
     fieldWriter = writer.getSerialFieldWriter(currentClass);
     methodWriter = writer.getSerialMethodWriter(currentClass);
     if (currentClass.isClass() && currentClass.isSerializable()) {
       if (!serialClassInclude(currentClass)) {
         continue;
       }
       Content classTree = writer.getClassHeader(currentClass);
       buildChildren(node, classTree);
       classSerializedTree.addContent(classTree);
     }
   }
   packageSerializedTree.addContent(classSerializedTree);
 }
 /**
  * Build the serialization overview for the given class.
  *
  * @param classDoc the class to print the overview for.
  * @param classContentTree content tree to which the documentation will be added
  */
 public void buildFieldSerializationOverview(ClassDoc classDoc, Content classContentTree) {
   if (classDoc.definesSerializableFields()) {
     FieldDoc serialPersistentField = classDoc.serializableFields()[0];
     // Check to see if there are inline comments, tags or deprecation
     // information to be printed.
     if (fieldWriter.shouldPrintOverview(serialPersistentField)) {
       Content serializableFieldsTree = fieldWriter.getSerializableFieldsHeader();
       Content fieldsOverviewContentTree = fieldWriter.getFieldsContentHeader(true);
       fieldWriter.addMemberDeprecatedInfo(serialPersistentField, fieldsOverviewContentTree);
       if (!configuration.nocomment) {
         fieldWriter.addMemberDescription(serialPersistentField, fieldsOverviewContentTree);
         fieldWriter.addMemberTags(serialPersistentField, fieldsOverviewContentTree);
       }
       serializableFieldsTree.addContent(fieldsOverviewContentTree);
       classContentTree.addContent(
           fieldWriter.getSerializableFields(
               configuration.getText("doclet.Serialized_Form_class"), serializableFieldsTree));
     }
   }
 }
 /**
  * Build the summaries for the fields that belong to the given class.
  *
  * @param node the XML element that specifies which components to document
  * @param classContentTree content tree to which the documentation will be added
  */
 public void buildSerializableFields(XMLNode node, Content classContentTree) {
   MemberDoc[] members = currentClass.serializableFields();
   int membersLength = members.length;
   if (membersLength > 0) {
     Content serializableFieldsTree = fieldWriter.getSerializableFieldsHeader();
     for (int i = 0; i < membersLength; i++) {
       currentMember = members[i];
       if (!currentClass.definesSerializableFields()) {
         Content fieldsContentTree = fieldWriter.getFieldsContentHeader((i == membersLength - 1));
         buildChildren(node, fieldsContentTree);
         serializableFieldsTree.addContent(fieldsContentTree);
       } else {
         buildSerialFieldTagsInfo(serializableFieldsTree);
       }
     }
     classContentTree.addContent(
         fieldWriter.getSerializableFields(
             configuration.getText("doclet.Serialized_Form_fields"), serializableFieldsTree));
   }
 }
 /**
  * Build the annotation type documentation.
  *
  * @param node the XML element that specifies which components to document
  * @param contentTree the content tree to which the documentation will be added
  */
 public void buildAnnotationTypeDoc(XMLNode node, Content contentTree) throws Exception {
   contentTree =
       writer.getHeader(
           configuration.getText("doclet.AnnotationType") + " " + annotationTypeDoc.name());
   Content annotationContentTree = writer.getAnnotationContentHeader();
   buildChildren(node, annotationContentTree);
   contentTree.addContent(annotationContentTree);
   writer.addFooter(contentTree);
   writer.printDocument(contentTree);
   writer.close();
   copyDocFiles();
 }
示例#26
0
 /**
  * Print the frames version of the Html file header. Called only when generating an HTML frames
  * file.
  *
  * @param title Title of this HTML document
  * @param configuration the configuration object
  * @param body the body content tree to be added to the HTML document
  */
 public void printFramesDocument(String title, ConfigurationImpl configuration, HtmlTree body)
     throws IOException {
   Content htmlDocType = configuration.isOutputHtml5() ? DocType.HTML5 : DocType.TRANSITIONAL;
   Content htmlComment = new Comment(configuration.getText("doclet.New_Page"));
   Content head = new HtmlTree(HtmlTag.HEAD);
   head.addContent(getGeneratedBy(!configuration.notimestamp));
   Content windowTitle = HtmlTree.TITLE(new StringContent(title));
   head.addContent(windowTitle);
   Content meta =
       HtmlTree.META(
           "Content-Type",
           CONTENT_TYPE,
           (configuration.charset.length() > 0)
               ? configuration.charset
               : HtmlConstants.HTML_DEFAULT_CHARSET);
   head.addContent(meta);
   head.addContent(getStyleSheetProperties(configuration));
   head.addContent(getFramesJavaScript());
   Content htmlTree = HtmlTree.HTML(configuration.getLocale().getLanguage(), head, body);
   Content htmlDocument = new HtmlDocument(htmlDocType, htmlComment, htmlTree);
   write(htmlDocument);
 }
 /**
  * Build the serial UID information for the given class.
  *
  * @param node the XML element that specifies which components to document
  * @param classTree content tree to which the serial UID information will be added
  */
 public void buildSerialUIDInfo(XMLNode node, Content classTree) {
   Content serialUidTree = writer.getSerialUIDInfoHeader();
   FieldDoc[] fields = currentClass.fields(false);
   for (int i = 0; i < fields.length; i++) {
     if (fields[i].name().equals("serialVersionUID")
         && fields[i].constantValueExpression() != null) {
       writer.addSerialUIDInfo(
           SERIAL_VERSION_UID_HEADER, fields[i].constantValueExpression(), serialUidTree);
       break;
     }
   }
   classTree.addContent(serialUidTree);
 }
 /**
  * Add the modifier for the member.
  *
  * @param member the member for which teh modifier will be added.
  * @param htmltree the content tree to which the modifier information will be added.
  */
 protected void addModifiers(MemberDoc member, Content htmltree) {
   String mod = modifierString(member);
   // According to JLS, we should not be showing public modifier for
   // interface methods.
   if ((member.isField() || member.isMethod())
       && writer instanceof ClassWriterImpl
       && ((ClassWriterImpl) writer).getClassDoc().isInterface()) {
     // This check for isDefault() and the default modifier needs to be
     // added for it to appear on the method details section. Once the
     // default modifier is added to the Modifier list on DocEnv and once
     // it is updated to use the javax.lang.model.element.Modifier, we
     // will need to remove this.
     mod =
         (member.isMethod() && ((MethodDoc) member).isDefault())
             ? utils.replaceText(mod, "public", "default").trim()
             : utils.replaceText(mod, "public", "").trim();
   }
   if (mod.length() > 0) {
     htmltree.addContent(mod);
     htmltree.addContent(writer.getSpace());
   }
 }
 /** Generate the package use list. */
 protected void generatePackageUseFile() throws IOException {
   Content body = getPackageUseHeader();
   HtmlTree div = new HtmlTree(HtmlTag.DIV);
   div.addStyle(HtmlStyle.contentContainer);
   if (usingPackageToUsedClasses.isEmpty()) {
     div.addContent(getResource("doclet.ClassUse_No.usage.of.0", pkgdoc.name()));
   } else {
     addPackageUse(div);
   }
   body.addContent(div);
   addNavLinks(false, body);
   addBottom(body);
   printHtmlDocument(null, true, body);
 }
 /**
  * Build the package serialized form for the current package being processed.
  *
  * @param node the XML element that specifies which components to document
  * @param serializedSummariesTree content tree to which the documentation will be added
  */
 public void buildPackageSerializedForm(XMLNode node, Content serializedSummariesTree) {
   Content packageSerializedTree = writer.getPackageSerializedHeader();
   String foo = currentPackage.name();
   ClassDoc[] classes = currentPackage.allClasses(false);
   if (classes == null || classes.length == 0) {
     return;
   }
   if (!serialInclude(currentPackage)) {
     return;
   }
   if (!serialClassFoundToDocument(classes)) {
     return;
   }
   buildChildren(node, packageSerializedTree);
   serializedSummariesTree.addContent(packageSerializedTree);
 }