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

changeset 766
90af8d87741f
parent 554
9d9f26857129
child 798
4868a36f6fd8
     1.1 --- a/src/share/classes/com/sun/tools/doclets/formats/html/SubWriterHolderWriter.java	Tue Nov 30 09:38:48 2010 -0800
     1.2 +++ b/src/share/classes/com/sun/tools/doclets/formats/html/SubWriterHolderWriter.java	Wed Dec 01 11:02:38 2010 -0800
     1.3 @@ -25,10 +25,11 @@
     1.4  
     1.5  package com.sun.tools.doclets.formats.html;
     1.6  
     1.7 +import java.io.*;
     1.8  import com.sun.javadoc.*;
     1.9 +import com.sun.tools.doclets.internal.toolkit.*;
    1.10  import com.sun.tools.doclets.internal.toolkit.util.*;
    1.11 -
    1.12 -import java.io.*;
    1.13 +import com.sun.tools.doclets.formats.html.markup.*;
    1.14  
    1.15  /**
    1.16   * This abstract class exists to provide functionality needed in the
    1.17 @@ -71,13 +72,31 @@
    1.18          tdEnd();
    1.19      }
    1.20  
    1.21 -    public void printSummaryHeader(AbstractMemberWriter mw, ClassDoc cd) {
    1.22 -        mw.printSummaryAnchor(cd);
    1.23 -        mw.printTableSummary();
    1.24 -        tableCaptionStart();
    1.25 -        mw.printSummaryLabel();
    1.26 -        tableCaptionEnd();
    1.27 -        mw.printSummaryTableHeader(cd);
    1.28 +    /**
    1.29 +     * Add the summary header.
    1.30 +     *
    1.31 +     * @param mw the writer for the member being documented
    1.32 +     * @param cd the classdoc to be documented
    1.33 +     * @param memberTree the content tree to which the summary header will be added
    1.34 +     */
    1.35 +    public void addSummaryHeader(AbstractMemberWriter mw, ClassDoc cd,
    1.36 +            Content memberTree) {
    1.37 +        mw.addSummaryAnchor(cd, memberTree);
    1.38 +        mw.addSummaryLabel(memberTree);
    1.39 +    }
    1.40 +
    1.41 +    /**
    1.42 +     * Get the summary table.
    1.43 +     *
    1.44 +     * @param mw the writer for the member being documented
    1.45 +     * @param cd the classdoc to be documented
    1.46 +     * @return the content tree for the summary table
    1.47 +     */
    1.48 +    public Content getSummaryTableTree(AbstractMemberWriter mw, ClassDoc cd) {
    1.49 +        Content table = HtmlTree.TABLE(HtmlStyle.overviewSummary, 0, 3, 0,
    1.50 +                mw.getTableSummary(), getTableCaption(mw.getCaption()));
    1.51 +        table.addContent(getSummaryTableHeader(mw.getSummaryTableHeader(cd), "col"));
    1.52 +        return table;
    1.53      }
    1.54  
    1.55      public void printTableHeadingBackground(String str) {
    1.56 @@ -88,15 +107,17 @@
    1.57          tableEnd();
    1.58      }
    1.59  
    1.60 -    public void printInheritedSummaryHeader(AbstractMemberWriter mw, ClassDoc cd) {
    1.61 -        mw.printInheritedSummaryAnchor(cd);
    1.62 -        tableIndexSummary();
    1.63 -        tableInheritedHeaderStart("#EEEEFF");
    1.64 -        mw.printInheritedSummaryLabel(cd);
    1.65 -        tableInheritedHeaderEnd();
    1.66 -        trBgcolorStyle("white", "TableRowColor");
    1.67 -        summaryRow(0);
    1.68 -        code();
    1.69 +    /**
    1.70 +     * Add the inherited summary header.
    1.71 +     *
    1.72 +     * @param mw the writer for the member being documented
    1.73 +     * @param cd the classdoc to be documented
    1.74 +     * @param inheritedTree the content tree to which the inherited summary header will be added
    1.75 +     */
    1.76 +    public void addInheritedSummaryHeader(AbstractMemberWriter mw, ClassDoc cd,
    1.77 +            Content inheritedTree) {
    1.78 +        mw.addInheritedSummaryAnchor(cd, inheritedTree);
    1.79 +        mw.addInheritedSummaryLabel(cd, inheritedTree);
    1.80      }
    1.81  
    1.82      public void printSummaryFooter(AbstractMemberWriter mw, ClassDoc cd) {
    1.83 @@ -112,8 +133,14 @@
    1.84          space();
    1.85      }
    1.86  
    1.87 -    protected void printIndexComment(Doc member) {
    1.88 -        printIndexComment(member, member.firstSentenceTags());
    1.89 +    /**
    1.90 +     * Add the index comment.
    1.91 +     *
    1.92 +     * @param member the member being documented
    1.93 +     * @param contentTree the content tree to which the comment will be added
    1.94 +     */
    1.95 +    protected void addIndexComment(Doc member, Content contentTree) {
    1.96 +        addIndexComment(member, member.firstSentenceTags(), contentTree);
    1.97      }
    1.98  
    1.99      protected void printIndexComment(Doc member, Tag[] firstSentenceTags) {
   1.100 @@ -134,17 +161,60 @@
   1.101          printSummaryComment(member, firstSentenceTags);
   1.102      }
   1.103  
   1.104 -    public void printSummaryLinkType(AbstractMemberWriter mw,
   1.105 -                                     ProgramElementDoc member) {
   1.106 -        trBgcolorStyle("white", "TableRowColor");
   1.107 -        mw.printSummaryType(member);
   1.108 -        summaryRow(0);
   1.109 -        code();
   1.110 +    /**
   1.111 +     * Add the index comment.
   1.112 +     *
   1.113 +     * @param member the member being documented
   1.114 +     * @param firstSentenceTags the first sentence tags for the member to be documented
   1.115 +     * @param tdSummary the content tree to which the comment will be added
   1.116 +     */
   1.117 +    protected void addIndexComment(Doc member, Tag[] firstSentenceTags,
   1.118 +            Content tdSummary) {
   1.119 +        Tag[] deprs = member.tags("deprecated");
   1.120 +        Content div;
   1.121 +        if (Util.isDeprecated((ProgramElementDoc) member)) {
   1.122 +            Content strong = HtmlTree.STRONG(deprecatedPhrase);
   1.123 +            div = HtmlTree.DIV(HtmlStyle.block, strong);
   1.124 +            div.addContent(getSpace());
   1.125 +            if (deprs.length > 0) {
   1.126 +                addInlineDeprecatedComment(member, deprs[0], div);
   1.127 +            }
   1.128 +            tdSummary.addContent(div);
   1.129 +            return;
   1.130 +        } else {
   1.131 +            ClassDoc cd = ((ProgramElementDoc)member).containingClass();
   1.132 +            if (cd != null && Util.isDeprecated(cd)) {
   1.133 +                Content strong = HtmlTree.STRONG(deprecatedPhrase);
   1.134 +                div = HtmlTree.DIV(HtmlStyle.block, strong);
   1.135 +                div.addContent(getSpace());
   1.136 +                tdSummary.addContent(div);
   1.137 +            }
   1.138 +        }
   1.139 +        addSummaryComment(member, firstSentenceTags, tdSummary);
   1.140      }
   1.141  
   1.142 -    public void printSummaryLinkComment(AbstractMemberWriter mw,
   1.143 -                                        ProgramElementDoc member) {
   1.144 -        printSummaryLinkComment(mw, member, member.firstSentenceTags());
   1.145 +    /**
   1.146 +     * Add the summary type for the member.
   1.147 +     *
   1.148 +     * @param mw the writer for the member being documented
   1.149 +     * @param member the member to be documented
   1.150 +     * @param tdSummaryType the content tree to which the type will be added
   1.151 +     */
   1.152 +    public void addSummaryType(AbstractMemberWriter mw, ProgramElementDoc member,
   1.153 +            Content tdSummaryType) {
   1.154 +        mw.addSummaryType(member, tdSummaryType);
   1.155 +    }
   1.156 +
   1.157 +    /**
   1.158 +     * Add the summary link for the member.
   1.159 +     *
   1.160 +     * @param mw the writer for the member being documented
   1.161 +     * @param member the member to be documented
   1.162 +     * @param contentTree the content tree to which the link will be added
   1.163 +     */
   1.164 +    public void addSummaryLinkComment(AbstractMemberWriter mw,
   1.165 +            ProgramElementDoc member, Content contentTree) {
   1.166 +        addSummaryLinkComment(mw, member, member.firstSentenceTags(), contentTree);
   1.167      }
   1.168  
   1.169      public void printSummaryLinkComment(AbstractMemberWriter mw,
   1.170 @@ -159,12 +229,34 @@
   1.171          trEnd();
   1.172      }
   1.173  
   1.174 -    public void printInheritedSummaryMember(AbstractMemberWriter mw, ClassDoc cd,
   1.175 -            ProgramElementDoc member, boolean isFirst) {
   1.176 +    /**
   1.177 +     * Add the summary link comment.
   1.178 +     *
   1.179 +     * @param mw the writer for the member being documented
   1.180 +     * @param member the member being documented
   1.181 +     * @param firstSentenceTags the first sentence tags for the member to be documented
   1.182 +     * @param tdSummary the content tree to which the comment will be added
   1.183 +     */
   1.184 +    public void addSummaryLinkComment(AbstractMemberWriter mw,
   1.185 +            ProgramElementDoc member, Tag[] firstSentenceTags, Content tdSummary) {
   1.186 +        addIndexComment(member, firstSentenceTags, tdSummary);
   1.187 +    }
   1.188 +
   1.189 +    /**
   1.190 +     * Add the inherited member summary.
   1.191 +     *
   1.192 +     * @param mw the writer for the member being documented
   1.193 +     * @param cd the class being documented
   1.194 +     * @param member the member being documented
   1.195 +     * @param isFirst true if its the first link being documented
   1.196 +     * @param linksTree the content tree to which the summary will be added
   1.197 +     */
   1.198 +    public void addInheritedMemberSummary(AbstractMemberWriter mw, ClassDoc cd,
   1.199 +            ProgramElementDoc member, boolean isFirst, Content linksTree) {
   1.200          if (! isFirst) {
   1.201 -            mw.print(", ");
   1.202 +            linksTree.addContent(", ");
   1.203          }
   1.204 -        mw.writeInheritedSummaryLink(cd, member);
   1.205 +        mw.addInheritedSummaryLink(cd, member, linksTree);
   1.206      }
   1.207  
   1.208      public void printMemberHeader() {
   1.209 @@ -174,4 +266,67 @@
   1.210      public void printMemberFooter() {
   1.211      }
   1.212  
   1.213 +    /**
   1.214 +     * Get the document content header tree
   1.215 +     *
   1.216 +     * @return a content tree the document content header
   1.217 +     */
   1.218 +    public Content getContentHeader() {
   1.219 +        HtmlTree div = new HtmlTree(HtmlTag.DIV);
   1.220 +        div.addStyle(HtmlStyle.contentContainer);
   1.221 +        return div;
   1.222 +    }
   1.223 +
   1.224 +    /**
   1.225 +     * Get the member header tree
   1.226 +     *
   1.227 +     * @return a content tree the member header
   1.228 +     */
   1.229 +    public Content getMemberTreeHeader() {
   1.230 +        HtmlTree li = new HtmlTree(HtmlTag.LI);
   1.231 +        li.addStyle(HtmlStyle.blockList);
   1.232 +        return li;
   1.233 +    }
   1.234 +
   1.235 +    /**
   1.236 +     * Get the member tree
   1.237 +     *
   1.238 +     * @param contentTree the tree used to generate the complete member tree
   1.239 +     * @return a content tree for the member
   1.240 +     */
   1.241 +    public Content getMemberTree(Content contentTree) {
   1.242 +        Content ul = HtmlTree.UL(HtmlStyle.blockList, contentTree);
   1.243 +        return ul;
   1.244 +    }
   1.245 +
   1.246 +    /**
   1.247 +     * Get the member summary tree
   1.248 +     *
   1.249 +     * @param contentTree the tree used to generate the member summary tree
   1.250 +     * @return a content tree for the member summary
   1.251 +     */
   1.252 +    public Content getMemberSummaryTree(Content contentTree) {
   1.253 +        return getMemberTree(HtmlStyle.summary, contentTree);
   1.254 +    }
   1.255 +
   1.256 +    /**
   1.257 +     * Get the member details tree
   1.258 +     *
   1.259 +     * @param contentTree the tree used to generate the member details tree
   1.260 +     * @return a content tree for the member details
   1.261 +     */
   1.262 +    public Content getMemberDetailsTree(Content contentTree) {
   1.263 +        return getMemberTree(HtmlStyle.details, contentTree);
   1.264 +    }
   1.265 +
   1.266 +    /**
   1.267 +     * Get the member tree
   1.268 +     *
   1.269 +     * @param style the style class to be added to the content tree
   1.270 +     * @param contentTree the tree used to generate the complete member tree
   1.271 +     */
   1.272 +    public Content getMemberTree(HtmlStyle style, Content contentTree) {
   1.273 +        Content div = HtmlTree.DIV(style, getMemberTree(contentTree));
   1.274 +        return div;
   1.275 +    }
   1.276  }

mercurial