1.1 --- a/src/share/classes/com/sun/tools/doclets/formats/html/HtmlSerialFieldWriter.java Mon Mar 09 13:34:19 2009 -0700 1.2 +++ b/src/share/classes/com/sun/tools/doclets/formats/html/HtmlSerialFieldWriter.java Mon Mar 09 23:53:41 2009 -0700 1.3 @@ -25,11 +25,12 @@ 1.4 1.5 package com.sun.tools.doclets.formats.html; 1.6 1.7 +import java.util.*; 1.8 + 1.9 +import com.sun.javadoc.*; 1.10 import com.sun.tools.doclets.internal.toolkit.*; 1.11 import com.sun.tools.doclets.internal.toolkit.taglets.*; 1.12 import com.sun.tools.doclets.internal.toolkit.util.*; 1.13 -import com.sun.javadoc.*; 1.14 -import java.util.*; 1.15 1.16 /** 1.17 * Generate serialized form for serializable fields. 1.18 @@ -37,6 +38,7 @@ 1.19 * <code>serialField</code> is processed. 1.20 * 1.21 * @author Joe Fialli 1.22 + * @author Bhavesh Patel (Modified) 1.23 */ 1.24 public class HtmlSerialFieldWriter extends FieldWriterImpl 1.25 implements SerializedFormWriter.SerialFieldWriter { 1.26 @@ -75,7 +77,7 @@ 1.27 writer.println(); 1.28 if (heading.equals( 1.29 configuration().getText("doclet.Serialized_Form_class"))) { 1.30 - writer.dl(); 1.31 + assert !writer.getMemberDetailsListPrinted(); 1.32 } 1.33 } else { 1.34 writer.printTableHeadingBackground(heading); 1.35 @@ -102,7 +104,7 @@ 1.36 print(fieldDimensions + ' '); 1.37 strong(fieldName); 1.38 writer.preEnd(); 1.39 - writer.dl(); 1.40 + assert !writer.getMemberDetailsListPrinted(); 1.41 } 1.42 1.43 /** 1.44 @@ -111,9 +113,7 @@ 1.45 * @param field the field to document. 1.46 */ 1.47 public void writeMemberDeprecatedInfo(FieldDoc field) { 1.48 - print(((TagletOutputImpl) 1.49 - (new DeprecatedTaglet()).getTagletOutput(field, 1.50 - writer.getTagletWriterInstance(false))).toString()); 1.51 + printDeprecated(field); 1.52 } 1.53 1.54 /** 1.55 @@ -123,14 +123,17 @@ 1.56 */ 1.57 public void writeMemberDescription(FieldDoc field) { 1.58 if (field.inlineTags().length > 0) { 1.59 + writer.printMemberDetailsListStartTag(); 1.60 writer.dd(); 1.61 writer.printInlineComment(field); 1.62 + writer.ddEnd(); 1.63 } 1.64 Tag[] tags = field.tags("serial"); 1.65 if (tags.length > 0) { 1.66 - writer.dt(); 1.67 + writer.printMemberDetailsListStartTag(); 1.68 writer.dd(); 1.69 writer.printInlineComment(field, tags[0]); 1.70 + writer.ddEnd(); 1.71 } 1.72 } 1.73 1.74 @@ -140,9 +143,14 @@ 1.75 * @param serialFieldTag the field to document (represented by tag). 1.76 */ 1.77 public void writeMemberDescription(SerialFieldTag serialFieldTag) { 1.78 - writer.dd(); 1.79 - writer.print(serialFieldTag.description()); 1.80 - writer.dlEnd(); 1.81 + String serialFieldTagDesc = serialFieldTag.description().trim(); 1.82 + if (!serialFieldTagDesc.isEmpty()) { 1.83 + writer.dl(); 1.84 + writer.dd(); 1.85 + writer.print(serialFieldTagDesc); 1.86 + writer.ddEnd(); 1.87 + writer.dlEnd(); 1.88 + } 1.89 } 1.90 1.91 /** 1.92 @@ -151,33 +159,57 @@ 1.93 * @param field the field to document. 1.94 */ 1.95 public void writeMemberTags(FieldDoc field) { 1.96 - writer.dl(); 1.97 TagletOutputImpl output = new TagletOutputImpl(""); 1.98 TagletWriter.genTagOuput(configuration().tagletManager, field, 1.99 configuration().tagletManager.getCustomTags(field), 1.100 writer.getTagletWriterInstance(false), output); 1.101 - if (output.toString().length() > 0) { 1.102 - print(output.toString()); 1.103 + String outputString = output.toString().trim(); 1.104 + if (!outputString.isEmpty()) { 1.105 + writer.printMemberDetailsListStartTag(); 1.106 + writer.dd(); 1.107 + writer.dl(); 1.108 + print(outputString); 1.109 + writer.dlEnd(); 1.110 + writer.ddEnd(); 1.111 } 1.112 - writer.dlEnd(); 1.113 - } 1.114 - public void writeMemberFooter(FieldDoc member) { 1.115 - writer.dlEnd(); 1.116 } 1.117 1.118 /** 1.119 - * Check to see if member details should be printed. If 1.120 + * Check to see if overview details should be printed. If 1.121 * nocomment option set or if there is no text to be printed 1.122 - * for deprecation info, inline comment, no serial tag or inline tags, 1.123 - * do not print member details. 1.124 + * for deprecation info, comment or tags, do not print overview details. 1.125 + * 1.126 + * @param field the field to check overview details for. 1.127 + * @return true if overview details need to be printed 1.128 */ 1.129 - public boolean shouldPrintMemberDetails(FieldDoc field) { 1.130 - if (!configuration().nocomment) 1.131 - if((field.inlineTags().length > 0) || 1.132 - (field.tags("serial").length > 0) || (writer.hasTagsToPrint(field))) 1.133 + public boolean shouldPrintOverview(FieldDoc field) { 1.134 + if (!configuration().nocomment) { 1.135 + if(!field.commentText().isEmpty() || 1.136 + writer.hasSerializationOverviewTags(field)) 1.137 return true; 1.138 - if (!Util.isDeprecated(field)) 1.139 + } 1.140 + if (field.tags("deprecated").length > 0) 1.141 return true; 1.142 return false; 1.143 } 1.144 + 1.145 + public void writeMemberFooter() { 1.146 + printMemberFooter(); 1.147 + } 1.148 + 1.149 + /** 1.150 + * Write the footer information. If the serilization overview section was 1.151 + * printed, check for definition list and close list tag. 1.152 + * 1.153 + * @param heading the heading that was written. 1.154 + */ 1.155 + public void writeFooter(String heading) { 1.156 + if (printedOverallAnchor) { 1.157 + if (heading.equals( 1.158 + configuration().getText("doclet.Serialized_Form_class"))) { 1.159 + writer.printMemberDetailsListEndTag(); 1.160 + assert !writer.getMemberDetailsListPrinted(); 1.161 + } 1.162 + } 1.163 + } 1.164 }