Thu, 10 Jun 2010 17:09:56 -0700
6960407: Potential rebranding issues in openjdk/langtools repository sources
Reviewed-by: darcy
1 /*
2 * Copyright (c) 1998, 2005, 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 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 strongText("doclet.Package");
77 print(' ');
78 strong(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 strong(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 strong(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 }