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

changeset 1417
522a1ee72340
parent 1410
bfec2a1cc869
child 1468
690c41cdab55
     1.1 --- a/src/share/classes/com/sun/tools/doclets/formats/html/AbstractMemberWriter.java	Mon Nov 19 11:38:49 2012 -0800
     1.2 +++ b/src/share/classes/com/sun/tools/doclets/formats/html/AbstractMemberWriter.java	Mon Nov 19 16:10:34 2012 -0800
     1.3 @@ -52,6 +52,9 @@
     1.4      protected final ConfigurationImpl configuration;
     1.5      protected final SubWriterHolderWriter writer;
     1.6      protected final ClassDoc classdoc;
     1.7 +    protected Map<String,Integer> typeMap = new LinkedHashMap<String,Integer>();
     1.8 +    protected Set<MethodTypes> methodTypes = EnumSet.noneOf(MethodTypes.class);
     1.9 +    private int methodTypesOr = 0;
    1.10      public final boolean nodepr;
    1.11  
    1.12      protected boolean printedSummaryHeader = false;
    1.13 @@ -524,11 +527,11 @@
    1.14       * @param classDoc the class that is being documented
    1.15       * @param member the member being documented
    1.16       * @param firstSentenceTags the first sentence tags to be added to the summary
    1.17 -     * @param tableTree the content tree to which the documentation will be added
    1.18 -     * @param counter the counter for determing style for the table row
    1.19 +     * @param tableContents the list of contents to which the documentation will be added
    1.20 +     * @param counter the counter for determining id and style for the table row
    1.21       */
    1.22      public void addMemberSummary(ClassDoc classDoc, ProgramElementDoc member,
    1.23 -            Tag[] firstSentenceTags, Content tableTree, int counter) {
    1.24 +            Tag[] firstSentenceTags, List<Content> tableContents, int counter) {
    1.25          HtmlTree tdSummaryType = new HtmlTree(HtmlTag.TD);
    1.26          tdSummaryType.addStyle(HtmlStyle.colFirst);
    1.27          writer.addSummaryType(this, member, tdSummaryType);
    1.28 @@ -538,11 +541,46 @@
    1.29          writer.addSummaryLinkComment(this, member, firstSentenceTags, tdSummary);
    1.30          HtmlTree tr = HtmlTree.TR(tdSummaryType);
    1.31          tr.addContent(tdSummary);
    1.32 +        if (member instanceof MethodDoc && !member.isAnnotationTypeElement()) {
    1.33 +            int methodType = (member.isStatic()) ? MethodTypes.STATIC.value() :
    1.34 +                    MethodTypes.INSTANCE.value();
    1.35 +            methodType = (classdoc.isInterface() || ((MethodDoc)member).isAbstract()) ?
    1.36 +                    methodType | MethodTypes.ABSTRACT.value() :
    1.37 +                    methodType | MethodTypes.CONCRETE.value();
    1.38 +            if (Util.isDeprecated(member) || Util.isDeprecated(classdoc)) {
    1.39 +                methodType = methodType | MethodTypes.DEPRECATED.value();
    1.40 +            }
    1.41 +            methodTypesOr = methodTypesOr | methodType;
    1.42 +            String tableId = "i" + counter;
    1.43 +            typeMap.put(tableId, methodType);
    1.44 +            tr.addAttr(HtmlAttr.ID, tableId);
    1.45 +        }
    1.46          if (counter%2 == 0)
    1.47              tr.addStyle(HtmlStyle.altColor);
    1.48          else
    1.49              tr.addStyle(HtmlStyle.rowColor);
    1.50 -        tableTree.addContent(tr);
    1.51 +        tableContents.add(tr);
    1.52 +    }
    1.53 +
    1.54 +    /**
    1.55 +     * Generate the method types set and return true if the method summary table
    1.56 +     * needs to show tabs.
    1.57 +     *
    1.58 +     * @return true if the table should show tabs
    1.59 +     */
    1.60 +    public boolean showTabs() {
    1.61 +        int value;
    1.62 +        for (MethodTypes type : EnumSet.allOf(MethodTypes.class)) {
    1.63 +            value = type.value();
    1.64 +            if ((value & methodTypesOr) == value) {
    1.65 +                methodTypes.add(type);
    1.66 +            }
    1.67 +        }
    1.68 +        boolean showTabs = methodTypes.size() > 1;
    1.69 +        if (showTabs) {
    1.70 +            methodTypes.add(MethodTypes.ALL);
    1.71 +        }
    1.72 +        return showTabs;
    1.73      }
    1.74  
    1.75      /**
    1.76 @@ -595,10 +633,11 @@
    1.77       * Get the summary table tree for the given class.
    1.78       *
    1.79       * @param classDoc the class for which the summary table is generated
    1.80 +     * @param tableContents list of contents to be displayed in the summary table
    1.81       * @return a content tree for the summary table
    1.82       */
    1.83 -    public Content getSummaryTableTree(ClassDoc classDoc) {
    1.84 -        return writer.getSummaryTableTree(this, classDoc);
    1.85 +    public Content getSummaryTableTree(ClassDoc classDoc, List<Content> tableContents) {
    1.86 +        return writer.getSummaryTableTree(this, classDoc, tableContents, showTabs());
    1.87      }
    1.88  
    1.89      /**

mercurial