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

Fri, 04 Mar 2011 19:53:03 -0800

author
jjg
date
Fri, 04 Mar 2011 19:53:03 -0800
changeset 910
ebf7c13df6c0
parent 798
4868a36f6fd8
child 1357
c75be5bc5283
permissions
-rw-r--r--

6866185: Util.getPackageSourcePath should use lastIndexOf not indexOf and related cleanup
Reviewed-by: bpatel

duke@1 1 /*
ohair@798 2 * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.
duke@1 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
duke@1 4 *
duke@1 5 * This code is free software; you can redistribute it and/or modify it
duke@1 6 * under the terms of the GNU General Public License version 2 only, as
ohair@554 7 * published by the Free Software Foundation. Oracle designates this
duke@1 8 * particular file as subject to the "Classpath" exception as provided
ohair@554 9 * by Oracle in the LICENSE file that accompanied this code.
duke@1 10 *
duke@1 11 * This code is distributed in the hope that it will be useful, but WITHOUT
duke@1 12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
duke@1 13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
duke@1 14 * version 2 for more details (a copy is included in the LICENSE file that
duke@1 15 * accompanied this code).
duke@1 16 *
duke@1 17 * You should have received a copy of the GNU General Public License version
duke@1 18 * 2 along with this work; if not, write to the Free Software Foundation,
duke@1 19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
duke@1 20 *
ohair@554 21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
ohair@554 22 * or visit www.oracle.com if you need additional information or have any
ohair@554 23 * questions.
duke@1 24 */
duke@1 25
duke@1 26 package com.sun.tools.doclets.formats.html;
duke@1 27
bpatel@766 28 import java.util.*;
bpatel@233 29 import java.lang.reflect.Modifier;
bpatel@233 30 import com.sun.javadoc.*;
bpatel@766 31 import com.sun.tools.doclets.formats.html.markup.*;
bpatel@766 32 import com.sun.tools.doclets.internal.toolkit.*;
duke@1 33 import com.sun.tools.doclets.internal.toolkit.util.*;
duke@1 34 import com.sun.tools.doclets.internal.toolkit.taglets.*;
duke@1 35
duke@1 36 /**
duke@1 37 * The base class for member writers.
duke@1 38 *
duke@1 39 * @author Robert Field
duke@1 40 * @author Atul M Dambalkar
duke@1 41 * @author Jamie Ho (Re-write)
bpatel@233 42 * @author Bhavesh Patel (Modified)
duke@1 43 */
duke@1 44 public abstract class AbstractMemberWriter {
duke@1 45
duke@1 46 protected boolean printedSummaryHeader = false;
duke@1 47 protected final SubWriterHolderWriter writer;
duke@1 48 protected final ClassDoc classdoc;
duke@1 49 public final boolean nodepr;
duke@1 50
duke@1 51 public AbstractMemberWriter(SubWriterHolderWriter writer,
duke@1 52 ClassDoc classdoc) {
duke@1 53 this.writer = writer;
duke@1 54 this.nodepr = configuration().nodeprecated;
duke@1 55 this.classdoc = classdoc;
duke@1 56 }
duke@1 57
duke@1 58 public AbstractMemberWriter(SubWriterHolderWriter writer) {
duke@1 59 this(writer, null);
duke@1 60 }
duke@1 61
duke@1 62 /*** abstracts ***/
duke@1 63
bpatel@766 64 /**
bpatel@766 65 * Add the summary label for the member.
bpatel@766 66 *
bpatel@766 67 * @param memberTree the content tree to which the label will be added
bpatel@766 68 */
bpatel@766 69 public abstract void addSummaryLabel(Content memberTree);
bpatel@243 70
bpatel@766 71 /**
bpatel@766 72 * Get the summary for the member summary table.
bpatel@766 73 *
bpatel@766 74 * @return a string for the table summary
bpatel@766 75 */
bpatel@766 76 public abstract String getTableSummary();
bpatel@243 77
bpatel@766 78 /**
bpatel@766 79 * Get the caption for the member summary table.
bpatel@766 80 *
bpatel@766 81 * @return a string for the table caption
bpatel@766 82 */
bpatel@766 83 public abstract String getCaption();
duke@1 84
bpatel@766 85 /**
bpatel@766 86 * Get the summary table header for the member.
bpatel@766 87 *
bpatel@766 88 * @param member the member to be documented
bpatel@766 89 * @return the summary table header
bpatel@766 90 */
bpatel@766 91 public abstract String[] getSummaryTableHeader(ProgramElementDoc member);
duke@1 92
bpatel@766 93 /**
bpatel@766 94 * Add inherited summary lable for the member.
bpatel@766 95 *
bpatel@766 96 * @param cd the class doc to which to link to
bpatel@766 97 * @param inheritedTree the content tree to which the inherited summary label will be added
bpatel@766 98 */
bpatel@766 99 public abstract void addInheritedSummaryLabel(ClassDoc cd, Content inheritedTree);
duke@1 100
bpatel@766 101 /**
bpatel@766 102 * Add the anchor for the summary section of the member.
bpatel@766 103 *
bpatel@766 104 * @param cd the class doc to be documented
bpatel@766 105 * @param memberTree the content tree to which the summary anchor will be added
bpatel@766 106 */
bpatel@766 107 public abstract void addSummaryAnchor(ClassDoc cd, Content memberTree);
duke@1 108
bpatel@766 109 /**
bpatel@766 110 * Add the anchor for the inherited summary section of the member.
bpatel@766 111 *
bpatel@766 112 * @param cd the class doc to be documented
bpatel@766 113 * @param inheritedTree the content tree to which the inherited summary anchor will be added
bpatel@766 114 */
bpatel@766 115 public abstract void addInheritedSummaryAnchor(ClassDoc cd, Content inheritedTree);
duke@1 116
bpatel@766 117 /**
bpatel@766 118 * Add the summary type for the member.
bpatel@766 119 *
bpatel@766 120 * @param member the member to be documented
bpatel@766 121 * @param tdSummaryType the content tree to which the type will be added
bpatel@766 122 */
bpatel@766 123 protected abstract void addSummaryType(ProgramElementDoc member,
bpatel@766 124 Content tdSummaryType);
bpatel@766 125
bpatel@766 126 /**
bpatel@766 127 * Add the summary link for the member.
bpatel@766 128 *
bpatel@766 129 * @param cd the class doc to be documented
bpatel@766 130 * @param member the member to be documented
bpatel@766 131 * @param tdSummary the content tree to which the link will be added
bpatel@766 132 */
bpatel@766 133 protected void addSummaryLink(ClassDoc cd, ProgramElementDoc member,
bpatel@766 134 Content tdSummary) {
bpatel@766 135 addSummaryLink(LinkInfoImpl.CONTEXT_MEMBER, cd, member, tdSummary);
duke@1 136 }
duke@1 137
bpatel@766 138 /**
bpatel@766 139 * Add the summary link for the member.
bpatel@766 140 *
bpatel@766 141 * @param context the id of the context where the link will be printed
bpatel@766 142 * @param cd the class doc to be documented
bpatel@766 143 * @param member the member to be documented
bpatel@766 144 * @param tdSummary the content tree to which the summary link will be added
bpatel@766 145 */
bpatel@766 146 protected abstract void addSummaryLink(int context,
bpatel@766 147 ClassDoc cd, ProgramElementDoc member, Content tdSummary);
duke@1 148
bpatel@766 149 /**
bpatel@766 150 * Add the inherited summary link for the member.
bpatel@766 151 *
bpatel@766 152 * @param cd the class doc to be documented
bpatel@766 153 * @param member the member to be documented
bpatel@766 154 * @param linksTree the content tree to which the inherited summary link will be added
bpatel@766 155 */
bpatel@766 156 protected abstract void addInheritedSummaryLink(ClassDoc cd,
bpatel@766 157 ProgramElementDoc member, Content linksTree);
duke@1 158
bpatel@766 159 /**
bpatel@766 160 * Get the deprecated link.
bpatel@766 161 *
bpatel@766 162 * @param member the member being linked to
bpatel@766 163 * @return a content tree representing the link
bpatel@766 164 */
bpatel@766 165 protected abstract Content getDeprecatedLink(ProgramElementDoc member);
duke@1 166
bpatel@766 167 /**
bpatel@766 168 * Get the navigation summary link.
bpatel@766 169 *
bpatel@766 170 * @param cd the class doc to be documented
bpatel@766 171 * @param link true if its a link else the label to be printed
bpatel@766 172 * @return a content tree for the navigation summary link.
bpatel@766 173 */
bpatel@766 174 protected abstract Content getNavSummaryLink(ClassDoc cd, boolean link);
duke@1 175
bpatel@766 176 /**
bpatel@766 177 * Add the navigation detail link.
bpatel@766 178 *
bpatel@766 179 * @param link true if its a link else the label to be printed
bpatel@766 180 * @param liNav the content tree to which the navigation detail link will be added
bpatel@766 181 */
bpatel@766 182 protected abstract void addNavDetailLink(boolean link, Content liNav);
duke@1 183
duke@1 184 /*** ***/
duke@1 185
duke@1 186 protected void print(String str) {
duke@1 187 writer.print(str);
duke@1 188 writer.displayLength += str.length();
duke@1 189 }
duke@1 190
duke@1 191 protected void print(char ch) {
duke@1 192 writer.print(ch);
duke@1 193 writer.displayLength++;
duke@1 194 }
duke@1 195
bpatel@182 196 protected void strong(String str) {
bpatel@182 197 writer.strong(str);
duke@1 198 writer.displayLength += str.length();
duke@1 199 }
duke@1 200
duke@1 201 /**
bpatel@766 202 * Add the member name to the content tree and modifies the display length.
bpatel@766 203 *
bpatel@766 204 * @param name the member name to be added to the content tree.
bpatel@766 205 * @param htmltree the content tree to which the name will be added.
bpatel@766 206 */
bpatel@766 207 protected void addName(String name, Content htmltree) {
bpatel@766 208 htmltree.addContent(name);
bpatel@766 209 writer.displayLength += name.length();
bpatel@766 210 }
bpatel@766 211
bpatel@766 212 /**
duke@1 213 * Return a string describing the access modifier flags.
duke@1 214 * Don't include native or synchronized.
duke@1 215 *
duke@1 216 * The modifier names are returned in canonical order, as
duke@1 217 * specified by <em>The Java Language Specification</em>.
duke@1 218 */
duke@1 219 protected String modifierString(MemberDoc member) {
duke@1 220 int ms = member.modifierSpecifier();
duke@1 221 int no = Modifier.NATIVE | Modifier.SYNCHRONIZED;
duke@1 222 return Modifier.toString(ms & ~no);
duke@1 223 }
duke@1 224
duke@1 225 protected String typeString(MemberDoc member) {
duke@1 226 String type = "";
duke@1 227 if (member instanceof MethodDoc) {
duke@1 228 type = ((MethodDoc)member).returnType().toString();
duke@1 229 } else if (member instanceof FieldDoc) {
duke@1 230 type = ((FieldDoc)member).type().toString();
duke@1 231 }
duke@1 232 return type;
duke@1 233 }
duke@1 234
bpatel@766 235 /**
bpatel@766 236 * Add the modifier for the member.
bpatel@766 237 *
bpatel@766 238 * @param member the member for which teh modifier will be added.
bpatel@766 239 * @param htmltree the content tree to which the modifier information will be added.
bpatel@766 240 */
bpatel@766 241 protected void addModifiers(MemberDoc member, Content htmltree) {
duke@1 242 String mod = modifierString(member);
duke@1 243 // According to JLS, we should not be showing public modifier for
duke@1 244 // interface methods.
duke@1 245 if ((member.isField() || member.isMethod()) &&
duke@1 246 writer instanceof ClassWriterImpl &&
bpatel@766 247 ((ClassWriterImpl) writer).getClassDoc().isInterface()) {
duke@1 248 mod = Util.replaceText(mod, "public", "").trim();
duke@1 249 }
duke@1 250 if(mod.length() > 0) {
bpatel@766 251 htmltree.addContent(mod);
bpatel@766 252 htmltree.addContent(writer.getSpace());
duke@1 253 }
duke@1 254 }
duke@1 255
duke@1 256 protected String makeSpace(int len) {
duke@1 257 if (len <= 0) {
duke@1 258 return "";
duke@1 259 }
duke@1 260 StringBuffer sb = new StringBuffer(len);
duke@1 261 for(int i = 0; i < len; i++) {
duke@1 262 sb.append(' ');
duke@1 263 }
duke@1 264 return sb.toString();
duke@1 265 }
duke@1 266
duke@1 267 /**
bpatel@766 268 * Add the modifier and type for the member in the member summary.
bpatel@766 269 *
bpatel@766 270 * @param member the member to add the type for
bpatel@766 271 * @param type the type to add
bpatel@766 272 * @param tdSummaryType the content tree to which the modified and type will be added
duke@1 273 */
bpatel@766 274 protected void addModifierAndType(ProgramElementDoc member, Type type,
bpatel@766 275 Content tdSummaryType) {
bpatel@766 276 HtmlTree code = new HtmlTree(HtmlTag.CODE);
bpatel@766 277 addModifier(member, code);
duke@1 278 if (type == null) {
duke@1 279 if (member.isClass()) {
bpatel@766 280 code.addContent("class");
duke@1 281 } else {
bpatel@766 282 code.addContent("interface");
duke@1 283 }
bpatel@766 284 code.addContent(writer.getSpace());
duke@1 285 } else {
duke@1 286 if (member instanceof ExecutableMemberDoc &&
duke@1 287 ((ExecutableMemberDoc) member).typeParameters().length > 0) {
duke@1 288 //Code to avoid ugly wrapping in member summary table.
bpatel@766 289 int displayLength = ((AbstractExecutableMemberWriter) this).addTypeParameters(
bpatel@766 290 (ExecutableMemberDoc) member, code);
duke@1 291 if (displayLength > 10) {
bpatel@766 292 code.addContent(new HtmlTree(HtmlTag.BR));
duke@1 293 }
bpatel@766 294 code.addContent(new RawHtml(
bpatel@766 295 writer.getLink(new LinkInfoImpl(
bpatel@766 296 LinkInfoImpl.CONTEXT_SUMMARY_RETURN_TYPE, type))));
duke@1 297 } else {
bpatel@766 298 code.addContent(new RawHtml(
bpatel@766 299 writer.getLink(new LinkInfoImpl(
bpatel@766 300 LinkInfoImpl.CONTEXT_SUMMARY_RETURN_TYPE, type))));
duke@1 301 }
duke@1 302
duke@1 303 }
bpatel@766 304 tdSummaryType.addContent(code);
duke@1 305 }
duke@1 306
duke@1 307 private void printModifier(ProgramElementDoc member) {
duke@1 308 if (member.isProtected()) {
duke@1 309 print("protected ");
duke@1 310 } else if (member.isPrivate()) {
duke@1 311 print("private ");
duke@1 312 } else if (!member.isPublic()) { // Package private
duke@1 313 writer.printText("doclet.Package_private");
duke@1 314 print(" ");
duke@1 315 }
duke@1 316 if (member.isMethod() && ((MethodDoc)member).isAbstract()) {
duke@1 317 print("abstract ");
duke@1 318 }
duke@1 319 if (member.isStatic()) {
duke@1 320 print("static");
duke@1 321 }
duke@1 322 }
duke@1 323
bpatel@233 324 /**
bpatel@766 325 * Add the modifier for the member.
bpatel@766 326 *
bpatel@766 327 * @param member the member to add the type for
bpatel@766 328 * @param code the content tree to which the modified will be added
bpatel@766 329 */
bpatel@766 330 private void addModifier(ProgramElementDoc member, Content code) {
bpatel@766 331 if (member.isProtected()) {
bpatel@766 332 code.addContent("protected ");
bpatel@766 333 } else if (member.isPrivate()) {
bpatel@766 334 code.addContent("private ");
bpatel@766 335 } else if (!member.isPublic()) { // Package private
bpatel@766 336 code.addContent(configuration().getText("doclet.Package_private"));
bpatel@766 337 code.addContent(" ");
bpatel@766 338 }
bpatel@766 339 if (member.isMethod() && ((MethodDoc)member).isAbstract()) {
bpatel@766 340 code.addContent("abstract ");
bpatel@766 341 }
bpatel@766 342 if (member.isStatic()) {
bpatel@766 343 code.addContent("static ");
bpatel@766 344 }
bpatel@766 345 }
bpatel@766 346
bpatel@766 347 /**
bpatel@766 348 * Add the deprecated information for the given member.
bpatel@233 349 *
bpatel@233 350 * @param member the member being documented.
bpatel@766 351 * @param contentTree the content tree to which the deprecated information will be added.
bpatel@233 352 */
bpatel@766 353 protected void addDeprecatedInfo(ProgramElementDoc member, Content contentTree) {
bpatel@233 354 String output = (new DeprecatedTaglet()).getTagletOutput(member,
bpatel@233 355 writer.getTagletWriterInstance(false)).toString().trim();
bpatel@233 356 if (!output.isEmpty()) {
bpatel@766 357 Content deprecatedContent = new RawHtml(output);
bpatel@766 358 Content div = HtmlTree.DIV(HtmlStyle.block, deprecatedContent);
bpatel@766 359 contentTree.addContent(div);
bpatel@233 360 }
bpatel@233 361 }
bpatel@233 362
bpatel@766 363 /**
bpatel@766 364 * Add the comment for the given member.
bpatel@766 365 *
bpatel@766 366 * @param member the member being documented.
bpatel@766 367 * @param contentTree the content tree to which the comment will be added.
bpatel@766 368 */
bpatel@766 369 protected void addComment(ProgramElementDoc member, Content htmltree) {
duke@1 370 if (member.inlineTags().length > 0) {
bpatel@766 371 writer.addInlineComment(member, htmltree);
duke@1 372 }
duke@1 373 }
duke@1 374
duke@1 375 protected String name(ProgramElementDoc member) {
duke@1 376 return member.name();
duke@1 377 }
duke@1 378
bpatel@766 379 /**
bpatel@766 380 * Get the header for the section.
bpatel@766 381 *
bpatel@766 382 * @param member the member being documented.
bpatel@766 383 * @return a header content for the section.
bpatel@766 384 */
bpatel@766 385 protected Content getHead(MemberDoc member) {
bpatel@766 386 Content memberContent = new RawHtml(member.name());
bpatel@766 387 Content heading = HtmlTree.HEADING(HtmlConstants.MEMBER_HEADING, memberContent);
bpatel@766 388 return heading;
duke@1 389 }
duke@1 390
duke@1 391 /**
duke@1 392 * Return true if the given <code>ProgramElement</code> is inherited
duke@1 393 * by the class that is being documented.
duke@1 394 *
duke@1 395 * @param ped The <code>ProgramElement</code> being checked.
duke@1 396 * return true if the <code>ProgramElement</code> is being inherited and
duke@1 397 * false otherwise.
duke@1 398 */
duke@1 399 protected boolean isInherited(ProgramElementDoc ped){
duke@1 400 if(ped.isPrivate() || (ped.isPackagePrivate() &&
duke@1 401 ! ped.containingPackage().equals(classdoc.containingPackage()))){
duke@1 402 return false;
duke@1 403 }
duke@1 404 return true;
duke@1 405 }
duke@1 406
duke@1 407 /**
bpatel@766 408 * Add deprecated information to the documentation tree
bpatel@766 409 *
bpatel@766 410 * @param deprmembers list of deprecated members
bpatel@766 411 * @param headingKey the caption for the deprecated members table
bpatel@766 412 * @param tableSummary the summary for the deprecated members table
bpatel@766 413 * @param tableHeader table headers for the deprecated members table
bpatel@766 414 * @param contentTree the content tree to which the deprecated members table will be added
duke@1 415 */
bpatel@766 416 protected void addDeprecatedAPI(List<Doc> deprmembers, String headingKey,
bpatel@766 417 String tableSummary, String[] tableHeader, Content contentTree) {
duke@1 418 if (deprmembers.size() > 0) {
bpatel@766 419 Content table = HtmlTree.TABLE(0, 3, 0, tableSummary,
bpatel@766 420 writer.getTableCaption(configuration().getText(headingKey)));
bpatel@766 421 table.addContent(writer.getSummaryTableHeader(tableHeader, "col"));
bpatel@766 422 Content tbody = new HtmlTree(HtmlTag.TBODY);
duke@1 423 for (int i = 0; i < deprmembers.size(); i++) {
duke@1 424 ProgramElementDoc member =(ProgramElementDoc)deprmembers.get(i);
bpatel@766 425 HtmlTree td = HtmlTree.TD(HtmlStyle.colOne, getDeprecatedLink(member));
duke@1 426 if (member.tags("deprecated").length > 0)
bpatel@766 427 writer.addInlineDeprecatedComment(member,
bpatel@766 428 member.tags("deprecated")[0], td);
bpatel@766 429 HtmlTree tr = HtmlTree.TR(td);
bpatel@766 430 if (i%2 == 0)
bpatel@766 431 tr.addStyle(HtmlStyle.altColor);
bpatel@766 432 else
bpatel@766 433 tr.addStyle(HtmlStyle.rowColor);
bpatel@766 434 tbody.addContent(tr);
duke@1 435 }
bpatel@766 436 table.addContent(tbody);
bpatel@766 437 Content li = HtmlTree.LI(HtmlStyle.blockList, table);
bpatel@766 438 Content ul = HtmlTree.UL(HtmlStyle.blockList, li);
bpatel@766 439 contentTree.addContent(ul);
duke@1 440 }
duke@1 441 }
duke@1 442
duke@1 443 /**
bpatel@766 444 * Add use information to the documentation tree.
bpatel@766 445 *
bpatel@766 446 * @param mems list of program elements for which the use information will be added
bpatel@766 447 * @param heading the section heading
bpatel@766 448 * @param tableSummary the summary for the use table
bpatel@766 449 * @param contentTree the content tree to which the use information will be added
duke@1 450 */
bpatel@766 451 protected void addUseInfo(List<? extends ProgramElementDoc> mems,
bpatel@766 452 String heading, String tableSummary, Content contentTree) {
duke@1 453 if (mems == null) {
duke@1 454 return;
duke@1 455 }
jjg@74 456 List<? extends ProgramElementDoc> members = mems;
bpatel@243 457 boolean printedUseTableHeader = false;
duke@1 458 if (members.size() > 0) {
bpatel@766 459 Content table = HtmlTree.TABLE(0, 3, 0, tableSummary,
bpatel@766 460 writer.getTableCaption(heading));
bpatel@766 461 Content tbody = new HtmlTree(HtmlTag.TBODY);
bpatel@766 462 Iterator<? extends ProgramElementDoc> it = members.iterator();
bpatel@766 463 for (int i = 0; it.hasNext(); i++) {
jjg@74 464 ProgramElementDoc pgmdoc = it.next();
duke@1 465 ClassDoc cd = pgmdoc.containingClass();
bpatel@243 466 if (!printedUseTableHeader) {
bpatel@766 467 table.addContent(writer.getSummaryTableHeader(
bpatel@766 468 this.getSummaryTableHeader(pgmdoc), "col"));
bpatel@243 469 printedUseTableHeader = true;
bpatel@243 470 }
bpatel@766 471 HtmlTree tr = new HtmlTree(HtmlTag.TR);
bpatel@766 472 if (i % 2 == 0) {
bpatel@766 473 tr.addStyle(HtmlStyle.altColor);
bpatel@766 474 } else {
bpatel@766 475 tr.addStyle(HtmlStyle.rowColor);
bpatel@766 476 }
bpatel@766 477 HtmlTree tdFirst = new HtmlTree(HtmlTag.TD);
bpatel@766 478 tdFirst.addStyle(HtmlStyle.colFirst);
bpatel@766 479 writer.addSummaryType(this, pgmdoc, tdFirst);
bpatel@766 480 tr.addContent(tdFirst);
bpatel@766 481 HtmlTree tdLast = new HtmlTree(HtmlTag.TD);
bpatel@766 482 tdLast.addStyle(HtmlStyle.colLast);
duke@1 483 if (cd != null && !(pgmdoc instanceof ConstructorDoc)
bpatel@766 484 && !(pgmdoc instanceof ClassDoc)) {
bpatel@766 485 HtmlTree name = new HtmlTree(HtmlTag.SPAN);
bpatel@766 486 name.addStyle(HtmlStyle.strong);
bpatel@766 487 name.addContent(cd.name() + ".");
bpatel@766 488 tdLast.addContent(name);
duke@1 489 }
bpatel@766 490 addSummaryLink(pgmdoc instanceof ClassDoc ?
bpatel@766 491 LinkInfoImpl.CONTEXT_CLASS_USE : LinkInfoImpl.CONTEXT_MEMBER,
bpatel@766 492 cd, pgmdoc, tdLast);
bpatel@766 493 writer.addSummaryLinkComment(this, pgmdoc, tdLast);
bpatel@766 494 tr.addContent(tdLast);
bpatel@766 495 tbody.addContent(tr);
duke@1 496 }
bpatel@766 497 table.addContent(tbody);
bpatel@766 498 contentTree.addContent(table);
duke@1 499 }
duke@1 500 }
duke@1 501
bpatel@766 502 /**
bpatel@766 503 * Add the navigation detail link.
bpatel@766 504 *
bpatel@766 505 * @param members the members to be linked
bpatel@766 506 * @param liNav the content tree to which the navigation detail link will be added
bpatel@766 507 */
bpatel@766 508 protected void addNavDetailLink(List<?> members, Content liNav) {
bpatel@766 509 addNavDetailLink(members.size() > 0 ? true : false, liNav);
duke@1 510 }
duke@1 511
bpatel@766 512 /**
bpatel@766 513 * Add the navigation summary link.
bpatel@766 514 *
bpatel@766 515 * @param members members to be linked
bpatel@766 516 * @param visibleMemberMap the visible inherited members map
bpatel@766 517 * @param liNav the content tree to which the navigation summary link will be added
bpatel@766 518 */
bpatel@766 519 protected void addNavSummaryLink(List<?> members,
bpatel@766 520 VisibleMemberMap visibleMemberMap, Content liNav) {
duke@1 521 if (members.size() > 0) {
bpatel@766 522 liNav.addContent(getNavSummaryLink(null, true));
duke@1 523 return;
bpatel@766 524 }
bpatel@766 525 ClassDoc icd = classdoc.superclass();
bpatel@766 526 while (icd != null) {
bpatel@766 527 List<?> inhmembers = visibleMemberMap.getMembersFor(icd);
bpatel@766 528 if (inhmembers.size() > 0) {
bpatel@766 529 liNav.addContent(getNavSummaryLink(icd, true));
bpatel@766 530 return;
duke@1 531 }
bpatel@766 532 icd = icd.superclass();
duke@1 533 }
bpatel@766 534 liNav.addContent(getNavSummaryLink(null, false));
duke@1 535 }
duke@1 536
duke@1 537 protected void serialWarning(SourcePosition pos, String key, String a1, String a2) {
duke@1 538 if (configuration().serialwarn) {
duke@1 539 ConfigurationImpl.getInstance().getDocletSpecificMsg().warning(pos, key, a1, a2);
duke@1 540 }
duke@1 541 }
duke@1 542
duke@1 543 public ProgramElementDoc[] eligibleMembers(ProgramElementDoc[] members) {
duke@1 544 return nodepr? Util.excludeDeprecatedMembers(members): members;
duke@1 545 }
duke@1 546
duke@1 547 public ConfigurationImpl configuration() {
duke@1 548 return writer.configuration;
duke@1 549 }
duke@1 550
duke@1 551 /**
bpatel@766 552 * Add the member summary for the given class.
bpatel@766 553 *
bpatel@766 554 * @param classDoc the class that is being documented
bpatel@766 555 * @param member the member being documented
bpatel@766 556 * @param firstSentenceTags the first sentence tags to be added to the summary
bpatel@766 557 * @param tableTree the content tree to which the documentation will be added
bpatel@766 558 * @param counter the counter for determing style for the table row
duke@1 559 */
bpatel@766 560 public void addMemberSummary(ClassDoc classDoc, ProgramElementDoc member,
bpatel@766 561 Tag[] firstSentenceTags, Content tableTree, int counter) {
bpatel@766 562 HtmlTree tdSummaryType = new HtmlTree(HtmlTag.TD);
bpatel@766 563 tdSummaryType.addStyle(HtmlStyle.colFirst);
bpatel@766 564 writer.addSummaryType(this, member, tdSummaryType);
bpatel@766 565 HtmlTree tdSummary = new HtmlTree(HtmlTag.TD);
bpatel@766 566 setSummaryColumnStyle(tdSummary);
bpatel@766 567 addSummaryLink(classDoc, member, tdSummary);
bpatel@766 568 writer.addSummaryLinkComment(this, member, firstSentenceTags, tdSummary);
bpatel@766 569 HtmlTree tr = HtmlTree.TR(tdSummaryType);
bpatel@766 570 tr.addContent(tdSummary);
bpatel@766 571 if (counter%2 == 0)
bpatel@766 572 tr.addStyle(HtmlStyle.altColor);
bpatel@766 573 else
bpatel@766 574 tr.addStyle(HtmlStyle.rowColor);
bpatel@766 575 tableTree.addContent(tr);
bpatel@766 576 }
bpatel@766 577
bpatel@766 578 /**
bpatel@766 579 * Set the style for the summary column.
bpatel@766 580 *
bpatel@766 581 * @param tdTree the column for which the style will be set
bpatel@766 582 */
bpatel@766 583 public void setSummaryColumnStyle(HtmlTree tdTree) {
bpatel@766 584 tdTree.addStyle(HtmlStyle.colLast);
bpatel@766 585 }
bpatel@766 586
bpatel@766 587 /**
bpatel@766 588 * Add inherited member summary for the given class and member.
bpatel@766 589 *
bpatel@766 590 * @param classDoc the class the inherited member belongs to
bpatel@766 591 * @param nestedClass the inherited member that is summarized
bpatel@766 592 * @param isFirst true if this is the first member in the list
bpatel@766 593 * @param isLast true if this is the last member in the list
bpatel@766 594 * @param linksTree the content tree to which the summary will be added
bpatel@766 595 */
bpatel@766 596 public void addInheritedMemberSummary(ClassDoc classDoc,
bpatel@766 597 ProgramElementDoc nestedClass, boolean isFirst, boolean isLast,
bpatel@766 598 Content linksTree) {
bpatel@766 599 writer.addInheritedMemberSummary(this, classDoc, nestedClass, isFirst,
bpatel@766 600 linksTree);
bpatel@766 601 }
bpatel@766 602
bpatel@766 603 /**
bpatel@766 604 * Get the inherited summary header for the given class.
bpatel@766 605 *
bpatel@766 606 * @param classDoc the class the inherited member belongs to
bpatel@766 607 * @return a content tree for the inherited summary header
bpatel@766 608 */
bpatel@766 609 public Content getInheritedSummaryHeader(ClassDoc classDoc) {
bpatel@766 610 Content inheritedTree = writer.getMemberTreeHeader();
bpatel@766 611 writer.addInheritedSummaryHeader(this, classDoc, inheritedTree);
bpatel@766 612 return inheritedTree;
bpatel@766 613 }
bpatel@766 614
bpatel@766 615 /**
bpatel@766 616 * Get the inherited summary links tree.
bpatel@766 617 *
bpatel@766 618 * @return a content tree for the inherited summary links
bpatel@766 619 */
bpatel@766 620 public Content getInheritedSummaryLinksTree() {
bpatel@766 621 return new HtmlTree(HtmlTag.CODE);
bpatel@766 622 }
bpatel@766 623
bpatel@766 624 /**
bpatel@766 625 * Get the summary table tree for the given class.
bpatel@766 626 *
bpatel@766 627 * @param classDoc the class for which the summary table is generated
bpatel@766 628 * @return a content tree for the summary table
bpatel@766 629 */
bpatel@766 630 public Content getSummaryTableTree(ClassDoc classDoc) {
bpatel@766 631 return writer.getSummaryTableTree(this, classDoc);
bpatel@766 632 }
bpatel@766 633
bpatel@766 634 /**
bpatel@766 635 * Get the member tree to be documented.
bpatel@766 636 *
bpatel@766 637 * @param memberTree the content tree of member to be documented
bpatel@766 638 * @return a content tree that will be added to the class documentation
bpatel@766 639 */
bpatel@766 640 public Content getMemberTree(Content memberTree) {
bpatel@766 641 return writer.getMemberTree(memberTree);
bpatel@766 642 }
bpatel@766 643
bpatel@766 644 /**
bpatel@766 645 * Get the member tree to be documented.
bpatel@766 646 *
bpatel@766 647 * @param memberTree the content tree of member to be documented
bpatel@766 648 * @param isLastContent true if the content to be added is the last content
bpatel@766 649 * @return a content tree that will be added to the class documentation
bpatel@766 650 */
bpatel@766 651 public Content getMemberTree(Content memberTree, boolean isLastContent) {
bpatel@766 652 if (isLastContent)
bpatel@766 653 return HtmlTree.UL(HtmlStyle.blockListLast, memberTree);
bpatel@766 654 else
bpatel@766 655 return HtmlTree.UL(HtmlStyle.blockList, memberTree);
duke@1 656 }
duke@1 657 }

mercurial