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

Tue, 09 Oct 2012 19:10:00 -0700

author
jjg
date
Tue, 09 Oct 2012 19:10:00 -0700
changeset 1357
c75be5bc5283
parent 798
4868a36f6fd8
child 1358
fc123bdeddb8
permissions
-rw-r--r--

8000663: clean up langtools imports
Reviewed-by: darcy

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

mercurial