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

     1 /*
     2  * Copyright 1998-2005 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 java.io.*;
    31 /**
    32  * Generate the Serialized Form Information Page.
    33  *
    34  * @author Atul M Dambalkar
    35  */
    36 public class SerializedFormWriterImpl extends SubWriterHolderWriter
    37     implements com.sun.tools.doclets.internal.toolkit.SerializedFormWriter {
    39     private static final String FILE_NAME = "serialized-form.html";
    41     /**
    42      * @throws IOException
    43      * @throws DocletAbortException
    44      */
    45     public SerializedFormWriterImpl() throws IOException {
    46         super(ConfigurationImpl.getInstance(), FILE_NAME);
    47     }
    49     /**
    50      * Writes the given header.
    51      *
    52      * @param header the header to write.
    53      */
    54     public void writeHeader(String header) {
    55         printHtmlHeader(header, null, true);
    56         printTop();
    57         navLinks(true);
    58         hr();
    59         center();
    60         h1();
    61         print(header);
    62         h1End();
    63         centerEnd();
    64     }
    66     /**
    67      * Write the given package header.
    68      *
    69      * @param packageName the package header to write.
    70      */
    71     public void writePackageHeader(String packageName) {
    72         hr(4, "noshade");
    73         tableHeader();
    74         thAlign("center");
    75         font("+2");
    76         boldText("doclet.Package");
    77         print(' ');
    78         bold(packageName);
    79         tableFooter();
    80     }
    82     /**
    83      * Write the serial UID info.
    84      *
    85      * @param header the header that will show up before the UID.
    86      * @param serialUID the serial UID to print.
    87      */
    88     public void writeSerialUIDInfo(String header, String serialUID) {
    89         bold(header + " ");
    90         println(serialUID);
    91         p();
    92     }
    94     /**
    95      * Write the footer.
    96      */
    97     public void writeFooter() {
    98         p();
    99         hr();
   100         navLinks(false);
   101         printBottom();
   102         printBodyHtmlEnd();
   103     }
   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.isProtected())?
   113             getLink(new LinkInfoImpl(classDoc,
   114                 configuration.getClassName(classDoc))):
   115             classDoc.qualifiedName();
   116         p();
   117         anchor(classDoc.qualifiedName());
   118         String superClassLink =
   119             classDoc.superclassType() != null ?
   120                 getLink(new LinkInfoImpl(LinkInfoImpl.CONTEXT_SERIALIZED_FORM,
   121                     classDoc.superclassType())) :
   122                 null;
   124         //Print the heading.
   125         String className = superClassLink == null ?
   126             configuration.getText(
   127                 "doclet.Class_0_implements_serializable", classLink) :
   128             configuration.getText(
   129                 "doclet.Class_0_extends_implements_serializable", classLink,
   130                     superClassLink);
   131         tableHeader();
   132         thAlignColspan("left", 2);
   133         font("+2");
   134         bold(className);
   135         tableFooter();
   136         p();
   137     }
   139     private void tableHeader() {
   140         tableIndexSummary();
   141         trBgcolorStyle("#CCCCFF", "TableSubHeadingColor");
   142     }
   144     private void tableFooter() {
   145         fontEnd();
   146         thEnd(); trEnd(); tableEnd();
   147     }
   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     }
   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 }

mercurial