Tue, 03 Dec 2013 14:21:45 -0800
8025416: doclet not substituting {@docRoot} in some cases
Reviewed-by: jjg
duke@1 | 1 | /* |
jjg@1743 | 2 | * Copyright (c) 1998, 2013, 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 | * |
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 Joe Fialli |
bpatel@766 | 43 | * @author Bhavesh Patel (Modified) |
duke@1 | 44 | */ |
duke@1 | 45 | public class HtmlSerialMethodWriter extends MethodWriterImpl implements |
duke@1 | 46 | SerializedFormWriter.SerialMethodWriter{ |
duke@1 | 47 | |
duke@1 | 48 | public HtmlSerialMethodWriter(SubWriterHolderWriter writer, |
duke@1 | 49 | ClassDoc classdoc) { |
duke@1 | 50 | super(writer, classdoc); |
duke@1 | 51 | } |
duke@1 | 52 | |
bpatel@766 | 53 | /** |
bpatel@766 | 54 | * Return the header for serializable methods section. |
bpatel@766 | 55 | * |
bpatel@766 | 56 | * @return a content tree for the header |
bpatel@766 | 57 | */ |
bpatel@766 | 58 | public Content getSerializableMethodsHeader() { |
bpatel@766 | 59 | HtmlTree ul = new HtmlTree(HtmlTag.UL); |
bpatel@766 | 60 | ul.addStyle(HtmlStyle.blockList); |
bpatel@766 | 61 | return ul; |
duke@1 | 62 | } |
duke@1 | 63 | |
bpatel@766 | 64 | /** |
bpatel@766 | 65 | * Return the header for serializable methods content section. |
bpatel@766 | 66 | * |
bpatel@766 | 67 | * @param isLastContent true if the cotent being documented is the last content. |
bpatel@766 | 68 | * @return a content tree for the header |
bpatel@766 | 69 | */ |
bpatel@766 | 70 | public Content getMethodsContentHeader(boolean isLastContent) { |
bpatel@766 | 71 | HtmlTree li = new HtmlTree(HtmlTag.LI); |
bpatel@766 | 72 | if (isLastContent) |
bpatel@766 | 73 | li.addStyle(HtmlStyle.blockListLast); |
bpatel@766 | 74 | else |
bpatel@766 | 75 | li.addStyle(HtmlStyle.blockList); |
bpatel@766 | 76 | return li; |
duke@1 | 77 | } |
duke@1 | 78 | |
bpatel@766 | 79 | /** |
bpatel@766 | 80 | * Add serializable methods. |
bpatel@766 | 81 | * |
bpatel@766 | 82 | * @param heading the heading for the section |
bpatel@766 | 83 | * @param serializableMethodContent the tree to be added to the serializable methods |
bpatel@766 | 84 | * content tree |
bpatel@766 | 85 | * @return a content tree for the serializable methods content |
bpatel@766 | 86 | */ |
bpatel@766 | 87 | public Content getSerializableMethods(String heading, Content serializableMethodContent) { |
bpatel@766 | 88 | Content headingContent = new StringContent(heading); |
bpatel@766 | 89 | Content serialHeading = HtmlTree.HEADING(HtmlConstants.SERIALIZED_MEMBER_HEADING, |
bpatel@766 | 90 | headingContent); |
bpatel@2101 | 91 | Content li = HtmlTree.LI(HtmlStyle.blockList, serialHeading); |
bpatel@766 | 92 | li.addContent(serializableMethodContent); |
bpatel@766 | 93 | return li; |
duke@1 | 94 | } |
duke@1 | 95 | |
bpatel@766 | 96 | /** |
bpatel@766 | 97 | * Return the no customization message. |
bpatel@766 | 98 | * |
bpatel@766 | 99 | * @param msg the message to be displayed |
bpatel@766 | 100 | * @return no customization message content |
bpatel@766 | 101 | */ |
bpatel@766 | 102 | public Content getNoCustomizationMsg(String msg) { |
bpatel@766 | 103 | Content noCustomizationMsg = new StringContent(msg); |
bpatel@766 | 104 | return noCustomizationMsg; |
duke@1 | 105 | } |
duke@1 | 106 | |
bpatel@766 | 107 | /** |
bpatel@766 | 108 | * Add the member header. |
bpatel@766 | 109 | * |
bpatel@766 | 110 | * @param member the method document to be listed |
bpatel@766 | 111 | * @param methodsContentTree the content tree to which the member header will be added |
bpatel@766 | 112 | */ |
bpatel@766 | 113 | public void addMemberHeader(MethodDoc member, Content methodsContentTree) { |
bpatel@766 | 114 | methodsContentTree.addContent(getHead(member)); |
bpatel@766 | 115 | methodsContentTree.addContent(getSignature(member)); |
duke@1 | 116 | } |
duke@1 | 117 | |
bpatel@766 | 118 | /** |
bpatel@766 | 119 | * Add the deprecated information for this member. |
bpatel@766 | 120 | * |
bpatel@766 | 121 | * @param member the method to document. |
bpatel@766 | 122 | * @param methodsContentTree the tree to which the deprecated info will be added |
bpatel@766 | 123 | */ |
bpatel@766 | 124 | public void addDeprecatedMemberInfo(MethodDoc member, Content methodsContentTree) { |
bpatel@766 | 125 | addDeprecatedInfo(member, methodsContentTree); |
duke@1 | 126 | } |
duke@1 | 127 | |
bpatel@766 | 128 | /** |
bpatel@766 | 129 | * Add the description text for this member. |
bpatel@766 | 130 | * |
bpatel@766 | 131 | * @param member the method to document. |
bpatel@766 | 132 | * @param methodsContentTree the tree to which the deprecated info will be added |
bpatel@766 | 133 | */ |
bpatel@766 | 134 | public void addMemberDescription(MethodDoc member, Content methodsContentTree) { |
bpatel@766 | 135 | addComment(member, methodsContentTree); |
bpatel@766 | 136 | } |
bpatel@766 | 137 | |
bpatel@766 | 138 | /** |
bpatel@766 | 139 | * Add the tag information for this member. |
bpatel@766 | 140 | * |
bpatel@766 | 141 | * @param member the method to document. |
bpatel@766 | 142 | * @param methodsContentTree the tree to which the member tags info will be added |
bpatel@766 | 143 | */ |
bpatel@766 | 144 | public void addMemberTags(MethodDoc member, Content methodsContentTree) { |
jjg@1751 | 145 | Content tagContent = new ContentBuilder(); |
duke@1 | 146 | TagletManager tagletManager = |
jjg@1410 | 147 | configuration.tagletManager; |
duke@1 | 148 | TagletWriter.genTagOuput(tagletManager, member, |
jjg@1750 | 149 | tagletManager.getSerializedFormTaglets(), |
jjg@1751 | 150 | writer.getTagletWriterInstance(false), tagContent); |
bpatel@766 | 151 | Content dlTags = new HtmlTree(HtmlTag.DL); |
jjg@1744 | 152 | dlTags.addContent(tagContent); |
jjg@1744 | 153 | methodsContentTree.addContent(dlTags); // TODO: what if empty? |
jjg@74 | 154 | MethodDoc method = member; |
duke@1 | 155 | if (method.name().compareTo("writeExternal") == 0 |
duke@1 | 156 | && method.tags("serialData").length == 0) { |
duke@1 | 157 | serialWarning(member.position(), "doclet.MissingSerialDataTag", |
duke@1 | 158 | method.containingClass().qualifiedName(), method.name()); |
duke@1 | 159 | } |
duke@1 | 160 | } |
duke@1 | 161 | } |