001: /*
002: * Copyright 1998-2005 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 java.io.*;
030:
031: /**
032: * Generate the Serialized Form Information Page.
033: *
034: * @author Atul M Dambalkar
035: */
036: public class SerializedFormWriterImpl extends SubWriterHolderWriter
037: implements
038: com.sun.tools.doclets.internal.toolkit.SerializedFormWriter {
039:
040: private static final String FILE_NAME = "serialized-form.html";
041:
042: /**
043: * @throws IOException
044: * @throws DocletAbortException
045: */
046: public SerializedFormWriterImpl() throws IOException {
047: super (ConfigurationImpl.getInstance(), FILE_NAME);
048: }
049:
050: /**
051: * Writes the given header.
052: *
053: * @param header the header to write.
054: */
055: public void writeHeader(String header) {
056: printHtmlHeader(header, null, true);
057: printTop();
058: navLinks(true);
059: hr();
060: center();
061: h1();
062: print(header);
063: h1End();
064: centerEnd();
065: }
066:
067: /**
068: * Write the given package header.
069: *
070: * @param packageName the package header to write.
071: */
072: public void writePackageHeader(String packageName) {
073: hr(4, "noshade");
074: tableHeader();
075: thAlign("center");
076: font("+2");
077: boldText("doclet.Package");
078: print(' ');
079: bold(packageName);
080: tableFooter();
081: }
082:
083: /**
084: * Write the serial UID info.
085: *
086: * @param header the header that will show up before the UID.
087: * @param serialUID the serial UID to print.
088: */
089: public void writeSerialUIDInfo(String header, String serialUID) {
090: bold(header + " ");
091: println(serialUID);
092: p();
093: }
094:
095: /**
096: * Write the footer.
097: */
098: public void writeFooter() {
099: p();
100: hr();
101: navLinks(false);
102: printBottom();
103: printBodyHtmlEnd();
104: }
105:
106: /**
107: * Write the serializable class heading.
108: *
109: * @param classDoc the class being processed.
110: */
111: public void writeClassHeader(ClassDoc classDoc) {
112: String classLink = (classDoc.isPublic() || classDoc
113: .isProtected()) ? getLink(new LinkInfoImpl(classDoc,
114: configuration.getClassName(classDoc))) : classDoc
115: .qualifiedName();
116: p();
117: anchor(classDoc.qualifiedName());
118: String super ClassLink = classDoc.super classType() != null ? getLink(new LinkInfoImpl(
119: LinkInfoImpl.CONTEXT_SERIALIZED_FORM, classDoc
120: .super classType()))
121: : null;
122:
123: //Print the heading.
124: String className = super ClassLink == null ? configuration
125: .getText("doclet.Class_0_implements_serializable",
126: classLink) : configuration.getText(
127: "doclet.Class_0_extends_implements_serializable",
128: classLink, super ClassLink);
129: tableHeader();
130: thAlignColspan("left", 2);
131: font("+2");
132: bold(className);
133: tableFooter();
134: p();
135: }
136:
137: private void tableHeader() {
138: tableIndexSummary();
139: trBgcolorStyle("#CCCCFF", "TableSubHeadingColor");
140: }
141:
142: private void tableFooter() {
143: fontEnd();
144: thEnd();
145: trEnd();
146: tableEnd();
147: }
148:
149: /**
150: * Return an instance of a SerialFieldWriter.
151: *
152: * @return an instance of a SerialFieldWriter.
153: */
154: public SerialFieldWriter getSerialFieldWriter(ClassDoc classDoc) {
155: return new HtmlSerialFieldWriter(this , classDoc);
156: }
157:
158: /**
159: * Return an instance of a SerialMethodWriter.
160: *
161: * @return an instance of a SerialMethodWriter.
162: */
163: public SerialMethodWriter getSerialMethodWriter(ClassDoc classDoc) {
164: return new HtmlSerialMethodWriter(this, classDoc);
165: }
166: }
|