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

Tue, 09 Oct 2012 19:10:00 -0700

author
jjg
date
Tue, 09 Oct 2012 19:10:00 -0700
changeset 1357
c75be5bc5283
parent 798
4868a36f6fd8
child 1359
25e14ad23cef
permissions
-rw-r--r--

8000663: clean up langtools imports
Reviewed-by: darcy

duke@1 1 /*
jjg@1357 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@233 28 import com.sun.javadoc.*;
jjg@1357 29 import com.sun.tools.doclets.formats.html.markup.*;
duke@1 30 import com.sun.tools.doclets.internal.toolkit.*;
duke@1 31 import com.sun.tools.doclets.internal.toolkit.taglets.*;
duke@1 32
duke@1 33 /**
duke@1 34 * Generate serialized form for Serializable/Externalizable methods.
duke@1 35 * Documentation denoted by the <code>serialData</code> tag is processed.
duke@1 36 *
duke@1 37 * @author Joe Fialli
bpatel@766 38 * @author Bhavesh Patel (Modified)
duke@1 39 */
duke@1 40 public class HtmlSerialMethodWriter extends MethodWriterImpl implements
duke@1 41 SerializedFormWriter.SerialMethodWriter{
duke@1 42
duke@1 43 public HtmlSerialMethodWriter(SubWriterHolderWriter writer,
duke@1 44 ClassDoc classdoc) {
duke@1 45 super(writer, classdoc);
duke@1 46 }
duke@1 47
bpatel@766 48 /**
bpatel@766 49 * Return the header for serializable methods section.
bpatel@766 50 *
bpatel@766 51 * @return a content tree for the header
bpatel@766 52 */
bpatel@766 53 public Content getSerializableMethodsHeader() {
bpatel@766 54 HtmlTree ul = new HtmlTree(HtmlTag.UL);
bpatel@766 55 ul.addStyle(HtmlStyle.blockList);
bpatel@766 56 return ul;
duke@1 57 }
duke@1 58
bpatel@766 59 /**
bpatel@766 60 * Return the header for serializable methods content section.
bpatel@766 61 *
bpatel@766 62 * @param isLastContent true if the cotent being documented is the last content.
bpatel@766 63 * @return a content tree for the header
bpatel@766 64 */
bpatel@766 65 public Content getMethodsContentHeader(boolean isLastContent) {
bpatel@766 66 HtmlTree li = new HtmlTree(HtmlTag.LI);
bpatel@766 67 if (isLastContent)
bpatel@766 68 li.addStyle(HtmlStyle.blockListLast);
bpatel@766 69 else
bpatel@766 70 li.addStyle(HtmlStyle.blockList);
bpatel@766 71 return li;
duke@1 72 }
duke@1 73
bpatel@766 74 /**
bpatel@766 75 * Add serializable methods.
bpatel@766 76 *
bpatel@766 77 * @param heading the heading for the section
bpatel@766 78 * @param serializableMethodContent the tree to be added to the serializable methods
bpatel@766 79 * content tree
bpatel@766 80 * @return a content tree for the serializable methods content
bpatel@766 81 */
bpatel@766 82 public Content getSerializableMethods(String heading, Content serializableMethodContent) {
bpatel@766 83 Content li = HtmlTree.LI(HtmlStyle.blockList, writer.getMarkerAnchor(
bpatel@766 84 "serialized_methods"));
bpatel@766 85 Content headingContent = new StringContent(heading);
bpatel@766 86 Content serialHeading = HtmlTree.HEADING(HtmlConstants.SERIALIZED_MEMBER_HEADING,
bpatel@766 87 headingContent);
bpatel@766 88 li.addContent(serialHeading);
bpatel@766 89 li.addContent(serializableMethodContent);
bpatel@766 90 return li;
duke@1 91 }
duke@1 92
bpatel@766 93 /**
bpatel@766 94 * Return the no customization message.
bpatel@766 95 *
bpatel@766 96 * @param msg the message to be displayed
bpatel@766 97 * @return no customization message content
bpatel@766 98 */
bpatel@766 99 public Content getNoCustomizationMsg(String msg) {
bpatel@766 100 Content noCustomizationMsg = new StringContent(msg);
bpatel@766 101 return noCustomizationMsg;
duke@1 102 }
duke@1 103
bpatel@766 104 /**
bpatel@766 105 * Add the member header.
bpatel@766 106 *
bpatel@766 107 * @param member the method document to be listed
bpatel@766 108 * @param methodsContentTree the content tree to which the member header will be added
bpatel@766 109 */
bpatel@766 110 public void addMemberHeader(MethodDoc member, Content methodsContentTree) {
bpatel@766 111 methodsContentTree.addContent(writer.getMarkerAnchor(
bpatel@766 112 writer.getAnchor(member)));
bpatel@766 113 methodsContentTree.addContent(getHead(member));
bpatel@766 114 methodsContentTree.addContent(getSignature(member));
duke@1 115 }
duke@1 116
bpatel@766 117 /**
bpatel@766 118 * Add the deprecated information for this member.
bpatel@766 119 *
bpatel@766 120 * @param member the method to document.
bpatel@766 121 * @param methodsContentTree the tree to which the deprecated info will be added
bpatel@766 122 */
bpatel@766 123 public void addDeprecatedMemberInfo(MethodDoc member, Content methodsContentTree) {
bpatel@766 124 addDeprecatedInfo(member, methodsContentTree);
duke@1 125 }
duke@1 126
bpatel@766 127 /**
bpatel@766 128 * Add the description text for this member.
bpatel@766 129 *
bpatel@766 130 * @param member the method to document.
bpatel@766 131 * @param methodsContentTree the tree to which the deprecated info will be added
bpatel@766 132 */
bpatel@766 133 public void addMemberDescription(MethodDoc member, Content methodsContentTree) {
bpatel@766 134 addComment(member, methodsContentTree);
bpatel@766 135 }
bpatel@766 136
bpatel@766 137 /**
bpatel@766 138 * Add the tag information for this member.
bpatel@766 139 *
bpatel@766 140 * @param member the method to document.
bpatel@766 141 * @param methodsContentTree the tree to which the member tags info will be added
bpatel@766 142 */
bpatel@766 143 public void addMemberTags(MethodDoc member, Content methodsContentTree) {
duke@1 144 TagletOutputImpl output = new TagletOutputImpl("");
duke@1 145 TagletManager tagletManager =
duke@1 146 ConfigurationImpl.getInstance().tagletManager;
duke@1 147 TagletWriter.genTagOuput(tagletManager, member,
duke@1 148 tagletManager.getSerializedFormTags(),
duke@1 149 writer.getTagletWriterInstance(false), output);
bpatel@233 150 String outputString = output.toString().trim();
bpatel@766 151 Content dlTags = new HtmlTree(HtmlTag.DL);
bpatel@233 152 if (!outputString.isEmpty()) {
bpatel@766 153 Content tagContent = new RawHtml(outputString);
bpatel@766 154 dlTags.addContent(tagContent);
bpatel@233 155 }
bpatel@766 156 methodsContentTree.addContent(dlTags);
jjg@74 157 MethodDoc method = member;
duke@1 158 if (method.name().compareTo("writeExternal") == 0
duke@1 159 && method.tags("serialData").length == 0) {
duke@1 160 serialWarning(member.position(), "doclet.MissingSerialDataTag",
duke@1 161 method.containingClass().qualifiedName(), method.name());
duke@1 162 }
duke@1 163 }
duke@1 164
duke@1 165 protected void printTypeLinkNoDimension(Type type) {
duke@1 166 ClassDoc cd = type.asClassDoc();
duke@1 167 if (type.isPrimitive() || cd.isPackagePrivate()) {
duke@1 168 print(type.typeName());
duke@1 169 } else {
duke@1 170 writer.printLink(new LinkInfoImpl(
duke@1 171 LinkInfoImpl.CONTEXT_SERIAL_MEMBER,type));
duke@1 172 }
duke@1 173 }
duke@1 174 }

mercurial