/** {@inheritDoc} */ public Content simpleTagOutput(Tag simpleTag, String header) { ContentBuilder result = new ContentBuilder(); result.addContent(HtmlTree.DT(HtmlTree.SPAN(HtmlStyle.simpleTagLabel, new RawHtml(header)))); Content body = htmlWriter.commentTagsToContent(simpleTag, null, simpleTag.inlineTags(), false); result.addContent(HtmlTree.DD(body)); return result; }
/** * Get summary links for navigation bar. * * @return the content tree for the navigation summary links */ protected Content getNavSummaryLinks() throws Exception { Content li = HtmlTree.LI(summaryLabel); li.addContent(getSpace()); Content ulNav = HtmlTree.UL(HtmlStyle.subNavList, li); MemberSummaryBuilder memberSummaryBuilder = (MemberSummaryBuilder) configuration.getBuilderFactory().getMemberSummaryBuilder(this); Content liNavField = new HtmlTree(HtmlTag.LI); addNavSummaryLink( memberSummaryBuilder, "doclet.navField", VisibleMemberMap.ANNOTATION_TYPE_FIELDS, liNavField); addNavGap(liNavField); ulNav.addContent(liNavField); Content liNavReq = new HtmlTree(HtmlTag.LI); addNavSummaryLink( memberSummaryBuilder, "doclet.navAnnotationTypeRequiredMember", VisibleMemberMap.ANNOTATION_TYPE_MEMBER_REQUIRED, liNavReq); addNavGap(liNavReq); ulNav.addContent(liNavReq); Content liNavOpt = new HtmlTree(HtmlTag.LI); addNavSummaryLink( memberSummaryBuilder, "doclet.navAnnotationTypeOptionalMember", VisibleMemberMap.ANNOTATION_TYPE_MEMBER_OPTIONAL, liNavOpt); ulNav.addContent(liNavOpt); return ulNav; }
/** {@inheritDoc} */ public Content getThrowsHeader() { HtmlTree result = HtmlTree.DT( HtmlTree.SPAN( HtmlStyle.throwsLabel, new StringContent(configuration.getText("doclet.Throws")))); return result; }
/** * Generate a package summary page for the left-hand bottom frame. Construct the * PackageFrameWriter object and then uses it generate the file. * * @param configuration the current configuration of the doclet. * @param packageDoc The package for which "pacakge-frame.html" is to be generated. */ public static void generate(ConfigurationImpl configuration, PackageDoc packageDoc) { PackageFrameWriter packgen; try { packgen = new PackageFrameWriter(configuration, packageDoc); String pkgName = Util.getPackageName(packageDoc); Content body = packgen.getBody(false, packgen.getWindowTitle(pkgName)); Content pkgNameContent = new StringContent(pkgName); Content heading = HtmlTree.HEADING( HtmlConstants.TITLE_HEADING, HtmlStyle.bar, packgen.getTargetPackageLink(packageDoc, "classFrame", pkgNameContent)); body.addContent(heading); HtmlTree div = new HtmlTree(HtmlTag.DIV); div.addStyle(HtmlStyle.indexContainer); packgen.addClassListing(div); body.addContent(div); packgen.printHtmlDocument( configuration.metakeywords.getMetaKeywords(packageDoc), false, body); packgen.close(); } catch (IOException exc) { configuration.standardmessage.error( "doclet.exception_encountered", exc.toString(), DocPaths.PACKAGE_FRAME.getPath()); throw new DocletAbortException(exc); } }
/** {@inheritDoc} */ public Content throwsTagOutput(Type throwsType) { HtmlTree result = HtmlTree.DD( HtmlTree.CODE( htmlWriter.getLink( new LinkInfoImpl(configuration, LinkInfoImpl.Kind.MEMBER, throwsType)))); return result; }
/** {@inheritDoc} */ public Content paramTagOutput(ParamTag paramTag, String paramName) { ContentBuilder body = new ContentBuilder(); body.addContent(HtmlTree.CODE(new RawHtml(paramName))); body.addContent(" - "); body.addContent(htmlWriter.commentTagsToContent(paramTag, null, paramTag.inlineTags(), false)); HtmlTree result = HtmlTree.DD(body); return result; }
/** {@inheritDoc} */ public Content propertyTagOutput(Tag tag, String prefix) { Content body = new ContentBuilder(); body.addContent(new RawHtml(prefix)); body.addContent(" "); body.addContent(HtmlTree.CODE(new RawHtml(tag.text()))); body.addContent("."); Content result = HtmlTree.P(body); return result; }
/** {@inheritDoc} */ public void addClassesSummary( ClassDoc[] classes, String label, String tableSummary, String[] tableHeader, Content packageSummaryContentTree) { HtmlTree li = new HtmlTree(HtmlTag.LI); li.addStyle(HtmlStyle.blockList); addClassesSummary(classes, label, tableSummary, tableHeader, li, profileValue); packageSummaryContentTree.addContent(li); }
/** {@inheritDoc} */ public Content returnTagOutput(Tag returnTag) { ContentBuilder result = new ContentBuilder(); result.addContent( HtmlTree.DT( HtmlTree.SPAN( HtmlStyle.returnLabel, new StringContent(configuration.getText("doclet.Returns"))))); result.addContent( HtmlTree.DD( htmlWriter.commentTagsToContent(returnTag, null, returnTag.inlineTags(), false))); return result; }
/** * Get link to next class. * * @return a content tree for the next class link */ public Content getNavLinkNext() { Content li; if (next != null) { Content nextLink = getLink( new LinkInfoImpl(configuration, LinkInfoImpl.Kind.CLASS, next.asClassDoc()) .label(nextclassLabel) .strong(true)); li = HtmlTree.LI(nextLink); } else li = HtmlTree.LI(nextclassLabel); return li; }
/** * Get link to previous class. * * @return a content tree for the previous class link */ public Content getNavLinkPrevious() { Content li; if (prev != null) { Content prevLink = getLink( new LinkInfoImpl(configuration, LinkInfoImpl.Kind.CLASS, prev.asClassDoc()) .label(prevclassLabel) .strong(true)); li = HtmlTree.LI(prevLink); } else li = HtmlTree.LI(prevclassLabel); return li; }
/** {@inheritDoc} */ public Content simpleTagOutput(Tag[] simpleTags, String header) { ContentBuilder result = new ContentBuilder(); result.addContent(HtmlTree.DT(HtmlTree.SPAN(HtmlStyle.simpleTagLabel, new RawHtml(header)))); ContentBuilder body = new ContentBuilder(); for (int i = 0; i < simpleTags.length; i++) { if (i > 0) { body.addContent(", "); } body.addContent( htmlWriter.commentTagsToContent(simpleTags[i], null, simpleTags[i].inlineTags(), false)); } result.addContent(HtmlTree.DD(body)); return result; }
/** * Add description for Class, Field, Method or Constructor. * * @param member MemberDoc for the member of the Class Kind * @param dlTree the content tree to which the description will be added */ protected void addDescription(MemberDoc member, Content dlTree) { String name = (member instanceof ExecutableMemberDoc) ? member.name() + ((ExecutableMemberDoc) member).flatSignature() : member.name(); Content span = HtmlTree.SPAN(HtmlStyle.memberNameLink, getDocLink(LinkInfoImpl.Kind.INDEX, member, name)); Content dt = HtmlTree.DT(span); dt.addContent(" - "); addMemberDesc(member, dt); dlTree.addContent(dt); Content dd = new HtmlTree(HtmlTag.DD); addComment(member, dd); dlTree.addContent(dd); }
/** * Add the package deprecation information to the documentation tree. * * @param div the content tree to which the deprecation information will be added */ public void addDeprecationInfo(Content div) { Tag[] deprs = packageDoc.tags("deprecated"); if (Util.isDeprecated(packageDoc)) { HtmlTree deprDiv = new HtmlTree(HtmlTag.DIV); deprDiv.addStyle(HtmlStyle.deprecatedContent); Content deprPhrase = HtmlTree.SPAN(HtmlStyle.deprecatedLabel, deprecatedPhrase); deprDiv.addContent(deprPhrase); if (deprs.length > 0) { Tag[] commentTags = deprs[0].inlineTags(); if (commentTags.length > 0) { addInlineDeprecatedComment(packageDoc, deprs[0], deprDiv); } } div.addContent(deprDiv); } }
/** * Get "NEXT PACKAGE" link in the navigation bar. * * @return a content tree for the next link */ public Content getNavLinkNext() { Content li; if (next == null) { li = HtmlTree.LI(nextpackageLabel); } else { DocPath path = DocPath.relativePath(packageDoc, next); li = HtmlTree.LI( getHyperLink( path.resolve(DocPaths.profilePackageSummary(profileName)), nextpackageLabel, "", "")); } return li; }
/** {@inheritDoc} */ public void addAnnotationTypeDeprecationInfo(Content annotationInfoTree) { Content hr = new HtmlTree(HtmlTag.HR); annotationInfoTree.addContent(hr); Tag[] deprs = annotationType.tags("deprecated"); if (Util.isDeprecated(annotationType)) { Content deprLabel = HtmlTree.SPAN(HtmlStyle.deprecatedLabel, deprecatedPhrase); Content div = HtmlTree.DIV(HtmlStyle.block, deprLabel); if (deprs.length > 0) { Tag[] commentTags = deprs[0].inlineTags(); if (commentTags.length > 0) { div.addContent(getSpace()); addInlineDeprecatedComment(annotationType, deprs[0], div); } } annotationInfoTree.addContent(div); } }
/** {@inheritDoc} */ public Content throwsTagOutput(ThrowsTag throwsTag) { ContentBuilder body = new ContentBuilder(); Content excName = (throwsTag.exceptionType() == null) ? new RawHtml(throwsTag.exceptionName()) : htmlWriter.getLink( new LinkInfoImpl( configuration, LinkInfoImpl.Kind.MEMBER, throwsTag.exceptionType())); body.addContent(HtmlTree.CODE(excName)); Content desc = htmlWriter.commentTagsToContent(throwsTag, null, throwsTag.inlineTags(), false); if (desc != null && !desc.isEmpty()) { body.addContent(" - "); body.addContent(desc); } HtmlTree result = HtmlTree.DD(body); return result; }
/** {@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; }
/** {@inheritDoc} */ public void addPackageDescription(Content packageContentTree) { if (packageDoc.inlineTags().length > 0) { packageContentTree.addContent(getMarkerAnchor(SectionName.PACKAGE_DESCRIPTION)); Content h2Content = new StringContent(configuration.getText("doclet.Package_Description", packageDoc.name())); packageContentTree.addContent( HtmlTree.HEADING(HtmlConstants.PACKAGE_HEADING, true, h2Content)); addInlineComment(packageDoc, packageContentTree); } }
/** * Add summary details to the navigation bar. * * @param subDiv the content tree to which the summary detail links will be added */ protected void addSummaryDetailLinks(Content subDiv) { try { Content div = HtmlTree.DIV(getNavSummaryLinks()); div.addContent(getNavDetailLinks()); subDiv.addContent(div); } catch (Exception e) { e.printStackTrace(); throw new DocletAbortException(e); } }
/** * Add one line summary comment for the class. * * @param cd the class being documented * @param dlTree the content tree to which the description will be added */ protected void addDescription(ClassDoc cd, Content dlTree) { Content link = getLink(new LinkInfoImpl(configuration, LinkInfoImpl.Kind.INDEX, cd).strong(true)); Content dt = HtmlTree.DT(link); dt.addContent(" - "); addClassInfo(cd, dt); dlTree.addContent(dt); Content dd = new HtmlTree(HtmlTag.DD); addComment(cd, dd); dlTree.addContent(dd); }
/** * Add one line summary comment for the package. * * @param pkg the package to be documented * @param dlTree the content tree to which the description will be added */ protected void addDescription(PackageDoc pkg, Content dlTree) { Content link = getPackageLink(pkg, new StringContent(Util.getPackageName(pkg))); Content dt = HtmlTree.DT(link); dt.addContent(" - "); dt.addContent(getResource("doclet.package")); dt.addContent(" " + pkg.name()); dlTree.addContent(dt); Content dd = new HtmlTree(HtmlTag.DD); addSummaryComment(pkg, dd); dlTree.addContent(dd); }
/** {@inheritDoc} */ public Content deprecatedTagOutput(Doc doc) { ContentBuilder result = new ContentBuilder(); Tag[] deprs = doc.tags("deprecated"); if (doc instanceof ClassDoc) { if (Util.isDeprecated((ProgramElementDoc) doc)) { result.addContent( HtmlTree.SPAN( HtmlStyle.deprecatedLabel, new StringContent(configuration.getText("doclet.Deprecated")))); result.addContent(RawHtml.nbsp); if (deprs.length > 0) { Tag[] commentTags = deprs[0].inlineTags(); if (commentTags.length > 0) { result.addContent(commentTagsToOutput(null, doc, deprs[0].inlineTags(), false)); } } } } else { MemberDoc member = (MemberDoc) doc; if (Util.isDeprecated((ProgramElementDoc) doc)) { result.addContent( HtmlTree.SPAN( HtmlStyle.deprecatedLabel, new StringContent(configuration.getText("doclet.Deprecated")))); result.addContent(RawHtml.nbsp); if (deprs.length > 0) { Content body = commentTagsToOutput(null, doc, deprs[0].inlineTags(), false); if (!body.isEmpty()) result.addContent(HtmlTree.SPAN(HtmlStyle.deprecationComment, body)); } } else { if (Util.isDeprecated(member.containingClass())) { result.addContent( HtmlTree.SPAN( HtmlStyle.deprecatedLabel, new StringContent(configuration.getText("doclet.Deprecated")))); result.addContent(RawHtml.nbsp); } } } return result; }
/** * Add specific class kind listing. Also add label to the listing. * * @param arr Array of specific class kinds, namely Class or Interface or Exception or Error * @param labelContent content tree of the label to be added * @param contentTree the content tree to which the class kind listing will be added */ protected void addClassKindListing(ClassDoc[] arr, Content labelContent, Content contentTree) { arr = Util.filterOutPrivateClasses(arr, configuration.javafx); if (arr.length > 0) { Arrays.sort(arr); boolean printedHeader = false; HtmlTree ul = new HtmlTree(HtmlTag.UL); ul.setTitle(labelContent); for (int i = 0; i < arr.length; i++) { if (documentedClasses != null && !documentedClasses.contains(arr[i])) { continue; } if (!Util.isCoreClass(arr[i]) || !configuration.isGeneratedDoc(arr[i])) { continue; } if (!printedHeader) { Content heading = HtmlTree.HEADING(HtmlConstants.CONTENT_HEADING, true, labelContent); contentTree.addContent(heading); printedHeader = true; } Content arr_i_name = new StringContent(arr[i].name()); if (arr[i].isInterface()) arr_i_name = HtmlTree.SPAN(HtmlStyle.interfaceName, arr_i_name); Content link = getLink( new LinkInfoImpl(configuration, LinkInfoImpl.Kind.PACKAGE_FRAME, arr[i]) .label(arr_i_name) .target("classFrame")); Content li = HtmlTree.LI(link); ul.addContent(li); } contentTree.addContent(ul); } }
/** {@inheritDoc} */ public Content getHeader(String header) { String pkgname = (annotationType.containingPackage() != null) ? annotationType.containingPackage().name() : ""; String clname = annotationType.name(); Content bodyTree = getBody(true, getWindowTitle(clname)); addTop(bodyTree); addNavLinks(true, bodyTree); bodyTree.addContent(HtmlConstants.START_OF_CLASS_DATA); HtmlTree div = new HtmlTree(HtmlTag.DIV); div.addStyle(HtmlStyle.header); if (pkgname.length() > 0) { Content pkgNameContent = new StringContent(pkgname); Content pkgNameDiv = HtmlTree.DIV(HtmlStyle.subTitle, pkgNameContent); div.addContent(pkgNameDiv); } LinkInfoImpl linkInfo = new LinkInfoImpl(configuration, LinkInfoImpl.Kind.CLASS_HEADER, annotationType); Content headerContent = new StringContent(header); Content heading = HtmlTree.HEADING(HtmlConstants.CLASS_PAGE_HEADING, true, HtmlStyle.title, headerContent); heading.addContent(getTypeParameterLinks(linkInfo)); div.addContent(heading); bodyTree.addContent(div); return bodyTree; }
/** * Get detail links for the navigation bar. * * @return the content tree for the detail links */ protected Content getNavDetailLinks() throws Exception { Content li = HtmlTree.LI(detailLabel); li.addContent(getSpace()); Content ulNav = HtmlTree.UL(HtmlStyle.subNavList, li); MemberSummaryBuilder memberSummaryBuilder = (MemberSummaryBuilder) configuration.getBuilderFactory().getMemberSummaryBuilder(this); AbstractMemberWriter writerField = ((AbstractMemberWriter) memberSummaryBuilder.getMemberSummaryWriter(VisibleMemberMap.ANNOTATION_TYPE_FIELDS)); AbstractMemberWriter writerOptional = ((AbstractMemberWriter) memberSummaryBuilder.getMemberSummaryWriter( VisibleMemberMap.ANNOTATION_TYPE_MEMBER_OPTIONAL)); AbstractMemberWriter writerRequired = ((AbstractMemberWriter) memberSummaryBuilder.getMemberSummaryWriter( VisibleMemberMap.ANNOTATION_TYPE_MEMBER_REQUIRED)); Content liNavField = new HtmlTree(HtmlTag.LI); if (writerField != null) { writerField.addNavDetailLink(annotationType.fields().length > 0, liNavField); } else { liNavField.addContent(getResource("doclet.navField")); } addNavGap(liNavField); ulNav.addContent(liNavField); if (writerOptional != null) { Content liNavOpt = new HtmlTree(HtmlTag.LI); writerOptional.addNavDetailLink(annotationType.elements().length > 0, liNavOpt); ulNav.addContent(liNavOpt); } else if (writerRequired != null) { Content liNavReq = new HtmlTree(HtmlTag.LI); writerRequired.addNavDetailLink(annotationType.elements().length > 0, liNavReq); ulNav.addContent(liNavReq); } else { Content liNav = HtmlTree.LI(getResource("doclet.navAnnotationTypeMember")); ulNav.addContent(liNav); } return ulNav; }
/** * Add comment for each element in the index. If the element is deprecated and it has * a @deprecated tag, use that comment. Else if the containing class for this element is * deprecated, then add the word "Deprecated." at the start and then print the normal comment. * * @param element Index element * @param contentTree the content tree to which the comment will be added */ protected void addComment(ProgramElementDoc element, Content contentTree) { Tag[] tags; Content span = HtmlTree.SPAN(HtmlStyle.deprecatedLabel, deprecatedPhrase); HtmlTree div = new HtmlTree(HtmlTag.DIV); div.addStyle(HtmlStyle.block); if (Util.isDeprecated(element)) { div.addContent(span); if ((tags = element.tags("deprecated")).length > 0) addInlineDeprecatedComment(element, tags[0], div); contentTree.addContent(div); } else { ClassDoc cont = element.containingClass(); while (cont != null) { if (Util.isDeprecated(cont)) { div.addContent(span); contentTree.addContent(div); break; } cont = cont.containingClass(); } addSummaryComment(element, contentTree); } }
/** {@inheritDoc} */ public void addAnnotationTypeSignature(String modifiers, Content annotationInfoTree) { annotationInfoTree.addContent(new HtmlTree(HtmlTag.BR)); Content pre = new HtmlTree(HtmlTag.PRE); addAnnotationInfo(annotationType, pre); pre.addContent(modifiers); LinkInfoImpl linkInfo = new LinkInfoImpl(configuration, LinkInfoImpl.Kind.CLASS_SIGNATURE, annotationType); Content annotationName = new StringContent(annotationType.name()); Content parameterLinks = getTypeParameterLinks(linkInfo); if (configuration.linksource) { addSrcLink(annotationType, annotationName, pre); pre.addContent(parameterLinks); } else { Content span = HtmlTree.SPAN(HtmlStyle.memberNameLabel, annotationName); span.addContent(parameterLinks); pre.addContent(span); } annotationInfoTree.addContent(pre); }
/** * Add the member information for the unicode character along with the list of the members. * * @param unicode Unicode for which member list information to be generated * @param memberlist List of members for the unicode character * @param contentTree the content tree to which the information will be added */ protected void addContents(Character uc, List<? extends Doc> memberlist, Content contentTree) { String unicode = uc.toString(); contentTree.addContent(getMarkerAnchorForIndex(unicode)); Content headContent = new StringContent(unicode); Content heading = HtmlTree.HEADING(HtmlConstants.CONTENT_HEADING, false, HtmlStyle.title, headContent); contentTree.addContent(heading); int memberListSize = memberlist.size(); // Display the list only if there are elements to be displayed. if (memberListSize > 0) { Content dl = new HtmlTree(HtmlTag.DL); for (int i = 0; i < memberListSize; i++) { Doc element = memberlist.get(i); if (element instanceof MemberDoc) { addDescription((MemberDoc) element, dl); } else if (element instanceof ClassDoc) { addDescription((ClassDoc) element, dl); } else if (element instanceof PackageDoc) { addDescription((PackageDoc) element, dl); } } contentTree.addContent(dl); } }
/** * Highlight "Package" in the navigation bar, as this is the package page. * * @return a content tree for the package link */ protected Content getNavLinkPackage() { Content li = HtmlTree.LI(HtmlStyle.navBarCell1Rev, packageLabel); return li; }