001 /*
002 * Copyright 1997-2004 Sun Microsystems, Inc. All Rights Reserved.
003 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
004 *
005 * This code is free software; you can redistribute it and/or modify it
006 * under the terms of the GNU General Public License version 2 only, as
007 * published by the Free Software Foundation. Sun designates this
008 * particular file as subject to the "Classpath" exception as provided
009 * by Sun in the LICENSE file that accompanied this code.
010 *
011 * This code is distributed in the hope that it will be useful, but WITHOUT
012 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
013 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
014 * version 2 for more details (a copy is included in the LICENSE file that
015 * accompanied this code).
016 *
017 * You should have received a copy of the GNU General Public License version
018 * 2 along with this work; if not, write to the Free Software Foundation,
019 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
020 *
021 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
022 * CA 95054 USA or visit www.sun.com if you need additional information or
023 * have any questions.
024 */
025
026 package com.sun.tools.doclets.formats.html;
027
028 import com.sun.javadoc.*;
029 import com.sun.tools.doclets.internal.toolkit.util.*;
030
031 import java.io.*;
032
033 /**
034 * This abstract class exists to provide functionality needed in the
035 * the formatting of member information. Since AbstractSubWriter and its
036 * subclasses control this, they would be the logical place to put this.
037 * However, because each member type has its own subclass, subclassing
038 * can not be used effectively to change formatting. The concrete
039 * class subclass of this class can be subclassed to change formatting.
040 *
041 * @see AbstractMemberWriter
042 * @see ClassWriterImpl
043 *
044 * @author Robert Field
045 * @author Atul M Dambalkar
046 */
047 public abstract class SubWriterHolderWriter extends HtmlDocletWriter {
048
049 public SubWriterHolderWriter(ConfigurationImpl configuration,
050 String filename) throws IOException {
051 super(configuration, filename);
052 }
053
054
055 public SubWriterHolderWriter(ConfigurationImpl configuration,
056 String path, String filename, String relpath)
057 throws IOException {
058 super(configuration, path, filename, relpath);
059 }
060
061 public void printTypeSummaryHeader() {
062 tdIndex();
063 font("-1");
064 code();
065 }
066
067 public void printTypeSummaryFooter() {
068 codeEnd();
069 fontEnd();
070 tdEnd();
071 }
072
073 public void printSummaryHeader(AbstractMemberWriter mw, ClassDoc cd) {
074 mw.printSummaryAnchor(cd);
075 tableIndexSummary();
076 tableHeaderStart("#CCCCFF");
077 mw.printSummaryLabel(cd);
078 tableHeaderEnd();
079 }
080
081 public void printTableHeadingBackground(String str) {
082 tableIndexDetail();
083 tableHeaderStart("#CCCCFF", 1);
084 strong(str);
085 tableHeaderEnd();
086 tableEnd();
087 }
088
089 public void printInheritedSummaryHeader(AbstractMemberWriter mw, ClassDoc cd) {
090 mw.printInheritedSummaryAnchor(cd);
091 tableIndexSummary();
092 tableInheritedHeaderStart("#EEEEFF");
093 mw.printInheritedSummaryLabel(cd);
094 tableInheritedHeaderEnd();
095 trBgcolorStyle("white", "TableRowColor");
096 summaryRow(0);
097 code();
098 }
099
100 public void printSummaryFooter(AbstractMemberWriter mw, ClassDoc cd) {
101 tableEnd();
102 space();
103 }
104
105 public void printInheritedSummaryFooter(AbstractMemberWriter mw, ClassDoc cd) {
106 codeEnd();
107 summaryRowEnd();
108 trEnd();
109 tableEnd();
110 space();
111 }
112
113 protected void printIndexComment(Doc member) {
114 printIndexComment(member, member.firstSentenceTags());
115 }
116
117 protected void printIndexComment(Doc member, Tag[] firstSentenceTags) {
118 Tag[] deprs = member.tags("deprecated");
119 if (Util.isDeprecated((ProgramElementDoc) member)) {
120 strongText("doclet.Deprecated");
121 space();
122 if (deprs.length > 0) {
123 printInlineDeprecatedComment(member, deprs[0]);
124 }
125 return;
126 } else {
127 ClassDoc cd = ((ProgramElementDoc)member).containingClass();
128 if (cd != null && Util.isDeprecated(cd)) {
129 strongText("doclet.Deprecated"); space();
130 }
131 }
132 printSummaryComment(member, firstSentenceTags);
133 }
134
135 public void printSummaryLinkType(AbstractMemberWriter mw,
136 ProgramElementDoc member) {
137 trBgcolorStyle("white", "TableRowColor");
138 mw.printSummaryType(member);
139 summaryRow(0);
140 code();
141 }
142
143 public void printSummaryLinkComment(AbstractMemberWriter mw,
144 ProgramElementDoc member) {
145 printSummaryLinkComment(mw, member, member.firstSentenceTags());
146 }
147
148 public void printSummaryLinkComment(AbstractMemberWriter mw,
149 ProgramElementDoc member,
150 Tag[] firstSentenceTags) {
151 codeEnd();
152 println();
153 br();
154 printNbsps();
155 printIndexComment(member, firstSentenceTags);
156 summaryRowEnd();
157 trEnd();
158 }
159
160 public void printInheritedSummaryMember(AbstractMemberWriter mw, ClassDoc cd,
161 ProgramElementDoc member, boolean isFirst) {
162 if (! isFirst) {
163 mw.print(", ");
164 }
165 mw.writeInheritedSummaryLink(cd, member);
166 }
167
168 public void printMemberHeader() {
169 hr();
170 }
171
172 public void printMemberFooter() {
173 }
174
175 }