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

changeset 240
8c55d5b0ed71
parent 229
03bcd66bd8e7
parent 233
5240b1120530
child 243
edd944553131
     1.1 --- a/src/share/classes/com/sun/tools/doclets/formats/html/HtmlDocletWriter.java	Mon Mar 09 13:34:19 2009 -0700
     1.2 +++ b/src/share/classes/com/sun/tools/doclets/formats/html/HtmlDocletWriter.java	Mon Mar 09 23:53:41 2009 -0700
     1.3 @@ -24,17 +24,16 @@
     1.4   */
     1.5  
     1.6  package com.sun.tools.doclets.formats.html;
     1.7 -import com.sun.tools.doclets.formats.html.markup.*;
     1.8  
     1.9 -import com.sun.tools.doclets.internal.toolkit.*;
    1.10 -import com.sun.tools.doclets.internal.toolkit.util.*;
    1.11 -import com.sun.tools.doclets.internal.toolkit.taglets.*;
    1.12 -
    1.13 -import com.sun.javadoc.*;
    1.14  import java.io.*;
    1.15  import java.text.SimpleDateFormat;
    1.16  import java.util.*;
    1.17  
    1.18 +import com.sun.javadoc.*;
    1.19 +import com.sun.tools.doclets.formats.html.markup.*;
    1.20 +import com.sun.tools.doclets.internal.toolkit.*;
    1.21 +import com.sun.tools.doclets.internal.toolkit.util.*;
    1.22 +import com.sun.tools.doclets.internal.toolkit.taglets.*;
    1.23  
    1.24  /**
    1.25   * Class for the Html Format Code Generation specific to JavaDoc.
    1.26 @@ -44,6 +43,7 @@
    1.27   * @since 1.2
    1.28   * @author Atul M Dambalkar
    1.29   * @author Robert Field
    1.30 + * @author Bhavesh Patel (Modified)
    1.31   */
    1.32  public class HtmlDocletWriter extends HtmlDocWriter {
    1.33  
    1.34 @@ -205,7 +205,13 @@
    1.35      private void printMethodInfo(MethodDoc method) {
    1.36          ClassDoc[] intfacs = method.containingClass().interfaces();
    1.37          MethodDoc overriddenMethod = method.overriddenMethod();
    1.38 -        if (intfacs.length > 0 || overriddenMethod != null) {
    1.39 +        // Check whether there is any implementation or overridden info to be
    1.40 +        // printed. If no overridden or implementation info needs to be
    1.41 +        // printed, do not print this section.
    1.42 +        if ((intfacs.length > 0 &&
    1.43 +                new ImplementedMethods(method, this.configuration).build().length > 0) ||
    1.44 +                overriddenMethod != null) {
    1.45 +            printMemberDetailsListStartTag();
    1.46              dd();
    1.47              printTagsInfoHeader();
    1.48              MethodWriterImpl.printImplementsInfo(this, method);
    1.49 @@ -216,7 +222,6 @@
    1.50              printTagsInfoFooter();
    1.51              ddEnd();
    1.52          }
    1.53 -        dd();
    1.54      }
    1.55  
    1.56      protected void printTags(Doc doc) {
    1.57 @@ -230,41 +235,35 @@
    1.58          TagletWriter.genTagOuput(configuration.tagletManager, doc,
    1.59              configuration.tagletManager.getCustomTags(doc),
    1.60                  getTagletWriterInstance(false), output);
    1.61 -        if (output.toString().trim().length() > 0) {
    1.62 +        String outputString = output.toString().trim();
    1.63 +        // For RootDoc and ClassDoc, this section is not the definition description
    1.64 +        // but the start of definition list.
    1.65 +        if (!outputString.isEmpty()) {
    1.66 +            if (!(doc instanceof RootDoc || doc instanceof ClassDoc)) {
    1.67 +                printMemberDetailsListStartTag();
    1.68 +                dd();
    1.69 +            }
    1.70              printTagsInfoHeader();
    1.71 -            print(output.toString());
    1.72 +            print(outputString);
    1.73              printTagsInfoFooter();
    1.74 -        } else if (! (doc instanceof ConstructorDoc ||
    1.75 -            doc instanceof RootDoc || doc instanceof ClassDoc)) {
    1.76 -            //To be consistent with 1.4.2 output.
    1.77 -            //I hate to do this but we have to pass the diff test to prove
    1.78 -            //nothing has broken.
    1.79 -            printTagsInfoHeader();
    1.80 -            printTagsInfoFooter();
    1.81 +            if (!(doc instanceof RootDoc || doc instanceof ClassDoc))
    1.82 +                ddEnd();
    1.83          }
    1.84      }
    1.85  
    1.86      /**
    1.87 -     * Check whether there are any tags to be printed.
    1.88 +     * Check whether there are any tags for Serialization Overview
    1.89 +     * section to be printed.
    1.90       *
    1.91 -     * @param doc the Doc object to check for tags.
    1.92 +     * @param field the FieldDoc object to check for tags.
    1.93       * @return true if there are tags to be printed else return false.
    1.94       */
    1.95 -    protected boolean hasTagsToPrint(Doc doc) {
    1.96 -        if (doc instanceof MethodDoc) {
    1.97 -            ClassDoc[] intfacs = ((MethodDoc)doc).containingClass().interfaces();
    1.98 -            MethodDoc overriddenMethod = ((MethodDoc)doc).overriddenMethod();
    1.99 -            if ((intfacs.length > 0 &&
   1.100 -                new ImplementedMethods((MethodDoc)doc, this.configuration).build().length > 0) ||
   1.101 -                overriddenMethod != null) {
   1.102 -                return true;
   1.103 -            }
   1.104 -        }
   1.105 +    protected boolean hasSerializationOverviewTags(FieldDoc field) {
   1.106          TagletOutputImpl output = new TagletOutputImpl("");
   1.107 -        TagletWriter.genTagOuput(configuration.tagletManager, doc,
   1.108 -            configuration.tagletManager.getCustomTags(doc),
   1.109 +        TagletWriter.genTagOuput(configuration.tagletManager, field,
   1.110 +            configuration.tagletManager.getCustomTags(field),
   1.111                  getTagletWriterInstance(false), output);
   1.112 -        return (output.toString().trim().isEmpty());
   1.113 +        return (!output.toString().trim().isEmpty());
   1.114      }
   1.115  
   1.116      /**

mercurial