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

Sun, 11 Apr 2010 23:24:24 -0700

author
yhuang
date
Sun, 11 Apr 2010 23:24:24 -0700
changeset 539
06e06ec0d6f2
parent 243
edd944553131
child 554
9d9f26857129
permissions
-rw-r--r--

6875904: Java 7 message synchronization 1
Reviewed-by: ogino, faryad

     1 /*
     2  * Copyright 1997-2004 Sun Microsystems, Inc.  All Rights Reserved.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     4  *
     5  * This code is free software; you can redistribute it and/or modify it
     6  * under the terms of the GNU General Public License version 2 only, as
     7  * published by the Free Software Foundation.  Sun designates this
     8  * particular file as subject to the "Classpath" exception as provided
     9  * by Sun 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
    22  * CA 95054 USA or visit www.sun.com if you need additional information or
    23  * have any questions.
    24  */
    26 package com.sun.tools.doclets.formats.html;
    28 import com.sun.javadoc.*;
    29 import com.sun.tools.doclets.internal.toolkit.util.*;
    31 import java.io.*;
    33 /**
    34  * This abstract class exists to provide functionality needed in the
    35  * the formatting of member information.  Since AbstractSubWriter and its
    36  * subclasses control this, they would be the logical place to put this.
    37  * However, because each member type has its own subclass, subclassing
    38  * can not be used effectively to change formatting.  The concrete
    39  * class subclass of this class can be subclassed to change formatting.
    40  *
    41  * @see AbstractMemberWriter
    42  * @see ClassWriterImpl
    43  *
    44  * @author Robert Field
    45  * @author Atul M Dambalkar
    46  * @author Bhavesh Patel (Modified)
    47  */
    48 public abstract class SubWriterHolderWriter extends HtmlDocletWriter {
    50     public SubWriterHolderWriter(ConfigurationImpl configuration,
    51                                  String filename) throws IOException {
    52         super(configuration, filename);
    53     }
    56     public SubWriterHolderWriter(ConfigurationImpl configuration,
    57                                  String path, String filename, String relpath)
    58                                  throws IOException {
    59         super(configuration, path, filename, relpath);
    60     }
    62     public void printTypeSummaryHeader() {
    63         tdIndex();
    64         font("-1");
    65         code();
    66     }
    68     public void printTypeSummaryFooter() {
    69         codeEnd();
    70         fontEnd();
    71         tdEnd();
    72     }
    74     public void printSummaryHeader(AbstractMemberWriter mw, ClassDoc cd) {
    75         mw.printSummaryAnchor(cd);
    76         mw.printTableSummary();
    77         tableCaptionStart();
    78         mw.printSummaryLabel();
    79         tableCaptionEnd();
    80         mw.printSummaryTableHeader(cd);
    81     }
    83     public void printTableHeadingBackground(String str) {
    84         tableIndexDetail();
    85         tableHeaderStart("#CCCCFF", 1);
    86         strong(str);
    87         tableHeaderEnd();
    88         tableEnd();
    89     }
    91     public void printInheritedSummaryHeader(AbstractMemberWriter mw, ClassDoc cd) {
    92         mw.printInheritedSummaryAnchor(cd);
    93         tableIndexSummary();
    94         tableInheritedHeaderStart("#EEEEFF");
    95         mw.printInheritedSummaryLabel(cd);
    96         tableInheritedHeaderEnd();
    97         trBgcolorStyle("white", "TableRowColor");
    98         summaryRow(0);
    99         code();
   100     }
   102     public void printSummaryFooter(AbstractMemberWriter mw, ClassDoc cd) {
   103         tableEnd();
   104         space();
   105     }
   107     public void printInheritedSummaryFooter(AbstractMemberWriter mw, ClassDoc cd) {
   108         codeEnd();
   109         summaryRowEnd();
   110         trEnd();
   111         tableEnd();
   112         space();
   113     }
   115     protected void printIndexComment(Doc member) {
   116         printIndexComment(member, member.firstSentenceTags());
   117     }
   119     protected void printIndexComment(Doc member, Tag[] firstSentenceTags) {
   120         Tag[] deprs = member.tags("deprecated");
   121         if (Util.isDeprecated((ProgramElementDoc) member)) {
   122             strongText("doclet.Deprecated");
   123             space();
   124             if (deprs.length > 0) {
   125                 printInlineDeprecatedComment(member, deprs[0]);
   126             }
   127             return;
   128         } else {
   129             ClassDoc cd = ((ProgramElementDoc)member).containingClass();
   130             if (cd != null && Util.isDeprecated(cd)) {
   131                 strongText("doclet.Deprecated"); space();
   132             }
   133         }
   134         printSummaryComment(member, firstSentenceTags);
   135     }
   137     public void printSummaryLinkType(AbstractMemberWriter mw,
   138                                      ProgramElementDoc member) {
   139         trBgcolorStyle("white", "TableRowColor");
   140         mw.printSummaryType(member);
   141         summaryRow(0);
   142         code();
   143     }
   145     public void printSummaryLinkComment(AbstractMemberWriter mw,
   146                                         ProgramElementDoc member) {
   147         printSummaryLinkComment(mw, member, member.firstSentenceTags());
   148     }
   150     public void printSummaryLinkComment(AbstractMemberWriter mw,
   151                                         ProgramElementDoc member,
   152                                         Tag[] firstSentenceTags) {
   153         codeEnd();
   154         println();
   155         br();
   156         printNbsps();
   157         printIndexComment(member, firstSentenceTags);
   158         summaryRowEnd();
   159         trEnd();
   160     }
   162     public void printInheritedSummaryMember(AbstractMemberWriter mw, ClassDoc cd,
   163             ProgramElementDoc member, boolean isFirst) {
   164         if (! isFirst) {
   165             mw.print(", ");
   166         }
   167         mw.writeInheritedSummaryLink(cd, member);
   168     }
   170     public void printMemberHeader() {
   171         hr();
   172     }
   174     public void printMemberFooter() {
   175     }
   177 }

mercurial