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

Sat, 13 Apr 2013 18:48:29 -0700

author
bpatel
date
Sat, 13 Apr 2013 18:48:29 -0700
changeset 1691
f10cffab99b4
parent 1410
bfec2a1cc869
child 1735
8ea30d59ac41
permissions
-rw-r--r--

8009686: Generated javadoc documentation should be able to display type annotation on an array
Reviewed-by: jjg

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

mercurial