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

changeset 1735
8ea30d59ac41
parent 1568
5f0731e4e5e6
child 1736
74cd21f2c2fe
equal deleted inserted replaced
1734:8dd528992c15 1735:8ea30d59ac41
123 */ 123 */
124 public Content getNavLinkPrevious() { 124 public Content getNavLinkPrevious() {
125 Content li; 125 Content li;
126 if (prev != null) { 126 if (prev != null) {
127 Content prevLink = new RawHtml(getLink(new LinkInfoImpl(configuration, 127 Content prevLink = new RawHtml(getLink(new LinkInfoImpl(configuration,
128 LinkInfoImpl.CONTEXT_CLASS, prev, "", 128 LinkInfoImpl.Kind.CLASS, prev, "",
129 configuration.getText("doclet.Prev_Class"), true))); 129 configuration.getText("doclet.Prev_Class"), true)));
130 li = HtmlTree.LI(prevLink); 130 li = HtmlTree.LI(prevLink);
131 } 131 }
132 else 132 else
133 li = HtmlTree.LI(prevclassLabel); 133 li = HtmlTree.LI(prevclassLabel);
141 */ 141 */
142 public Content getNavLinkNext() { 142 public Content getNavLinkNext() {
143 Content li; 143 Content li;
144 if (next != null) { 144 if (next != null) {
145 Content nextLink = new RawHtml(getLink(new LinkInfoImpl(configuration, 145 Content nextLink = new RawHtml(getLink(new LinkInfoImpl(configuration,
146 LinkInfoImpl.CONTEXT_CLASS, next, "", 146 LinkInfoImpl.Kind.CLASS, next, "",
147 configuration.getText("doclet.Next_Class"), true))); 147 configuration.getText("doclet.Next_Class"), true)));
148 li = HtmlTree.LI(nextLink); 148 li = HtmlTree.LI(nextLink);
149 } 149 }
150 else 150 else
151 li = HtmlTree.LI(nextclassLabel); 151 li = HtmlTree.LI(nextclassLabel);
183 Content pkgNameContent = new StringContent(pkgname); 183 Content pkgNameContent = new StringContent(pkgname);
184 Content pkgNameDiv = HtmlTree.DIV(HtmlStyle.subTitle, pkgNameContent); 184 Content pkgNameDiv = HtmlTree.DIV(HtmlStyle.subTitle, pkgNameContent);
185 div.addContent(pkgNameDiv); 185 div.addContent(pkgNameDiv);
186 } 186 }
187 LinkInfoImpl linkInfo = new LinkInfoImpl(configuration, 187 LinkInfoImpl linkInfo = new LinkInfoImpl(configuration,
188 LinkInfoImpl.CONTEXT_CLASS_HEADER, classDoc, false); 188 LinkInfoImpl.Kind.CLASS_HEADER, classDoc, false);
189 //Let's not link to ourselves in the header. 189 //Let's not link to ourselves in the header.
190 linkInfo.linkToSelf = false; 190 linkInfo.linkToSelf = false;
191 Content headerContent = new StringContent(header); 191 Content headerContent = new StringContent(header);
192 Content heading = HtmlTree.HEADING(HtmlConstants.CLASS_PAGE_HEADING, true, 192 Content heading = HtmlTree.HEADING(HtmlConstants.CLASS_PAGE_HEADING, true,
193 HtmlStyle.title, headerContent); 193 HtmlStyle.title, headerContent);
243 classInfoTree.addContent(new HtmlTree(HtmlTag.BR)); 243 classInfoTree.addContent(new HtmlTree(HtmlTag.BR));
244 Content pre = new HtmlTree(HtmlTag.PRE); 244 Content pre = new HtmlTree(HtmlTag.PRE);
245 addAnnotationInfo(classDoc, pre); 245 addAnnotationInfo(classDoc, pre);
246 pre.addContent(modifiers); 246 pre.addContent(modifiers);
247 LinkInfoImpl linkInfo = new LinkInfoImpl(configuration, 247 LinkInfoImpl linkInfo = new LinkInfoImpl(configuration,
248 LinkInfoImpl.CONTEXT_CLASS_SIGNATURE, classDoc, false); 248 LinkInfoImpl.Kind.CLASS_SIGNATURE, classDoc, false);
249 //Let's not link to ourselves in the signature. 249 //Let's not link to ourselves in the signature.
250 linkInfo.linkToSelf = false; 250 linkInfo.linkToSelf = false;
251 Content className = new StringContent(classDoc.name()); 251 Content className = new StringContent(classDoc.name());
252 Content parameterLinks = new RawHtml(getTypeParameterLinks(linkInfo)); 252 Content parameterLinks = new RawHtml(getTypeParameterLinks(linkInfo));
253 if (configuration.linksource) { 253 if (configuration.linksource) {
263 configuration); 263 configuration);
264 if (superclass != null) { 264 if (superclass != null) {
265 pre.addContent(DocletConstants.NL); 265 pre.addContent(DocletConstants.NL);
266 pre.addContent("extends "); 266 pre.addContent("extends ");
267 Content link = new RawHtml(getLink(new LinkInfoImpl(configuration, 267 Content link = new RawHtml(getLink(new LinkInfoImpl(configuration,
268 LinkInfoImpl.CONTEXT_CLASS_SIGNATURE_PARENT_NAME, 268 LinkInfoImpl.Kind.CLASS_SIGNATURE_PARENT_NAME,
269 superclass))); 269 superclass)));
270 pre.addContent(link); 270 pre.addContent(link);
271 } 271 }
272 } 272 }
273 Type[] implIntfacs = classDoc.interfaceTypes(); 273 Type[] implIntfacs = classDoc.interfaceTypes();
284 pre.addContent(isInterface? "extends " : "implements "); 284 pre.addContent(isInterface? "extends " : "implements ");
285 } else { 285 } else {
286 pre.addContent(", "); 286 pre.addContent(", ");
287 } 287 }
288 Content link = new RawHtml(getLink(new LinkInfoImpl(configuration, 288 Content link = new RawHtml(getLink(new LinkInfoImpl(configuration,
289 LinkInfoImpl.CONTEXT_CLASS_SIGNATURE_PARENT_NAME, 289 LinkInfoImpl.Kind.CLASS_SIGNATURE_PARENT_NAME,
290 implIntfacs[i]))); 290 implIntfacs[i])));
291 pre.addContent(link); 291 pre.addContent(link);
292 counter++; 292 counter++;
293 } 293 }
294 } 294 }
359 */ 359 */
360 private Content getTreeForClassHelper(Type type) { 360 private Content getTreeForClassHelper(Type type) {
361 Content li = new HtmlTree(HtmlTag.LI); 361 Content li = new HtmlTree(HtmlTag.LI);
362 if (type.equals(classDoc)) { 362 if (type.equals(classDoc)) {
363 String typeParameters = getTypeParameterLinks( 363 String typeParameters = getTypeParameterLinks(
364 new LinkInfoImpl(configuration, LinkInfoImpl.CONTEXT_TREE, 364 new LinkInfoImpl(configuration, LinkInfoImpl.Kind.TREE,
365 classDoc, false)); 365 classDoc, false));
366 if (configuration.shouldExcludeQualifier( 366 if (configuration.shouldExcludeQualifier(
367 classDoc.containingPackage().name())) { 367 classDoc.containingPackage().name())) {
368 li.addContent(type.asClassDoc().name()); 368 li.addContent(type.asClassDoc().name());
369 li.addContent(new RawHtml(typeParameters)); 369 li.addContent(new RawHtml(typeParameters));
371 li.addContent(type.asClassDoc().qualifiedName()); 371 li.addContent(type.asClassDoc().qualifiedName());
372 li.addContent(new RawHtml(typeParameters)); 372 li.addContent(new RawHtml(typeParameters));
373 } 373 }
374 } else { 374 } else {
375 Content link = new RawHtml(getLink(new LinkInfoImpl(configuration, 375 Content link = new RawHtml(getLink(new LinkInfoImpl(configuration,
376 LinkInfoImpl.CONTEXT_CLASS_TREE_PARENT, 376 LinkInfoImpl.Kind.CLASS_TREE_PARENT,
377 type instanceof ClassDoc ? (ClassDoc) type : type, 377 type instanceof ClassDoc ? (ClassDoc) type : type,
378 configuration.getClassName(type.asClassDoc()), false))); 378 configuration.getClassName(type.asClassDoc()), false)));
379 li.addContent(link); 379 li.addContent(link);
380 } 380 }
381 return li; 381 return li;
417 if (subclasses.size() > 0) { 417 if (subclasses.size() > 0) {
418 Content label = getResource( 418 Content label = getResource(
419 "doclet.Subclasses"); 419 "doclet.Subclasses");
420 Content dt = HtmlTree.DT(label); 420 Content dt = HtmlTree.DT(label);
421 Content dl = HtmlTree.DL(dt); 421 Content dl = HtmlTree.DL(dt);
422 dl.addContent(getClassLinks(LinkInfoImpl.CONTEXT_SUBCLASSES, 422 dl.addContent(getClassLinks(LinkInfoImpl.Kind.SUBCLASSES,
423 subclasses)); 423 subclasses));
424 classInfoTree.addContent(dl); 424 classInfoTree.addContent(dl);
425 } 425 }
426 } 426 }
427 } 427 }
435 if (subInterfaces.size() > 0) { 435 if (subInterfaces.size() > 0) {
436 Content label = getResource( 436 Content label = getResource(
437 "doclet.Subinterfaces"); 437 "doclet.Subinterfaces");
438 Content dt = HtmlTree.DT(label); 438 Content dt = HtmlTree.DT(label);
439 Content dl = HtmlTree.DL(dt); 439 Content dl = HtmlTree.DL(dt);
440 dl.addContent(getClassLinks(LinkInfoImpl.CONTEXT_SUBINTERFACES, 440 dl.addContent(getClassLinks(LinkInfoImpl.Kind.SUBINTERFACES,
441 subInterfaces)); 441 subInterfaces));
442 classInfoTree.addContent(dl); 442 classInfoTree.addContent(dl);
443 } 443 }
444 } 444 }
445 } 445 }
459 if (implcl.size() > 0) { 459 if (implcl.size() > 0) {
460 Content label = getResource( 460 Content label = getResource(
461 "doclet.Implementing_Classes"); 461 "doclet.Implementing_Classes");
462 Content dt = HtmlTree.DT(label); 462 Content dt = HtmlTree.DT(label);
463 Content dl = HtmlTree.DL(dt); 463 Content dl = HtmlTree.DL(dt);
464 dl.addContent(getClassLinks(LinkInfoImpl.CONTEXT_IMPLEMENTED_CLASSES, 464 dl.addContent(getClassLinks(LinkInfoImpl.Kind.IMPLEMENTED_CLASSES,
465 implcl)); 465 implcl));
466 classInfoTree.addContent(dl); 466 classInfoTree.addContent(dl);
467 } 467 }
468 } 468 }
469 469
477 if (classDoc.isClass() && interfaceArray.size() > 0) { 477 if (classDoc.isClass() && interfaceArray.size() > 0) {
478 Content label = getResource( 478 Content label = getResource(
479 "doclet.All_Implemented_Interfaces"); 479 "doclet.All_Implemented_Interfaces");
480 Content dt = HtmlTree.DT(label); 480 Content dt = HtmlTree.DT(label);
481 Content dl = HtmlTree.DL(dt); 481 Content dl = HtmlTree.DL(dt);
482 dl.addContent(getClassLinks(LinkInfoImpl.CONTEXT_IMPLEMENTED_INTERFACES, 482 dl.addContent(getClassLinks(LinkInfoImpl.Kind.IMPLEMENTED_INTERFACES,
483 interfaceArray)); 483 interfaceArray));
484 classInfoTree.addContent(dl); 484 classInfoTree.addContent(dl);
485 } 485 }
486 } 486 }
487 487
495 if (classDoc.isInterface() && interfaceArray.size() > 0) { 495 if (classDoc.isInterface() && interfaceArray.size() > 0) {
496 Content label = getResource( 496 Content label = getResource(
497 "doclet.All_Superinterfaces"); 497 "doclet.All_Superinterfaces");
498 Content dt = HtmlTree.DT(label); 498 Content dt = HtmlTree.DT(label);
499 Content dl = HtmlTree.DL(dt); 499 Content dl = HtmlTree.DL(dt);
500 dl.addContent(getClassLinks(LinkInfoImpl.CONTEXT_SUPER_INTERFACES, 500 dl.addContent(getClassLinks(LinkInfoImpl.Kind.SUPER_INTERFACES,
501 interfaceArray)); 501 interfaceArray));
502 classInfoTree.addContent(dl); 502 classInfoTree.addContent(dl);
503 } 503 }
504 } 504 }
505 505
519 } 519 }
520 Content dt = HtmlTree.DT(label); 520 Content dt = HtmlTree.DT(label);
521 Content dl = HtmlTree.DL(dt); 521 Content dl = HtmlTree.DL(dt);
522 Content dd = new HtmlTree(HtmlTag.DD); 522 Content dd = new HtmlTree(HtmlTag.DD);
523 dd.addContent(new RawHtml(getLink(new LinkInfoImpl(configuration, 523 dd.addContent(new RawHtml(getLink(new LinkInfoImpl(configuration,
524 LinkInfoImpl.CONTEXT_CLASS, outerClass, false)))); 524 LinkInfoImpl.Kind.CLASS, outerClass, false))));
525 dl.addContent(dd); 525 dl.addContent(dd);
526 classInfoTree.addContent(dl); 526 classInfoTree.addContent(dl);
527 } 527 }
528 } 528 }
529 529
567 * 567 *
568 * @param context the id of the context where the link will be printed 568 * @param context the id of the context where the link will be printed
569 * @param list the list of classes 569 * @param list the list of classes
570 * @return a content tree for the class list 570 * @return a content tree for the class list
571 */ 571 */
572 private Content getClassLinks(int context, List<?> list) { 572 private Content getClassLinks(LinkInfoImpl.Kind context, List<?> list) {
573 Object[] typeList = list.toArray(); 573 Object[] typeList = list.toArray();
574 Content dd = new HtmlTree(HtmlTag.DD); 574 Content dd = new HtmlTree(HtmlTag.DD);
575 for (int i = 0; i < list.size(); i++) { 575 for (int i = 0; i < list.size(); i++) {
576 if (i > 0) { 576 if (i > 0) {
577 Content separator = new StringContent(", "); 577 Content separator = new StringContent(", ");

mercurial