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

changeset 240
8c55d5b0ed71
parent 229
03bcd66bd8e7
parent 233
5240b1120530
child 554
9d9f26857129
equal deleted inserted replaced
230:2c0076945b1a 240:8c55d5b0ed71
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 java.util.*;
29
30 import com.sun.javadoc.*;
28 import com.sun.tools.doclets.internal.toolkit.*; 31 import com.sun.tools.doclets.internal.toolkit.*;
29 import com.sun.tools.doclets.internal.toolkit.taglets.*; 32 import com.sun.tools.doclets.internal.toolkit.taglets.*;
30 import com.sun.tools.doclets.internal.toolkit.util.*; 33 import com.sun.tools.doclets.internal.toolkit.util.*;
31 import com.sun.javadoc.*;
32 import java.util.*;
33 34
34 /** 35 /**
35 * Generate serialized form for serializable fields. 36 * Generate serialized form for serializable fields.
36 * Documentation denoted by the tags <code>serial</code> and 37 * Documentation denoted by the tags <code>serial</code> and
37 * <code>serialField</code> is processed. 38 * <code>serialField</code> is processed.
38 * 39 *
39 * @author Joe Fialli 40 * @author Joe Fialli
41 * @author Bhavesh Patel (Modified)
40 */ 42 */
41 public class HtmlSerialFieldWriter extends FieldWriterImpl 43 public class HtmlSerialFieldWriter extends FieldWriterImpl
42 implements SerializedFormWriter.SerialFieldWriter { 44 implements SerializedFormWriter.SerialFieldWriter {
43 ProgramElementDoc[] members = null; 45 ProgramElementDoc[] members = null;
44 46
73 printedOverallAnchor = true; 75 printedOverallAnchor = true;
74 writer.printTableHeadingBackground(heading); 76 writer.printTableHeadingBackground(heading);
75 writer.println(); 77 writer.println();
76 if (heading.equals( 78 if (heading.equals(
77 configuration().getText("doclet.Serialized_Form_class"))) { 79 configuration().getText("doclet.Serialized_Form_class"))) {
78 writer.dl(); 80 assert !writer.getMemberDetailsListPrinted();
79 } 81 }
80 } else { 82 } else {
81 writer.printTableHeadingBackground(heading); 83 writer.printTableHeadingBackground(heading);
82 writer.println(); 84 writer.println();
83 } 85 }
100 fieldType)); 102 fieldType));
101 } 103 }
102 print(fieldDimensions + ' '); 104 print(fieldDimensions + ' ');
103 strong(fieldName); 105 strong(fieldName);
104 writer.preEnd(); 106 writer.preEnd();
105 writer.dl(); 107 assert !writer.getMemberDetailsListPrinted();
106 } 108 }
107 109
108 /** 110 /**
109 * Write the deprecated information for this member. 111 * Write the deprecated information for this member.
110 * 112 *
111 * @param field the field to document. 113 * @param field the field to document.
112 */ 114 */
113 public void writeMemberDeprecatedInfo(FieldDoc field) { 115 public void writeMemberDeprecatedInfo(FieldDoc field) {
114 print(((TagletOutputImpl) 116 printDeprecated(field);
115 (new DeprecatedTaglet()).getTagletOutput(field,
116 writer.getTagletWriterInstance(false))).toString());
117 } 117 }
118 118
119 /** 119 /**
120 * Write the description text for this member. 120 * Write the description text for this member.
121 * 121 *
122 * @param field the field to document. 122 * @param field the field to document.
123 */ 123 */
124 public void writeMemberDescription(FieldDoc field) { 124 public void writeMemberDescription(FieldDoc field) {
125 if (field.inlineTags().length > 0) { 125 if (field.inlineTags().length > 0) {
126 writer.printMemberDetailsListStartTag();
126 writer.dd(); 127 writer.dd();
127 writer.printInlineComment(field); 128 writer.printInlineComment(field);
129 writer.ddEnd();
128 } 130 }
129 Tag[] tags = field.tags("serial"); 131 Tag[] tags = field.tags("serial");
130 if (tags.length > 0) { 132 if (tags.length > 0) {
131 writer.dt(); 133 writer.printMemberDetailsListStartTag();
132 writer.dd(); 134 writer.dd();
133 writer.printInlineComment(field, tags[0]); 135 writer.printInlineComment(field, tags[0]);
136 writer.ddEnd();
134 } 137 }
135 } 138 }
136 139
137 /** 140 /**
138 * Write the description text for this member represented by the tag. 141 * Write the description text for this member represented by the tag.
139 * 142 *
140 * @param serialFieldTag the field to document (represented by tag). 143 * @param serialFieldTag the field to document (represented by tag).
141 */ 144 */
142 public void writeMemberDescription(SerialFieldTag serialFieldTag) { 145 public void writeMemberDescription(SerialFieldTag serialFieldTag) {
143 writer.dd(); 146 String serialFieldTagDesc = serialFieldTag.description().trim();
144 writer.print(serialFieldTag.description()); 147 if (!serialFieldTagDesc.isEmpty()) {
145 writer.dlEnd(); 148 writer.dl();
149 writer.dd();
150 writer.print(serialFieldTagDesc);
151 writer.ddEnd();
152 writer.dlEnd();
153 }
146 } 154 }
147 155
148 /** 156 /**
149 * Write the tag information for this member. 157 * Write the tag information for this member.
150 * 158 *
151 * @param field the field to document. 159 * @param field the field to document.
152 */ 160 */
153 public void writeMemberTags(FieldDoc field) { 161 public void writeMemberTags(FieldDoc field) {
154 writer.dl();
155 TagletOutputImpl output = new TagletOutputImpl(""); 162 TagletOutputImpl output = new TagletOutputImpl("");
156 TagletWriter.genTagOuput(configuration().tagletManager, field, 163 TagletWriter.genTagOuput(configuration().tagletManager, field,
157 configuration().tagletManager.getCustomTags(field), 164 configuration().tagletManager.getCustomTags(field),
158 writer.getTagletWriterInstance(false), output); 165 writer.getTagletWriterInstance(false), output);
159 if (output.toString().length() > 0) { 166 String outputString = output.toString().trim();
160 print(output.toString()); 167 if (!outputString.isEmpty()) {
161 } 168 writer.printMemberDetailsListStartTag();
162 writer.dlEnd(); 169 writer.dd();
163 } 170 writer.dl();
164 public void writeMemberFooter(FieldDoc member) { 171 print(outputString);
165 writer.dlEnd(); 172 writer.dlEnd();
166 } 173 writer.ddEnd();
167 174 }
168 /** 175 }
169 * Check to see if member details should be printed. If 176
177 /**
178 * Check to see if overview details should be printed. If
170 * nocomment option set or if there is no text to be printed 179 * nocomment option set or if there is no text to be printed
171 * for deprecation info, inline comment, no serial tag or inline tags, 180 * for deprecation info, comment or tags, do not print overview details.
172 * do not print member details. 181 *
173 */ 182 * @param field the field to check overview details for.
174 public boolean shouldPrintMemberDetails(FieldDoc field) { 183 * @return true if overview details need to be printed
175 if (!configuration().nocomment) 184 */
176 if((field.inlineTags().length > 0) || 185 public boolean shouldPrintOverview(FieldDoc field) {
177 (field.tags("serial").length > 0) || (writer.hasTagsToPrint(field))) 186 if (!configuration().nocomment) {
187 if(!field.commentText().isEmpty() ||
188 writer.hasSerializationOverviewTags(field))
178 return true; 189 return true;
179 if (!Util.isDeprecated(field)) 190 }
191 if (field.tags("deprecated").length > 0)
180 return true; 192 return true;
181 return false; 193 return false;
182 } 194 }
195
196 public void writeMemberFooter() {
197 printMemberFooter();
198 }
199
200 /**
201 * Write the footer information. If the serilization overview section was
202 * printed, check for definition list and close list tag.
203 *
204 * @param heading the heading that was written.
205 */
206 public void writeFooter(String heading) {
207 if (printedOverallAnchor) {
208 if (heading.equals(
209 configuration().getText("doclet.Serialized_Form_class"))) {
210 writer.printMemberDetailsListEndTag();
211 assert !writer.getMemberDetailsListPrinted();
212 }
213 }
214 }
183 } 215 }

mercurial