コード例 #1
0
 /**
  * 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);
 }
コード例 #2
0
 /**
  * Add the packages list that use the given class.
  *
  * @param contentTree the content tree to which the packages 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",
                   getLink(
                       new LinkInfoImpl(
                           configuration, LinkInfoImpl.Kind.CLASS_USE_HEADER, classdoc)))));
   table.addContent(getSummaryTableHeader(packageTableHeader, "col"));
   Content tbody = new HtmlTree(HtmlTag.TBODY);
   Iterator<PackageDoc> it = pkgSet.iterator();
   for (int i = 0; it.hasNext(); i++) {
     PackageDoc pkg = 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);
 }
コード例 #3
0
 /**
  * Generate the deprecated API list.
  *
  * @param deprapi list of deprecated API built already.
  */
 protected void generateDeprecatedListFile(DeprecatedAPIListBuilder deprapi) throws IOException {
   Content body = getHeader();
   body.addContent(getContentsList(deprapi));
   String memberTableSummary;
   String[] memberTableHeader = new String[1];
   HtmlTree div = new HtmlTree(HtmlTag.DIV);
   div.addStyle(HtmlStyle.contentContainer);
   for (int i = 0; i < DeprecatedAPIListBuilder.NUM_TYPES; i++) {
     if (deprapi.hasDocumentation(i)) {
       addAnchor(deprapi, i, div);
       memberTableSummary =
           configuration.getText(
               "doclet.Member_Table_Summary",
               configuration.getText(HEADING_KEYS[i]),
               configuration.getText(SUMMARY_KEYS[i]));
       memberTableHeader[0] =
           configuration.getText(
               "doclet.0_and_1",
               configuration.getText(HEADER_KEYS[i]),
               configuration.getText("doclet.Description"));
       writers[i].addDeprecatedAPI(
           deprapi.getList(i), HEADING_KEYS[i], memberTableSummary, memberTableHeader, div);
     }
   }
   body.addContent(div);
   addNavLinks(false, body);
   addBottom(body);
   printHtmlDocument(null, true, body);
 }
コード例 #4
0
 /**
  * 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);
 }
コード例 #5
0
 public Content getHyperLink(DocLink link, Content label, String title, String target) {
   HtmlTree anchor = HtmlTree.A(link.toString(), label);
   if (title != null && title.length() != 0) {
     anchor.addAttr(HtmlAttr.TITLE, title);
   }
   if (target != null && target.length() != 0) {
     anchor.addAttr(HtmlAttr.TARGET, target);
   }
   return anchor;
 }
コード例 #6
0
 /**
  * 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);
 }
コード例 #7
0
 /**
  * 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);
   }
 }
コード例 #8
0
 /**
  * Add the package use information.
  *
  * @param pkg the package that uses the given class
  * @param contentTree the content tree to which the package use information will be added
  */
 protected void addPackageUse(PackageDoc pkg, Content contentTree) throws IOException {
   Content tdFirst =
       HtmlTree.TD(
           HtmlStyle.colFirst,
           getHyperLink(pkg.name(), new StringContent(Util.getPackageName(pkg))));
   contentTree.addContent(tdFirst);
   HtmlTree tdLast = new HtmlTree(HtmlTag.TD);
   tdLast.addStyle(HtmlStyle.colLast);
   addSummaryComment(pkg, tdLast);
   contentTree.addContent(tdLast);
 }
コード例 #9
0
 /**
  * Add the line numbers for the source code.
  *
  * @param pre the content tree to which the line number will be added
  * @param lineno The line number
  */
 private static void addLineNo(Content pre, int lineno) {
   HtmlTree span = new HtmlTree(HtmlTag.SPAN);
   span.addStyle(HtmlStyle.sourceLineNo);
   if (lineno < 10) {
     span.addContent("00" + Integer.toString(lineno));
   } else if (lineno < 100) {
     span.addContent("0" + Integer.toString(lineno));
   } else {
     span.addContent(Integer.toString(lineno));
   }
   pre.addContent(span);
 }
コード例 #10
0
 /**
  * Write the output to the file.
  *
  * @param body the documentation content to be written to the file.
  * @param path the path for the file.
  */
 private void writeToFile(Content body, DocPath path) throws IOException {
   Content htmlDocType = configuration.isOutputHtml5() ? DocType.HTML5 : DocType.TRANSITIONAL;
   Content head = new HtmlTree(HtmlTag.HEAD);
   head.addContent(
       HtmlTree.TITLE(new StringContent(configuration.getText("doclet.Window_Source_title"))));
   head.addContent(getStyleSheetProperties());
   Content htmlTree = HtmlTree.HTML(configuration.getLocale().getLanguage(), head, body);
   Content htmlDocument = new HtmlDocument(htmlDocType, htmlTree);
   configuration.message.notice("doclet.Generating_0", path.getPath());
   DocFile df = DocFile.createFileForOutput(configuration, path);
   try (Writer w = df.openWriter()) {
     htmlDocument.write(w, true);
   }
 }
コード例 #11
0
 /**
  * Get the contents list.
  *
  * @param deprapi the deprecated list builder
  * @return a content tree for the contents list
  */
 public Content getContentsList(DeprecatedAPIListBuilder deprapi) {
   Content headContent = getResource("doclet.Deprecated_API");
   Content heading =
       HtmlTree.HEADING(HtmlConstants.TITLE_HEADING, true, HtmlStyle.title, headContent);
   Content div = HtmlTree.DIV(HtmlStyle.header, heading);
   Content headingContent = getResource("doclet.Contents");
   div.addContent(HtmlTree.HEADING(HtmlConstants.CONTENT_HEADING, true, headingContent));
   Content ul = new HtmlTree(HtmlTag.UL);
   for (int i = 0; i < DeprecatedAPIListBuilder.NUM_TYPES; i++) {
     addIndexLink(deprapi, i, ul);
   }
   div.addContent(ul);
   return div;
 }
コード例 #12
0
 /** 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);
 }
コード例 #13
0
 /** Generate the class use list. */
 protected void generateClassUseFile() throws IOException {
   Content body = getClassUseHeader();
   HtmlTree div = new HtmlTree(HtmlTag.DIV);
   div.addStyle(HtmlStyle.classUseContainer);
   if (pkgSet.size() > 0) {
     addClassUse(div);
   } else {
     div.addContent(getResource("doclet.ClassUse_No.usage.of.0", classdoc.qualifiedName()));
   }
   body.addContent(div);
   addNavLinks(false, body);
   addBottom(body);
   printHtmlDocument(null, true, body);
 }
コード例 #14
0
 /**
  * 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);
 }
コード例 #15
0
 /**
  * Get the header for the package use listing.
  *
  * @return a content tree representing the package use header
  */
 protected Content getPackageUseHeader() {
   String packageText = configuration.getText("doclet.Package");
   String name = pkgdoc.name();
   String title = configuration.getText("doclet.Window_ClassUse_Header", packageText, name);
   Content bodyTree = getBody(true, getWindowTitle(title));
   addTop(bodyTree);
   addNavLinks(true, bodyTree);
   ContentBuilder headContent = new ContentBuilder();
   headContent.addContent(getResource("doclet.ClassUse_Title", packageText));
   headContent.addContent(new HtmlTree(HtmlTag.BR));
   headContent.addContent(name);
   Content heading =
       HtmlTree.HEADING(HtmlConstants.TITLE_HEADING, true, HtmlStyle.title, headContent);
   Content div = HtmlTree.DIV(HtmlStyle.header, heading);
   bodyTree.addContent(div);
   return bodyTree;
 }
コード例 #16
0
 /**
  * Get class page link.
  *
  * @return a content tree for the class page link
  */
 protected Content getNavLinkClass() {
   Content linkContent =
       getLink(
           new LinkInfoImpl(configuration, LinkInfoImpl.Kind.CLASS_USE_HEADER, classdoc)
               .label(configuration.getText("doclet.Class")));
   Content li = HtmlTree.LI(linkContent);
   return li;
 }
コード例 #17
0
 /**
  * Get the tree link.
  *
  * @return a content tree for the tree link
  */
 protected Content getNavLinkTree() {
   Content linkContent =
       classdoc.containingPackage().isIncluded()
           ? getHyperLink(DocPath.parent.resolve(DocPaths.PACKAGE_TREE), treeLabel)
           : getHyperLink(pathToRoot.resolve(DocPaths.OVERVIEW_TREE), treeLabel);
   Content li = HtmlTree.LI(linkContent);
   return li;
 }
コード例 #18
0
 /** {@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;
 }
コード例 #19
0
 /**
  * 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);
   }
 }
コード例 #20
0
 /**
  * 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);
 }
コード例 #21
0
 /**
  * Get the header for the class use Listing.
  *
  * @return a content tree representing the class use header
  */
 protected Content getClassUseHeader() {
   String cltype =
       configuration.getText(classdoc.isInterface() ? "doclet.Interface" : "doclet.Class");
   String clname = classdoc.qualifiedName();
   String title = configuration.getText("doclet.Window_ClassUse_Header", cltype, clname);
   Content bodyTree = getBody(true, getWindowTitle(title));
   addTop(bodyTree);
   addNavLinks(true, bodyTree);
   ContentBuilder headContent = new ContentBuilder();
   headContent.addContent(getResource("doclet.ClassUse_Title", cltype));
   headContent.addContent(new HtmlTree(HtmlTag.BR));
   headContent.addContent(clname);
   Content heading =
       HtmlTree.HEADING(HtmlConstants.CLASS_PAGE_HEADING, true, HtmlStyle.title, headContent);
   Content div = HtmlTree.DIV(HtmlStyle.header, heading);
   bodyTree.addContent(div);
   return bodyTree;
 }
コード例 #22
0
 /**
  * Add the package annotation list.
  *
  * @param contentTree the content tree to which the package annotation list will be added
  */
 protected void addPackageAnnotationList(Content contentTree) throws IOException {
   if ((!classdoc.isAnnotationType())
       || pkgToPackageAnnotations == null
       || pkgToPackageAnnotations.isEmpty()) {
     return;
   }
   Content table =
       HtmlTree.TABLE(
           HtmlStyle.useSummary,
           0,
           3,
           0,
           useTableSummary,
           getTableCaption(
               configuration.getResource(
                   "doclet.ClassUse_PackageAnnotation",
                   getLink(
                       new LinkInfoImpl(
                           configuration, LinkInfoImpl.Kind.CLASS_USE_HEADER, classdoc)))));
   table.addContent(getSummaryTableHeader(packageTableHeader, "col"));
   Content tbody = new HtmlTree(HtmlTag.TBODY);
   Iterator<PackageDoc> it = pkgToPackageAnnotations.iterator();
   for (int i = 0; it.hasNext(); i++) {
     PackageDoc pkg = it.next();
     HtmlTree tr = new HtmlTree(HtmlTag.TR);
     if (i % 2 == 0) {
       tr.addStyle(HtmlStyle.altColor);
     } else {
       tr.addStyle(HtmlStyle.rowColor);
     }
     Content tdFirst =
         HtmlTree.TD(HtmlStyle.colFirst, getPackageLink(pkg, new StringContent(pkg.name())));
     tr.addContent(tdFirst);
     HtmlTree tdLast = new HtmlTree(HtmlTag.TD);
     tdLast.addStyle(HtmlStyle.colLast);
     addSummaryComment(pkg, tdLast);
     tr.addContent(tdLast);
     tbody.addContent(tr);
   }
   table.addContent(tbody);
   Content li = HtmlTree.LI(HtmlStyle.blockList, table);
   contentTree.addContent(li);
 }
コード例 #23
0
 /**
  * Add a line from source to the HTML file that is generated.
  *
  * @param pre the content tree to which the line will be added.
  * @param line the string to format.
  * @param currentLineNo the current number.
  */
 private void addLine(Content pre, String line, int currentLineNo) {
   if (line != null) {
     Content anchor =
         HtmlTree.A(
             configuration.htmlVersion,
             "line." + Integer.toString(currentLineNo),
             new StringContent(utils.replaceTabs(configuration, line)));
     pre.addContent(anchor);
     pre.addContent(NEW_LINE);
   }
 }
コード例 #24
0
 /**
  * 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);
   }
 }
コード例 #25
0
 /**
  * Returns a link to the stylesheet file.
  *
  * @return an HtmlTree for the lINK tag which provides the stylesheet location
  */
 public HtmlTree getStyleSheetProperties() {
   String filename = configuration.stylesheetfile;
   DocPath stylesheet;
   if (filename.length() > 0) {
     DocFile file = DocFile.createFileForInput(configuration, filename);
     stylesheet = DocPath.create(file.getName());
   } else {
     stylesheet = DocPaths.STYLESHEET;
   }
   DocPath p = relativePath.resolve(stylesheet);
   HtmlTree link = HtmlTree.LINK("stylesheet", "text/css", p.getPath(), "Style");
   return link;
 }
コード例 #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);
 }
コード例 #27
0
 /**
  * Returns a link to the stylesheet file.
  *
  * @return an HtmlTree for the lINK tag which provides the stylesheet location
  */
 public HtmlTree getStyleSheetProperties(ConfigurationImpl configuration) {
   String stylesheetfile = configuration.stylesheetfile;
   DocPath stylesheet;
   if (stylesheetfile.isEmpty()) {
     stylesheet = DocPaths.STYLESHEET;
   } else {
     DocFile file = DocFile.createFileForInput(configuration, stylesheetfile);
     stylesheet = DocPath.create(file.getName());
   }
   HtmlTree link =
       HtmlTree.LINK("stylesheet", "text/css", pathToRoot.resolve(stylesheet).getPath(), "Style");
   return link;
 }
コード例 #28
0
 /**
  * Convert the given Class to an HTML.
  *
  * @param cd the class to convert.
  * @param outputdir the name of the directory to output to.
  */
 public void convertClass(ClassDoc cd, DocPath outputdir) {
   if (cd == null) {
     return;
   }
   try {
     SourcePosition sp = cd.position();
     if (sp == null) return;
     Reader r;
     // temp hack until we can update SourcePosition API.
     if (sp instanceof SourcePositionImpl) {
       FileObject fo = ((SourcePositionImpl) sp).fileObject();
       if (fo == null) return;
       r = fo.openReader(true);
     } else {
       File file = sp.file();
       if (file == null) return;
       r = new FileReader(file);
     }
     int lineno = 1;
     String line;
     relativePath = DocPaths.SOURCE_OUTPUT.resolve(DocPath.forPackage(cd)).invert();
     Content body = getHeader();
     Content pre = new HtmlTree(HtmlTag.PRE);
     try (LineNumberReader reader = new LineNumberReader(r)) {
       while ((line = reader.readLine()) != null) {
         addLineNo(pre, lineno);
         addLine(pre, line, lineno);
         lineno++;
       }
     }
     addBlankLines(pre);
     Content div = HtmlTree.DIV(HtmlStyle.sourceContainer, pre);
     body.addContent((configuration.allowTag(HtmlTag.MAIN)) ? HtmlTree.MAIN(div) : div);
     writeToFile(body, outputdir.resolve(DocPath.forClass(cd)));
   } catch (IOException e) {
     e.printStackTrace();
   }
 }
コード例 #29
0
 /**
  * Add the member summary for the given class.
  *
  * @param classDoc the class that is being documented
  * @param member the member being documented
  * @param firstSentenceTags the first sentence tags to be added to the summary
  * @param tableContents the list of contents to which the documentation will be added
  * @param counter the counter for determining id and style for the table row
  */
 public void addMemberSummary(
     ClassDoc classDoc,
     ProgramElementDoc member,
     Tag[] firstSentenceTags,
     List<Content> tableContents,
     int counter) {
   HtmlTree tdSummaryType = new HtmlTree(HtmlTag.TD);
   tdSummaryType.addStyle(HtmlStyle.colFirst);
   writer.addSummaryType(this, member, tdSummaryType);
   HtmlTree tdSummary = new HtmlTree(HtmlTag.TD);
   setSummaryColumnStyle(tdSummary);
   addSummaryLink(classDoc, member, tdSummary);
   writer.addSummaryLinkComment(this, member, firstSentenceTags, tdSummary);
   HtmlTree tr = HtmlTree.TR(tdSummaryType);
   tr.addContent(tdSummary);
   if (member instanceof MethodDoc && !member.isAnnotationTypeElement()) {
     int methodType =
         (member.isStatic()) ? MethodTypes.STATIC.value() : MethodTypes.INSTANCE.value();
     if (member.containingClass().isInterface()) {
       methodType =
           (((MethodDoc) member).isAbstract())
               ? methodType | MethodTypes.ABSTRACT.value()
               : methodType | MethodTypes.DEFAULT.value();
     } else {
       methodType =
           (((MethodDoc) member).isAbstract())
               ? methodType | MethodTypes.ABSTRACT.value()
               : methodType | MethodTypes.CONCRETE.value();
     }
     if (utils.isDeprecated(member) || utils.isDeprecated(classdoc)) {
       methodType = methodType | MethodTypes.DEPRECATED.value();
     }
     methodTypesOr = methodTypesOr | methodType;
     String tableId = "i" + counter;
     typeMap.put(tableId, methodType);
     tr.addAttr(HtmlAttr.ID, tableId);
   }
   if (counter % 2 == 0) tr.addStyle(HtmlStyle.altColor);
   else tr.addStyle(HtmlStyle.rowColor);
   tableContents.add(tr);
 }
コード例 #30
0
 public Content getHyperLink(
     DocLink link, Content label, boolean strong, String stylename, String title, String target) {
   Content body = label;
   if (strong) {
     body = HtmlTree.SPAN(HtmlStyle.typeNameLink, body);
   }
   if (stylename != null && stylename.length() != 0) {
     HtmlTree t = new HtmlTree(HtmlTag.FONT, body);
     t.addAttr(HtmlAttr.CLASS, stylename);
     body = t;
   }
   HtmlTree l = HtmlTree.A(link.toString(), body);
   if (title != null && title.length() != 0) {
     l.addAttr(HtmlAttr.TITLE, title);
   }
   if (target != null && target.length() != 0) {
     l.addAttr(HtmlAttr.TARGET, target);
   }
   return l;
 }