PackageUseWriterpublic class PackageUseWriter extends SubWriterHolderWriter Generate package usage information. |
Fields Summary |
---|
final PackageDoc | pkgdoc | final SortedMap | usingPackageToUsedClasses |
Constructors Summary |
---|
public PackageUseWriter(ClassUseMapper mapper, String filename, PackageDoc pkgdoc)Constructor.
super(DirectoryManager.getDirectoryPath(pkgdoc),
filename,
DirectoryManager.getRelativePath(pkgdoc.name()));
this.pkgdoc = pkgdoc;
// by examining all classes in this package, find what packages
// use these classes - produce a map between using package and
// used classes.
ClassDoc[] content = pkgdoc.allClasses();
for (int i = 0; i < content.length; ++i) {
ClassDoc usedClass = content[i];
Set usingClasses = (Set)mapper.classToClass.get(usedClass);
if (usingClasses != null) {
for (Iterator it = usingClasses.iterator(); it.hasNext(); ) {
ClassDoc usingClass = (ClassDoc)it.next();
PackageDoc usingPackage = usingClass.containingPackage();
Set usedClasses = (Set)usingPackageToUsedClasses
.get(usingPackage);
if (usedClasses == null) {
usedClasses = new TreeSet();
usingPackageToUsedClasses.put(usingPackage,
usedClasses);
}
usedClasses.add(usedClass);
}
}
}
|
Methods Summary |
---|
public static void | generate(ClassUseMapper mapper, com.sun.javadoc.PackageDoc pkgdoc)Generate a class page.
PackageUseWriter pkgusegen;
String filename = "package-use.html";
try {
pkgusegen = new PackageUseWriter(mapper, filename, pkgdoc);
pkgusegen.generatePackageUseFile();
pkgusegen.close();
} catch (IOException exc) {
Standard.configuration().standardmessage.
error("doclet.exception_encountered",
exc.toString(), filename);
throw new DocletAbortException();
}
| protected void | generateClassList()
Iterator itp = usingPackageToUsedClasses.keySet().iterator();
while (itp.hasNext()) {
PackageDoc usingPackage = (PackageDoc)itp.next();
anchor(usingPackage.name());
tableIndexSummary();
tableHeaderStart("#CCCCFF");
printText("doclet.ClassUse_Classes.in.0.used.by.1",
getPackageLink(pkgdoc),
getPackageLink(usingPackage));
Iterator itc =
((Collection)usingPackageToUsedClasses.get(usingPackage))
.iterator();
while (itc.hasNext()) {
printClassRow((ClassDoc)itc.next(), usingPackage);
}
tableHeaderEnd();
tableEnd();
space();
p();
}
| protected void | generatePackageList()
tableIndexSummary();
tableHeaderStart("#CCCCFF");
printText("doclet.ClassUse_Packages.that.use.0",
getPackageLink(pkgdoc));
tableHeaderEnd();
Iterator it = usingPackageToUsedClasses.keySet().iterator();
while (it.hasNext()) {
PackageDoc pkg = (PackageDoc)it.next();
generatePackageUse(pkg);
}
tableEnd();
space();
p();
| protected void | generatePackageUse()Print the class use list.
if (Standard.configuration().packages.length > 1) {
generatePackageList();
}
generateClassList();
| protected void | generatePackageUse(com.sun.javadoc.PackageDoc pkg)Print the package use list.
trBgcolorStyle("white", "TableRowColor");
summaryRow(0);
printHyperLink("", pkg.name(), pkg.name(), true);
summaryRowEnd();
summaryRow(0);
printSummaryComment(pkg);
space();
summaryRowEnd();
trEnd();
| protected void | generatePackageUseFile()Print the class use list.
printPackageUseHeader();
if (usingPackageToUsedClasses.isEmpty()) {
printText("doclet.ClassUse_No.usage.of.0", pkgdoc.name());
p();
} else {
generatePackageUse();
}
printPackageUseFooter();
| protected void | navLinkClassUse()Print class use link
navCellRevStart();
fontStyle("NavBarFont1Rev");
boldText("doclet.navClassUse");
fontEnd();
navCellEnd();
| protected void | navLinkPackage()Print this package link
navCellStart();
printHyperLink("package-summary.html", "", getText("doclet.Package"),
true, "NavBarFont1");
navCellEnd();
| protected void | navLinkTree()
navCellStart();
printHyperLink("package-tree.html", "", getText("doclet.Tree"),
true, "NavBarFont1");
navCellEnd();
| protected void | printClassRow(com.sun.javadoc.ClassDoc usedClass, com.sun.javadoc.PackageDoc usingPackage)
String path = pathString(usedClass,
"class-use/" + usedClass.name() + ".html");
trBgcolorStyle("white", "TableRowColor");
summaryRow(0);
bold();
printHyperLink(path, usingPackage.name(), usedClass.name(), true);
boldEnd();
println(); br();
printNbsps();
printIndexComment(usedClass);
summaryRowEnd();
trEnd();
| protected void | printPackageUseFooter()Print the footer for the class use Listing.
hr();
navLinks(false);
printBottom();
printBodyHtmlEnd();
| protected void | printPackageUseHeader()Print the header for the class use Listing.
String packageLabel = getText("doclet.Package");
String name = pkgdoc.name();
printHeader(getText("doclet.Window_ClassUse_Header",
Standard.configuration().windowtitle,
packageLabel, name));
navLinks(true);
hr();
center();
h2();
boldText("doclet.ClassUse_Title", packageLabel, name);
h2End();
centerEnd();
|
|