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

Sat, 01 Dec 2007 00:00:00 +0000

author
duke
date
Sat, 01 Dec 2007 00:00:00 +0000
changeset 1
9a66ca7c79fa
child 182
47a62d8d98b4
permissions
-rw-r--r--

Initial load

duke@1 1 /*
duke@1 2 * Copyright 1998-2005 Sun Microsystems, Inc. All Rights Reserved.
duke@1 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
duke@1 4 *
duke@1 5 * This code is free software; you can redistribute it and/or modify it
duke@1 6 * under the terms of the GNU General Public License version 2 only, as
duke@1 7 * published by the Free Software Foundation. Sun designates this
duke@1 8 * particular file as subject to the "Classpath" exception as provided
duke@1 9 * by Sun in the LICENSE file that accompanied this code.
duke@1 10 *
duke@1 11 * This code is distributed in the hope that it will be useful, but WITHOUT
duke@1 12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
duke@1 13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
duke@1 14 * version 2 for more details (a copy is included in the LICENSE file that
duke@1 15 * accompanied this code).
duke@1 16 *
duke@1 17 * You should have received a copy of the GNU General Public License version
duke@1 18 * 2 along with this work; if not, write to the Free Software Foundation,
duke@1 19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
duke@1 20 *
duke@1 21 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
duke@1 22 * CA 95054 USA or visit www.sun.com if you need additional information or
duke@1 23 * have any questions.
duke@1 24 */
duke@1 25
duke@1 26 package com.sun.tools.doclets.formats.html;
duke@1 27
duke@1 28 import com.sun.javadoc.*;
duke@1 29 import java.io.*;
duke@1 30
duke@1 31 /**
duke@1 32 * Generate the Serialized Form Information Page.
duke@1 33 *
duke@1 34 * @author Atul M Dambalkar
duke@1 35 */
duke@1 36 public class SerializedFormWriterImpl extends SubWriterHolderWriter
duke@1 37 implements com.sun.tools.doclets.internal.toolkit.SerializedFormWriter {
duke@1 38
duke@1 39 private static final String FILE_NAME = "serialized-form.html";
duke@1 40
duke@1 41 /**
duke@1 42 * @throws IOException
duke@1 43 * @throws DocletAbortException
duke@1 44 */
duke@1 45 public SerializedFormWriterImpl() throws IOException {
duke@1 46 super(ConfigurationImpl.getInstance(), FILE_NAME);
duke@1 47 }
duke@1 48
duke@1 49 /**
duke@1 50 * Writes the given header.
duke@1 51 *
duke@1 52 * @param header the header to write.
duke@1 53 */
duke@1 54 public void writeHeader(String header) {
duke@1 55 printHtmlHeader(header, null, true);
duke@1 56 printTop();
duke@1 57 navLinks(true);
duke@1 58 hr();
duke@1 59 center();
duke@1 60 h1();
duke@1 61 print(header);
duke@1 62 h1End();
duke@1 63 centerEnd();
duke@1 64 }
duke@1 65
duke@1 66 /**
duke@1 67 * Write the given package header.
duke@1 68 *
duke@1 69 * @param packageName the package header to write.
duke@1 70 */
duke@1 71 public void writePackageHeader(String packageName) {
duke@1 72 hr(4, "noshade");
duke@1 73 tableHeader();
duke@1 74 thAlign("center");
duke@1 75 font("+2");
duke@1 76 boldText("doclet.Package");
duke@1 77 print(' ');
duke@1 78 bold(packageName);
duke@1 79 tableFooter();
duke@1 80 }
duke@1 81
duke@1 82 /**
duke@1 83 * Write the serial UID info.
duke@1 84 *
duke@1 85 * @param header the header that will show up before the UID.
duke@1 86 * @param serialUID the serial UID to print.
duke@1 87 */
duke@1 88 public void writeSerialUIDInfo(String header, String serialUID) {
duke@1 89 bold(header + " ");
duke@1 90 println(serialUID);
duke@1 91 p();
duke@1 92 }
duke@1 93
duke@1 94 /**
duke@1 95 * Write the footer.
duke@1 96 */
duke@1 97 public void writeFooter() {
duke@1 98 p();
duke@1 99 hr();
duke@1 100 navLinks(false);
duke@1 101 printBottom();
duke@1 102 printBodyHtmlEnd();
duke@1 103 }
duke@1 104
duke@1 105
duke@1 106 /**
duke@1 107 * Write the serializable class heading.
duke@1 108 *
duke@1 109 * @param classDoc the class being processed.
duke@1 110 */
duke@1 111 public void writeClassHeader(ClassDoc classDoc) {
duke@1 112 String classLink = (classDoc.isPublic() || classDoc.isProtected())?
duke@1 113 getLink(new LinkInfoImpl(classDoc,
duke@1 114 configuration.getClassName(classDoc))):
duke@1 115 classDoc.qualifiedName();
duke@1 116 p();
duke@1 117 anchor(classDoc.qualifiedName());
duke@1 118 String superClassLink =
duke@1 119 classDoc.superclassType() != null ?
duke@1 120 getLink(new LinkInfoImpl(LinkInfoImpl.CONTEXT_SERIALIZED_FORM,
duke@1 121 classDoc.superclassType())) :
duke@1 122 null;
duke@1 123
duke@1 124 //Print the heading.
duke@1 125 String className = superClassLink == null ?
duke@1 126 configuration.getText(
duke@1 127 "doclet.Class_0_implements_serializable", classLink) :
duke@1 128 configuration.getText(
duke@1 129 "doclet.Class_0_extends_implements_serializable", classLink,
duke@1 130 superClassLink);
duke@1 131 tableHeader();
duke@1 132 thAlignColspan("left", 2);
duke@1 133 font("+2");
duke@1 134 bold(className);
duke@1 135 tableFooter();
duke@1 136 p();
duke@1 137 }
duke@1 138
duke@1 139 private void tableHeader() {
duke@1 140 tableIndexSummary();
duke@1 141 trBgcolorStyle("#CCCCFF", "TableSubHeadingColor");
duke@1 142 }
duke@1 143
duke@1 144 private void tableFooter() {
duke@1 145 fontEnd();
duke@1 146 thEnd(); trEnd(); tableEnd();
duke@1 147 }
duke@1 148
duke@1 149 /**
duke@1 150 * Return an instance of a SerialFieldWriter.
duke@1 151 *
duke@1 152 * @return an instance of a SerialFieldWriter.
duke@1 153 */
duke@1 154 public SerialFieldWriter getSerialFieldWriter(ClassDoc classDoc) {
duke@1 155 return new HtmlSerialFieldWriter(this, classDoc);
duke@1 156 }
duke@1 157
duke@1 158 /**
duke@1 159 * Return an instance of a SerialMethodWriter.
duke@1 160 *
duke@1 161 * @return an instance of a SerialMethodWriter.
duke@1 162 */
duke@1 163 public SerialMethodWriter getSerialMethodWriter(ClassDoc classDoc) {
duke@1 164 return new HtmlSerialMethodWriter(this, classDoc);
duke@1 165 }
duke@1 166 }

mercurial