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

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

mercurial