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

changeset 233
5240b1120530
parent 182
47a62d8d98b4
child 554
9d9f26857129
equal deleted inserted replaced
232:1fbc1cc6e260 233:5240b1120530
23 * have any questions. 23 * have any questions.
24 */ 24 */
25 25
26 package com.sun.tools.doclets.formats.html; 26 package com.sun.tools.doclets.formats.html;
27 27
28 import com.sun.javadoc.*;
28 import com.sun.tools.doclets.internal.toolkit.*; 29 import com.sun.tools.doclets.internal.toolkit.*;
29 import com.sun.tools.doclets.internal.toolkit.builders.SerializedFormBuilder; 30 import com.sun.tools.doclets.internal.toolkit.builders.SerializedFormBuilder;
30 import com.sun.tools.doclets.internal.toolkit.taglets.*; 31 import com.sun.tools.doclets.internal.toolkit.taglets.*;
31 import com.sun.tools.doclets.internal.toolkit.util.*; 32 import com.sun.tools.doclets.internal.toolkit.util.*;
32 import com.sun.javadoc.*;
33 33
34 /** 34 /**
35 * The taglet writer that writes HTML. 35 * The taglet writer that writes HTML.
36 * 36 *
37 * @since 1.5 37 * @since 1.5
38 * @author Jamie Ho 38 * @author Jamie Ho
39 * @author Bhavesh Patel (Modified)
39 */ 40 */
40 41
41 public class TagletWriterImpl extends TagletWriter { 42 public class TagletWriterImpl extends TagletWriter {
42 43
43 private HtmlDocletWriter htmlWriter; 44 private HtmlDocletWriter htmlWriter;
97 } 98 }
98 if (member instanceof ExecutableMemberDoc) { 99 if (member instanceof ExecutableMemberDoc) {
99 output.append(DocletConstants.NL + "<P>" + 100 output.append(DocletConstants.NL + "<P>" +
100 DocletConstants.NL); 101 DocletConstants.NL);
101 } 102 }
103 output.append("</DD>");
102 } else { 104 } else {
103 if (Util.isDeprecated(member.containingClass())) { 105 if (Util.isDeprecated(member.containingClass())) {
104 output.append("<DD><STRONG>" + 106 output.append("<DD><STRONG>" +
105 ConfigurationImpl.getInstance(). 107 ConfigurationImpl.getInstance().
106 getText("doclet.Deprecated") + "</STRONG>&nbsp;"); 108 getText("doclet.Deprecated") + "</STRONG>&nbsp;</DD>");
107 } 109 }
108 } 110 }
109 } 111 }
110 return new TagletOutputImpl(output.toString()); 112 return new TagletOutputImpl(output.toString());
111 } 113 }
121 * {@inheritDoc} 123 * {@inheritDoc}
122 */ 124 */
123 public TagletOutput getParamHeader(String header) { 125 public TagletOutput getParamHeader(String header) {
124 StringBuffer result = new StringBuffer(); 126 StringBuffer result = new StringBuffer();
125 result.append("<DT>"); 127 result.append("<DT>");
126 result.append("<STRONG>" + header + "</STRONG>"); 128 result.append("<STRONG>" + header + "</STRONG></DT>");
127 return new TagletOutputImpl(result.toString()); 129 return new TagletOutputImpl(result.toString());
128 } 130 }
129 131
130 /** 132 /**
131 * {@inheritDoc} 133 * {@inheritDoc}
132 */ 134 */
133 public TagletOutput paramTagOutput(ParamTag paramTag, String paramName) { 135 public TagletOutput paramTagOutput(ParamTag paramTag, String paramName) {
134 TagletOutput result = new TagletOutputImpl("<DD><CODE>" + paramName + "</CODE>" 136 TagletOutput result = new TagletOutputImpl("<DD><CODE>" + paramName + "</CODE>"
135 + " - " + htmlWriter.commentTagsToString(paramTag, null, paramTag.inlineTags(), false)); 137 + " - " + htmlWriter.commentTagsToString(paramTag, null, paramTag.inlineTags(), false) + "</DD>");
136 return result; 138 return result;
137 } 139 }
138 140
139 /** 141 /**
140 * {@inheritDoc} 142 * {@inheritDoc}
141 */ 143 */
142 public TagletOutput returnTagOutput(Tag returnTag) { 144 public TagletOutput returnTagOutput(Tag returnTag) {
143 TagletOutput result = new TagletOutputImpl(DocletConstants.NL + "<DT>" + 145 TagletOutput result = new TagletOutputImpl(DocletConstants.NL + "<DT>" +
144 "<STRONG>" + htmlWriter.configuration.getText("doclet.Returns") + 146 "<STRONG>" + htmlWriter.configuration.getText("doclet.Returns") +
145 "</STRONG>" + "<DD>" + 147 "</STRONG>" + "</DT>" + "<DD>" +
146 htmlWriter.commentTagsToString(returnTag, null, returnTag.inlineTags(), 148 htmlWriter.commentTagsToString(returnTag, null, returnTag.inlineTags(),
147 false)); 149 false) + "</DD>");
148 return result; 150 return result;
149 } 151 }
150 152
151 /** 153 /**
152 * {@inheritDoc} 154 * {@inheritDoc}
172 + "." + ((FieldDoc) holder).name(), 174 + "." + ((FieldDoc) holder).name(),
173 htmlWriter.configuration.getText("doclet.Constants_Summary")); 175 htmlWriter.configuration.getText("doclet.Constants_Summary"));
174 } 176 }
175 if (holder.isClass() && ((ClassDoc)holder).isSerializable()) { 177 if (holder.isClass() && ((ClassDoc)holder).isSerializable()) {
176 //Automatically add link to serialized form page for serializable classes. 178 //Automatically add link to serialized form page for serializable classes.
177 if (!(SerializedFormBuilder.serialInclude(holder) && 179 if ((SerializedFormBuilder.serialInclude(holder) &&
178 SerializedFormBuilder.serialInclude(((ClassDoc)holder).containingPackage()))) { 180 SerializedFormBuilder.serialInclude(((ClassDoc)holder).containingPackage()))) {
179 return result.equals("") ? null : new TagletOutputImpl(result); 181 result = addSeeHeader(result);
180 } 182 result += htmlWriter.getHyperLink(htmlWriter.relativePath + "serialized-form.html",
181 result = addSeeHeader(result); 183 ((ClassDoc)holder).qualifiedName(), htmlWriter.configuration.getText("doclet.Serialized_Form"), false);
182 result += htmlWriter.getHyperLink(htmlWriter.relativePath + "serialized-form.html", 184 }
183 ((ClassDoc)holder).qualifiedName(), htmlWriter.configuration.getText("doclet.Serialized_Form"), false); 185 }
184 } 186 return result.equals("") ? null : new TagletOutputImpl(result + "</DD>");
185 return result.equals("") ? null : new TagletOutputImpl(result);
186 } 187 }
187 188
188 private String addSeeHeader(String result) { 189 private String addSeeHeader(String result) {
189 if (result != null && result.length() > 0) { 190 if (result != null && result.length() > 0) {
190 return result + ", " + DocletConstants.NL; 191 return result + ", " + DocletConstants.NL;
191 } else { 192 } else {
192 return "<DT><STRONG>" + htmlWriter.configuration().getText("doclet.See_Also") + "</STRONG><DD>"; 193 return "<DT><STRONG>" + htmlWriter.configuration().getText("doclet.See_Also") + "</STRONG></DT><DD>";
193 } 194 }
194 } 195 }
195 196
196 /** 197 /**
197 * {@inheritDoc} 198 * {@inheritDoc}
203 if (i > 0) { 204 if (i > 0) {
204 result += ", "; 205 result += ", ";
205 } 206 }
206 result += htmlWriter.commentTagsToString(simpleTags[i], null, simpleTags[i].inlineTags(), false); 207 result += htmlWriter.commentTagsToString(simpleTags[i], null, simpleTags[i].inlineTags(), false);
207 } 208 }
208 return new TagletOutputImpl(result + "</DD>" + DocletConstants.NL); 209 result += "</DD>" + DocletConstants.NL;
210 return new TagletOutputImpl(result);
209 } 211 }
210 212
211 /** 213 /**
212 * {@inheritDoc} 214 * {@inheritDoc}
213 */ 215 */
220 /** 222 /**
221 * {@inheritDoc} 223 * {@inheritDoc}
222 */ 224 */
223 public TagletOutput getThrowsHeader() { 225 public TagletOutput getThrowsHeader() {
224 return new TagletOutputImpl(DocletConstants.NL + "<DT>" + "<STRONG>" + 226 return new TagletOutputImpl(DocletConstants.NL + "<DT>" + "<STRONG>" +
225 htmlWriter.configuration().getText("doclet.Throws") + "</STRONG>"); 227 htmlWriter.configuration().getText("doclet.Throws") + "</STRONG></DT>");
226 } 228 }
227 229
228 /** 230 /**
229 * {@inheritDoc} 231 * {@inheritDoc}
230 */ 232 */
239 htmlWriter.commentTagsToString(throwsTag, null, 241 htmlWriter.commentTagsToString(throwsTag, null,
240 throwsTag.inlineTags(), false)); 242 throwsTag.inlineTags(), false));
241 if (text != null && text.toString().length() > 0) { 243 if (text != null && text.toString().length() > 0) {
242 result += " - " + text; 244 result += " - " + text;
243 } 245 }
246 result += "</DD>";
244 return new TagletOutputImpl(result); 247 return new TagletOutputImpl(result);
245 } 248 }
246 249
247 /** 250 /**
248 * {@inheritDoc} 251 * {@inheritDoc}
249 */ 252 */
250 public TagletOutput throwsTagOutput(Type throwsType) { 253 public TagletOutput throwsTagOutput(Type throwsType) {
251 return new TagletOutputImpl(DocletConstants.NL + "<DD>" + 254 return new TagletOutputImpl(DocletConstants.NL + "<DD>" +
252 htmlWriter.codeText(htmlWriter.getLink( 255 htmlWriter.codeText(htmlWriter.getLink(
253 new LinkInfoImpl(LinkInfoImpl.CONTEXT_MEMBER, throwsType)))); 256 new LinkInfoImpl(LinkInfoImpl.CONTEXT_MEMBER, throwsType))) + "</DD>");
254 } 257 }
255 258
256 /** 259 /**
257 * {@inheritDoc} 260 * {@inheritDoc}
258 */ 261 */

mercurial