/**
  * 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);
   }
 }
Пример #2
0
 /** Return true if c has a @hidden tag associated with it */
 private boolean hidden(ProgramElementDoc c) {
   Tag tags[] = c.tags("hidden");
   if (tags.length > 0) return true;
   tags = c.tags("view");
   if (tags.length > 0) return true;
   Options opt;
   if (c instanceof ClassDoc) opt = optionProvider.getOptionsFor((ClassDoc) c);
   else opt = optionProvider.getOptionsFor(c.containingClass());
   return opt.matchesHideExpression(c.toString());
 }
Пример #3
0
 /**
  * Return true if the given Doc is deprecated.
  *
  * @param doc the Doc to check.
  * @return true if the given Doc is deprecated.
  */
 public static boolean isDeprecated(ProgramElementDoc doc) {
   if (doc.tags("deprecated").length > 0) {
     return true;
   }
   AnnotationDesc[] annotationDescList = doc.annotations();
   for (int i = 0; i < annotationDescList.length; i++) {
     if (annotationDescList[i]
         .annotationType()
         .qualifiedName()
         .equals(java.lang.Deprecated.class.getName())) {
       return true;
     }
   }
   return false;
 }
Пример #4
0
 /**
  * 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);
   }
 }