/**
  * 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);
   }
 }
Пример #2
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;
 }
 /**
  * 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;
 }
 /**
  * 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;
 }
 /**
  * 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();
   }
 }