src/share/classes/com/sun/tools/doclets/formats/html/AbstractMemberWriter.java

changeset 1417
522a1ee72340
parent 1410
bfec2a1cc869
child 1468
690c41cdab55
equal deleted inserted replaced
1416:c0f0c41cafa0 1417:522a1ee72340
50 public abstract class AbstractMemberWriter { 50 public abstract class AbstractMemberWriter {
51 51
52 protected final ConfigurationImpl configuration; 52 protected final ConfigurationImpl configuration;
53 protected final SubWriterHolderWriter writer; 53 protected final SubWriterHolderWriter writer;
54 protected final ClassDoc classdoc; 54 protected final ClassDoc classdoc;
55 protected Map<String,Integer> typeMap = new LinkedHashMap<String,Integer>();
56 protected Set<MethodTypes> methodTypes = EnumSet.noneOf(MethodTypes.class);
57 private int methodTypesOr = 0;
55 public final boolean nodepr; 58 public final boolean nodepr;
56 59
57 protected boolean printedSummaryHeader = false; 60 protected boolean printedSummaryHeader = false;
58 61
59 public AbstractMemberWriter(SubWriterHolderWriter writer, ClassDoc classdoc) { 62 public AbstractMemberWriter(SubWriterHolderWriter writer, ClassDoc classdoc) {
522 * Add the member summary for the given class. 525 * Add the member summary for the given class.
523 * 526 *
524 * @param classDoc the class that is being documented 527 * @param classDoc the class that is being documented
525 * @param member the member being documented 528 * @param member the member being documented
526 * @param firstSentenceTags the first sentence tags to be added to the summary 529 * @param firstSentenceTags the first sentence tags to be added to the summary
527 * @param tableTree the content tree to which the documentation will be added 530 * @param tableContents the list of contents to which the documentation will be added
528 * @param counter the counter for determing style for the table row 531 * @param counter the counter for determining id and style for the table row
529 */ 532 */
530 public void addMemberSummary(ClassDoc classDoc, ProgramElementDoc member, 533 public void addMemberSummary(ClassDoc classDoc, ProgramElementDoc member,
531 Tag[] firstSentenceTags, Content tableTree, int counter) { 534 Tag[] firstSentenceTags, List<Content> tableContents, int counter) {
532 HtmlTree tdSummaryType = new HtmlTree(HtmlTag.TD); 535 HtmlTree tdSummaryType = new HtmlTree(HtmlTag.TD);
533 tdSummaryType.addStyle(HtmlStyle.colFirst); 536 tdSummaryType.addStyle(HtmlStyle.colFirst);
534 writer.addSummaryType(this, member, tdSummaryType); 537 writer.addSummaryType(this, member, tdSummaryType);
535 HtmlTree tdSummary = new HtmlTree(HtmlTag.TD); 538 HtmlTree tdSummary = new HtmlTree(HtmlTag.TD);
536 setSummaryColumnStyle(tdSummary); 539 setSummaryColumnStyle(tdSummary);
537 addSummaryLink(classDoc, member, tdSummary); 540 addSummaryLink(classDoc, member, tdSummary);
538 writer.addSummaryLinkComment(this, member, firstSentenceTags, tdSummary); 541 writer.addSummaryLinkComment(this, member, firstSentenceTags, tdSummary);
539 HtmlTree tr = HtmlTree.TR(tdSummaryType); 542 HtmlTree tr = HtmlTree.TR(tdSummaryType);
540 tr.addContent(tdSummary); 543 tr.addContent(tdSummary);
544 if (member instanceof MethodDoc && !member.isAnnotationTypeElement()) {
545 int methodType = (member.isStatic()) ? MethodTypes.STATIC.value() :
546 MethodTypes.INSTANCE.value();
547 methodType = (classdoc.isInterface() || ((MethodDoc)member).isAbstract()) ?
548 methodType | MethodTypes.ABSTRACT.value() :
549 methodType | MethodTypes.CONCRETE.value();
550 if (Util.isDeprecated(member) || Util.isDeprecated(classdoc)) {
551 methodType = methodType | MethodTypes.DEPRECATED.value();
552 }
553 methodTypesOr = methodTypesOr | methodType;
554 String tableId = "i" + counter;
555 typeMap.put(tableId, methodType);
556 tr.addAttr(HtmlAttr.ID, tableId);
557 }
541 if (counter%2 == 0) 558 if (counter%2 == 0)
542 tr.addStyle(HtmlStyle.altColor); 559 tr.addStyle(HtmlStyle.altColor);
543 else 560 else
544 tr.addStyle(HtmlStyle.rowColor); 561 tr.addStyle(HtmlStyle.rowColor);
545 tableTree.addContent(tr); 562 tableContents.add(tr);
563 }
564
565 /**
566 * Generate the method types set and return true if the method summary table
567 * needs to show tabs.
568 *
569 * @return true if the table should show tabs
570 */
571 public boolean showTabs() {
572 int value;
573 for (MethodTypes type : EnumSet.allOf(MethodTypes.class)) {
574 value = type.value();
575 if ((value & methodTypesOr) == value) {
576 methodTypes.add(type);
577 }
578 }
579 boolean showTabs = methodTypes.size() > 1;
580 if (showTabs) {
581 methodTypes.add(MethodTypes.ALL);
582 }
583 return showTabs;
546 } 584 }
547 585
548 /** 586 /**
549 * Set the style for the summary column. 587 * Set the style for the summary column.
550 * 588 *
593 631
594 /** 632 /**
595 * Get the summary table tree for the given class. 633 * Get the summary table tree for the given class.
596 * 634 *
597 * @param classDoc the class for which the summary table is generated 635 * @param classDoc the class for which the summary table is generated
636 * @param tableContents list of contents to be displayed in the summary table
598 * @return a content tree for the summary table 637 * @return a content tree for the summary table
599 */ 638 */
600 public Content getSummaryTableTree(ClassDoc classDoc) { 639 public Content getSummaryTableTree(ClassDoc classDoc, List<Content> tableContents) {
601 return writer.getSummaryTableTree(this, classDoc); 640 return writer.getSummaryTableTree(this, classDoc, tableContents, showTabs());
602 } 641 }
603 642
604 /** 643 /**
605 * Get the member tree to be documented. 644 * Get the member tree to be documented.
606 * 645 *

mercurial