30 |
import gnu.classpath.tools.doclets.DocletOptionString; |
import gnu.classpath.tools.doclets.DocletOptionString; |
31 |
import gnu.classpath.tools.doclets.PackageGroup; |
import gnu.classpath.tools.doclets.PackageGroup; |
32 |
import gnu.classpath.tools.doclets.TagletPrinter; |
import gnu.classpath.tools.doclets.TagletPrinter; |
33 |
|
import gnu.classpath.tools.doclets.InlineTagRenderer; |
34 |
|
|
35 |
import gnu.classpath.tools.doclets.xmldoclet.HtmlRepairer; |
import gnu.classpath.tools.doclets.xmldoclet.HtmlRepairer; |
36 |
|
|
37 |
|
import gnu.classpath.tools.taglets.GnuExtendedTaglet; |
38 |
import gnu.classpath.tools.taglets.TagletContext; |
import gnu.classpath.tools.taglets.TagletContext; |
39 |
|
|
40 |
import gnu.classpath.tools.java2xhtml.Java2xhtml; |
import gnu.classpath.tools.java2xhtml.Java2xhtml; |
42 |
import gnu.classpath.tools.StringToolkit; |
import gnu.classpath.tools.StringToolkit; |
43 |
|
|
44 |
import com.sun.javadoc.*; |
import com.sun.javadoc.*; |
45 |
|
import com.sun.tools.doclets.Taglet; |
46 |
|
|
47 |
import java.io.File; |
import java.io.File; |
48 |
import java.io.FileInputStream; |
import java.io.FileInputStream; |
76 |
|
|
77 |
public class HtmlDoclet |
public class HtmlDoclet |
78 |
extends AbstractDoclet |
extends AbstractDoclet |
79 |
|
implements InlineTagRenderer |
80 |
{ |
{ |
81 |
private static String filenameExtension = ".html"; |
private static String filenameExtension = ".html"; |
82 |
|
|
326 |
private void printPackagePageClasses(HtmlPage output, ClassDoc[] classDocs, String header) |
private void printPackagePageClasses(HtmlPage output, ClassDoc[] classDocs, String header) |
327 |
{ |
{ |
328 |
if (classDocs.length > 0) { |
if (classDocs.length > 0) { |
329 |
|
output.beginDiv(CssClass.TABLE_CONTAINER); |
330 |
output.beginTable(CssClass.PACKAGE_SUMMARY, new String[] { "border", "width" }, new String[] { "1", "100%" }); |
output.beginTable(CssClass.PACKAGE_SUMMARY, new String[] { "border", "width" }, new String[] { "1", "100%" }); |
331 |
output.rowDiv(CssClass.TABLE_HEADER, header); |
output.rowDiv(CssClass.TABLE_HEADER, header); |
332 |
|
|
340 |
output.endCell(); |
output.endCell(); |
341 |
|
|
342 |
output.beginCell(CssClass.PACKAGE_SUMMARY_RIGHT); |
output.beginCell(CssClass.PACKAGE_SUMMARY_RIGHT); |
343 |
printTags(output, classDoc.firstSentenceTags(), true); |
printTags(output, classDoc, classDoc.firstSentenceTags(), true); |
344 |
output.endCell(); |
output.endCell(); |
345 |
output.endRow(); |
output.endRow(); |
346 |
} |
} |
391 |
output.endDiv(CssClass.PACKAGE_TITLE); |
output.endDiv(CssClass.PACKAGE_TITLE); |
392 |
|
|
393 |
output.beginDiv(CssClass.PACKAGE_DESCRIPTION_TOP); |
output.beginDiv(CssClass.PACKAGE_DESCRIPTION_TOP); |
394 |
printTags(output, packageDoc.firstSentenceTags(), true); |
printTags(output, packageDoc, packageDoc.firstSentenceTags(), true); |
395 |
output.endDiv(CssClass.PACKAGE_DESCRIPTION_TOP); |
output.endDiv(CssClass.PACKAGE_DESCRIPTION_TOP); |
396 |
|
|
397 |
printPackagePageClasses(output, packageDoc.interfaces(), |
printPackagePageClasses(output, packageDoc.interfaces(), |
405 |
|
|
406 |
output.anchorName("description"); |
output.anchorName("description"); |
407 |
output.beginDiv(CssClass.PACKAGE_DESCRIPTION_FULL); |
output.beginDiv(CssClass.PACKAGE_DESCRIPTION_FULL); |
408 |
printTags(output, packageDoc.inlineTags(), false); |
printTags(output, packageDoc, packageDoc.inlineTags(), false); |
409 |
output.endDiv(CssClass.PACKAGE_DESCRIPTION_FULL); |
output.endDiv(CssClass.PACKAGE_DESCRIPTION_FULL); |
410 |
|
|
411 |
printNavBarBottom(output, "package"); |
printNavBarBottom(output, "package"); |
703 |
printType(output, containingClass); |
printType(output, containingClass); |
704 |
} |
} |
705 |
output.beginDiv(CssClass.INDEX_ENTRY_DESCRIPTION); |
output.beginDiv(CssClass.INDEX_ENTRY_DESCRIPTION); |
706 |
printTags(output, entry.firstSentenceTags(), true); |
printTags(output, entry, entry.firstSentenceTags(), true); |
707 |
output.endDiv(CssClass.INDEX_ENTRY_DESCRIPTION); |
output.endDiv(CssClass.INDEX_ENTRY_DESCRIPTION); |
708 |
output.endDiv(CssClass.INDEX_ENTRY); |
output.endDiv(CssClass.INDEX_ENTRY); |
709 |
} |
} |
963 |
private void printDeprecationSummary(HtmlPage output, List docs, String header) |
private void printDeprecationSummary(HtmlPage output, List docs, String header) |
964 |
{ |
{ |
965 |
if (!docs.isEmpty()) { |
if (!docs.isEmpty()) { |
966 |
|
output.beginDiv(CssClass.TABLE_CONTAINER); |
967 |
output.beginTable(CssClass.DEPRECATION_SUMMARY, new String[] { "border", "width" }, new String[] { "1", "100%" }); |
output.beginTable(CssClass.DEPRECATION_SUMMARY, new String[] { "border", "width" }, new String[] { "1", "100%" }); |
968 |
output.rowDiv(CssClass.TABLE_HEADER, header); |
output.rowDiv(CssClass.TABLE_HEADER, header); |
969 |
|
|
988 |
output.endAnchor(); |
output.endAnchor(); |
989 |
} |
} |
990 |
output.beginDiv(CssClass.DEPRECATION_SUMMARY_DESCRIPTION); |
output.beginDiv(CssClass.DEPRECATION_SUMMARY_DESCRIPTION); |
991 |
printTags(output, doc.tags("deprecated")[0].firstSentenceTags(), true); |
printTags(output, doc, doc.tags("deprecated")[0].firstSentenceTags(), true); |
992 |
output.endDiv(CssClass.DEPRECATION_SUMMARY_DESCRIPTION); |
output.endDiv(CssClass.DEPRECATION_SUMMARY_DESCRIPTION); |
993 |
|
|
994 |
output.endCell(); |
output.endCell(); |
996 |
output.endRow(); |
output.endRow(); |
997 |
} |
} |
998 |
output.endTable(); |
output.endTable(); |
999 |
|
output.endDiv(CssClass.TABLE_CONTAINER); |
1000 |
output.print("\n"); |
output.print("\n"); |
1001 |
} |
} |
1002 |
} |
} |
1206 |
|
|
1207 |
private void printOverviewPackages(HtmlPage output, Collection packageDocs, String header) |
private void printOverviewPackages(HtmlPage output, Collection packageDocs, String header) |
1208 |
{ |
{ |
1209 |
output.endDiv(CssClass.TABLE_CONTAINER); |
output.beginDiv(CssClass.TABLE_CONTAINER); |
1210 |
output.beginTable(CssClass.OVERVIEW_SUMMARY, new String[] { "border", "width" }, new String[] { "1", "100%" }); |
output.beginTable(CssClass.OVERVIEW_SUMMARY, new String[] { "border", "width" }, new String[] { "1", "100%" }); |
1211 |
output.rowDiv(CssClass.TABLE_HEADER, header); |
output.rowDiv(CssClass.TABLE_HEADER, header); |
1212 |
|
|
1222 |
output.endCell(); |
output.endCell(); |
1223 |
|
|
1224 |
output.beginCell(CssClass.OVERVIEW_SUMMARY_RIGHT); |
output.beginCell(CssClass.OVERVIEW_SUMMARY_RIGHT); |
1225 |
printTags(output, packageDoc.firstSentenceTags(), true); |
printTags(output, packageDoc, packageDoc.firstSentenceTags(), true); |
1226 |
output.endCell(); |
output.endCell(); |
1227 |
output.endRow(); |
output.endRow(); |
1228 |
} |
} |
1257 |
while (usageTypeIterator.hasNext()) { |
while (usageTypeIterator.hasNext()) { |
1258 |
UsageType usageType = (UsageType)usageTypeIterator.next(); |
UsageType usageType = (UsageType)usageTypeIterator.next(); |
1259 |
|
|
1260 |
|
output.endDiv(CssClass.TABLE_CONTAINER); |
1261 |
output.beginTable(CssClass.USAGE_SUMMARY, new String[] { "border", "width" }, new String[] { "1", "100%" }); |
output.beginTable(CssClass.USAGE_SUMMARY, new String[] { "border", "width" }, new String[] { "1", "100%" }); |
1262 |
output.rowDiv(CssClass.TABLE_HEADER, format("usagetype." + usageType.getId(), |
output.rowDiv(CssClass.TABLE_HEADER, format("usagetype." + usageType.getId(), |
1263 |
classDoc.qualifiedName())); |
classDoc.qualifiedName())); |
1346 |
} |
} |
1347 |
} |
} |
1348 |
|
|
1349 |
|
private static boolean isSubInterface(ClassDoc classDoc, ClassDoc otherClassDoc) |
1350 |
|
{ |
1351 |
|
ClassDoc[] interfaces = otherClassDoc.interfaces(); |
1352 |
|
for (int i=0; i<interfaces.length; ++i) { |
1353 |
|
if (classDoc == interfaces[i]) { |
1354 |
|
return true; |
1355 |
|
} |
1356 |
|
else if (isSubInterface(classDoc, interfaces[i])) { |
1357 |
|
return true; |
1358 |
|
} |
1359 |
|
} |
1360 |
|
return false; |
1361 |
|
} |
1362 |
|
|
1363 |
|
private void printCommaSeparatedTypes(HtmlPage output, |
1364 |
|
Collection list, |
1365 |
|
String header, |
1366 |
|
CssClass cssClass) |
1367 |
|
{ |
1368 |
|
if (!list.isEmpty()) { |
1369 |
|
output.beginDiv(cssClass); |
1370 |
|
output.div(CssClass.CLASS_KNOWNIMPLEMENTING_HEADER, header); |
1371 |
|
output.beginDiv(CssClass.CLASS_KNOWNIMPLEMENTING_ITEM); |
1372 |
|
Iterator it = list.iterator(); |
1373 |
|
while (it.hasNext()) { |
1374 |
|
Type type = (Type)it.next(); |
1375 |
|
printType(output, type); |
1376 |
|
if (it.hasNext()) { |
1377 |
|
output.print(", "); |
1378 |
|
} |
1379 |
|
} |
1380 |
|
output.endDiv(CssClass.CLASS_KNOWNIMPLEMENTING_ITEM); |
1381 |
|
output.endDiv(cssClass); |
1382 |
|
} |
1383 |
|
} |
1384 |
|
|
1385 |
private void printClassPage(File packageDir, String pathToRoot, ClassDoc classDoc) |
private void printClassPage(File packageDir, String pathToRoot, ClassDoc classDoc) |
1386 |
throws IOException |
throws IOException |
1387 |
{ |
{ |
1400 |
getClassTypeName(classDoc) |
getClassTypeName(classDoc) |
1401 |
+ " " + classDoc.name()); |
+ " " + classDoc.name()); |
1402 |
|
|
1403 |
LinkedList superClasses = new LinkedList(); |
if (classDoc.isInterface()) { |
|
for (ClassDoc cd = classDoc; cd != null; cd = cd.superclass()) { |
|
|
superClasses.add(cd); |
|
|
} |
|
|
output.beginElement("ul"); |
|
|
printSuperTreeRec(output, superClasses.listIterator(superClasses.size())); |
|
|
output.endElement("ul"); |
|
1404 |
|
|
1405 |
if (null != classDoc.containingClass()) { |
InterfaceRelation relation |
1406 |
output.beginDiv(CssClass.CLASS_ENCLOSINGCLASS); |
= (InterfaceRelation)getInterfaceRelations().get(classDoc); |
|
output.div(CssClass.CLASS_ENCLOSINGCLASS_HEADER, "Enclosing Class:"); |
|
|
output.beginDiv(CssClass.CLASS_ENCLOSINGCLASS_ITEM); |
|
|
printType(output, classDoc.containingClass()); |
|
|
output.endDiv(CssClass.CLASS_ENCLOSINGCLASS_ITEM); |
|
|
output.endDiv(CssClass.CLASS_ENCLOSINGCLASS); |
|
|
} |
|
1407 |
|
|
1408 |
List knownDirectSubclasses = getKnownDirectSubclasses(classDoc); |
Set implementingClasses = new TreeSet(); |
1409 |
if (!knownDirectSubclasses.isEmpty()) { |
ClassDoc[] classes = getRootDoc().classes(); |
1410 |
output.beginDiv(CssClass.CLASS_SUBCLASSES); |
for (int i=0; i<classes.length; ++i) { |
1411 |
output.div(CssClass.CLASS_SUBCLASSES_HEADER, "Known Direct Subclasses:"); |
ClassDoc otherClassDoc = classes[i]; |
1412 |
output.beginDiv(CssClass.CLASS_SUBCLASSES_ITEM); |
if (!otherClassDoc.isInterface()) { |
1413 |
Iterator it = knownDirectSubclasses.iterator(); |
ClassDoc[] interfaces = otherClassDoc.interfaces(); |
1414 |
while (it.hasNext()) { |
for (int j=0; j<interfaces.length; ++j) { |
1415 |
printType(output, (ClassDoc)it.next()); |
if (classDoc == interfaces[j] || |
1416 |
if (it.hasNext()) { |
relation.subInterfaces.contains(interfaces[j])) { |
1417 |
output.print(", "); |
implementingClasses.add(otherClassDoc); |
1418 |
|
List subClasses = (List)getAllSubClasses().get(otherClassDoc); |
1419 |
|
if (null != subClasses) { |
1420 |
|
implementingClasses.addAll(subClasses); |
1421 |
|
} |
1422 |
|
break; |
1423 |
|
} |
1424 |
|
} |
1425 |
} |
} |
1426 |
} |
} |
1427 |
output.endDiv(CssClass.CLASS_SUBCLASSES_ITEM); |
|
1428 |
output.endDiv(CssClass.CLASS_SUBCLASSES_HEADER); |
printCommaSeparatedTypes(output, |
1429 |
|
relation.superInterfaces, |
1430 |
|
"All Superinterfaces:", |
1431 |
|
CssClass.CLASS_KNOWNIMPLEMENTING); |
1432 |
|
|
1433 |
|
printCommaSeparatedTypes(output, |
1434 |
|
relation.subInterfaces, |
1435 |
|
"Known Subinterfaces:", |
1436 |
|
CssClass.CLASS_KNOWNIMPLEMENTING); |
1437 |
|
|
1438 |
|
printCommaSeparatedTypes(output, |
1439 |
|
implementingClasses, |
1440 |
|
"Known Implementing Classes:", |
1441 |
|
CssClass.CLASS_KNOWNIMPLEMENTING); |
1442 |
|
} |
1443 |
|
else { |
1444 |
|
LinkedList superClasses = new LinkedList(); |
1445 |
|
for (ClassDoc cd = classDoc; cd != null; cd = cd.superclass()) { |
1446 |
|
superClasses.add(cd); |
1447 |
|
} |
1448 |
|
output.beginElement("ul"); |
1449 |
|
printSuperTreeRec(output, superClasses.listIterator(superClasses.size())); |
1450 |
|
output.endElement("ul"); |
1451 |
|
|
1452 |
|
if (null != classDoc.containingClass()) { |
1453 |
|
output.beginDiv(CssClass.CLASS_ENCLOSINGCLASS); |
1454 |
|
output.div(CssClass.CLASS_ENCLOSINGCLASS_HEADER, "Enclosing Class:"); |
1455 |
|
output.beginDiv(CssClass.CLASS_ENCLOSINGCLASS_ITEM); |
1456 |
|
printType(output, classDoc.containingClass()); |
1457 |
|
output.endDiv(CssClass.CLASS_ENCLOSINGCLASS_ITEM); |
1458 |
|
output.endDiv(CssClass.CLASS_ENCLOSINGCLASS); |
1459 |
|
} |
1460 |
|
|
1461 |
|
Set implementedInterfaces = new TreeSet(); |
1462 |
|
|
1463 |
|
for (ClassDoc cd = classDoc; cd != null; cd = cd.superclass()) { |
1464 |
|
ClassDoc[] interfaces = cd.interfaces(); |
1465 |
|
for (int i=0; i<interfaces.length; ++i) { |
1466 |
|
implementedInterfaces.add(interfaces[i]); |
1467 |
|
InterfaceRelation relation |
1468 |
|
= (InterfaceRelation)getInterfaceRelations().get(interfaces[i]); |
1469 |
|
if (null != relation) { |
1470 |
|
implementedInterfaces.addAll(relation.superInterfaces); |
1471 |
|
} |
1472 |
|
else { |
1473 |
|
System.err.println("no relation for interface " + interfaces[i]); |
1474 |
|
} |
1475 |
|
} |
1476 |
|
} |
1477 |
|
|
1478 |
|
printCommaSeparatedTypes(output, |
1479 |
|
implementedInterfaces, |
1480 |
|
"Implemented Interfaces:", |
1481 |
|
CssClass.CLASS_KNOWNIMPLEMENTING); |
1482 |
|
|
1483 |
|
|
1484 |
|
List knownDirectSubclasses = getKnownDirectSubclasses(classDoc); |
1485 |
|
if (!knownDirectSubclasses.isEmpty()) { |
1486 |
|
output.beginDiv(CssClass.CLASS_SUBCLASSES); |
1487 |
|
output.div(CssClass.CLASS_SUBCLASSES_HEADER, "Known Direct Subclasses:"); |
1488 |
|
output.beginDiv(CssClass.CLASS_SUBCLASSES_ITEM); |
1489 |
|
Iterator it = knownDirectSubclasses.iterator(); |
1490 |
|
while (it.hasNext()) { |
1491 |
|
printType(output, (ClassDoc)it.next()); |
1492 |
|
if (it.hasNext()) { |
1493 |
|
output.print(", "); |
1494 |
|
} |
1495 |
|
} |
1496 |
|
output.endDiv(CssClass.CLASS_SUBCLASSES_ITEM); |
1497 |
|
output.endDiv(CssClass.CLASS_SUBCLASSES_HEADER); |
1498 |
|
output.endDiv(CssClass.CLASS_SUBCLASSES); |
1499 |
|
} |
1500 |
} |
} |
1501 |
|
|
1502 |
output.hr(); |
output.hr(); |
1505 |
output.beginDiv(CssClass.CLASS_SYNOPSIS_DECLARATION); |
output.beginDiv(CssClass.CLASS_SYNOPSIS_DECLARATION); |
1506 |
output.print(getFullModifiers(classDoc) + ' ' + getClassTypeKeyword(classDoc) |
output.print(getFullModifiers(classDoc) + ' ' + getClassTypeKeyword(classDoc) |
1507 |
+ ' '); |
+ ' '); |
1508 |
|
output.beginSpan(CssClass.CLASS_SYNOPSIS_NAME); |
1509 |
if (optionLinkSource.getValue() && null != classDoc.position()) { |
if (optionLinkSource.getValue() && null != classDoc.position()) { |
1510 |
output.beginAnchor(getOuterClassDoc(classDoc).name() + "-source" + filenameExtension + "#line." + classDoc.position()); |
output.beginAnchor(getOuterClassDoc(classDoc).name() + "-source" + filenameExtension + "#line." + classDoc.position()); |
1511 |
output.print(classDoc.name()); |
output.print(classDoc.name()); |
1514 |
else { |
else { |
1515 |
output.print(classDoc.name()); |
output.print(classDoc.name()); |
1516 |
} |
} |
1517 |
|
output.endSpan(CssClass.CLASS_SYNOPSIS_NAME); |
1518 |
output.endDiv(CssClass.CLASS_SYNOPSIS_DECLARATION); |
output.endDiv(CssClass.CLASS_SYNOPSIS_DECLARATION); |
1519 |
|
|
1520 |
if (null != classDoc.superclass()) { |
if (!classDoc.isInterface()) { |
1521 |
output.beginDiv(CssClass.CLASS_SYNOPSIS_SUPERCLASS); |
if (null != classDoc.superclass()) { |
1522 |
output.print("extends "); |
output.beginDiv(CssClass.CLASS_SYNOPSIS_SUPERCLASS); |
1523 |
printType(output, classDoc.superclass()); |
output.print("extends "); |
1524 |
output.endDiv(CssClass.CLASS_SYNOPSIS_SUPERCLASS); |
printType(output, classDoc.superclass()); |
1525 |
|
output.endDiv(CssClass.CLASS_SYNOPSIS_SUPERCLASS); |
1526 |
|
} |
1527 |
} |
} |
1528 |
|
|
1529 |
ClassDoc[] interfaces = classDoc.interfaces(); |
ClassDoc[] interfaces = classDoc.interfaces(); |
1530 |
if (interfaces.length > 0) { |
if (interfaces.length > 0) { |
1531 |
output.beginDiv(CssClass.CLASS_SYNOPSIS_IMPLEMENTS); |
output.beginDiv(CssClass.CLASS_SYNOPSIS_IMPLEMENTS); |
1532 |
output.print("implements "); |
if (!classDoc.isInterface()) { |
1533 |
|
output.print("implements "); |
1534 |
|
} |
1535 |
|
else { |
1536 |
|
output.print("extends "); |
1537 |
|
} |
1538 |
for (int i=0; i<interfaces.length; ++i) { |
for (int i=0; i<interfaces.length; ++i) { |
1539 |
if (i>0) { |
if (i>0) { |
1540 |
output.print(", "); |
output.print(", "); |
1549 |
|
|
1550 |
if (!optionNoComment.getValue()) { |
if (!optionNoComment.getValue()) { |
1551 |
output.beginDiv(CssClass.CLASS_DESCRIPTION); |
output.beginDiv(CssClass.CLASS_DESCRIPTION); |
1552 |
printTags(output, classDoc.inlineTags(), false); |
printTags(output, classDoc, classDoc.inlineTags(), false); |
1553 |
output.endDiv(CssClass.CLASS_DESCRIPTION); |
output.endDiv(CssClass.CLASS_DESCRIPTION); |
1554 |
|
|
1555 |
printTaglets(output, classDoc.tags(), TagletContext.TYPE); |
printTaglets(output, classDoc.tags(), new HtmlTagletContext(classDoc, output)); |
1556 |
} |
} |
1557 |
|
|
1558 |
printProgramElementDocs(output, classDoc.fields(), |
printProgramElementDocs(output, classDoc.fields(), |
1619 |
for (int j=0; j<methods.length; ++j) { |
for (int j=0; j<methods.length; ++j) { |
1620 |
if (methods[j].name().equals(methodDoc.name()) |
if (methods[j].name().equals(methodDoc.name()) |
1621 |
&& methods[j].signature().equals(methodDoc.signature())) { |
&& methods[j].signature().equals(methodDoc.signature())) { |
1622 |
specifyingInterfaces.add(interfaces[i]); |
specifyingInterfaces.add(methods[j]); |
1623 |
} |
} |
1624 |
} |
} |
1625 |
collectSpecifiedByRecursive(specifyingInterfaces, |
collectSpecifiedByRecursive(specifyingInterfaces, |
1677 |
} |
} |
1678 |
output.endDiv(CssClass.MEMBER_DETAIL_SYNOPSIS); |
output.endDiv(CssClass.MEMBER_DETAIL_SYNOPSIS); |
1679 |
|
|
1680 |
|
output.beginDiv(CssClass.MEMBER_DETAIL_BODY); |
1681 |
output.beginDiv(CssClass.MEMBER_DETAIL_DESCRIPTION); |
output.beginDiv(CssClass.MEMBER_DETAIL_DESCRIPTION); |
1682 |
printTags(output, memberDoc.inlineTags(), false); |
printTags(output, memberDoc, memberDoc.inlineTags(), false); |
1683 |
output.endDiv(CssClass.MEMBER_DETAIL_DESCRIPTION); |
output.endDiv(CssClass.MEMBER_DETAIL_DESCRIPTION); |
1684 |
|
|
1685 |
if (memberDoc.isConstructor() || memberDoc.isMethod()) { |
if (memberDoc.isConstructor() || memberDoc.isMethod()) { |
1698 |
output.div(CssClass.MEMBER_DETAIL_SPECIFIED_BY_HEADER, "Specified by:"); |
output.div(CssClass.MEMBER_DETAIL_SPECIFIED_BY_HEADER, "Specified by:"); |
1699 |
Iterator it = specifyingInterfaces.iterator(); |
Iterator it = specifyingInterfaces.iterator(); |
1700 |
while (it.hasNext()) { |
while (it.hasNext()) { |
1701 |
ClassDoc specifyingInterface = (ClassDoc)it.next(); |
MethodDoc specifyingInterfaceMethod = (MethodDoc)it.next(); |
1702 |
output.beginDiv(CssClass.MEMBER_DETAIL_SPECIFIED_BY_ITEM); |
output.beginDiv(CssClass.MEMBER_DETAIL_SPECIFIED_BY_ITEM); |
1703 |
output.print(memberDoc.name() + " in interface "); |
output.beginAnchor(getMemberDocURL(output, |
1704 |
printType(output, specifyingInterface); |
specifyingInterfaceMethod)); |
1705 |
|
output.print(memberDoc.name()); |
1706 |
|
output.endAnchor(); |
1707 |
|
output.print(" in interface "); |
1708 |
|
printType(output, specifyingInterfaceMethod.containingClass()); |
1709 |
output.endDiv(CssClass.MEMBER_DETAIL_SPECIFIED_BY_ITEM); |
output.endDiv(CssClass.MEMBER_DETAIL_SPECIFIED_BY_ITEM); |
1710 |
} |
} |
1711 |
output.endDiv(CssClass.MEMBER_DETAIL_SPECIFIED_BY_LIST); |
output.endDiv(CssClass.MEMBER_DETAIL_SPECIFIED_BY_LIST); |
1762 |
|
|
1763 |
if (null != paramTag) { |
if (null != paramTag) { |
1764 |
output.beginDiv(CssClass.MEMBER_DETAIL_PARAMETER_ITEM); |
output.beginDiv(CssClass.MEMBER_DETAIL_PARAMETER_ITEM); |
1765 |
|
output.beginSpan(CssClass.MEMBER_DETAIL_PARAMETER_ITEM_NAME); |
1766 |
output.print(parameter.name()); |
output.print(parameter.name()); |
1767 |
|
output.endSpan(CssClass.MEMBER_DETAIL_PARAMETER_ITEM_NAME); |
1768 |
|
output.beginSpan(CssClass.MEMBER_DETAIL_PARAMETER_ITEM_SEPARATOR); |
1769 |
output.print(" - "); |
output.print(" - "); |
1770 |
printTags(output, paramTag.inlineTags(), false); |
output.endSpan(CssClass.MEMBER_DETAIL_PARAMETER_ITEM_SEPARATOR); |
1771 |
|
output.beginSpan(CssClass.MEMBER_DETAIL_PARAMETER_ITEM_DESCRIPTION); |
1772 |
|
printTags(output, execMemberDoc, paramTag.inlineTags(), false); |
1773 |
|
output.endSpan(CssClass.MEMBER_DETAIL_PARAMETER_ITEM_DESCRIPTION); |
1774 |
output.endDiv(CssClass.MEMBER_DETAIL_PARAMETER_ITEM); |
output.endDiv(CssClass.MEMBER_DETAIL_PARAMETER_ITEM); |
1775 |
} |
} |
1776 |
} |
} |
1786 |
output.div(CssClass.MEMBER_DETAIL_RETURN_HEADER, "Returns:"); |
output.div(CssClass.MEMBER_DETAIL_RETURN_HEADER, "Returns:"); |
1787 |
output.beginDiv(CssClass.MEMBER_DETAIL_RETURN_ITEM); |
output.beginDiv(CssClass.MEMBER_DETAIL_RETURN_ITEM); |
1788 |
|
|
1789 |
printTags(output, returnTags, false); |
printTags(output, execMemberDoc, returnTags, false); |
1790 |
|
|
1791 |
output.endDiv(CssClass.MEMBER_DETAIL_RETURN_ITEM); |
output.endDiv(CssClass.MEMBER_DETAIL_RETURN_ITEM); |
1792 |
output.endDiv(CssClass.MEMBER_DETAIL_RETURN_LIST); |
output.endDiv(CssClass.MEMBER_DETAIL_RETURN_LIST); |
1810 |
} |
} |
1811 |
|
|
1812 |
output.beginDiv(CssClass.MEMBER_DETAIL_THROWN_ITEM); |
output.beginDiv(CssClass.MEMBER_DETAIL_THROWN_ITEM); |
1813 |
|
output.beginSpan(CssClass.MEMBER_DETAIL_THROWN_ITEM_NAME); |
1814 |
printType(output, exception); |
printType(output, exception); |
1815 |
|
output.endSpan(CssClass.MEMBER_DETAIL_THROWN_ITEM_NAME); |
1816 |
if (null != throwsTag) { |
if (null != throwsTag) { |
1817 |
|
output.beginSpan(CssClass.MEMBER_DETAIL_THROWN_ITEM_SEPARATOR); |
1818 |
output.print(" - "); |
output.print(" - "); |
1819 |
printTags(output, throwsTag.inlineTags(), false); |
output.endSpan(CssClass.MEMBER_DETAIL_THROWN_ITEM_SEPARATOR); |
1820 |
|
output.beginSpan(CssClass.MEMBER_DETAIL_THROWN_ITEM_DESCRIPTION); |
1821 |
|
printTags(output, execMemberDoc, throwsTag.inlineTags(), false); |
1822 |
|
output.endSpan(CssClass.MEMBER_DETAIL_THROWN_ITEM_DESCRIPTION); |
1823 |
} |
} |
1824 |
output.endDiv(CssClass.MEMBER_DETAIL_THROWN_ITEM); |
output.endDiv(CssClass.MEMBER_DETAIL_THROWN_ITEM); |
1825 |
} |
} |
1841 |
} |
} |
1842 |
} |
} |
1843 |
|
|
1844 |
TagletContext context; |
TagletContext context = new HtmlTagletContext(memberDoc, output); |
|
if (memberDoc.isField()) { |
|
|
context = TagletContext.FIELD; |
|
|
} |
|
|
else if (memberDoc.isMethod()) { |
|
|
context = TagletContext.METHOD; |
|
|
} |
|
|
else if (memberDoc.isConstructor()) { |
|
|
context = TagletContext.CONSTRUCTOR; |
|
|
} |
|
|
else { |
|
|
// assert(false); -- we should have a field, method or constructor here |
|
|
throw new RuntimeException("Assertion failed: expected field, method or constructor"); |
|
|
} |
|
|
|
|
1845 |
printTaglets(output, memberDoc.tags(), context); |
printTaglets(output, memberDoc.tags(), context); |
1846 |
} |
} |
1847 |
|
|
1848 |
|
output.endDiv(CssClass.MEMBER_DETAIL_BODY); |
1849 |
output.endDiv(CssClass.MEMBER_DETAIL); |
output.endDiv(CssClass.MEMBER_DETAIL); |
1850 |
} |
} |
1851 |
} |
} |
1879 |
ProgramElementDoc memberDoc = memberDocs[i]; |
ProgramElementDoc memberDoc = memberDocs[i]; |
1880 |
output.beginRow(); |
output.beginRow(); |
1881 |
|
|
1882 |
output.beginCell(CssClass.CLASS_SUMMARY_LEFT); |
if (!memberDoc.isConstructor()) { |
1883 |
output.print(getFullModifiers(memberDoc) + " "); |
output.beginCell(CssClass.CLASS_SUMMARY_LEFT); |
1884 |
if (memberDoc.isMethod()) { |
output.beginDiv(CssClass.CLASS_SUMMARY_LEFT_SYNOPSIS); |
1885 |
printType(output, ((MethodDoc)memberDoc).returnType()); |
output.print(getSummaryModifiers(memberDoc) + " "); |
1886 |
} |
if (memberDoc.isMethod()) { |
1887 |
else if (memberDoc.isField()) { |
printType(output, ((MethodDoc)memberDoc).returnType()); |
1888 |
printType(output, ((FieldDoc)memberDoc).type()); |
} |
1889 |
|
else if (memberDoc.isField()) { |
1890 |
|
printType(output, ((FieldDoc)memberDoc).type()); |
1891 |
|
} |
1892 |
|
output.endDiv(CssClass.CLASS_SUMMARY_LEFT_SYNOPSIS); |
1893 |
|
output.endCell(); |
1894 |
} |
} |
|
output.endCell(); |
|
1895 |
|
|
1896 |
output.beginCell(CssClass.CLASS_SUMMARY_RIGHT); |
output.beginCell(CssClass.CLASS_SUMMARY_RIGHT); |
1897 |
output.beginDiv(CssClass.CLASS_SUMMARY_RIGHT_LIST); |
output.beginDiv(CssClass.CLASS_SUMMARY_RIGHT_LIST); |
1898 |
output.beginDiv(CssClass.CLASS_SUMMARY_RIGHT_SYNOPSIS); |
output.beginDiv(CssClass.CLASS_SUMMARY_RIGHT_SYNOPSIS); |
|
output.print(" "); |
|
1899 |
output.beginAnchor("#" + getMemberAnchor(memberDoc)); |
output.beginAnchor("#" + getMemberAnchor(memberDoc)); |
1900 |
output.print(memberDoc.name()); |
output.print(memberDoc.name()); |
1901 |
output.endAnchor(); |
output.endAnchor(); |
1903 |
printParameters(output, (ExecutableMemberDoc)memberDoc); |
printParameters(output, (ExecutableMemberDoc)memberDoc); |
1904 |
} |
} |
1905 |
output.endDiv(CssClass.CLASS_SUMMARY_RIGHT_SYNOPSIS); |
output.endDiv(CssClass.CLASS_SUMMARY_RIGHT_SYNOPSIS); |
|
output.beginDiv(CssClass.CLASS_SUMMARY_RIGHT_DESCRIPTION); |
|
|
|
|
1906 |
Tag[] firstSentenceTags = memberDoc.firstSentenceTags(); |
Tag[] firstSentenceTags = memberDoc.firstSentenceTags(); |
1907 |
if (null != firstSentenceTags && firstSentenceTags.length > 0) { |
if (null != firstSentenceTags && firstSentenceTags.length > 0) { |
1908 |
printTags(output, firstSentenceTags, true); |
output.beginDiv(CssClass.CLASS_SUMMARY_RIGHT_DESCRIPTION); |
1909 |
|
printTags(output, memberDoc, firstSentenceTags, true); |
1910 |
|
output.endDiv(CssClass.CLASS_SUMMARY_RIGHT_DESCRIPTION); |
1911 |
} |
} |
|
|
|
|
output.endDiv(CssClass.CLASS_SUMMARY_RIGHT_DESCRIPTION); |
|
1912 |
output.endDiv(CssClass.CLASS_SUMMARY_RIGHT_LIST); |
output.endDiv(CssClass.CLASS_SUMMARY_RIGHT_LIST); |
1913 |
output.endCell(); |
output.endCell(); |
1914 |
output.endRow(); |
output.endRow(); |
1918 |
} |
} |
1919 |
} |
} |
1920 |
|
|
1921 |
private void printTag(HtmlPage output, HtmlRepairer repairer, |
private void printTag(final HtmlPage output, |
1922 |
Tag tag, boolean firstSentence) |
HtmlRepairer repairer, |
1923 |
{ |
Tag tag, boolean firstSentence, |
1924 |
if ("Text".equals(tag.name())) { |
boolean inline, |
1925 |
output.print(repairer.getWellformedHTML(tag.text())); |
Doc contextDoc) |
1926 |
} |
{ |
1927 |
else if ("@link".equals(tag.name())) { |
TagletContext context = new HtmlTagletContext(contextDoc, output); |
1928 |
SeeTag seeTag = (SeeTag)tag; |
if (firstSentence) { |
1929 |
String href = null; |
output.print(renderInlineTags(tag.firstSentenceTags(), context)); |
|
MemberDoc referencedMember = seeTag.referencedMember(); |
|
|
if (null != seeTag.referencedClass()) { |
|
|
href = getClassDocURL(output, seeTag.referencedClass()); |
|
|
if (null != referencedMember) { |
|
|
href += '#' + referencedMember.name(); |
|
|
if (referencedMember.isMethod() || referencedMember.isConstructor()) { |
|
|
href += ((ExecutableMemberDoc)referencedMember).signature(); |
|
|
} |
|
|
} |
|
|
else if (null != seeTag.referencedMemberName()) { |
|
|
href = null; |
|
|
} |
|
|
} |
|
|
else if (null != referencedMember) { |
|
|
href = '#' + referencedMember.name(); |
|
|
if (referencedMember.isMethod() || referencedMember.isConstructor()) { |
|
|
href += ((ExecutableMemberDoc)referencedMember).signature(); |
|
|
} |
|
|
} |
|
|
|
|
|
String label = tag.text(); |
|
|
if (label.startsWith("#")) { |
|
|
label = label.substring(1); |
|
|
} |
|
|
else { |
|
|
label = label.replace('#', '.'); |
|
|
} |
|
|
|
|
|
if (null != href) { |
|
|
output.beginAnchor(href); |
|
|
output.print(label); |
|
|
output.endAnchor(); |
|
|
} |
|
|
else { |
|
|
output.print(label); |
|
|
} |
|
|
} |
|
|
else if ("@docRoot".equals(tag.name())) { |
|
|
output.print(output.getPathToRoot()); |
|
|
} |
|
|
else if (firstSentence) { |
|
|
printTags(output, tag.firstSentenceTags(), true); |
|
1930 |
} |
} |
1931 |
else { |
else { |
1932 |
printTags(output, tag.inlineTags(), false); |
output.print(renderInlineTags(tag.inlineTags(), context)); |
1933 |
} |
} |
1934 |
} |
} |
1935 |
|
|
1936 |
private void printTags(HtmlPage output, Tag[] tags, boolean firstSentence) |
private void printTags(HtmlPage output, Doc contextDoc, Tag[] tags, boolean firstSentence) |
1937 |
{ |
{ |
1938 |
|
printTags(output, contextDoc, tags, firstSentence, false); |
1939 |
|
} |
1940 |
|
|
1941 |
|
private void printTags(HtmlPage output, Doc contextDoc, Tag[] tags, boolean firstSentence, boolean inline) |
1942 |
|
{ |
1943 |
|
output.print(renderInlineTags(tags, new HtmlTagletContext(contextDoc, output))); |
1944 |
|
/* |
1945 |
if (!optionNoComment.getValue()) { |
if (!optionNoComment.getValue()) { |
1946 |
|
output.print(renderInlineTags(tag.firstSentenceTags(), output)); |
1947 |
HtmlRepairer repairer = new HtmlRepairer(getRootDoc(), |
HtmlRepairer repairer = new HtmlRepairer(getRootDoc(), |
1948 |
true, false, |
true, false, |
1949 |
null, null, |
null, null, |
1950 |
true); |
true); |
1951 |
for (int i=0; i<tags.length; ++i) { |
for (int i=0; i<tags.length; ++i) { |
1952 |
printTag(output, repairer, tags[i], firstSentence); |
printTag(output, repairer, tags[i], firstSentence, inline); |
1953 |
} |
} |
1954 |
output.print(repairer.terminateText()); |
output.print(repairer.terminateText()); |
1955 |
} |
} |
1956 |
|
*/ |
1957 |
} |
} |
1958 |
|
|
1959 |
private String getClassDocURL(HtmlPage output, ClassDoc classDoc) |
private String getClassDocURL(HtmlPage output, ClassDoc classDoc) |
2036 |
|
|
2037 |
private void printTaglets(final HtmlPage output, Tag[] tags, TagletContext context) |
private void printTaglets(final HtmlPage output, Tag[] tags, TagletContext context) |
2038 |
{ |
{ |
2039 |
super.printTaglets(tags, context, new TagletPrinter() { |
super.printMainTaglets(tags, context, new TagletPrinter() { |
2040 |
public void printTagletString(String tagletString) { |
public void printTagletString(String tagletString) { |
2041 |
output.beginDiv(CssClass.TAGLET); |
output.beginDiv(CssClass.TAGLET); |
2042 |
output.print(tagletString); |
output.print(tagletString); |
2089 |
} |
} |
2090 |
} |
} |
2091 |
} |
} |
2092 |
|
printNotice("Building cross-reference information..."); |
2093 |
|
getInterfaceRelations(); |
2094 |
|
getAllSubClasses(); |
2095 |
|
|
2096 |
printNotice("Writing overview files..."); |
printNotice("Writing overview files..."); |
2097 |
printFrameSetPage(); |
printFrameSetPage(); |
2273 |
return result.toString(); |
return result.toString(); |
2274 |
} |
} |
2275 |
|
|
2276 |
|
private String getSummaryModifiers(ProgramElementDoc memberDoc) |
2277 |
|
{ |
2278 |
|
StringBuffer result = new StringBuffer(); |
2279 |
|
if (memberDoc.isPackagePrivate()) { |
2280 |
|
result.append("(package private) "); |
2281 |
|
} |
2282 |
|
else if (memberDoc.isPrivate()) { |
2283 |
|
result.append("private "); |
2284 |
|
} |
2285 |
|
else if (memberDoc.isProtected()) { |
2286 |
|
result.append("protected "); |
2287 |
|
} |
2288 |
|
if (memberDoc.isStatic()) { |
2289 |
|
result.append("static"); |
2290 |
|
} |
2291 |
|
else if (memberDoc.isClass() && ((ClassDoc)memberDoc).isAbstract()) { |
2292 |
|
result.append("abstract"); |
2293 |
|
} |
2294 |
|
return result.toString(); |
2295 |
|
} |
2296 |
|
|
2297 |
protected DocletOption[] getOptions() |
protected DocletOption[] getOptions() |
2298 |
{ |
{ |
2299 |
return options; |
return options; |
2441 |
{ |
{ |
2442 |
return optionCharset.getValue(); |
return optionCharset.getValue(); |
2443 |
} |
} |
2444 |
|
|
2445 |
|
public InlineTagRenderer getInlineTagRenderer() |
2446 |
|
{ |
2447 |
|
return this; |
2448 |
|
} |
2449 |
|
|
2450 |
|
public String renderInlineTags(Tag[] tags, TagletContext context) |
2451 |
|
{ |
2452 |
|
StringBuffer result = new StringBuffer(); |
2453 |
|
|
2454 |
|
HtmlRepairer repairer = new HtmlRepairer(getRootDoc(), |
2455 |
|
true, false, |
2456 |
|
null, null, |
2457 |
|
true); |
2458 |
|
|
2459 |
|
for (int i=0; i<tags.length; ++i) { |
2460 |
|
|
2461 |
|
Tag tag = tags[i]; |
2462 |
|
|
2463 |
|
if ("Text".equals(tag.name())) { |
2464 |
|
result.append(repairer.getWellformedHTML(tag.text())); |
2465 |
|
} |
2466 |
|
else if ("@link".equals(tag.name())) { |
2467 |
|
SeeTag seeTag = (SeeTag)tag; |
2468 |
|
String href = null; |
2469 |
|
MemberDoc referencedMember = seeTag.referencedMember(); |
2470 |
|
if (null != seeTag.referencedClass()) { |
2471 |
|
href = getClassDocURL(((HtmlTagletContext)context).getOutput(), seeTag.referencedClass()); |
2472 |
|
if (null != referencedMember) { |
2473 |
|
href += '#' + referencedMember.name(); |
2474 |
|
if (referencedMember.isMethod() || referencedMember.isConstructor()) { |
2475 |
|
href += ((ExecutableMemberDoc)referencedMember).signature(); |
2476 |
|
} |
2477 |
|
} |
2478 |
|
else if (null != seeTag.referencedMemberName()) { |
2479 |
|
href = null; |
2480 |
|
} |
2481 |
|
} |
2482 |
|
else if (null != referencedMember) { |
2483 |
|
href = '#' + referencedMember.name(); |
2484 |
|
if (referencedMember.isMethod() || referencedMember.isConstructor()) { |
2485 |
|
href += ((ExecutableMemberDoc)referencedMember).signature(); |
2486 |
|
} |
2487 |
|
} |
2488 |
|
|
2489 |
|
String label = tag.text(); |
2490 |
|
if (label.startsWith("#")) { |
2491 |
|
label = label.substring(1); |
2492 |
|
} |
2493 |
|
else { |
2494 |
|
label = label.replace('#', '.'); |
2495 |
|
} |
2496 |
|
|
2497 |
|
if (null != href) { |
2498 |
|
result.append("<a href=\""); |
2499 |
|
result.append(href); |
2500 |
|
result.append("\">"); |
2501 |
|
result.append(label); |
2502 |
|
result.append("</a>"); |
2503 |
|
} |
2504 |
|
else { |
2505 |
|
result.append(label); |
2506 |
|
} |
2507 |
|
} |
2508 |
|
else if ("@docRoot".equals(tag.name())) { |
2509 |
|
result.append(((HtmlTagletContext)context).getOutput().getPathToRoot()); |
2510 |
|
} |
2511 |
|
else { |
2512 |
|
//TagletContext context = TagletContext.OVERVIEW; // FIXME |
2513 |
|
Taglet taglet = (Taglet)tagletMap.get(tag.name().substring(1)); |
2514 |
|
if (null != taglet) { |
2515 |
|
if (taglet instanceof GnuExtendedTaglet) { |
2516 |
|
result.append(((GnuExtendedTaglet)taglet).toString(tag, context)); |
2517 |
|
} |
2518 |
|
else { |
2519 |
|
result.append(taglet.toString(tag)); |
2520 |
|
} |
2521 |
|
} |
2522 |
|
} |
2523 |
|
} |
2524 |
|
result.append(repairer.terminateText()); |
2525 |
|
return result.toString(); |
2526 |
|
} |
2527 |
} |
} |