0N/A/*
797N/A * Copyright (c) 1998, 2010, Oracle and/or its affiliates. All rights reserved.
0N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
0N/A *
0N/A * This code is free software; you can redistribute it and/or modify it
0N/A * under the terms of the GNU General Public License version 2 only, as
553N/A * published by the Free Software Foundation. Oracle designates this
0N/A * particular file as subject to the "Classpath" exception as provided
553N/A * by Oracle in the LICENSE file that accompanied this code.
0N/A *
0N/A * This code is distributed in the hope that it will be useful, but WITHOUT
0N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
0N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
0N/A * version 2 for more details (a copy is included in the LICENSE file that
0N/A * accompanied this code).
0N/A *
0N/A * You should have received a copy of the GNU General Public License version
0N/A * 2 along with this work; if not, write to the Free Software Foundation,
0N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
0N/A *
553N/A * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
553N/A * or visit www.oracle.com if you need additional information or have any
553N/A * questions.
0N/A */
0N/A
0N/Apackage com.sun.tools.doclets.formats.html;
0N/A
232N/Aimport com.sun.javadoc.*;
0N/Aimport com.sun.tools.doclets.internal.toolkit.*;
0N/Aimport com.sun.tools.doclets.internal.toolkit.taglets.*;
765N/Aimport com.sun.tools.doclets.formats.html.markup.*;
0N/A
0N/A/**
0N/A * Generate serialized form for Serializable/Externalizable methods.
0N/A * Documentation denoted by the <code>serialData</code> tag is processed.
0N/A *
0N/A * @author Joe Fialli
765N/A * @author Bhavesh Patel (Modified)
0N/A */
0N/Apublic class HtmlSerialMethodWriter extends MethodWriterImpl implements
0N/A SerializedFormWriter.SerialMethodWriter{
0N/A
0N/A public HtmlSerialMethodWriter(SubWriterHolderWriter writer,
0N/A ClassDoc classdoc) {
0N/A super(writer, classdoc);
0N/A }
0N/A
765N/A /**
765N/A * Return the header for serializable methods section.
765N/A *
765N/A * @return a content tree for the header
765N/A */
765N/A public Content getSerializableMethodsHeader() {
765N/A HtmlTree ul = new HtmlTree(HtmlTag.UL);
765N/A ul.addStyle(HtmlStyle.blockList);
765N/A return ul;
0N/A }
0N/A
765N/A /**
765N/A * Return the header for serializable methods content section.
765N/A *
765N/A * @param isLastContent true if the cotent being documented is the last content.
765N/A * @return a content tree for the header
765N/A */
765N/A public Content getMethodsContentHeader(boolean isLastContent) {
765N/A HtmlTree li = new HtmlTree(HtmlTag.LI);
765N/A if (isLastContent)
765N/A li.addStyle(HtmlStyle.blockListLast);
765N/A else
765N/A li.addStyle(HtmlStyle.blockList);
765N/A return li;
765N/A }
765N/A
765N/A /**
765N/A * Add serializable methods.
765N/A *
765N/A * @param heading the heading for the section
765N/A * @param serializableMethodContent the tree to be added to the serializable methods
765N/A * content tree
765N/A * @return a content tree for the serializable methods content
765N/A */
765N/A public Content getSerializableMethods(String heading, Content serializableMethodContent) {
765N/A Content li = HtmlTree.LI(HtmlStyle.blockList, writer.getMarkerAnchor(
765N/A "serialized_methods"));
765N/A Content headingContent = new StringContent(heading);
765N/A Content serialHeading = HtmlTree.HEADING(HtmlConstants.SERIALIZED_MEMBER_HEADING,
765N/A headingContent);
765N/A li.addContent(serialHeading);
765N/A li.addContent(serializableMethodContent);
765N/A return li;
0N/A }
0N/A
765N/A /**
765N/A * Return the no customization message.
765N/A *
765N/A * @param msg the message to be displayed
765N/A * @return no customization message content
765N/A */
765N/A public Content getNoCustomizationMsg(String msg) {
765N/A Content noCustomizationMsg = new StringContent(msg);
765N/A return noCustomizationMsg;
765N/A }
765N/A
765N/A /**
765N/A * Add the member header.
765N/A *
765N/A * @param member the method document to be listed
765N/A * @param methodsContentTree the content tree to which the member header will be added
765N/A */
765N/A public void addMemberHeader(MethodDoc member, Content methodsContentTree) {
765N/A methodsContentTree.addContent(writer.getMarkerAnchor(
765N/A writer.getAnchor(member)));
765N/A methodsContentTree.addContent(getHead(member));
765N/A methodsContentTree.addContent(getSignature(member));
0N/A }
0N/A
765N/A /**
765N/A * Add the deprecated information for this member.
765N/A *
765N/A * @param member the method to document.
765N/A * @param methodsContentTree the tree to which the deprecated info will be added
765N/A */
765N/A public void addDeprecatedMemberInfo(MethodDoc member, Content methodsContentTree) {
765N/A addDeprecatedInfo(member, methodsContentTree);
0N/A }
0N/A
765N/A /**
765N/A * Add the description text for this member.
765N/A *
765N/A * @param member the method to document.
765N/A * @param methodsContentTree the tree to which the deprecated info will be added
765N/A */
765N/A public void addMemberDescription(MethodDoc member, Content methodsContentTree) {
765N/A addComment(member, methodsContentTree);
0N/A }
0N/A
765N/A /**
765N/A * Add the tag information for this member.
765N/A *
765N/A * @param member the method to document.
765N/A * @param methodsContentTree the tree to which the member tags info will be added
765N/A */
765N/A public void addMemberTags(MethodDoc member, Content methodsContentTree) {
0N/A TagletOutputImpl output = new TagletOutputImpl("");
0N/A TagletManager tagletManager =
0N/A ConfigurationImpl.getInstance().tagletManager;
0N/A TagletWriter.genTagOuput(tagletManager, member,
0N/A tagletManager.getSerializedFormTags(),
0N/A writer.getTagletWriterInstance(false), output);
232N/A String outputString = output.toString().trim();
765N/A Content dlTags = new HtmlTree(HtmlTag.DL);
232N/A if (!outputString.isEmpty()) {
765N/A Content tagContent = new RawHtml(outputString);
765N/A dlTags.addContent(tagContent);
232N/A }
765N/A methodsContentTree.addContent(dlTags);
73N/A MethodDoc method = member;
0N/A if (method.name().compareTo("writeExternal") == 0
0N/A && method.tags("serialData").length == 0) {
0N/A serialWarning(member.position(), "doclet.MissingSerialDataTag",
0N/A method.containingClass().qualifiedName(), method.name());
0N/A }
0N/A }
0N/A
0N/A protected void printTypeLinkNoDimension(Type type) {
0N/A ClassDoc cd = type.asClassDoc();
0N/A if (type.isPrimitive() || cd.isPackagePrivate()) {
0N/A print(type.typeName());
0N/A } else {
0N/A writer.printLink(new LinkInfoImpl(
0N/A LinkInfoImpl.CONTEXT_SERIAL_MEMBER,type));
0N/A }
0N/A }
0N/A}