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

changeset 1
9a66ca7c79fa
child 182
47a62d8d98b4
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/src/share/classes/com/sun/tools/doclets/formats/html/SubWriterHolderWriter.java	Sat Dec 01 00:00:00 2007 +0000
     1.3 @@ -0,0 +1,175 @@
     1.4 +/*
     1.5 + * Copyright 1997-2004 Sun Microsystems, Inc.  All Rights Reserved.
     1.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     1.7 + *
     1.8 + * This code is free software; you can redistribute it and/or modify it
     1.9 + * under the terms of the GNU General Public License version 2 only, as
    1.10 + * published by the Free Software Foundation.  Sun designates this
    1.11 + * particular file as subject to the "Classpath" exception as provided
    1.12 + * by Sun in the LICENSE file that accompanied this code.
    1.13 + *
    1.14 + * This code is distributed in the hope that it will be useful, but WITHOUT
    1.15 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
    1.16 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
    1.17 + * version 2 for more details (a copy is included in the LICENSE file that
    1.18 + * accompanied this code).
    1.19 + *
    1.20 + * You should have received a copy of the GNU General Public License version
    1.21 + * 2 along with this work; if not, write to the Free Software Foundation,
    1.22 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
    1.23 + *
    1.24 + * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
    1.25 + * CA 95054 USA or visit www.sun.com if you need additional information or
    1.26 + * have any questions.
    1.27 + */
    1.28 +
    1.29 +package com.sun.tools.doclets.formats.html;
    1.30 +
    1.31 +import com.sun.javadoc.*;
    1.32 +import com.sun.tools.doclets.internal.toolkit.util.*;
    1.33 +
    1.34 +import java.io.*;
    1.35 +
    1.36 +/**
    1.37 + * This abstract class exists to provide functionality needed in the
    1.38 + * the formatting of member information.  Since AbstractSubWriter and its
    1.39 + * subclasses control this, they would be the logical place to put this.
    1.40 + * However, because each member type has its own subclass, subclassing
    1.41 + * can not be used effectively to change formatting.  The concrete
    1.42 + * class subclass of this class can be subclassed to change formatting.
    1.43 + *
    1.44 + * @see AbstractMemberWriter
    1.45 + * @see ClassWriterImpl
    1.46 + *
    1.47 + * @author Robert Field
    1.48 + * @author Atul M Dambalkar
    1.49 + */
    1.50 +public abstract class SubWriterHolderWriter extends HtmlDocletWriter {
    1.51 +
    1.52 +    public SubWriterHolderWriter(ConfigurationImpl configuration,
    1.53 +                                 String filename) throws IOException {
    1.54 +        super(configuration, filename);
    1.55 +    }
    1.56 +
    1.57 +
    1.58 +    public SubWriterHolderWriter(ConfigurationImpl configuration,
    1.59 +                                 String path, String filename, String relpath)
    1.60 +                                 throws IOException {
    1.61 +        super(configuration, path, filename, relpath);
    1.62 +    }
    1.63 +
    1.64 +    public void printTypeSummaryHeader() {
    1.65 +        tdIndex();
    1.66 +        font("-1");
    1.67 +        code();
    1.68 +    }
    1.69 +
    1.70 +    public void printTypeSummaryFooter() {
    1.71 +        codeEnd();
    1.72 +        fontEnd();
    1.73 +        tdEnd();
    1.74 +    }
    1.75 +
    1.76 +    public void printSummaryHeader(AbstractMemberWriter mw, ClassDoc cd) {
    1.77 +        mw.printSummaryAnchor(cd);
    1.78 +        tableIndexSummary();
    1.79 +        tableHeaderStart("#CCCCFF");
    1.80 +        mw.printSummaryLabel(cd);
    1.81 +        tableHeaderEnd();
    1.82 +    }
    1.83 +
    1.84 +    public void printTableHeadingBackground(String str) {
    1.85 +        tableIndexDetail();
    1.86 +        tableHeaderStart("#CCCCFF", 1);
    1.87 +        bold(str);
    1.88 +        tableHeaderEnd();
    1.89 +        tableEnd();
    1.90 +    }
    1.91 +
    1.92 +    public void printInheritedSummaryHeader(AbstractMemberWriter mw, ClassDoc cd) {
    1.93 +        mw.printInheritedSummaryAnchor(cd);
    1.94 +        tableIndexSummary();
    1.95 +        tableInheritedHeaderStart("#EEEEFF");
    1.96 +        mw.printInheritedSummaryLabel(cd);
    1.97 +        tableInheritedHeaderEnd();
    1.98 +        trBgcolorStyle("white", "TableRowColor");
    1.99 +        summaryRow(0);
   1.100 +        code();
   1.101 +    }
   1.102 +
   1.103 +    public void printSummaryFooter(AbstractMemberWriter mw, ClassDoc cd) {
   1.104 +        tableEnd();
   1.105 +        space();
   1.106 +    }
   1.107 +
   1.108 +    public void printInheritedSummaryFooter(AbstractMemberWriter mw, ClassDoc cd) {
   1.109 +        codeEnd();
   1.110 +        summaryRowEnd();
   1.111 +        trEnd();
   1.112 +        tableEnd();
   1.113 +        space();
   1.114 +    }
   1.115 +
   1.116 +    protected void printIndexComment(Doc member) {
   1.117 +        printIndexComment(member, member.firstSentenceTags());
   1.118 +    }
   1.119 +
   1.120 +    protected void printIndexComment(Doc member, Tag[] firstSentenceTags) {
   1.121 +        Tag[] deprs = member.tags("deprecated");
   1.122 +        if (Util.isDeprecated((ProgramElementDoc) member)) {
   1.123 +            boldText("doclet.Deprecated");
   1.124 +            space();
   1.125 +            if (deprs.length > 0) {
   1.126 +                printInlineDeprecatedComment(member, deprs[0]);
   1.127 +            }
   1.128 +            return;
   1.129 +        } else {
   1.130 +            ClassDoc cd = ((ProgramElementDoc)member).containingClass();
   1.131 +            if (cd != null && Util.isDeprecated(cd)) {
   1.132 +                boldText("doclet.Deprecated"); space();
   1.133 +            }
   1.134 +        }
   1.135 +        printSummaryComment(member, firstSentenceTags);
   1.136 +    }
   1.137 +
   1.138 +    public void printSummaryLinkType(AbstractMemberWriter mw,
   1.139 +                                     ProgramElementDoc member) {
   1.140 +        trBgcolorStyle("white", "TableRowColor");
   1.141 +        mw.printSummaryType(member);
   1.142 +        summaryRow(0);
   1.143 +        code();
   1.144 +    }
   1.145 +
   1.146 +    public void printSummaryLinkComment(AbstractMemberWriter mw,
   1.147 +                                        ProgramElementDoc member) {
   1.148 +        printSummaryLinkComment(mw, member, member.firstSentenceTags());
   1.149 +    }
   1.150 +
   1.151 +    public void printSummaryLinkComment(AbstractMemberWriter mw,
   1.152 +                                        ProgramElementDoc member,
   1.153 +                                        Tag[] firstSentenceTags) {
   1.154 +        codeEnd();
   1.155 +        println();
   1.156 +        br();
   1.157 +        printNbsps();
   1.158 +        printIndexComment(member, firstSentenceTags);
   1.159 +        summaryRowEnd();
   1.160 +        trEnd();
   1.161 +    }
   1.162 +
   1.163 +    public void printInheritedSummaryMember(AbstractMemberWriter mw, ClassDoc cd,
   1.164 +            ProgramElementDoc member, boolean isFirst) {
   1.165 +        if (! isFirst) {
   1.166 +            mw.print(", ");
   1.167 +        }
   1.168 +        mw.writeInheritedSummaryLink(cd, member);
   1.169 +    }
   1.170 +
   1.171 +    public void printMemberHeader() {
   1.172 +        hr();
   1.173 +    }
   1.174 +
   1.175 +    public void printMemberFooter() {
   1.176 +    }
   1.177 +
   1.178 +}

mercurial