src/share/classes/com/sun/tools/doclets/formats/html/ClassUseWriter.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 927
b60754fe206d
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) 1998, 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
duke@1 28 import java.io.*;
duke@1 29 import java.util.*;
bpatel@766 30 import com.sun.javadoc.*;
bpatel@766 31 import com.sun.tools.doclets.internal.toolkit.util.*;
bpatel@766 32 import com.sun.tools.doclets.formats.html.markup.*;
bpatel@766 33 import com.sun.tools.doclets.internal.toolkit.*;
duke@1 34
duke@1 35 /**
duke@1 36 * Generate class usage information.
duke@1 37 *
duke@1 38 * @author Robert G. Field
bpatel@243 39 * @author Bhavesh Patel (Modified)
duke@1 40 */
duke@1 41 public class ClassUseWriter extends SubWriterHolderWriter {
duke@1 42
duke@1 43 final ClassDoc classdoc;
mcimadamore@184 44 Set<PackageDoc> pkgToPackageAnnotations = null;
jjg@74 45 final Map<String,List<ProgramElementDoc>> pkgToClassTypeParameter;
jjg@74 46 final Map<String,List<ProgramElementDoc>> pkgToClassAnnotations;
jjg@74 47 final Map<String,List<ProgramElementDoc>> pkgToMethodTypeParameter;
jjg@74 48 final Map<String,List<ProgramElementDoc>> pkgToMethodArgTypeParameter;
jjg@74 49 final Map<String,List<ProgramElementDoc>> pkgToMethodReturnTypeParameter;
jjg@74 50 final Map<String,List<ProgramElementDoc>> pkgToMethodAnnotations;
jjg@74 51 final Map<String,List<ProgramElementDoc>> pkgToMethodParameterAnnotations;
jjg@74 52 final Map<String,List<ProgramElementDoc>> pkgToFieldTypeParameter;
jjg@74 53 final Map<String,List<ProgramElementDoc>> pkgToFieldAnnotations;
jjg@74 54 final Map<String,List<ProgramElementDoc>> pkgToSubclass;
jjg@74 55 final Map<String,List<ProgramElementDoc>> pkgToSubinterface;
jjg@74 56 final Map<String,List<ProgramElementDoc>> pkgToImplementingClass;
jjg@74 57 final Map<String,List<ProgramElementDoc>> pkgToField;
jjg@74 58 final Map<String,List<ProgramElementDoc>> pkgToMethodReturn;
jjg@74 59 final Map<String,List<ProgramElementDoc>> pkgToMethodArgs;
jjg@74 60 final Map<String,List<ProgramElementDoc>> pkgToMethodThrows;
jjg@74 61 final Map<String,List<ProgramElementDoc>> pkgToConstructorAnnotations;
jjg@74 62 final Map<String,List<ProgramElementDoc>> pkgToConstructorParameterAnnotations;
jjg@74 63 final Map<String,List<ProgramElementDoc>> pkgToConstructorArgs;
jjg@74 64 final Map<String,List<ProgramElementDoc>> pkgToConstructorArgTypeParameter;
jjg@74 65 final Map<String,List<ProgramElementDoc>> pkgToConstructorThrows;
jjg@74 66 final SortedSet<PackageDoc> pkgSet;
duke@1 67 final MethodWriterImpl methodSubWriter;
duke@1 68 final ConstructorWriterImpl constrSubWriter;
duke@1 69 final FieldWriterImpl fieldSubWriter;
duke@1 70 final NestedClassWriterImpl classSubWriter;
bpatel@243 71 // Summary for various use tables.
bpatel@243 72 final String classUseTableSummary;
bpatel@243 73 final String subclassUseTableSummary;
bpatel@243 74 final String subinterfaceUseTableSummary;
bpatel@243 75 final String fieldUseTableSummary;
bpatel@243 76 final String methodUseTableSummary;
bpatel@243 77 final String constructorUseTableSummary;
duke@1 78
duke@1 79
duke@1 80 /**
duke@1 81 * Constructor.
duke@1 82 *
duke@1 83 * @param filename the file to be generated.
duke@1 84 * @throws IOException
duke@1 85 * @throws DocletAbortException
duke@1 86 */
duke@1 87 public ClassUseWriter(ConfigurationImpl configuration,
duke@1 88 ClassUseMapper mapper, String path,
duke@1 89 String filename, String relpath,
duke@1 90 ClassDoc classdoc) throws IOException {
duke@1 91 super(configuration, path, filename, relpath);
duke@1 92 this.classdoc = classdoc;
duke@1 93 if (mapper.classToPackageAnnotations.containsKey(classdoc.qualifiedName()))
jjg@74 94 pkgToPackageAnnotations = new HashSet<PackageDoc>(mapper.classToPackageAnnotations.get(classdoc.qualifiedName()));
duke@1 95 configuration.currentcd = classdoc;
jjg@74 96 this.pkgSet = new TreeSet<PackageDoc>();
duke@1 97 this.pkgToClassTypeParameter = pkgDivide(mapper.classToClassTypeParam);
duke@1 98 this.pkgToClassAnnotations = pkgDivide(mapper.classToClassAnnotations);
duke@1 99 this.pkgToMethodTypeParameter = pkgDivide(mapper.classToExecMemberDocTypeParam);
duke@1 100 this.pkgToMethodArgTypeParameter = pkgDivide(mapper.classToExecMemberDocArgTypeParam);
duke@1 101 this.pkgToFieldTypeParameter = pkgDivide(mapper.classToFieldDocTypeParam);
duke@1 102 this.pkgToFieldAnnotations = pkgDivide(mapper.annotationToFieldDoc);
duke@1 103 this.pkgToMethodReturnTypeParameter = pkgDivide(mapper.classToExecMemberDocReturnTypeParam);
duke@1 104 this.pkgToMethodAnnotations = pkgDivide(mapper.classToExecMemberDocAnnotations);
duke@1 105 this.pkgToMethodParameterAnnotations = pkgDivide(mapper.classToExecMemberDocParamAnnotation);
duke@1 106 this.pkgToSubclass = pkgDivide(mapper.classToSubclass);
duke@1 107 this.pkgToSubinterface = pkgDivide(mapper.classToSubinterface);
duke@1 108 this.pkgToImplementingClass = pkgDivide(mapper.classToImplementingClass);
duke@1 109 this.pkgToField = pkgDivide(mapper.classToField);
duke@1 110 this.pkgToMethodReturn = pkgDivide(mapper.classToMethodReturn);
duke@1 111 this.pkgToMethodArgs = pkgDivide(mapper.classToMethodArgs);
duke@1 112 this.pkgToMethodThrows = pkgDivide(mapper.classToMethodThrows);
duke@1 113 this.pkgToConstructorAnnotations = pkgDivide(mapper.classToConstructorAnnotations);
duke@1 114 this.pkgToConstructorParameterAnnotations = pkgDivide(mapper.classToConstructorParamAnnotation);
duke@1 115 this.pkgToConstructorArgs = pkgDivide(mapper.classToConstructorArgs);
duke@1 116 this.pkgToConstructorArgTypeParameter = pkgDivide(mapper.classToConstructorDocArgTypeParam);
duke@1 117 this.pkgToConstructorThrows = pkgDivide(mapper.classToConstructorThrows);
duke@1 118 //tmp test
duke@1 119 if (pkgSet.size() > 0 &&
duke@1 120 mapper.classToPackage.containsKey(classdoc.qualifiedName()) &&
duke@1 121 !pkgSet.equals(mapper.classToPackage.get(classdoc.qualifiedName()))) {
duke@1 122 configuration.root.printWarning("Internal error: package sets don't match: " + pkgSet + " with: " +
duke@1 123 mapper.classToPackage.get(classdoc.qualifiedName()));
duke@1 124 }
duke@1 125 methodSubWriter = new MethodWriterImpl(this);
duke@1 126 constrSubWriter = new ConstructorWriterImpl(this);
duke@1 127 fieldSubWriter = new FieldWriterImpl(this);
duke@1 128 classSubWriter = new NestedClassWriterImpl(this);
bpatel@243 129 classUseTableSummary = configuration.getText("doclet.Use_Table_Summary",
bpatel@243 130 configuration.getText("doclet.classes"));
bpatel@243 131 subclassUseTableSummary = configuration.getText("doclet.Use_Table_Summary",
bpatel@243 132 configuration.getText("doclet.subclasses"));
bpatel@243 133 subinterfaceUseTableSummary = configuration.getText("doclet.Use_Table_Summary",
bpatel@243 134 configuration.getText("doclet.subinterfaces"));
bpatel@243 135 fieldUseTableSummary = configuration.getText("doclet.Use_Table_Summary",
bpatel@243 136 configuration.getText("doclet.fields"));
bpatel@243 137 methodUseTableSummary = configuration.getText("doclet.Use_Table_Summary",
bpatel@243 138 configuration.getText("doclet.methods"));
bpatel@243 139 constructorUseTableSummary = configuration.getText("doclet.Use_Table_Summary",
bpatel@243 140 configuration.getText("doclet.constructors"));
duke@1 141 }
duke@1 142
duke@1 143 /**
duke@1 144 * Write out class use pages.
duke@1 145 * @throws DocletAbortException
duke@1 146 */
duke@1 147 public static void generate(ConfigurationImpl configuration,
duke@1 148 ClassTree classtree) {
duke@1 149 ClassUseMapper mapper = new ClassUseMapper(configuration.root, classtree);
duke@1 150 ClassDoc[] classes = configuration.root.classes();
duke@1 151 for (int i = 0; i < classes.length; i++) {
duke@1 152 ClassUseWriter.generate(configuration, mapper, classes[i]);
duke@1 153 }
duke@1 154 PackageDoc[] pkgs = configuration.packages;
duke@1 155 for (int i = 0; i < pkgs.length; i++) {
duke@1 156 PackageUseWriter.generate(configuration, mapper, pkgs[i]);
duke@1 157 }
duke@1 158 }
duke@1 159
jjg@74 160 private Map<String,List<ProgramElementDoc>> pkgDivide(Map<String,? extends List<? extends ProgramElementDoc>> classMap) {
jjg@74 161 Map<String,List<ProgramElementDoc>> map = new HashMap<String,List<ProgramElementDoc>>();
jjg@74 162 List<? extends ProgramElementDoc> list= classMap.get(classdoc.qualifiedName());
duke@1 163 if (list != null) {
duke@1 164 Collections.sort(list);
jjg@74 165 Iterator<? extends ProgramElementDoc> it = list.iterator();
duke@1 166 while (it.hasNext()) {
jjg@74 167 ProgramElementDoc doc = it.next();
duke@1 168 PackageDoc pkg = doc.containingPackage();
duke@1 169 pkgSet.add(pkg);
jjg@74 170 List<ProgramElementDoc> inPkg = map.get(pkg.name());
duke@1 171 if (inPkg == null) {
jjg@74 172 inPkg = new ArrayList<ProgramElementDoc>();
duke@1 173 map.put(pkg.name(), inPkg);
duke@1 174 }
duke@1 175 inPkg.add(doc);
duke@1 176 }
duke@1 177 }
duke@1 178 return map;
duke@1 179 }
duke@1 180
duke@1 181 /**
duke@1 182 * Generate a class page.
duke@1 183 */
duke@1 184 public static void generate(ConfigurationImpl configuration,
duke@1 185 ClassUseMapper mapper, ClassDoc classdoc) {
duke@1 186 ClassUseWriter clsgen;
duke@1 187 String path = DirectoryManager.getDirectoryPath(classdoc.
duke@1 188 containingPackage());
duke@1 189 if (path.length() > 0) {
duke@1 190 path += File.separator;
duke@1 191 }
duke@1 192 path += "class-use";
duke@1 193 String filename = classdoc.name() + ".html";
duke@1 194 String pkgname = classdoc.containingPackage().name();
duke@1 195 pkgname += (pkgname.length() > 0)? ".class-use": "class-use";
duke@1 196 String relpath = DirectoryManager.getRelativePath(pkgname);
duke@1 197 try {
duke@1 198 clsgen = new ClassUseWriter(configuration,
duke@1 199 mapper, path, filename,
duke@1 200 relpath, classdoc);
duke@1 201 clsgen.generateClassUseFile();
duke@1 202 clsgen.close();
duke@1 203 } catch (IOException exc) {
duke@1 204 configuration.standardmessage.
duke@1 205 error("doclet.exception_encountered",
duke@1 206 exc.toString(), filename);
duke@1 207 throw new DocletAbortException();
duke@1 208 }
duke@1 209 }
duke@1 210
duke@1 211 /**
bpatel@766 212 * Generate the class use list.
duke@1 213 */
duke@1 214 protected void generateClassUseFile() throws IOException {
bpatel@766 215 Content body = getClassUseHeader();
bpatel@766 216 HtmlTree div = new HtmlTree(HtmlTag.DIV);
bpatel@766 217 div.addStyle(HtmlStyle.classUseContainer);
duke@1 218 if (pkgSet.size() > 0) {
bpatel@766 219 addClassUse(div);
duke@1 220 } else {
bpatel@766 221 div.addContent(getResource("doclet.ClassUse_No.usage.of.0",
bpatel@766 222 classdoc.qualifiedName()));
duke@1 223 }
bpatel@766 224 body.addContent(div);
bpatel@766 225 addNavLinks(false, body);
bpatel@766 226 addBottom(body);
bpatel@766 227 printHtmlDocument(null, true, body);
duke@1 228 }
duke@1 229
duke@1 230 /**
bpatel@766 231 * Add the class use documentation.
bpatel@766 232 *
bpatel@766 233 * @param contentTree the content tree to which the class use information will be added
duke@1 234 */
bpatel@766 235 protected void addClassUse(Content contentTree) throws IOException {
bpatel@766 236 HtmlTree ul = new HtmlTree(HtmlTag.UL);
bpatel@766 237 ul.addStyle(HtmlStyle.blockList);
bpatel@766 238 if (configuration.packages.length > 1) {
bpatel@766 239 addPackageList(ul);
bpatel@766 240 addPackageAnnotationList(ul);
bpatel@766 241 }
bpatel@766 242 addClassList(ul);
bpatel@766 243 contentTree.addContent(ul);
duke@1 244 }
duke@1 245
duke@1 246 /**
bpatel@766 247 * Add the packages list that use the given class.
bpatel@766 248 *
bpatel@766 249 * @param contentTree the content tree to which the packages list will be added
duke@1 250 */
bpatel@766 251 protected void addPackageList(Content contentTree) throws IOException {
bpatel@766 252 Content table = HtmlTree.TABLE(0, 3, 0, useTableSummary,
bpatel@766 253 getTableCaption(configuration().getText(
bpatel@766 254 "doclet.ClassUse_Packages.that.use.0",
bpatel@766 255 getLink(new LinkInfoImpl(LinkInfoImpl.CONTEXT_CLASS_USE_HEADER, classdoc,
bpatel@766 256 false)))));
bpatel@766 257 table.addContent(getSummaryTableHeader(packageTableHeader, "col"));
bpatel@766 258 Content tbody = new HtmlTree(HtmlTag.TBODY);
bpatel@766 259 Iterator<PackageDoc> it = pkgSet.iterator();
bpatel@766 260 for (int i = 0; it.hasNext(); i++) {
bpatel@766 261 PackageDoc pkg = it.next();
bpatel@766 262 HtmlTree tr = new HtmlTree(HtmlTag.TR);
bpatel@766 263 if (i % 2 == 0) {
bpatel@766 264 tr.addStyle(HtmlStyle.altColor);
bpatel@766 265 } else {
bpatel@766 266 tr.addStyle(HtmlStyle.rowColor);
bpatel@766 267 }
bpatel@766 268 addPackageUse(pkg, tr);
bpatel@766 269 tbody.addContent(tr);
bpatel@766 270 }
bpatel@766 271 table.addContent(tbody);
bpatel@766 272 Content li = HtmlTree.LI(HtmlStyle.blockList, table);
bpatel@766 273 contentTree.addContent(li);
duke@1 274 }
duke@1 275
duke@1 276 /**
bpatel@766 277 * Add the package annotation list.
bpatel@766 278 *
bpatel@766 279 * @param contentTree the content tree to which the package annotation list will be added
duke@1 280 */
bpatel@766 281 protected void addPackageAnnotationList(Content contentTree) throws IOException {
bpatel@766 282 if ((!classdoc.isAnnotationType()) ||
bpatel@766 283 pkgToPackageAnnotations == null ||
bpatel@766 284 pkgToPackageAnnotations.size() == 0) {
bpatel@766 285 return;
bpatel@766 286 }
bpatel@766 287 Content table = HtmlTree.TABLE(0, 3, 0, useTableSummary,
bpatel@766 288 getTableCaption(configuration().getText(
bpatel@766 289 "doclet.ClassUse_PackageAnnotation",
bpatel@766 290 getLink(new LinkInfoImpl(LinkInfoImpl.CONTEXT_CLASS_USE_HEADER, classdoc,
bpatel@766 291 false)))));
bpatel@766 292 table.addContent(getSummaryTableHeader(packageTableHeader, "col"));
bpatel@766 293 Content tbody = new HtmlTree(HtmlTag.TBODY);
bpatel@766 294 Iterator<PackageDoc> it = pkgToPackageAnnotations.iterator();
bpatel@766 295 for (int i = 0; it.hasNext(); i++) {
bpatel@766 296 PackageDoc pkg = it.next();
bpatel@766 297 HtmlTree tr = new HtmlTree(HtmlTag.TR);
bpatel@766 298 if (i % 2 == 0) {
bpatel@766 299 tr.addStyle(HtmlStyle.altColor);
bpatel@766 300 } else {
bpatel@766 301 tr.addStyle(HtmlStyle.rowColor);
bpatel@766 302 }
bpatel@766 303 Content tdFirst = HtmlTree.TD(HtmlStyle.colFirst,
bpatel@766 304 getPackageLink(pkg, new StringContent(pkg.name())));
bpatel@766 305 tr.addContent(tdFirst);
bpatel@766 306 HtmlTree tdLast = new HtmlTree(HtmlTag.TD);
bpatel@766 307 tdLast.addStyle(HtmlStyle.colLast);
bpatel@766 308 if (pkg != null) {
bpatel@766 309 addSummaryComment(pkg, tdLast);
bpatel@766 310 } else {
bpatel@766 311 tdLast.addContent(getSpace());
bpatel@766 312 }
bpatel@766 313 tr.addContent(tdLast);
bpatel@766 314 tbody.addContent(tr);
bpatel@766 315 }
bpatel@766 316 table.addContent(tbody);
bpatel@766 317 Content li = HtmlTree.LI(HtmlStyle.blockList, table);
bpatel@766 318 contentTree.addContent(li);
duke@1 319 }
duke@1 320
duke@1 321 /**
bpatel@766 322 * Add the class list that use the given class.
bpatel@766 323 *
bpatel@766 324 * @param contentTree the content tree to which the class list will be added
duke@1 325 */
bpatel@766 326 protected void addClassList(Content contentTree) throws IOException {
bpatel@766 327 HtmlTree ul = new HtmlTree(HtmlTag.UL);
bpatel@766 328 ul.addStyle(HtmlStyle.blockList);
bpatel@766 329 for (Iterator<PackageDoc> it = pkgSet.iterator(); it.hasNext();) {
bpatel@766 330 PackageDoc pkg = it.next();
bpatel@766 331 Content li = HtmlTree.LI(HtmlStyle.blockList, getMarkerAnchor(pkg.name()));
bpatel@766 332 Content link = new RawHtml(
bpatel@766 333 configuration.getText("doclet.ClassUse_Uses.of.0.in.1",
bpatel@766 334 getLink(new LinkInfoImpl(LinkInfoImpl.CONTEXT_CLASS_USE_HEADER,
bpatel@766 335 classdoc, false)),
bpatel@766 336 getPackageLinkString(pkg, Util.getPackageName(pkg), false)));
bpatel@766 337 Content heading = HtmlTree.HEADING(HtmlConstants.SUMMARY_HEADING, link);
bpatel@766 338 li.addContent(heading);
bpatel@766 339 addClassUse(pkg, li);
bpatel@766 340 ul.addContent(li);
bpatel@766 341 }
bpatel@766 342 Content li = HtmlTree.LI(HtmlStyle.blockList, ul);
bpatel@766 343 contentTree.addContent(li);
duke@1 344 }
duke@1 345
duke@1 346 /**
bpatel@766 347 * Add the package use information.
bpatel@766 348 *
bpatel@766 349 * @param pkg the package that uses the given class
bpatel@766 350 * @param contentTree the content tree to which the package use information will be added
duke@1 351 */
bpatel@766 352 protected void addPackageUse(PackageDoc pkg, Content contentTree) throws IOException {
bpatel@766 353 Content tdFirst = HtmlTree.TD(HtmlStyle.colFirst,
bpatel@766 354 getHyperLink("", pkg.name(), new StringContent(Util.getPackageName(pkg))));
bpatel@766 355 contentTree.addContent(tdFirst);
bpatel@766 356 HtmlTree tdLast = new HtmlTree(HtmlTag.TD);
bpatel@766 357 tdLast.addStyle(HtmlStyle.colLast);
bpatel@766 358 if (pkg != null)
bpatel@766 359 addSummaryComment(pkg, tdLast);
bpatel@766 360 else
bpatel@766 361 tdLast.addContent(getSpace());
bpatel@766 362 contentTree.addContent(tdLast);
duke@1 363 }
duke@1 364
duke@1 365 /**
bpatel@766 366 * Add the class use information.
bpatel@766 367 *
bpatel@766 368 * @param pkg the package that uses the given class
bpatel@766 369 * @param contentTree the content tree to which the class use information will be added
duke@1 370 */
bpatel@766 371 protected void addClassUse(PackageDoc pkg, Content contentTree) throws IOException {
bpatel@766 372 String classLink = getLink(new LinkInfoImpl(
bpatel@766 373 LinkInfoImpl.CONTEXT_CLASS_USE_HEADER, classdoc, false));
bpatel@766 374 String pkgLink = getPackageLinkString(pkg, Util.getPackageName(pkg), false);
bpatel@766 375 classSubWriter.addUseInfo(pkgToClassAnnotations.get(pkg.name()),
bpatel@766 376 configuration.getText("doclet.ClassUse_Annotation", classLink,
bpatel@766 377 pkgLink), classUseTableSummary, contentTree);
bpatel@766 378 classSubWriter.addUseInfo(pkgToClassTypeParameter.get(pkg.name()),
bpatel@766 379 configuration.getText("doclet.ClassUse_TypeParameter", classLink,
bpatel@766 380 pkgLink), classUseTableSummary, contentTree);
bpatel@766 381 classSubWriter.addUseInfo(pkgToSubclass.get(pkg.name()),
bpatel@766 382 configuration.getText("doclet.ClassUse_Subclass", classLink,
bpatel@766 383 pkgLink), subclassUseTableSummary, contentTree);
bpatel@766 384 classSubWriter.addUseInfo(pkgToSubinterface.get(pkg.name()),
bpatel@766 385 configuration.getText("doclet.ClassUse_Subinterface", classLink,
bpatel@766 386 pkgLink), subinterfaceUseTableSummary, contentTree);
bpatel@766 387 classSubWriter.addUseInfo(pkgToImplementingClass.get(pkg.name()),
bpatel@766 388 configuration.getText("doclet.ClassUse_ImplementingClass", classLink,
bpatel@766 389 pkgLink), classUseTableSummary, contentTree);
bpatel@766 390 fieldSubWriter.addUseInfo(pkgToField.get(pkg.name()),
bpatel@766 391 configuration.getText("doclet.ClassUse_Field", classLink,
bpatel@766 392 pkgLink), fieldUseTableSummary, contentTree);
bpatel@766 393 fieldSubWriter.addUseInfo(pkgToFieldAnnotations.get(pkg.name()),
bpatel@766 394 configuration.getText("doclet.ClassUse_FieldAnnotations", classLink,
bpatel@766 395 pkgLink), fieldUseTableSummary, contentTree);
bpatel@766 396 fieldSubWriter.addUseInfo(pkgToFieldTypeParameter.get(pkg.name()),
bpatel@766 397 configuration.getText("doclet.ClassUse_FieldTypeParameter", classLink,
bpatel@766 398 pkgLink), fieldUseTableSummary, contentTree);
bpatel@766 399 methodSubWriter.addUseInfo(pkgToMethodAnnotations.get(pkg.name()),
bpatel@766 400 configuration.getText("doclet.ClassUse_MethodAnnotations", classLink,
bpatel@766 401 pkgLink), methodUseTableSummary, contentTree);
bpatel@766 402 methodSubWriter.addUseInfo(pkgToMethodParameterAnnotations.get(pkg.name()),
bpatel@766 403 configuration.getText("doclet.ClassUse_MethodParameterAnnotations", classLink,
bpatel@766 404 pkgLink), methodUseTableSummary, contentTree);
bpatel@766 405 methodSubWriter.addUseInfo(pkgToMethodTypeParameter.get(pkg.name()),
bpatel@766 406 configuration.getText("doclet.ClassUse_MethodTypeParameter", classLink,
bpatel@766 407 pkgLink), methodUseTableSummary, contentTree);
bpatel@766 408 methodSubWriter.addUseInfo(pkgToMethodReturn.get(pkg.name()),
bpatel@766 409 configuration.getText("doclet.ClassUse_MethodReturn", classLink,
bpatel@766 410 pkgLink), methodUseTableSummary, contentTree);
bpatel@766 411 methodSubWriter.addUseInfo(pkgToMethodReturnTypeParameter.get(pkg.name()),
bpatel@766 412 configuration.getText("doclet.ClassUse_MethodReturnTypeParameter", classLink,
bpatel@766 413 pkgLink), methodUseTableSummary, contentTree);
bpatel@766 414 methodSubWriter.addUseInfo(pkgToMethodArgs.get(pkg.name()),
bpatel@766 415 configuration.getText("doclet.ClassUse_MethodArgs", classLink,
bpatel@766 416 pkgLink), methodUseTableSummary, contentTree);
bpatel@766 417 methodSubWriter.addUseInfo(pkgToMethodArgTypeParameter.get(pkg.name()),
bpatel@766 418 configuration.getText("doclet.ClassUse_MethodArgsTypeParameters", classLink,
bpatel@766 419 pkgLink), methodUseTableSummary, contentTree);
bpatel@766 420 methodSubWriter.addUseInfo(pkgToMethodThrows.get(pkg.name()),
bpatel@766 421 configuration.getText("doclet.ClassUse_MethodThrows", classLink,
bpatel@766 422 pkgLink), methodUseTableSummary, contentTree);
bpatel@766 423 constrSubWriter.addUseInfo(pkgToConstructorAnnotations.get(pkg.name()),
bpatel@766 424 configuration.getText("doclet.ClassUse_ConstructorAnnotations", classLink,
bpatel@766 425 pkgLink), constructorUseTableSummary, contentTree);
bpatel@766 426 constrSubWriter.addUseInfo(pkgToConstructorParameterAnnotations.get(pkg.name()),
bpatel@766 427 configuration.getText("doclet.ClassUse_ConstructorParameterAnnotations", classLink,
bpatel@766 428 pkgLink), constructorUseTableSummary, contentTree);
bpatel@766 429 constrSubWriter.addUseInfo(pkgToConstructorArgs.get(pkg.name()),
bpatel@766 430 configuration.getText("doclet.ClassUse_ConstructorArgs", classLink,
bpatel@766 431 pkgLink), constructorUseTableSummary, contentTree);
bpatel@766 432 constrSubWriter.addUseInfo(pkgToConstructorArgTypeParameter.get(pkg.name()),
bpatel@766 433 configuration.getText("doclet.ClassUse_ConstructorArgsTypeParameters", classLink,
bpatel@766 434 pkgLink), constructorUseTableSummary, contentTree);
bpatel@766 435 constrSubWriter.addUseInfo(pkgToConstructorThrows.get(pkg.name()),
bpatel@766 436 configuration.getText("doclet.ClassUse_ConstructorThrows", classLink,
bpatel@766 437 pkgLink), constructorUseTableSummary, contentTree);
duke@1 438 }
duke@1 439
bpatel@766 440 /**
bpatel@766 441 * Get the header for the class use Listing.
bpatel@766 442 *
bpatel@766 443 * @return a content tree representing the class use header
bpatel@766 444 */
bpatel@766 445 protected Content getClassUseHeader() {
bpatel@766 446 String cltype = configuration.getText(classdoc.isInterface()?
bpatel@766 447 "doclet.Interface":"doclet.Class");
bpatel@766 448 String clname = classdoc.qualifiedName();
bpatel@766 449 String title = configuration.getText("doclet.Window_ClassUse_Header",
bpatel@766 450 cltype, clname);
bpatel@766 451 Content bodyTree = getBody(true, getWindowTitle(title));
bpatel@766 452 addTop(bodyTree);
bpatel@766 453 addNavLinks(true, bodyTree);
bpatel@766 454 Content headContent = getResource("doclet.ClassUse_Title", cltype, clname);
bpatel@766 455 Content heading = HtmlTree.HEADING(HtmlConstants.CLASS_PAGE_HEADING,
bpatel@766 456 true, HtmlStyle.title, headContent);
bpatel@766 457 Content div = HtmlTree.DIV(HtmlStyle.header, heading);
bpatel@766 458 bodyTree.addContent(div);
bpatel@766 459 return bodyTree;
duke@1 460 }
duke@1 461
bpatel@766 462 /**
bpatel@766 463 * Get this package link.
bpatel@766 464 *
bpatel@766 465 * @return a content tree for the package link
bpatel@766 466 */
bpatel@766 467 protected Content getNavLinkPackage() {
bpatel@766 468 Content linkContent = getHyperLink("../package-summary.html", "",
bpatel@766 469 packageLabel);
bpatel@766 470 Content li = HtmlTree.LI(linkContent);
bpatel@766 471 return li;
bpatel@766 472 }
bpatel@766 473
bpatel@766 474 /**
bpatel@766 475 * Get class page link.
bpatel@766 476 *
bpatel@766 477 * @return a content tree for the class page link
bpatel@766 478 */
bpatel@766 479 protected Content getNavLinkClass() {
bpatel@766 480 Content linkContent = new RawHtml(getLink(new LinkInfoImpl(
bpatel@766 481 LinkInfoImpl.CONTEXT_CLASS_USE_HEADER, classdoc, "",
bpatel@766 482 configuration.getText("doclet.Class"), false)));
bpatel@766 483 Content li = HtmlTree.LI(linkContent);
bpatel@766 484 return li;
bpatel@766 485 }
bpatel@766 486
bpatel@766 487 /**
bpatel@766 488 * Get the use link.
bpatel@766 489 *
bpatel@766 490 * @return a content tree for the use link
bpatel@766 491 */
bpatel@766 492 protected Content getNavLinkClassUse() {
bpatel@766 493 Content li = HtmlTree.LI(HtmlStyle.navBarCell1Rev, useLabel);
bpatel@766 494 return li;
bpatel@766 495 }
bpatel@766 496
bpatel@766 497 /**
bpatel@766 498 * Get the tree link.
bpatel@766 499 *
bpatel@766 500 * @return a content tree for the tree link
bpatel@766 501 */
bpatel@766 502 protected Content getNavLinkTree() {
bpatel@766 503 Content linkContent = classdoc.containingPackage().isIncluded() ?
bpatel@766 504 getHyperLink("../package-tree.html", "", treeLabel) :
bpatel@766 505 getHyperLink(relativePath + "overview-tree.html", "", treeLabel);
bpatel@766 506 Content li = HtmlTree.LI(linkContent);
bpatel@766 507 return li;
bpatel@766 508 }
duke@1 509 }

mercurial