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

Wed, 10 Oct 2012 16:48:21 -0700

author
jjg
date
Wed, 10 Oct 2012 16:48:21 -0700
changeset 1359
25e14ad23cef
parent 1358
fc123bdeddb8
child 1361
6517bf8e50d0
permissions
-rw-r--r--

8000665: fix "internal API" comments on javadoc files
Reviewed-by: darcy

     1 /*
     2  * Copyright (c) 1998, 2012, Oracle and/or its affiliates. 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.  Oracle designates this
     8  * particular file as subject to the "Classpath" exception as provided
     9  * by Oracle 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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
    22  * or visit www.oracle.com if you need additional information or have any
    23  * questions.
    24  */
    26 package com.sun.tools.doclets.formats.html;
    28 import java.io.*;
    29 import com.sun.javadoc.*;
    30 import com.sun.tools.doclets.formats.html.markup.*;
    31 import com.sun.tools.doclets.internal.toolkit.*;
    32 import com.sun.tools.doclets.internal.toolkit.util.DocletAbortException;
    34 /**
    35  * Generate the Serialized Form Information Page.
    36  *
    37  *  <p><b>This is NOT part of any supported API.
    38  *  If you write code that depends on this, you do so at your own risk.
    39  *  This code and its internal interfaces are subject to change or
    40  *  deletion without notice.</b>
    41  *
    42  * @author Atul M Dambalkar
    43  */
    44 public class SerializedFormWriterImpl extends SubWriterHolderWriter
    45     implements com.sun.tools.doclets.internal.toolkit.SerializedFormWriter {
    47     private static final String FILE_NAME = "serialized-form.html";
    49     /**
    50      * @throws IOException
    51      * @throws DocletAbortException
    52      */
    53     public SerializedFormWriterImpl() throws IOException {
    54         super(ConfigurationImpl.getInstance(), FILE_NAME);
    55     }
    57     /**
    58      * Writes the given header.
    59      *
    60      * @param header the header to write.
    61      */
    62     public void writeHeader(String header) {
    63         printHtmlHeader(header, null, true);
    64         printTop();
    65         navLinks(true);
    66         hr();
    67         center();
    68         h1();
    69         print(header);
    70         h1End();
    71         centerEnd();
    72     }
    74     /**
    75      * Get the given header.
    76      *
    77      * @param header the header to write
    78      * @return the body content tree
    79      */
    80     public Content getHeader(String header) {
    81         Content bodyTree = getBody(true, getWindowTitle(header));
    82         addTop(bodyTree);
    83         addNavLinks(true, bodyTree);
    84         Content h1Content = new StringContent(header);
    85         Content heading = HtmlTree.HEADING(HtmlConstants.TITLE_HEADING, true,
    86                 HtmlStyle.title, h1Content);
    87         Content div = HtmlTree.DIV(HtmlStyle.header, heading);
    88         bodyTree.addContent(div);
    89         return bodyTree;
    90     }
    92     /**
    93      * Get the serialized form summaries header.
    94      *
    95      * @return the serialized form summary header tree
    96      */
    97     public Content getSerializedSummariesHeader() {
    98         HtmlTree ul = new HtmlTree(HtmlTag.UL);
    99         ul.addStyle(HtmlStyle.blockList);
   100         return ul;
   101     }
   103     /**
   104      * Get the package serialized form header.
   105      *
   106      * @return the package serialized form header tree
   107      */
   108     public Content getPackageSerializedHeader() {
   109         HtmlTree li = new HtmlTree(HtmlTag.LI);
   110         li.addStyle(HtmlStyle.blockList);
   111         return li;
   112     }
   114     /**
   115      * Get the given package header.
   116      *
   117      * @param packageName the package header to write
   118      * @return a content tree for the package header
   119      */
   120     public Content getPackageHeader(String packageName) {
   121         Content heading = HtmlTree.HEADING(HtmlConstants.PACKAGE_HEADING, true,
   122                 packageLabel);
   123         heading.addContent(getSpace());
   124         heading.addContent(packageName);
   125         return heading;
   126     }
   128     /**
   129      * Get the serialized class header.
   130      *
   131      * @return a content tree for the serialized class header
   132      */
   133     public Content getClassSerializedHeader() {
   134         HtmlTree ul = new HtmlTree(HtmlTag.UL);
   135         ul.addStyle(HtmlStyle.blockList);
   136         return ul;
   137     }
   139     /**
   140      * Get the serializable class heading.
   141      *
   142      * @param classDoc the class being processed
   143      * @return a content tree for the class header
   144      */
   145     public Content getClassHeader(ClassDoc classDoc) {
   146         String classLink = (classDoc.isPublic() || classDoc.isProtected())?
   147             getLink(new LinkInfoImpl(classDoc,
   148             configuration.getClassName(classDoc))):
   149             classDoc.qualifiedName();
   150         Content li = HtmlTree.LI(HtmlStyle.blockList, getMarkerAnchor(
   151                 classDoc.qualifiedName()));
   152         String superClassLink =
   153             classDoc.superclassType() != null ?
   154                 getLink(new LinkInfoImpl(LinkInfoImpl.CONTEXT_SERIALIZED_FORM,
   155                 classDoc.superclassType())) :
   156                 null;
   158         //Print the heading.
   159         String className = superClassLink == null ?
   160             configuration.getText(
   161             "doclet.Class_0_implements_serializable", classLink) :
   162             configuration.getText(
   163             "doclet.Class_0_extends_implements_serializable", classLink,
   164             superClassLink);
   165         Content classNameContent = new RawHtml(className);
   166         li.addContent(HtmlTree.HEADING(HtmlConstants.SERIALIZED_MEMBER_HEADING,
   167                 classNameContent));
   168         return li;
   169     }
   171     /**
   172      * Get the serial UID info header.
   173      *
   174      * @return a content tree for the serial uid info header
   175      */
   176     public Content getSerialUIDInfoHeader() {
   177         HtmlTree dl = new HtmlTree(HtmlTag.DL);
   178         dl.addStyle(HtmlStyle.nameValue);
   179         return dl;
   180     }
   182     /**
   183      * Adds the serial UID info.
   184      *
   185      * @param header the header that will show up before the UID.
   186      * @param serialUID the serial UID to print.
   187      * @param serialUidTree the serial UID content tree to which the serial UID
   188      *                      content will be added
   189      */
   190     public void addSerialUIDInfo(String header, String serialUID,
   191             Content serialUidTree) {
   192         Content headerContent = new StringContent(header);
   193         serialUidTree.addContent(HtmlTree.DT(headerContent));
   194         Content serialContent = new StringContent(serialUID);
   195         serialUidTree.addContent(HtmlTree.DD(serialContent));
   196     }
   198     /**
   199      * Get the class serialize content header.
   200      *
   201      * @return a content tree for the class serialize content header
   202      */
   203     public Content getClassContentHeader() {
   204         HtmlTree ul = new HtmlTree(HtmlTag.UL);
   205         ul.addStyle(HtmlStyle.blockList);
   206         return ul;
   207     }
   209     /**
   210      * Get the serialized content tree section.
   211      *
   212      * @param serializedTreeContent the serialized content tree to be added
   213      * @return a div content tree
   214      */
   215     public Content getSerializedContent(Content serializedTreeContent) {
   216         Content divContent = HtmlTree.DIV(HtmlStyle.serializedFormContainer,
   217                 serializedTreeContent);
   218         return divContent;
   219     }
   221     /**
   222      * Add the footer.
   223      *
   224      * @param serializedTree the serialized tree to be added
   225      */
   226     public void addFooter(Content serializedTree) {
   227         addNavLinks(false, serializedTree);
   228         addBottom(serializedTree);
   229     }
   231     /**
   232      * {@inheritDoc}
   233      */
   234     public void printDocument(Content serializedTree) {
   235         printHtmlDocument(null, true, serializedTree);
   236     }
   238     private void tableHeader() {
   239         tableIndexSummary();
   240         trBgcolorStyle("#CCCCFF", "TableSubHeadingColor");
   241     }
   243     private void tableFooter() {
   244         fontEnd();
   245         thEnd(); trEnd(); tableEnd();
   246     }
   248     /**
   249      * Return an instance of a SerialFieldWriter.
   250      *
   251      * @return an instance of a SerialFieldWriter.
   252      */
   253     public SerialFieldWriter getSerialFieldWriter(ClassDoc classDoc) {
   254         return new HtmlSerialFieldWriter(this, classDoc);
   255     }
   257     /**
   258      * Return an instance of a SerialMethodWriter.
   259      *
   260      * @return an instance of a SerialMethodWriter.
   261      */
   262     public SerialMethodWriter getSerialMethodWriter(ClassDoc classDoc) {
   263         return new HtmlSerialMethodWriter(this, classDoc);
   264     }
   265 }

mercurial