22 * CA 95054 USA or visit www.sun.com if you need additional information or |
22 * CA 95054 USA or visit www.sun.com if you need additional information or |
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 |
|
28 import java.io.*; |
|
29 import java.text.SimpleDateFormat; |
|
30 import java.util.*; |
|
31 |
|
32 import com.sun.javadoc.*; |
27 import com.sun.tools.doclets.formats.html.markup.*; |
33 import com.sun.tools.doclets.formats.html.markup.*; |
28 |
|
29 import com.sun.tools.doclets.internal.toolkit.*; |
34 import com.sun.tools.doclets.internal.toolkit.*; |
30 import com.sun.tools.doclets.internal.toolkit.util.*; |
35 import com.sun.tools.doclets.internal.toolkit.util.*; |
31 import com.sun.tools.doclets.internal.toolkit.taglets.*; |
36 import com.sun.tools.doclets.internal.toolkit.taglets.*; |
32 |
|
33 import com.sun.javadoc.*; |
|
34 import java.io.*; |
|
35 import java.text.SimpleDateFormat; |
|
36 import java.util.*; |
|
37 |
|
38 |
37 |
39 /** |
38 /** |
40 * Class for the Html Format Code Generation specific to JavaDoc. |
39 * Class for the Html Format Code Generation specific to JavaDoc. |
41 * This Class contains methods related to the Html Code Generation which |
40 * This Class contains methods related to the Html Code Generation which |
42 * are used extensively while generating the entire documentation. |
41 * are used extensively while generating the entire documentation. |
43 * |
42 * |
44 * @since 1.2 |
43 * @since 1.2 |
45 * @author Atul M Dambalkar |
44 * @author Atul M Dambalkar |
46 * @author Robert Field |
45 * @author Robert Field |
|
46 * @author Bhavesh Patel (Modified) |
47 */ |
47 */ |
48 public class HtmlDocletWriter extends HtmlDocWriter { |
48 public class HtmlDocletWriter extends HtmlDocWriter { |
49 |
49 |
50 /** |
50 /** |
51 * Relative path from the file getting generated to the destination |
51 * Relative path from the file getting generated to the destination |
203 } |
203 } |
204 |
204 |
205 private void printMethodInfo(MethodDoc method) { |
205 private void printMethodInfo(MethodDoc method) { |
206 ClassDoc[] intfacs = method.containingClass().interfaces(); |
206 ClassDoc[] intfacs = method.containingClass().interfaces(); |
207 MethodDoc overriddenMethod = method.overriddenMethod(); |
207 MethodDoc overriddenMethod = method.overriddenMethod(); |
208 if (intfacs.length > 0 || overriddenMethod != null) { |
208 // Check whether there is any implementation or overridden info to be |
|
209 // printed. If no overridden or implementation info needs to be |
|
210 // printed, do not print this section. |
|
211 if ((intfacs.length > 0 && |
|
212 new ImplementedMethods(method, this.configuration).build().length > 0) || |
|
213 overriddenMethod != null) { |
|
214 printMemberDetailsListStartTag(); |
209 dd(); |
215 dd(); |
210 printTagsInfoHeader(); |
216 printTagsInfoHeader(); |
211 MethodWriterImpl.printImplementsInfo(this, method); |
217 MethodWriterImpl.printImplementsInfo(this, method); |
212 if (overriddenMethod != null) { |
218 if (overriddenMethod != null) { |
213 MethodWriterImpl.printOverridden(this, |
219 MethodWriterImpl.printOverridden(this, |
214 method.overriddenType(), overriddenMethod); |
220 method.overriddenType(), overriddenMethod); |
215 } |
221 } |
216 printTagsInfoFooter(); |
222 printTagsInfoFooter(); |
217 ddEnd(); |
223 ddEnd(); |
218 } |
224 } |
219 dd(); |
|
220 } |
225 } |
221 |
226 |
222 protected void printTags(Doc doc) { |
227 protected void printTags(Doc doc) { |
223 if(configuration.nocomment){ |
228 if(configuration.nocomment){ |
224 return; |
229 return; |
228 } |
233 } |
229 TagletOutputImpl output = new TagletOutputImpl(""); |
234 TagletOutputImpl output = new TagletOutputImpl(""); |
230 TagletWriter.genTagOuput(configuration.tagletManager, doc, |
235 TagletWriter.genTagOuput(configuration.tagletManager, doc, |
231 configuration.tagletManager.getCustomTags(doc), |
236 configuration.tagletManager.getCustomTags(doc), |
232 getTagletWriterInstance(false), output); |
237 getTagletWriterInstance(false), output); |
233 if (output.toString().trim().length() > 0) { |
238 String outputString = output.toString().trim(); |
|
239 // For RootDoc and ClassDoc, this section is not the definition description |
|
240 // but the start of definition list. |
|
241 if (!outputString.isEmpty()) { |
|
242 if (!(doc instanceof RootDoc || doc instanceof ClassDoc)) { |
|
243 printMemberDetailsListStartTag(); |
|
244 dd(); |
|
245 } |
234 printTagsInfoHeader(); |
246 printTagsInfoHeader(); |
235 print(output.toString()); |
247 print(outputString); |
236 printTagsInfoFooter(); |
248 printTagsInfoFooter(); |
237 } else if (! (doc instanceof ConstructorDoc || |
249 if (!(doc instanceof RootDoc || doc instanceof ClassDoc)) |
238 doc instanceof RootDoc || doc instanceof ClassDoc)) { |
250 ddEnd(); |
239 //To be consistent with 1.4.2 output. |
251 } |
240 //I hate to do this but we have to pass the diff test to prove |
252 } |
241 //nothing has broken. |
253 |
242 printTagsInfoHeader(); |
254 /** |
243 printTagsInfoFooter(); |
255 * Check whether there are any tags for Serialization Overview |
244 } |
256 * section to be printed. |
245 } |
257 * |
246 |
258 * @param field the FieldDoc object to check for tags. |
247 /** |
|
248 * Check whether there are any tags to be printed. |
|
249 * |
|
250 * @param doc the Doc object to check for tags. |
|
251 * @return true if there are tags to be printed else return false. |
259 * @return true if there are tags to be printed else return false. |
252 */ |
260 */ |
253 protected boolean hasTagsToPrint(Doc doc) { |
261 protected boolean hasSerializationOverviewTags(FieldDoc field) { |
254 if (doc instanceof MethodDoc) { |
|
255 ClassDoc[] intfacs = ((MethodDoc)doc).containingClass().interfaces(); |
|
256 MethodDoc overriddenMethod = ((MethodDoc)doc).overriddenMethod(); |
|
257 if ((intfacs.length > 0 && |
|
258 new ImplementedMethods((MethodDoc)doc, this.configuration).build().length > 0) || |
|
259 overriddenMethod != null) { |
|
260 return true; |
|
261 } |
|
262 } |
|
263 TagletOutputImpl output = new TagletOutputImpl(""); |
262 TagletOutputImpl output = new TagletOutputImpl(""); |
264 TagletWriter.genTagOuput(configuration.tagletManager, doc, |
263 TagletWriter.genTagOuput(configuration.tagletManager, field, |
265 configuration.tagletManager.getCustomTags(doc), |
264 configuration.tagletManager.getCustomTags(field), |
266 getTagletWriterInstance(false), output); |
265 getTagletWriterInstance(false), output); |
267 return (output.toString().trim().isEmpty()); |
266 return (!output.toString().trim().isEmpty()); |
268 } |
267 } |
269 |
268 |
270 /** |
269 /** |
271 * Returns a TagletWriter that knows how to write HTML. |
270 * Returns a TagletWriter that knows how to write HTML. |
272 * |
271 * |