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

Thu, 15 Nov 2012 19:54:20 -0800

author
jjg
date
Thu, 15 Nov 2012 19:54:20 -0800
changeset 1412
400a4e8accd3
parent 1410
bfec2a1cc869
child 1417
522a1ee72340
permissions
-rw-r--r--

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

mercurial