/** {@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 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); } }
/** * 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); } }
/** {@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); } }