1.1 --- a/src/share/classes/com/sun/tools/doclets/formats/html/AbstractMemberWriter.java Tue Nov 30 09:38:48 2010 -0800 1.2 +++ b/src/share/classes/com/sun/tools/doclets/formats/html/AbstractMemberWriter.java Wed Dec 01 11:02:38 2010 -0800 1.3 @@ -25,10 +25,11 @@ 1.4 1.5 package com.sun.tools.doclets.formats.html; 1.6 1.7 +import java.util.*; 1.8 import java.lang.reflect.Modifier; 1.9 -import java.util.*; 1.10 - 1.11 import com.sun.javadoc.*; 1.12 +import com.sun.tools.doclets.formats.html.markup.*; 1.13 +import com.sun.tools.doclets.internal.toolkit.*; 1.14 import com.sun.tools.doclets.internal.toolkit.util.*; 1.15 import com.sun.tools.doclets.internal.toolkit.taglets.*; 1.16 1.17 @@ -60,36 +61,125 @@ 1.18 1.19 /*** abstracts ***/ 1.20 1.21 - public abstract void printSummaryLabel(); 1.22 + /** 1.23 + * Add the summary label for the member. 1.24 + * 1.25 + * @param memberTree the content tree to which the label will be added 1.26 + */ 1.27 + public abstract void addSummaryLabel(Content memberTree); 1.28 1.29 - public abstract void printTableSummary(); 1.30 + /** 1.31 + * Get the summary for the member summary table. 1.32 + * 1.33 + * @return a string for the table summary 1.34 + */ 1.35 + public abstract String getTableSummary(); 1.36 1.37 - public abstract void printSummaryTableHeader(ProgramElementDoc member); 1.38 + /** 1.39 + * Get the caption for the member summary table. 1.40 + * 1.41 + * @return a string for the table caption 1.42 + */ 1.43 + public abstract String getCaption(); 1.44 1.45 - public abstract void printInheritedSummaryLabel(ClassDoc cd); 1.46 + /** 1.47 + * Get the summary table header for the member. 1.48 + * 1.49 + * @param member the member to be documented 1.50 + * @return the summary table header 1.51 + */ 1.52 + public abstract String[] getSummaryTableHeader(ProgramElementDoc member); 1.53 1.54 - public abstract void printSummaryAnchor(ClassDoc cd); 1.55 + /** 1.56 + * Add inherited summary lable for the member. 1.57 + * 1.58 + * @param cd the class doc to which to link to 1.59 + * @param inheritedTree the content tree to which the inherited summary label will be added 1.60 + */ 1.61 + public abstract void addInheritedSummaryLabel(ClassDoc cd, Content inheritedTree); 1.62 1.63 - public abstract void printInheritedSummaryAnchor(ClassDoc cd); 1.64 + /** 1.65 + * Add the anchor for the summary section of the member. 1.66 + * 1.67 + * @param cd the class doc to be documented 1.68 + * @param memberTree the content tree to which the summary anchor will be added 1.69 + */ 1.70 + public abstract void addSummaryAnchor(ClassDoc cd, Content memberTree); 1.71 1.72 - protected abstract void printSummaryType(ProgramElementDoc member); 1.73 + /** 1.74 + * Add the anchor for the inherited summary section of the member. 1.75 + * 1.76 + * @param cd the class doc to be documented 1.77 + * @param inheritedTree the content tree to which the inherited summary anchor will be added 1.78 + */ 1.79 + public abstract void addInheritedSummaryAnchor(ClassDoc cd, Content inheritedTree); 1.80 1.81 - protected void writeSummaryLink(ClassDoc cd, ProgramElementDoc member) { 1.82 - writeSummaryLink(LinkInfoImpl.CONTEXT_MEMBER, cd, member); 1.83 + /** 1.84 + * Add the summary type for the member. 1.85 + * 1.86 + * @param member the member to be documented 1.87 + * @param tdSummaryType the content tree to which the type will be added 1.88 + */ 1.89 + protected abstract void addSummaryType(ProgramElementDoc member, 1.90 + Content tdSummaryType); 1.91 + 1.92 + /** 1.93 + * Add the summary link for the member. 1.94 + * 1.95 + * @param cd the class doc to be documented 1.96 + * @param member the member to be documented 1.97 + * @param tdSummary the content tree to which the link will be added 1.98 + */ 1.99 + protected void addSummaryLink(ClassDoc cd, ProgramElementDoc member, 1.100 + Content tdSummary) { 1.101 + addSummaryLink(LinkInfoImpl.CONTEXT_MEMBER, cd, member, tdSummary); 1.102 } 1.103 1.104 - protected abstract void writeSummaryLink(int context, 1.105 - ClassDoc cd, 1.106 - ProgramElementDoc member); 1.107 + /** 1.108 + * Add the summary link for the member. 1.109 + * 1.110 + * @param context the id of the context where the link will be printed 1.111 + * @param cd the class doc to be documented 1.112 + * @param member the member to be documented 1.113 + * @param tdSummary the content tree to which the summary link will be added 1.114 + */ 1.115 + protected abstract void addSummaryLink(int context, 1.116 + ClassDoc cd, ProgramElementDoc member, Content tdSummary); 1.117 1.118 - protected abstract void writeInheritedSummaryLink(ClassDoc cd, 1.119 - ProgramElementDoc member); 1.120 + /** 1.121 + * Add the inherited summary link for the member. 1.122 + * 1.123 + * @param cd the class doc to be documented 1.124 + * @param member the member to be documented 1.125 + * @param linksTree the content tree to which the inherited summary link will be added 1.126 + */ 1.127 + protected abstract void addInheritedSummaryLink(ClassDoc cd, 1.128 + ProgramElementDoc member, Content linksTree); 1.129 1.130 - protected abstract void writeDeprecatedLink(ProgramElementDoc member); 1.131 + /** 1.132 + * Get the deprecated link. 1.133 + * 1.134 + * @param member the member being linked to 1.135 + * @return a content tree representing the link 1.136 + */ 1.137 + protected abstract Content getDeprecatedLink(ProgramElementDoc member); 1.138 1.139 - protected abstract void printNavSummaryLink(ClassDoc cd, boolean link); 1.140 + /** 1.141 + * Get the navigation summary link. 1.142 + * 1.143 + * @param cd the class doc to be documented 1.144 + * @param link true if its a link else the label to be printed 1.145 + * @return a content tree for the navigation summary link. 1.146 + */ 1.147 + protected abstract Content getNavSummaryLink(ClassDoc cd, boolean link); 1.148 1.149 - protected abstract void printNavDetailLink(boolean link); 1.150 + /** 1.151 + * Add the navigation detail link. 1.152 + * 1.153 + * @param link true if its a link else the label to be printed 1.154 + * @param liNav the content tree to which the navigation detail link will be added 1.155 + */ 1.156 + protected abstract void addNavDetailLink(boolean link, Content liNav); 1.157 1.158 /*** ***/ 1.159 1.160 @@ -109,6 +199,17 @@ 1.161 } 1.162 1.163 /** 1.164 + * Add the member name to the content tree and modifies the display length. 1.165 + * 1.166 + * @param name the member name to be added to the content tree. 1.167 + * @param htmltree the content tree to which the name will be added. 1.168 + */ 1.169 + protected void addName(String name, Content htmltree) { 1.170 + htmltree.addContent(name); 1.171 + writer.displayLength += name.length(); 1.172 + } 1.173 + 1.174 + /** 1.175 * Return a string describing the access modifier flags. 1.176 * Don't include native or synchronized. 1.177 * 1.178 @@ -131,18 +232,24 @@ 1.179 return type; 1.180 } 1.181 1.182 - protected void printModifiers(MemberDoc member) { 1.183 + /** 1.184 + * Add the modifier for the member. 1.185 + * 1.186 + * @param member the member for which teh modifier will be added. 1.187 + * @param htmltree the content tree to which the modifier information will be added. 1.188 + */ 1.189 + protected void addModifiers(MemberDoc member, Content htmltree) { 1.190 String mod = modifierString(member); 1.191 // According to JLS, we should not be showing public modifier for 1.192 // interface methods. 1.193 if ((member.isField() || member.isMethod()) && 1.194 writer instanceof ClassWriterImpl && 1.195 - ((ClassWriterImpl) writer).getClassDoc().isInterface()) { 1.196 + ((ClassWriterImpl) writer).getClassDoc().isInterface()) { 1.197 mod = Util.replaceText(mod, "public", "").trim(); 1.198 } 1.199 if(mod.length() > 0) { 1.200 - print(mod); 1.201 - print(' '); 1.202 + htmltree.addContent(mod); 1.203 + htmltree.addContent(writer.getSpace()); 1.204 } 1.205 } 1.206 1.207 @@ -158,66 +265,43 @@ 1.208 } 1.209 1.210 /** 1.211 - * Print 'static' if static and type link. 1.212 + * Add the modifier and type for the member in the member summary. 1.213 + * 1.214 + * @param member the member to add the type for 1.215 + * @param type the type to add 1.216 + * @param tdSummaryType the content tree to which the modified and type will be added 1.217 */ 1.218 - protected void printStaticAndType(boolean isStatic, Type type) { 1.219 - writer.printTypeSummaryHeader(); 1.220 - if (isStatic) { 1.221 - print("static"); 1.222 - } 1.223 - writer.space(); 1.224 - if (type != null) { 1.225 - writer.printLink(new LinkInfoImpl(LinkInfoImpl.CONTEXT_MEMBER, 1.226 - type)); 1.227 - } 1.228 - writer.printTypeSummaryFooter(); 1.229 - } 1.230 - 1.231 - /** 1.232 - * Print the modifier and type for the member in the member summary. 1.233 - * 1.234 - * @param member the member to print the type for. 1.235 - * @param type the type to print. 1.236 - */ 1.237 - protected void printModifierAndType(ProgramElementDoc member, Type type) { 1.238 - writer.printTypeSummaryHeader(); 1.239 - printModifier(member); 1.240 + protected void addModifierAndType(ProgramElementDoc member, Type type, 1.241 + Content tdSummaryType) { 1.242 + HtmlTree code = new HtmlTree(HtmlTag.CODE); 1.243 + addModifier(member, code); 1.244 if (type == null) { 1.245 - writer.space(); 1.246 if (member.isClass()) { 1.247 - print("class"); 1.248 + code.addContent("class"); 1.249 } else { 1.250 - print("interface"); 1.251 + code.addContent("interface"); 1.252 } 1.253 + code.addContent(writer.getSpace()); 1.254 } else { 1.255 if (member instanceof ExecutableMemberDoc && 1.256 ((ExecutableMemberDoc) member).typeParameters().length > 0) { 1.257 //Code to avoid ugly wrapping in member summary table. 1.258 - writer.table(0,0,0); 1.259 - writer.trAlignVAlign("right", ""); 1.260 - writer.tdNowrap(); 1.261 - writer.font("-1"); 1.262 - writer.code(); 1.263 - int displayLength = ((AbstractExecutableMemberWriter) this). 1.264 - writeTypeParameters((ExecutableMemberDoc) member); 1.265 + int displayLength = ((AbstractExecutableMemberWriter) this).addTypeParameters( 1.266 + (ExecutableMemberDoc) member, code); 1.267 if (displayLength > 10) { 1.268 - writer.br(); 1.269 + code.addContent(new HtmlTree(HtmlTag.BR)); 1.270 } 1.271 - writer.printLink(new LinkInfoImpl( 1.272 - LinkInfoImpl.CONTEXT_SUMMARY_RETURN_TYPE, type)); 1.273 - writer.codeEnd(); 1.274 - writer.fontEnd(); 1.275 - writer.tdEnd(); 1.276 - writer.trEnd(); 1.277 - writer.tableEnd(); 1.278 + code.addContent(new RawHtml( 1.279 + writer.getLink(new LinkInfoImpl( 1.280 + LinkInfoImpl.CONTEXT_SUMMARY_RETURN_TYPE, type)))); 1.281 } else { 1.282 - writer.space(); 1.283 - writer.printLink(new LinkInfoImpl( 1.284 - LinkInfoImpl.CONTEXT_SUMMARY_RETURN_TYPE, type)); 1.285 + code.addContent(new RawHtml( 1.286 + writer.getLink(new LinkInfoImpl( 1.287 + LinkInfoImpl.CONTEXT_SUMMARY_RETURN_TYPE, type)))); 1.288 } 1.289 1.290 } 1.291 - writer.printTypeSummaryFooter(); 1.292 + tdSummaryType.addContent(code); 1.293 } 1.294 1.295 private void printModifier(ProgramElementDoc member) { 1.296 @@ -238,25 +322,53 @@ 1.297 } 1.298 1.299 /** 1.300 - * Print the deprecated output for the given member. 1.301 + * Add the modifier for the member. 1.302 + * 1.303 + * @param member the member to add the type for 1.304 + * @param code the content tree to which the modified will be added 1.305 + */ 1.306 + private void addModifier(ProgramElementDoc member, Content code) { 1.307 + if (member.isProtected()) { 1.308 + code.addContent("protected "); 1.309 + } else if (member.isPrivate()) { 1.310 + code.addContent("private "); 1.311 + } else if (!member.isPublic()) { // Package private 1.312 + code.addContent(configuration().getText("doclet.Package_private")); 1.313 + code.addContent(" "); 1.314 + } 1.315 + if (member.isMethod() && ((MethodDoc)member).isAbstract()) { 1.316 + code.addContent("abstract "); 1.317 + } 1.318 + if (member.isStatic()) { 1.319 + code.addContent("static "); 1.320 + } 1.321 + } 1.322 + 1.323 + /** 1.324 + * Add the deprecated information for the given member. 1.325 * 1.326 * @param member the member being documented. 1.327 + * @param contentTree the content tree to which the deprecated information will be added. 1.328 */ 1.329 - protected void printDeprecated(ProgramElementDoc member) { 1.330 + protected void addDeprecatedInfo(ProgramElementDoc member, Content contentTree) { 1.331 String output = (new DeprecatedTaglet()).getTagletOutput(member, 1.332 writer.getTagletWriterInstance(false)).toString().trim(); 1.333 if (!output.isEmpty()) { 1.334 - writer.printMemberDetailsListStartTag(); 1.335 - writer.print(output); 1.336 + Content deprecatedContent = new RawHtml(output); 1.337 + Content div = HtmlTree.DIV(HtmlStyle.block, deprecatedContent); 1.338 + contentTree.addContent(div); 1.339 } 1.340 } 1.341 1.342 - protected void printComment(ProgramElementDoc member) { 1.343 + /** 1.344 + * Add the comment for the given member. 1.345 + * 1.346 + * @param member the member being documented. 1.347 + * @param contentTree the content tree to which the comment will be added. 1.348 + */ 1.349 + protected void addComment(ProgramElementDoc member, Content htmltree) { 1.350 if (member.inlineTags().length > 0) { 1.351 - writer.printMemberDetailsListStartTag(); 1.352 - writer.dd(); 1.353 - writer.printInlineComment(member); 1.354 - writer.ddEnd(); 1.355 + writer.addInlineComment(member, htmltree); 1.356 } 1.357 } 1.358 1.359 @@ -264,67 +376,19 @@ 1.360 return member.name(); 1.361 } 1.362 1.363 - protected void printHead(MemberDoc member) { 1.364 - writer.h3(); 1.365 - writer.print(member.name()); 1.366 - writer.h3End(); 1.367 - } 1.368 - 1.369 - protected void printFullComment(ProgramElementDoc member) { 1.370 - if(configuration().nocomment){ 1.371 - return; 1.372 - } 1.373 - writer.dl(); 1.374 - print(((TagletOutputImpl) 1.375 - (new DeprecatedTaglet()).getTagletOutput(member, 1.376 - writer.getTagletWriterInstance(false))).toString()); 1.377 - printCommentAndTags(member); 1.378 - writer.dlEnd(); 1.379 - } 1.380 - 1.381 - protected void printCommentAndTags(ProgramElementDoc member) { 1.382 - printComment(member); 1.383 - writer.printTags(member); 1.384 + /** 1.385 + * Get the header for the section. 1.386 + * 1.387 + * @param member the member being documented. 1.388 + * @return a header content for the section. 1.389 + */ 1.390 + protected Content getHead(MemberDoc member) { 1.391 + Content memberContent = new RawHtml(member.name()); 1.392 + Content heading = HtmlTree.HEADING(HtmlConstants.MEMBER_HEADING, memberContent); 1.393 + return heading; 1.394 } 1.395 1.396 /** 1.397 - * Write the member footer. 1.398 - */ 1.399 - protected void printMemberFooter() { 1.400 - writer.printMemberDetailsListEndTag(); 1.401 - assert !writer.getMemberDetailsListPrinted(); 1.402 - } 1.403 - 1.404 - /** 1.405 - * Forward to containing writer 1.406 - */ 1.407 - public void printSummaryHeader(ClassDoc cd) { 1.408 - printedSummaryHeader = true; 1.409 - writer.printSummaryHeader(this, cd); 1.410 - } 1.411 - 1.412 - /** 1.413 - * Forward to containing writer 1.414 - */ 1.415 - public void printInheritedSummaryHeader(ClassDoc cd) { 1.416 - writer.printInheritedSummaryHeader(this, cd); 1.417 - } 1.418 - 1.419 - /** 1.420 - * Forward to containing writer 1.421 - */ 1.422 - public void printInheritedSummaryFooter(ClassDoc cd) { 1.423 - writer.printInheritedSummaryFooter(this, cd); 1.424 - } 1.425 - 1.426 - /** 1.427 - * Forward to containing writer 1.428 - */ 1.429 - public void printSummaryFooter(ClassDoc cd) { 1.430 - writer.printSummaryFooter(this, cd); 1.431 - } 1.432 - 1.433 - /** 1.434 * Return true if the given <code>ProgramElement</code> is inherited 1.435 * by the class that is being documented. 1.436 * 1.437 @@ -340,102 +404,134 @@ 1.438 return true; 1.439 } 1.440 1.441 - 1.442 /** 1.443 - * Generate the code for listing the deprecated APIs. Create the table 1.444 - * format for listing the API. Call methods from the sub-class to complete 1.445 - * the generation. 1.446 + * Add deprecated information to the documentation tree 1.447 + * 1.448 + * @param deprmembers list of deprecated members 1.449 + * @param headingKey the caption for the deprecated members table 1.450 + * @param tableSummary the summary for the deprecated members table 1.451 + * @param tableHeader table headers for the deprecated members table 1.452 + * @param contentTree the content tree to which the deprecated members table will be added 1.453 */ 1.454 - protected void printDeprecatedAPI(List<Doc> deprmembers, String headingKey, String tableSummary, String[] tableHeader) { 1.455 + protected void addDeprecatedAPI(List<Doc> deprmembers, String headingKey, 1.456 + String tableSummary, String[] tableHeader, Content contentTree) { 1.457 if (deprmembers.size() > 0) { 1.458 - writer.tableIndexSummary(tableSummary); 1.459 - writer.tableCaptionStart(); 1.460 - writer.printText(headingKey); 1.461 - writer.tableCaptionEnd(); 1.462 - writer.summaryTableHeader(tableHeader, "col"); 1.463 + Content table = HtmlTree.TABLE(0, 3, 0, tableSummary, 1.464 + writer.getTableCaption(configuration().getText(headingKey))); 1.465 + table.addContent(writer.getSummaryTableHeader(tableHeader, "col")); 1.466 + Content tbody = new HtmlTree(HtmlTag.TBODY); 1.467 for (int i = 0; i < deprmembers.size(); i++) { 1.468 ProgramElementDoc member =(ProgramElementDoc)deprmembers.get(i); 1.469 - writer.trBgcolorStyle("white", "TableRowColor"); 1.470 - writer.summaryRow(0); 1.471 - writeDeprecatedLink(member); 1.472 - writer.br(); 1.473 - writer.printNbsps(); 1.474 + HtmlTree td = HtmlTree.TD(HtmlStyle.colOne, getDeprecatedLink(member)); 1.475 if (member.tags("deprecated").length > 0) 1.476 - writer.printInlineDeprecatedComment(member, member.tags("deprecated")[0]); 1.477 - writer.space(); 1.478 - writer.summaryRowEnd(); 1.479 - writer.trEnd(); 1.480 + writer.addInlineDeprecatedComment(member, 1.481 + member.tags("deprecated")[0], td); 1.482 + HtmlTree tr = HtmlTree.TR(td); 1.483 + if (i%2 == 0) 1.484 + tr.addStyle(HtmlStyle.altColor); 1.485 + else 1.486 + tr.addStyle(HtmlStyle.rowColor); 1.487 + tbody.addContent(tr); 1.488 } 1.489 - writer.tableEnd(); 1.490 - writer.space(); 1.491 - writer.p(); 1.492 + table.addContent(tbody); 1.493 + Content li = HtmlTree.LI(HtmlStyle.blockList, table); 1.494 + Content ul = HtmlTree.UL(HtmlStyle.blockList, li); 1.495 + contentTree.addContent(ul); 1.496 } 1.497 } 1.498 1.499 /** 1.500 - * Print use info. 1.501 + * Add use information to the documentation tree. 1.502 + * 1.503 + * @param mems list of program elements for which the use information will be added 1.504 + * @param heading the section heading 1.505 + * @param tableSummary the summary for the use table 1.506 + * @param contentTree the content tree to which the use information will be added 1.507 */ 1.508 - protected void printUseInfo(List<? extends ProgramElementDoc> mems, String heading, String tableSummary) { 1.509 + protected void addUseInfo(List<? extends ProgramElementDoc> mems, 1.510 + String heading, String tableSummary, Content contentTree) { 1.511 if (mems == null) { 1.512 return; 1.513 } 1.514 List<? extends ProgramElementDoc> members = mems; 1.515 boolean printedUseTableHeader = false; 1.516 if (members.size() > 0) { 1.517 - writer.tableIndexSummary(tableSummary); 1.518 - writer.tableSubCaptionStart(); 1.519 - writer.print(heading); 1.520 - writer.tableCaptionEnd(); 1.521 - for (Iterator<? extends ProgramElementDoc> it = members.iterator(); it.hasNext(); ) { 1.522 + Content table = HtmlTree.TABLE(0, 3, 0, tableSummary, 1.523 + writer.getTableCaption(heading)); 1.524 + Content tbody = new HtmlTree(HtmlTag.TBODY); 1.525 + Iterator<? extends ProgramElementDoc> it = members.iterator(); 1.526 + for (int i = 0; it.hasNext(); i++) { 1.527 ProgramElementDoc pgmdoc = it.next(); 1.528 ClassDoc cd = pgmdoc.containingClass(); 1.529 if (!printedUseTableHeader) { 1.530 - // Passing ProgramElementDoc helps decides printing 1.531 - // interface or class header in case of nested classes. 1.532 - this.printSummaryTableHeader(pgmdoc); 1.533 + table.addContent(writer.getSummaryTableHeader( 1.534 + this.getSummaryTableHeader(pgmdoc), "col")); 1.535 printedUseTableHeader = true; 1.536 } 1.537 - 1.538 - writer.printSummaryLinkType(this, pgmdoc); 1.539 + HtmlTree tr = new HtmlTree(HtmlTag.TR); 1.540 + if (i % 2 == 0) { 1.541 + tr.addStyle(HtmlStyle.altColor); 1.542 + } else { 1.543 + tr.addStyle(HtmlStyle.rowColor); 1.544 + } 1.545 + HtmlTree tdFirst = new HtmlTree(HtmlTag.TD); 1.546 + tdFirst.addStyle(HtmlStyle.colFirst); 1.547 + writer.addSummaryType(this, pgmdoc, tdFirst); 1.548 + tr.addContent(tdFirst); 1.549 + HtmlTree tdLast = new HtmlTree(HtmlTag.TD); 1.550 + tdLast.addStyle(HtmlStyle.colLast); 1.551 if (cd != null && !(pgmdoc instanceof ConstructorDoc) 1.552 - && !(pgmdoc instanceof ClassDoc)) { 1.553 - // Add class context 1.554 - writer.strong(cd.name() + "."); 1.555 + && !(pgmdoc instanceof ClassDoc)) { 1.556 + HtmlTree name = new HtmlTree(HtmlTag.SPAN); 1.557 + name.addStyle(HtmlStyle.strong); 1.558 + name.addContent(cd.name() + "."); 1.559 + tdLast.addContent(name); 1.560 } 1.561 - writeSummaryLink( 1.562 - pgmdoc instanceof ClassDoc ? 1.563 - LinkInfoImpl.CONTEXT_CLASS_USE : LinkInfoImpl.CONTEXT_MEMBER, 1.564 - cd, pgmdoc); 1.565 - writer.printSummaryLinkComment(this, pgmdoc); 1.566 + addSummaryLink(pgmdoc instanceof ClassDoc ? 1.567 + LinkInfoImpl.CONTEXT_CLASS_USE : LinkInfoImpl.CONTEXT_MEMBER, 1.568 + cd, pgmdoc, tdLast); 1.569 + writer.addSummaryLinkComment(this, pgmdoc, tdLast); 1.570 + tr.addContent(tdLast); 1.571 + tbody.addContent(tr); 1.572 } 1.573 - writer.tableEnd(); 1.574 - writer.space(); 1.575 - writer.p(); 1.576 + table.addContent(tbody); 1.577 + contentTree.addContent(table); 1.578 } 1.579 } 1.580 1.581 - protected void navDetailLink(List<?> members) { 1.582 - printNavDetailLink(members.size() > 0? true: false); 1.583 + /** 1.584 + * Add the navigation detail link. 1.585 + * 1.586 + * @param members the members to be linked 1.587 + * @param liNav the content tree to which the navigation detail link will be added 1.588 + */ 1.589 + protected void addNavDetailLink(List<?> members, Content liNav) { 1.590 + addNavDetailLink(members.size() > 0 ? true : false, liNav); 1.591 } 1.592 1.593 - 1.594 - protected void navSummaryLink(List<?> members, 1.595 - VisibleMemberMap visibleMemberMap) { 1.596 + /** 1.597 + * Add the navigation summary link. 1.598 + * 1.599 + * @param members members to be linked 1.600 + * @param visibleMemberMap the visible inherited members map 1.601 + * @param liNav the content tree to which the navigation summary link will be added 1.602 + */ 1.603 + protected void addNavSummaryLink(List<?> members, 1.604 + VisibleMemberMap visibleMemberMap, Content liNav) { 1.605 if (members.size() > 0) { 1.606 - printNavSummaryLink(null, true); 1.607 + liNav.addContent(getNavSummaryLink(null, true)); 1.608 return; 1.609 - } else { 1.610 - ClassDoc icd = classdoc.superclass(); 1.611 - while (icd != null) { 1.612 - List<?> inhmembers = visibleMemberMap.getMembersFor(icd); 1.613 - if (inhmembers.size() > 0) { 1.614 - printNavSummaryLink(icd, true); 1.615 - return; 1.616 - } 1.617 - icd = icd.superclass(); 1.618 + } 1.619 + ClassDoc icd = classdoc.superclass(); 1.620 + while (icd != null) { 1.621 + List<?> inhmembers = visibleMemberMap.getMembersFor(icd); 1.622 + if (inhmembers.size() > 0) { 1.623 + liNav.addContent(getNavSummaryLink(icd, true)); 1.624 + return; 1.625 } 1.626 + icd = icd.superclass(); 1.627 } 1.628 - printNavSummaryLink(null, false); 1.629 + liNav.addContent(getNavSummaryLink(null, false)); 1.630 } 1.631 1.632 protected void serialWarning(SourcePosition pos, String key, String a1, String a2) { 1.633 @@ -453,12 +549,109 @@ 1.634 } 1.635 1.636 /** 1.637 - * {@inheritDoc} 1.638 + * Add the member summary for the given class. 1.639 + * 1.640 + * @param classDoc the class that is being documented 1.641 + * @param member the member being documented 1.642 + * @param firstSentenceTags the first sentence tags to be added to the summary 1.643 + * @param tableTree the content tree to which the documentation will be added 1.644 + * @param counter the counter for determing style for the table row 1.645 */ 1.646 - public void writeMemberSummary(ClassDoc classDoc, ProgramElementDoc member, 1.647 - Tag[] firstSentenceTags, boolean isFirst, boolean isLast) { 1.648 - writer.printSummaryLinkType(this, member); 1.649 - writeSummaryLink(classDoc, member); 1.650 - writer.printSummaryLinkComment(this, member, firstSentenceTags); 1.651 + public void addMemberSummary(ClassDoc classDoc, ProgramElementDoc member, 1.652 + Tag[] firstSentenceTags, Content tableTree, int counter) { 1.653 + HtmlTree tdSummaryType = new HtmlTree(HtmlTag.TD); 1.654 + tdSummaryType.addStyle(HtmlStyle.colFirst); 1.655 + writer.addSummaryType(this, member, tdSummaryType); 1.656 + HtmlTree tdSummary = new HtmlTree(HtmlTag.TD); 1.657 + setSummaryColumnStyle(tdSummary); 1.658 + addSummaryLink(classDoc, member, tdSummary); 1.659 + writer.addSummaryLinkComment(this, member, firstSentenceTags, tdSummary); 1.660 + HtmlTree tr = HtmlTree.TR(tdSummaryType); 1.661 + tr.addContent(tdSummary); 1.662 + if (counter%2 == 0) 1.663 + tr.addStyle(HtmlStyle.altColor); 1.664 + else 1.665 + tr.addStyle(HtmlStyle.rowColor); 1.666 + tableTree.addContent(tr); 1.667 + } 1.668 + 1.669 + /** 1.670 + * Set the style for the summary column. 1.671 + * 1.672 + * @param tdTree the column for which the style will be set 1.673 + */ 1.674 + public void setSummaryColumnStyle(HtmlTree tdTree) { 1.675 + tdTree.addStyle(HtmlStyle.colLast); 1.676 + } 1.677 + 1.678 + /** 1.679 + * Add inherited member summary for the given class and member. 1.680 + * 1.681 + * @param classDoc the class the inherited member belongs to 1.682 + * @param nestedClass the inherited member that is summarized 1.683 + * @param isFirst true if this is the first member in the list 1.684 + * @param isLast true if this is the last member in the list 1.685 + * @param linksTree the content tree to which the summary will be added 1.686 + */ 1.687 + public void addInheritedMemberSummary(ClassDoc classDoc, 1.688 + ProgramElementDoc nestedClass, boolean isFirst, boolean isLast, 1.689 + Content linksTree) { 1.690 + writer.addInheritedMemberSummary(this, classDoc, nestedClass, isFirst, 1.691 + linksTree); 1.692 + } 1.693 + 1.694 + /** 1.695 + * Get the inherited summary header for the given class. 1.696 + * 1.697 + * @param classDoc the class the inherited member belongs to 1.698 + * @return a content tree for the inherited summary header 1.699 + */ 1.700 + public Content getInheritedSummaryHeader(ClassDoc classDoc) { 1.701 + Content inheritedTree = writer.getMemberTreeHeader(); 1.702 + writer.addInheritedSummaryHeader(this, classDoc, inheritedTree); 1.703 + return inheritedTree; 1.704 + } 1.705 + 1.706 + /** 1.707 + * Get the inherited summary links tree. 1.708 + * 1.709 + * @return a content tree for the inherited summary links 1.710 + */ 1.711 + public Content getInheritedSummaryLinksTree() { 1.712 + return new HtmlTree(HtmlTag.CODE); 1.713 + } 1.714 + 1.715 + /** 1.716 + * Get the summary table tree for the given class. 1.717 + * 1.718 + * @param classDoc the class for which the summary table is generated 1.719 + * @return a content tree for the summary table 1.720 + */ 1.721 + public Content getSummaryTableTree(ClassDoc classDoc) { 1.722 + return writer.getSummaryTableTree(this, classDoc); 1.723 + } 1.724 + 1.725 + /** 1.726 + * Get the member tree to be documented. 1.727 + * 1.728 + * @param memberTree the content tree of member to be documented 1.729 + * @return a content tree that will be added to the class documentation 1.730 + */ 1.731 + public Content getMemberTree(Content memberTree) { 1.732 + return writer.getMemberTree(memberTree); 1.733 + } 1.734 + 1.735 + /** 1.736 + * Get the member tree to be documented. 1.737 + * 1.738 + * @param memberTree the content tree of member to be documented 1.739 + * @param isLastContent true if the content to be added is the last content 1.740 + * @return a content tree that will be added to the class documentation 1.741 + */ 1.742 + public Content getMemberTree(Content memberTree, boolean isLastContent) { 1.743 + if (isLastContent) 1.744 + return HtmlTree.UL(HtmlStyle.blockListLast, memberTree); 1.745 + else 1.746 + return HtmlTree.UL(HtmlStyle.blockList, memberTree); 1.747 } 1.748 }