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

changeset 766
90af8d87741f
parent 554
9d9f26857129
child 798
4868a36f6fd8
equal deleted inserted replaced
758:bcbc86cc5b31 766:90af8d87741f
23 * questions. 23 * 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.*;
28 import java.lang.reflect.Modifier; 29 import java.lang.reflect.Modifier;
29 import java.util.*;
30
31 import com.sun.javadoc.*; 30 import com.sun.javadoc.*;
31 import com.sun.tools.doclets.formats.html.markup.*;
32 import com.sun.tools.doclets.internal.toolkit.*;
32 import com.sun.tools.doclets.internal.toolkit.util.*; 33 import com.sun.tools.doclets.internal.toolkit.util.*;
33 import com.sun.tools.doclets.internal.toolkit.taglets.*; 34 import com.sun.tools.doclets.internal.toolkit.taglets.*;
34 35
35 /** 36 /**
36 * The base class for member writers. 37 * The base class for member writers.
58 this(writer, null); 59 this(writer, null);
59 } 60 }
60 61
61 /*** abstracts ***/ 62 /*** abstracts ***/
62 63
63 public abstract void printSummaryLabel(); 64 /**
64 65 * Add the summary label for the member.
65 public abstract void printTableSummary(); 66 *
66 67 * @param memberTree the content tree to which the label will be added
67 public abstract void printSummaryTableHeader(ProgramElementDoc member); 68 */
68 69 public abstract void addSummaryLabel(Content memberTree);
69 public abstract void printInheritedSummaryLabel(ClassDoc cd); 70
70 71 /**
71 public abstract void printSummaryAnchor(ClassDoc cd); 72 * Get the summary for the member summary table.
72 73 *
73 public abstract void printInheritedSummaryAnchor(ClassDoc cd); 74 * @return a string for the table summary
74 75 */
75 protected abstract void printSummaryType(ProgramElementDoc member); 76 public abstract String getTableSummary();
76 77
77 protected void writeSummaryLink(ClassDoc cd, ProgramElementDoc member) { 78 /**
78 writeSummaryLink(LinkInfoImpl.CONTEXT_MEMBER, cd, member); 79 * Get the caption for the member summary table.
79 } 80 *
80 81 * @return a string for the table caption
81 protected abstract void writeSummaryLink(int context, 82 */
82 ClassDoc cd, 83 public abstract String getCaption();
83 ProgramElementDoc member); 84
84 85 /**
85 protected abstract void writeInheritedSummaryLink(ClassDoc cd, 86 * Get the summary table header for the member.
86 ProgramElementDoc member); 87 *
87 88 * @param member the member to be documented
88 protected abstract void writeDeprecatedLink(ProgramElementDoc member); 89 * @return the summary table header
89 90 */
90 protected abstract void printNavSummaryLink(ClassDoc cd, boolean link); 91 public abstract String[] getSummaryTableHeader(ProgramElementDoc member);
91 92
92 protected abstract void printNavDetailLink(boolean link); 93 /**
94 * Add inherited summary lable for the member.
95 *
96 * @param cd the class doc to which to link to
97 * @param inheritedTree the content tree to which the inherited summary label will be added
98 */
99 public abstract void addInheritedSummaryLabel(ClassDoc cd, Content inheritedTree);
100
101 /**
102 * Add the anchor for the summary section of the member.
103 *
104 * @param cd the class doc to be documented
105 * @param memberTree the content tree to which the summary anchor will be added
106 */
107 public abstract void addSummaryAnchor(ClassDoc cd, Content memberTree);
108
109 /**
110 * Add the anchor for the inherited summary section of the member.
111 *
112 * @param cd the class doc to be documented
113 * @param inheritedTree the content tree to which the inherited summary anchor will be added
114 */
115 public abstract void addInheritedSummaryAnchor(ClassDoc cd, Content inheritedTree);
116
117 /**
118 * Add the summary type for the member.
119 *
120 * @param member the member to be documented
121 * @param tdSummaryType the content tree to which the type will be added
122 */
123 protected abstract void addSummaryType(ProgramElementDoc member,
124 Content tdSummaryType);
125
126 /**
127 * Add the summary link for the member.
128 *
129 * @param cd the class doc to be documented
130 * @param member the member to be documented
131 * @param tdSummary the content tree to which the link will be added
132 */
133 protected void addSummaryLink(ClassDoc cd, ProgramElementDoc member,
134 Content tdSummary) {
135 addSummaryLink(LinkInfoImpl.CONTEXT_MEMBER, cd, member, tdSummary);
136 }
137
138 /**
139 * Add the summary link for the member.
140 *
141 * @param context the id of the context where the link will be printed
142 * @param cd the class doc to be documented
143 * @param member the member to be documented
144 * @param tdSummary the content tree to which the summary link will be added
145 */
146 protected abstract void addSummaryLink(int context,
147 ClassDoc cd, ProgramElementDoc member, Content tdSummary);
148
149 /**
150 * Add the inherited summary link for the member.
151 *
152 * @param cd the class doc to be documented
153 * @param member the member to be documented
154 * @param linksTree the content tree to which the inherited summary link will be added
155 */
156 protected abstract void addInheritedSummaryLink(ClassDoc cd,
157 ProgramElementDoc member, Content linksTree);
158
159 /**
160 * Get the deprecated link.
161 *
162 * @param member the member being linked to
163 * @return a content tree representing the link
164 */
165 protected abstract Content getDeprecatedLink(ProgramElementDoc member);
166
167 /**
168 * Get the navigation summary link.
169 *
170 * @param cd the class doc to be documented
171 * @param link true if its a link else the label to be printed
172 * @return a content tree for the navigation summary link.
173 */
174 protected abstract Content getNavSummaryLink(ClassDoc cd, boolean link);
175
176 /**
177 * Add the navigation detail link.
178 *
179 * @param link true if its a link else the label to be printed
180 * @param liNav the content tree to which the navigation detail link will be added
181 */
182 protected abstract void addNavDetailLink(boolean link, Content liNav);
93 183
94 /*** ***/ 184 /*** ***/
95 185
96 protected void print(String str) { 186 protected void print(String str) {
97 writer.print(str); 187 writer.print(str);
104 } 194 }
105 195
106 protected void strong(String str) { 196 protected void strong(String str) {
107 writer.strong(str); 197 writer.strong(str);
108 writer.displayLength += str.length(); 198 writer.displayLength += str.length();
199 }
200
201 /**
202 * Add the member name to the content tree and modifies the display length.
203 *
204 * @param name the member name to be added to the content tree.
205 * @param htmltree the content tree to which the name will be added.
206 */
207 protected void addName(String name, Content htmltree) {
208 htmltree.addContent(name);
209 writer.displayLength += name.length();
109 } 210 }
110 211
111 /** 212 /**
112 * Return a string describing the access modifier flags. 213 * Return a string describing the access modifier flags.
113 * Don't include native or synchronized. 214 * Don't include native or synchronized.
129 type = ((FieldDoc)member).type().toString(); 230 type = ((FieldDoc)member).type().toString();
130 } 231 }
131 return type; 232 return type;
132 } 233 }
133 234
134 protected void printModifiers(MemberDoc member) { 235 /**
236 * Add the modifier for the member.
237 *
238 * @param member the member for which teh modifier will be added.
239 * @param htmltree the content tree to which the modifier information will be added.
240 */
241 protected void addModifiers(MemberDoc member, Content htmltree) {
135 String mod = modifierString(member); 242 String mod = modifierString(member);
136 // According to JLS, we should not be showing public modifier for 243 // According to JLS, we should not be showing public modifier for
137 // interface methods. 244 // interface methods.
138 if ((member.isField() || member.isMethod()) && 245 if ((member.isField() || member.isMethod()) &&
139 writer instanceof ClassWriterImpl && 246 writer instanceof ClassWriterImpl &&
140 ((ClassWriterImpl) writer).getClassDoc().isInterface()) { 247 ((ClassWriterImpl) writer).getClassDoc().isInterface()) {
141 mod = Util.replaceText(mod, "public", "").trim(); 248 mod = Util.replaceText(mod, "public", "").trim();
142 } 249 }
143 if(mod.length() > 0) { 250 if(mod.length() > 0) {
144 print(mod); 251 htmltree.addContent(mod);
145 print(' '); 252 htmltree.addContent(writer.getSpace());
146 } 253 }
147 } 254 }
148 255
149 protected String makeSpace(int len) { 256 protected String makeSpace(int len) {
150 if (len <= 0) { 257 if (len <= 0) {
156 } 263 }
157 return sb.toString(); 264 return sb.toString();
158 } 265 }
159 266
160 /** 267 /**
161 * Print 'static' if static and type link. 268 * Add the modifier and type for the member in the member summary.
162 */ 269 *
163 protected void printStaticAndType(boolean isStatic, Type type) { 270 * @param member the member to add the type for
164 writer.printTypeSummaryHeader(); 271 * @param type the type to add
165 if (isStatic) { 272 * @param tdSummaryType the content tree to which the modified and type will be added
166 print("static"); 273 */
167 } 274 protected void addModifierAndType(ProgramElementDoc member, Type type,
168 writer.space(); 275 Content tdSummaryType) {
169 if (type != null) { 276 HtmlTree code = new HtmlTree(HtmlTag.CODE);
170 writer.printLink(new LinkInfoImpl(LinkInfoImpl.CONTEXT_MEMBER, 277 addModifier(member, code);
171 type));
172 }
173 writer.printTypeSummaryFooter();
174 }
175
176 /**
177 * Print the modifier and type for the member in the member summary.
178 *
179 * @param member the member to print the type for.
180 * @param type the type to print.
181 */
182 protected void printModifierAndType(ProgramElementDoc member, Type type) {
183 writer.printTypeSummaryHeader();
184 printModifier(member);
185 if (type == null) { 278 if (type == null) {
186 writer.space();
187 if (member.isClass()) { 279 if (member.isClass()) {
188 print("class"); 280 code.addContent("class");
189 } else { 281 } else {
190 print("interface"); 282 code.addContent("interface");
191 } 283 }
284 code.addContent(writer.getSpace());
192 } else { 285 } else {
193 if (member instanceof ExecutableMemberDoc && 286 if (member instanceof ExecutableMemberDoc &&
194 ((ExecutableMemberDoc) member).typeParameters().length > 0) { 287 ((ExecutableMemberDoc) member).typeParameters().length > 0) {
195 //Code to avoid ugly wrapping in member summary table. 288 //Code to avoid ugly wrapping in member summary table.
196 writer.table(0,0,0); 289 int displayLength = ((AbstractExecutableMemberWriter) this).addTypeParameters(
197 writer.trAlignVAlign("right", ""); 290 (ExecutableMemberDoc) member, code);
198 writer.tdNowrap();
199 writer.font("-1");
200 writer.code();
201 int displayLength = ((AbstractExecutableMemberWriter) this).
202 writeTypeParameters((ExecutableMemberDoc) member);
203 if (displayLength > 10) { 291 if (displayLength > 10) {
204 writer.br(); 292 code.addContent(new HtmlTree(HtmlTag.BR));
205 } 293 }
206 writer.printLink(new LinkInfoImpl( 294 code.addContent(new RawHtml(
207 LinkInfoImpl.CONTEXT_SUMMARY_RETURN_TYPE, type)); 295 writer.getLink(new LinkInfoImpl(
208 writer.codeEnd(); 296 LinkInfoImpl.CONTEXT_SUMMARY_RETURN_TYPE, type))));
209 writer.fontEnd();
210 writer.tdEnd();
211 writer.trEnd();
212 writer.tableEnd();
213 } else { 297 } else {
214 writer.space(); 298 code.addContent(new RawHtml(
215 writer.printLink(new LinkInfoImpl( 299 writer.getLink(new LinkInfoImpl(
216 LinkInfoImpl.CONTEXT_SUMMARY_RETURN_TYPE, type)); 300 LinkInfoImpl.CONTEXT_SUMMARY_RETURN_TYPE, type))));
217 } 301 }
218 302
219 } 303 }
220 writer.printTypeSummaryFooter(); 304 tdSummaryType.addContent(code);
221 } 305 }
222 306
223 private void printModifier(ProgramElementDoc member) { 307 private void printModifier(ProgramElementDoc member) {
224 if (member.isProtected()) { 308 if (member.isProtected()) {
225 print("protected "); 309 print("protected ");
236 print("static"); 320 print("static");
237 } 321 }
238 } 322 }
239 323
240 /** 324 /**
241 * Print the deprecated output for the given member. 325 * Add the modifier for the member.
326 *
327 * @param member the member to add the type for
328 * @param code the content tree to which the modified will be added
329 */
330 private void addModifier(ProgramElementDoc member, Content code) {
331 if (member.isProtected()) {
332 code.addContent("protected ");
333 } else if (member.isPrivate()) {
334 code.addContent("private ");
335 } else if (!member.isPublic()) { // Package private
336 code.addContent(configuration().getText("doclet.Package_private"));
337 code.addContent(" ");
338 }
339 if (member.isMethod() && ((MethodDoc)member).isAbstract()) {
340 code.addContent("abstract ");
341 }
342 if (member.isStatic()) {
343 code.addContent("static ");
344 }
345 }
346
347 /**
348 * Add the deprecated information for the given member.
242 * 349 *
243 * @param member the member being documented. 350 * @param member the member being documented.
244 */ 351 * @param contentTree the content tree to which the deprecated information will be added.
245 protected void printDeprecated(ProgramElementDoc member) { 352 */
353 protected void addDeprecatedInfo(ProgramElementDoc member, Content contentTree) {
246 String output = (new DeprecatedTaglet()).getTagletOutput(member, 354 String output = (new DeprecatedTaglet()).getTagletOutput(member,
247 writer.getTagletWriterInstance(false)).toString().trim(); 355 writer.getTagletWriterInstance(false)).toString().trim();
248 if (!output.isEmpty()) { 356 if (!output.isEmpty()) {
249 writer.printMemberDetailsListStartTag(); 357 Content deprecatedContent = new RawHtml(output);
250 writer.print(output); 358 Content div = HtmlTree.DIV(HtmlStyle.block, deprecatedContent);
251 } 359 contentTree.addContent(div);
252 } 360 }
253 361 }
254 protected void printComment(ProgramElementDoc member) { 362
363 /**
364 * Add the comment for the given member.
365 *
366 * @param member the member being documented.
367 * @param contentTree the content tree to which the comment will be added.
368 */
369 protected void addComment(ProgramElementDoc member, Content htmltree) {
255 if (member.inlineTags().length > 0) { 370 if (member.inlineTags().length > 0) {
256 writer.printMemberDetailsListStartTag(); 371 writer.addInlineComment(member, htmltree);
257 writer.dd();
258 writer.printInlineComment(member);
259 writer.ddEnd();
260 } 372 }
261 } 373 }
262 374
263 protected String name(ProgramElementDoc member) { 375 protected String name(ProgramElementDoc member) {
264 return member.name(); 376 return member.name();
265 } 377 }
266 378
267 protected void printHead(MemberDoc member) { 379 /**
268 writer.h3(); 380 * Get the header for the section.
269 writer.print(member.name()); 381 *
270 writer.h3End(); 382 * @param member the member being documented.
271 } 383 * @return a header content for the section.
272 384 */
273 protected void printFullComment(ProgramElementDoc member) { 385 protected Content getHead(MemberDoc member) {
274 if(configuration().nocomment){ 386 Content memberContent = new RawHtml(member.name());
275 return; 387 Content heading = HtmlTree.HEADING(HtmlConstants.MEMBER_HEADING, memberContent);
276 } 388 return heading;
277 writer.dl(); 389 }
278 print(((TagletOutputImpl) 390
279 (new DeprecatedTaglet()).getTagletOutput(member, 391 /**
280 writer.getTagletWriterInstance(false))).toString());
281 printCommentAndTags(member);
282 writer.dlEnd();
283 }
284
285 protected void printCommentAndTags(ProgramElementDoc member) {
286 printComment(member);
287 writer.printTags(member);
288 }
289
290 /**
291 * Write the member footer.
292 */
293 protected void printMemberFooter() {
294 writer.printMemberDetailsListEndTag();
295 assert !writer.getMemberDetailsListPrinted();
296 }
297
298 /**
299 * Forward to containing writer
300 */
301 public void printSummaryHeader(ClassDoc cd) {
302 printedSummaryHeader = true;
303 writer.printSummaryHeader(this, cd);
304 }
305
306 /**
307 * Forward to containing writer
308 */
309 public void printInheritedSummaryHeader(ClassDoc cd) {
310 writer.printInheritedSummaryHeader(this, cd);
311 }
312
313 /**
314 * Forward to containing writer
315 */
316 public void printInheritedSummaryFooter(ClassDoc cd) {
317 writer.printInheritedSummaryFooter(this, cd);
318 }
319
320 /**
321 * Forward to containing writer
322 */
323 public void printSummaryFooter(ClassDoc cd) {
324 writer.printSummaryFooter(this, cd);
325 }
326
327 /**
328 * Return true if the given <code>ProgramElement</code> is inherited 392 * Return true if the given <code>ProgramElement</code> is inherited
329 * by the class that is being documented. 393 * by the class that is being documented.
330 * 394 *
331 * @param ped The <code>ProgramElement</code> being checked. 395 * @param ped The <code>ProgramElement</code> being checked.
332 * return true if the <code>ProgramElement</code> is being inherited and 396 * return true if the <code>ProgramElement</code> is being inherited and
338 return false; 402 return false;
339 } 403 }
340 return true; 404 return true;
341 } 405 }
342 406
343 407 /**
344 /** 408 * Add deprecated information to the documentation tree
345 * Generate the code for listing the deprecated APIs. Create the table 409 *
346 * format for listing the API. Call methods from the sub-class to complete 410 * @param deprmembers list of deprecated members
347 * the generation. 411 * @param headingKey the caption for the deprecated members table
348 */ 412 * @param tableSummary the summary for the deprecated members table
349 protected void printDeprecatedAPI(List<Doc> deprmembers, String headingKey, String tableSummary, String[] tableHeader) { 413 * @param tableHeader table headers for the deprecated members table
414 * @param contentTree the content tree to which the deprecated members table will be added
415 */
416 protected void addDeprecatedAPI(List<Doc> deprmembers, String headingKey,
417 String tableSummary, String[] tableHeader, Content contentTree) {
350 if (deprmembers.size() > 0) { 418 if (deprmembers.size() > 0) {
351 writer.tableIndexSummary(tableSummary); 419 Content table = HtmlTree.TABLE(0, 3, 0, tableSummary,
352 writer.tableCaptionStart(); 420 writer.getTableCaption(configuration().getText(headingKey)));
353 writer.printText(headingKey); 421 table.addContent(writer.getSummaryTableHeader(tableHeader, "col"));
354 writer.tableCaptionEnd(); 422 Content tbody = new HtmlTree(HtmlTag.TBODY);
355 writer.summaryTableHeader(tableHeader, "col");
356 for (int i = 0; i < deprmembers.size(); i++) { 423 for (int i = 0; i < deprmembers.size(); i++) {
357 ProgramElementDoc member =(ProgramElementDoc)deprmembers.get(i); 424 ProgramElementDoc member =(ProgramElementDoc)deprmembers.get(i);
358 writer.trBgcolorStyle("white", "TableRowColor"); 425 HtmlTree td = HtmlTree.TD(HtmlStyle.colOne, getDeprecatedLink(member));
359 writer.summaryRow(0);
360 writeDeprecatedLink(member);
361 writer.br();
362 writer.printNbsps();
363 if (member.tags("deprecated").length > 0) 426 if (member.tags("deprecated").length > 0)
364 writer.printInlineDeprecatedComment(member, member.tags("deprecated")[0]); 427 writer.addInlineDeprecatedComment(member,
365 writer.space(); 428 member.tags("deprecated")[0], td);
366 writer.summaryRowEnd(); 429 HtmlTree tr = HtmlTree.TR(td);
367 writer.trEnd(); 430 if (i%2 == 0)
431 tr.addStyle(HtmlStyle.altColor);
432 else
433 tr.addStyle(HtmlStyle.rowColor);
434 tbody.addContent(tr);
368 } 435 }
369 writer.tableEnd(); 436 table.addContent(tbody);
370 writer.space(); 437 Content li = HtmlTree.LI(HtmlStyle.blockList, table);
371 writer.p(); 438 Content ul = HtmlTree.UL(HtmlStyle.blockList, li);
372 } 439 contentTree.addContent(ul);
373 } 440 }
374 441 }
375 /** 442
376 * Print use info. 443 /**
377 */ 444 * Add use information to the documentation tree.
378 protected void printUseInfo(List<? extends ProgramElementDoc> mems, String heading, String tableSummary) { 445 *
446 * @param mems list of program elements for which the use information will be added
447 * @param heading the section heading
448 * @param tableSummary the summary for the use table
449 * @param contentTree the content tree to which the use information will be added
450 */
451 protected void addUseInfo(List<? extends ProgramElementDoc> mems,
452 String heading, String tableSummary, Content contentTree) {
379 if (mems == null) { 453 if (mems == null) {
380 return; 454 return;
381 } 455 }
382 List<? extends ProgramElementDoc> members = mems; 456 List<? extends ProgramElementDoc> members = mems;
383 boolean printedUseTableHeader = false; 457 boolean printedUseTableHeader = false;
384 if (members.size() > 0) { 458 if (members.size() > 0) {
385 writer.tableIndexSummary(tableSummary); 459 Content table = HtmlTree.TABLE(0, 3, 0, tableSummary,
386 writer.tableSubCaptionStart(); 460 writer.getTableCaption(heading));
387 writer.print(heading); 461 Content tbody = new HtmlTree(HtmlTag.TBODY);
388 writer.tableCaptionEnd(); 462 Iterator<? extends ProgramElementDoc> it = members.iterator();
389 for (Iterator<? extends ProgramElementDoc> it = members.iterator(); it.hasNext(); ) { 463 for (int i = 0; it.hasNext(); i++) {
390 ProgramElementDoc pgmdoc = it.next(); 464 ProgramElementDoc pgmdoc = it.next();
391 ClassDoc cd = pgmdoc.containingClass(); 465 ClassDoc cd = pgmdoc.containingClass();
392 if (!printedUseTableHeader) { 466 if (!printedUseTableHeader) {
393 // Passing ProgramElementDoc helps decides printing 467 table.addContent(writer.getSummaryTableHeader(
394 // interface or class header in case of nested classes. 468 this.getSummaryTableHeader(pgmdoc), "col"));
395 this.printSummaryTableHeader(pgmdoc);
396 printedUseTableHeader = true; 469 printedUseTableHeader = true;
397 } 470 }
398 471 HtmlTree tr = new HtmlTree(HtmlTag.TR);
399 writer.printSummaryLinkType(this, pgmdoc); 472 if (i % 2 == 0) {
473 tr.addStyle(HtmlStyle.altColor);
474 } else {
475 tr.addStyle(HtmlStyle.rowColor);
476 }
477 HtmlTree tdFirst = new HtmlTree(HtmlTag.TD);
478 tdFirst.addStyle(HtmlStyle.colFirst);
479 writer.addSummaryType(this, pgmdoc, tdFirst);
480 tr.addContent(tdFirst);
481 HtmlTree tdLast = new HtmlTree(HtmlTag.TD);
482 tdLast.addStyle(HtmlStyle.colLast);
400 if (cd != null && !(pgmdoc instanceof ConstructorDoc) 483 if (cd != null && !(pgmdoc instanceof ConstructorDoc)
401 && !(pgmdoc instanceof ClassDoc)) { 484 && !(pgmdoc instanceof ClassDoc)) {
402 // Add class context 485 HtmlTree name = new HtmlTree(HtmlTag.SPAN);
403 writer.strong(cd.name() + "."); 486 name.addStyle(HtmlStyle.strong);
487 name.addContent(cd.name() + ".");
488 tdLast.addContent(name);
404 } 489 }
405 writeSummaryLink( 490 addSummaryLink(pgmdoc instanceof ClassDoc ?
406 pgmdoc instanceof ClassDoc ? 491 LinkInfoImpl.CONTEXT_CLASS_USE : LinkInfoImpl.CONTEXT_MEMBER,
407 LinkInfoImpl.CONTEXT_CLASS_USE : LinkInfoImpl.CONTEXT_MEMBER, 492 cd, pgmdoc, tdLast);
408 cd, pgmdoc); 493 writer.addSummaryLinkComment(this, pgmdoc, tdLast);
409 writer.printSummaryLinkComment(this, pgmdoc); 494 tr.addContent(tdLast);
495 tbody.addContent(tr);
410 } 496 }
411 writer.tableEnd(); 497 table.addContent(tbody);
412 writer.space(); 498 contentTree.addContent(table);
413 writer.p(); 499 }
414 } 500 }
415 } 501
416 502 /**
417 protected void navDetailLink(List<?> members) { 503 * Add the navigation detail link.
418 printNavDetailLink(members.size() > 0? true: false); 504 *
419 } 505 * @param members the members to be linked
420 506 * @param liNav the content tree to which the navigation detail link will be added
421 507 */
422 protected void navSummaryLink(List<?> members, 508 protected void addNavDetailLink(List<?> members, Content liNav) {
423 VisibleMemberMap visibleMemberMap) { 509 addNavDetailLink(members.size() > 0 ? true : false, liNav);
510 }
511
512 /**
513 * Add the navigation summary link.
514 *
515 * @param members members to be linked
516 * @param visibleMemberMap the visible inherited members map
517 * @param liNav the content tree to which the navigation summary link will be added
518 */
519 protected void addNavSummaryLink(List<?> members,
520 VisibleMemberMap visibleMemberMap, Content liNav) {
424 if (members.size() > 0) { 521 if (members.size() > 0) {
425 printNavSummaryLink(null, true); 522 liNav.addContent(getNavSummaryLink(null, true));
426 return; 523 return;
427 } else { 524 }
428 ClassDoc icd = classdoc.superclass(); 525 ClassDoc icd = classdoc.superclass();
429 while (icd != null) { 526 while (icd != null) {
430 List<?> inhmembers = visibleMemberMap.getMembersFor(icd); 527 List<?> inhmembers = visibleMemberMap.getMembersFor(icd);
431 if (inhmembers.size() > 0) { 528 if (inhmembers.size() > 0) {
432 printNavSummaryLink(icd, true); 529 liNav.addContent(getNavSummaryLink(icd, true));
433 return; 530 return;
434 }
435 icd = icd.superclass();
436 } 531 }
437 } 532 icd = icd.superclass();
438 printNavSummaryLink(null, false); 533 }
534 liNav.addContent(getNavSummaryLink(null, false));
439 } 535 }
440 536
441 protected void serialWarning(SourcePosition pos, String key, String a1, String a2) { 537 protected void serialWarning(SourcePosition pos, String key, String a1, String a2) {
442 if (configuration().serialwarn) { 538 if (configuration().serialwarn) {
443 ConfigurationImpl.getInstance().getDocletSpecificMsg().warning(pos, key, a1, a2); 539 ConfigurationImpl.getInstance().getDocletSpecificMsg().warning(pos, key, a1, a2);
451 public ConfigurationImpl configuration() { 547 public ConfigurationImpl configuration() {
452 return writer.configuration; 548 return writer.configuration;
453 } 549 }
454 550
455 /** 551 /**
456 * {@inheritDoc} 552 * Add the member summary for the given class.
457 */ 553 *
458 public void writeMemberSummary(ClassDoc classDoc, ProgramElementDoc member, 554 * @param classDoc the class that is being documented
459 Tag[] firstSentenceTags, boolean isFirst, boolean isLast) { 555 * @param member the member being documented
460 writer.printSummaryLinkType(this, member); 556 * @param firstSentenceTags the first sentence tags to be added to the summary
461 writeSummaryLink(classDoc, member); 557 * @param tableTree the content tree to which the documentation will be added
462 writer.printSummaryLinkComment(this, member, firstSentenceTags); 558 * @param counter the counter for determing style for the table row
559 */
560 public void addMemberSummary(ClassDoc classDoc, ProgramElementDoc member,
561 Tag[] firstSentenceTags, Content tableTree, int counter) {
562 HtmlTree tdSummaryType = new HtmlTree(HtmlTag.TD);
563 tdSummaryType.addStyle(HtmlStyle.colFirst);
564 writer.addSummaryType(this, member, tdSummaryType);
565 HtmlTree tdSummary = new HtmlTree(HtmlTag.TD);
566 setSummaryColumnStyle(tdSummary);
567 addSummaryLink(classDoc, member, tdSummary);
568 writer.addSummaryLinkComment(this, member, firstSentenceTags, tdSummary);
569 HtmlTree tr = HtmlTree.TR(tdSummaryType);
570 tr.addContent(tdSummary);
571 if (counter%2 == 0)
572 tr.addStyle(HtmlStyle.altColor);
573 else
574 tr.addStyle(HtmlStyle.rowColor);
575 tableTree.addContent(tr);
576 }
577
578 /**
579 * Set the style for the summary column.
580 *
581 * @param tdTree the column for which the style will be set
582 */
583 public void setSummaryColumnStyle(HtmlTree tdTree) {
584 tdTree.addStyle(HtmlStyle.colLast);
585 }
586
587 /**
588 * Add inherited member summary for the given class and member.
589 *
590 * @param classDoc the class the inherited member belongs to
591 * @param nestedClass the inherited member that is summarized
592 * @param isFirst true if this is the first member in the list
593 * @param isLast true if this is the last member in the list
594 * @param linksTree the content tree to which the summary will be added
595 */
596 public void addInheritedMemberSummary(ClassDoc classDoc,
597 ProgramElementDoc nestedClass, boolean isFirst, boolean isLast,
598 Content linksTree) {
599 writer.addInheritedMemberSummary(this, classDoc, nestedClass, isFirst,
600 linksTree);
601 }
602
603 /**
604 * Get the inherited summary header for the given class.
605 *
606 * @param classDoc the class the inherited member belongs to
607 * @return a content tree for the inherited summary header
608 */
609 public Content getInheritedSummaryHeader(ClassDoc classDoc) {
610 Content inheritedTree = writer.getMemberTreeHeader();
611 writer.addInheritedSummaryHeader(this, classDoc, inheritedTree);
612 return inheritedTree;
613 }
614
615 /**
616 * Get the inherited summary links tree.
617 *
618 * @return a content tree for the inherited summary links
619 */
620 public Content getInheritedSummaryLinksTree() {
621 return new HtmlTree(HtmlTag.CODE);
622 }
623
624 /**
625 * Get the summary table tree for the given class.
626 *
627 * @param classDoc the class for which the summary table is generated
628 * @return a content tree for the summary table
629 */
630 public Content getSummaryTableTree(ClassDoc classDoc) {
631 return writer.getSummaryTableTree(this, classDoc);
632 }
633
634 /**
635 * Get the member tree to be documented.
636 *
637 * @param memberTree the content tree of member to be documented
638 * @return a content tree that will be added to the class documentation
639 */
640 public Content getMemberTree(Content memberTree) {
641 return writer.getMemberTree(memberTree);
642 }
643
644 /**
645 * Get the member tree to be documented.
646 *
647 * @param memberTree the content tree of member to be documented
648 * @param isLastContent true if the content to be added is the last content
649 * @return a content tree that will be added to the class documentation
650 */
651 public Content getMemberTree(Content memberTree, boolean isLastContent) {
652 if (isLastContent)
653 return HtmlTree.UL(HtmlStyle.blockListLast, memberTree);
654 else
655 return HtmlTree.UL(HtmlStyle.blockList, memberTree);
463 } 656 }
464 } 657 }

mercurial