< prev index next >

src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/SubWriterHolderWriter.java

Print this page




   8  * particular file as subject to the "Classpath" exception as provided
   9  * by Oracle in the LICENSE file that accompanied this code.
  10  *
  11  * This code is distributed in the hope that it will be useful, but WITHOUT
  12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  14  * version 2 for more details (a copy is included in the LICENSE file that
  15  * accompanied this code).
  16  *
  17  * You should have received a copy of the GNU General Public License version
  18  * 2 along with this work; if not, write to the Free Software Foundation,
  19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20  *
  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any
  23  * questions.
  24  */
  25 
  26 package jdk.javadoc.internal.doclets.formats.html;
  27 
  28 import java.io.*;
  29 import java.util.*;
  30 
  31 import javax.lang.model.element.Element;
  32 import javax.lang.model.element.TypeElement;
  33 
  34 import com.sun.source.doctree.DocTree;
  35 import jdk.javadoc.internal.doclets.formats.html.markup.HtmlStyle;
  36 import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTag;
  37 import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTree;
  38 import jdk.javadoc.internal.doclets.toolkit.Content;
  39 import jdk.javadoc.internal.doclets.toolkit.util.DocPath;
  40 import jdk.javadoc.internal.doclets.toolkit.util.MethodTypes;
  41 
  42 /**
  43  * This abstract class exists to provide functionality needed in the
  44  * the formatting of member information.  Since AbstractSubWriter and its
  45  * subclasses control this, they would be the logical place to put this.
  46  * However, because each member type has its own subclass, subclassing
  47  * can not be used effectively to change formatting.  The concrete
  48  * class subclass of this class can be subclassed to change formatting.


  88      *
  89      * @param mw the writer for the member being documented
  90      * @param typeElement the te to be documented
  91      * @param tableContents list of summary table contents
  92      * @param showTabs true if the table needs to show tabs
  93      * @return the content tree for the summary table
  94      */
  95     public Content getSummaryTableTree(AbstractMemberWriter mw, TypeElement typeElement,
  96             List<Content> tableContents, boolean showTabs) {
  97         Content caption;
  98         if (showTabs) {
  99             caption = getTableCaption(mw.methodTypes);
 100             generateTableTabTypesScript(mw.typeMap, mw.methodTypes, "methods");
 101         }
 102         else {
 103             caption = getTableCaption(mw.getCaption());
 104         }
 105         Content table = (configuration.isOutputHtml5())
 106                 ? HtmlTree.TABLE(HtmlStyle.memberSummary, caption)
 107                 : HtmlTree.TABLE(HtmlStyle.memberSummary, mw.getTableSummary(), caption);
 108         table.addContent(getSummaryTableHeader(mw.getSummaryTableHeader(typeElement), "col"));
 109         for (Content tableContent : tableContents) {
 110             table.addContent(tableContent);
 111         }
 112         return table;
 113     }
 114 
 115     /**
 116      * Get the summary table caption.
 117      *
 118      * @param methodTypes set comprising of method types to show as table caption
 119      * @return the caption for the summary table
 120      */
 121     public Content getTableCaption(Set<MethodTypes> methodTypes) {
 122         Content tabbedCaption = new HtmlTree(HtmlTag.CAPTION);
 123         for (MethodTypes type : methodTypes) {
 124             Content captionSpan;
 125             Content span;
 126             if (type.tableTabs().isDefaultTab()) {
 127                 captionSpan = HtmlTree.SPAN(configuration.getContent(type.tableTabs().resourceKey()));
 128                 span = HtmlTree.SPAN(type.tableTabs().tabId(),


 339      */
 340     public Content getMemberSummaryTree(Content contentTree) {
 341         return getMemberTree(HtmlStyle.summary, contentTree);
 342     }
 343 
 344     /**
 345      * Get the member details tree
 346      *
 347      * @param contentTree the tree used to generate the member details tree
 348      * @return a content tree for the member details
 349      */
 350     public Content getMemberDetailsTree(Content contentTree) {
 351         return getMemberTree(HtmlStyle.details, contentTree);
 352     }
 353 
 354     /**
 355      * Get the member tree
 356      *
 357      * @param style the style class to be added to the content tree
 358      * @param contentTree the tree used to generate the complete member tree

 359      */
 360     public Content getMemberTree(HtmlStyle style, Content contentTree) {
 361         Content div = HtmlTree.DIV(style, getMemberTree(contentTree));
 362         return div;
 363     }
 364 }


   8  * particular file as subject to the "Classpath" exception as provided
   9  * by Oracle in the LICENSE file that accompanied this code.
  10  *
  11  * This code is distributed in the hope that it will be useful, but WITHOUT
  12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  14  * version 2 for more details (a copy is included in the LICENSE file that
  15  * accompanied this code).
  16  *
  17  * You should have received a copy of the GNU General Public License version
  18  * 2 along with this work; if not, write to the Free Software Foundation,
  19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20  *
  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any
  23  * questions.
  24  */
  25 
  26 package jdk.javadoc.internal.doclets.formats.html;
  27 

  28 import java.util.*;
  29 
  30 import javax.lang.model.element.Element;
  31 import javax.lang.model.element.TypeElement;
  32 
  33 import com.sun.source.doctree.DocTree;
  34 import jdk.javadoc.internal.doclets.formats.html.markup.HtmlStyle;
  35 import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTag;
  36 import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTree;
  37 import jdk.javadoc.internal.doclets.toolkit.Content;
  38 import jdk.javadoc.internal.doclets.toolkit.util.DocPath;
  39 import jdk.javadoc.internal.doclets.toolkit.util.MethodTypes;
  40 
  41 /**
  42  * This abstract class exists to provide functionality needed in the
  43  * the formatting of member information.  Since AbstractSubWriter and its
  44  * subclasses control this, they would be the logical place to put this.
  45  * However, because each member type has its own subclass, subclassing
  46  * can not be used effectively to change formatting.  The concrete
  47  * class subclass of this class can be subclassed to change formatting.


  87      *
  88      * @param mw the writer for the member being documented
  89      * @param typeElement the te to be documented
  90      * @param tableContents list of summary table contents
  91      * @param showTabs true if the table needs to show tabs
  92      * @return the content tree for the summary table
  93      */
  94     public Content getSummaryTableTree(AbstractMemberWriter mw, TypeElement typeElement,
  95             List<Content> tableContents, boolean showTabs) {
  96         Content caption;
  97         if (showTabs) {
  98             caption = getTableCaption(mw.methodTypes);
  99             generateTableTabTypesScript(mw.typeMap, mw.methodTypes, "methods");
 100         }
 101         else {
 102             caption = getTableCaption(mw.getCaption());
 103         }
 104         Content table = (configuration.isOutputHtml5())
 105                 ? HtmlTree.TABLE(HtmlStyle.memberSummary, caption)
 106                 : HtmlTree.TABLE(HtmlStyle.memberSummary, mw.getTableSummary(), caption);
 107         table.addContent(mw.getSummaryTableHeader(typeElement).toContent());
 108         for (Content tableContent : tableContents) {
 109             table.addContent(tableContent);
 110         }
 111         return table;
 112     }
 113 
 114     /**
 115      * Get the summary table caption.
 116      *
 117      * @param methodTypes set comprising of method types to show as table caption
 118      * @return the caption for the summary table
 119      */
 120     public Content getTableCaption(Set<MethodTypes> methodTypes) {
 121         Content tabbedCaption = new HtmlTree(HtmlTag.CAPTION);
 122         for (MethodTypes type : methodTypes) {
 123             Content captionSpan;
 124             Content span;
 125             if (type.tableTabs().isDefaultTab()) {
 126                 captionSpan = HtmlTree.SPAN(configuration.getContent(type.tableTabs().resourceKey()));
 127                 span = HtmlTree.SPAN(type.tableTabs().tabId(),


 338      */
 339     public Content getMemberSummaryTree(Content contentTree) {
 340         return getMemberTree(HtmlStyle.summary, contentTree);
 341     }
 342 
 343     /**
 344      * Get the member details tree
 345      *
 346      * @param contentTree the tree used to generate the member details tree
 347      * @return a content tree for the member details
 348      */
 349     public Content getMemberDetailsTree(Content contentTree) {
 350         return getMemberTree(HtmlStyle.details, contentTree);
 351     }
 352 
 353     /**
 354      * Get the member tree
 355      *
 356      * @param style the style class to be added to the content tree
 357      * @param contentTree the tree used to generate the complete member tree
 358      * @return the member tree
 359      */
 360     public Content getMemberTree(HtmlStyle style, Content contentTree) {
 361         Content div = HtmlTree.DIV(style, getMemberTree(contentTree));
 362         return div;
 363     }
 364 }
< prev index next >