PackageWriterpublic class PackageWriter extends AbstractPackageWriter Class to generate file for each package contents in the right-hand
frame. This will list all the Class Kinds in the package. A click on any
class-kind will update the frame with the clicked class-kind page. |
Fields Summary |
---|
protected PackageDoc | prevThe prev package name in the alpha-order list. | protected PackageDoc | nextThe next package name in the alpha-order list. |
Constructors Summary |
---|
public PackageWriter(String path, String filename, PackageDoc packagedoc, PackageDoc prev, PackageDoc next)Constructor to construct PackageWriter object and to generate
"package-summary.html" file in the respective package directory.
For example for package "java.lang" this will generate file
"package-summary.html" file in the "java/lang" directory. It will also
create "java/lang" directory in the current or the destination directory
if it doesen't exist.
super(path, filename, packagedoc);
this.prev = prev;
this.next = next;
|
Methods Summary |
---|
protected void | copyDocFiles(java.lang.String path)Copy the "doc-files" directory contents from the source package directory
to the generated documentation directory. For example for a package
java.lang this method find out the source location of the package using
{@link SourcePath} and if "doc-files" directory is found in the source
directory structure, copy the entire directory, to the generated
documentation hierarchy.
SourcePath sourcePath = new SourcePath(
Standard.configuration().sourcepath);
String docfilesdir = path + fileseparator + "doc-files";
File sourcedir = sourcePath.getDirectory(docfilesdir);
if (sourcedir == null) {
return;
}
String destname = destdir;
if (destname.length() > 0 && !destname.endsWith(fileseparator)) {
destname += fileseparator;
}
String src = sourcedir.toString();
String dest = destname + path + fileseparator + "doc-files";
try {
File srcdir = new File(src);
File destdir = new File(dest);
DirectoryManager.createDirectory(dest);
String[] files = srcdir.list();
for (int i = 0; i < files.length; i++) {
File srcfile = new File(srcdir, files[i]);
File destfile = new File(destdir, files[i]);
if (srcfile.isFile()) {
notice("doclet.Copying_File_0_To_Dir_1",
srcfile.toString(), destdir.toString());
Util.copyFile(destfile, srcfile);
}
}
} catch (SecurityException exc) {
throw new DocletAbortException();
} catch (IOException exc) {
throw new DocletAbortException();
}
| public static void | generate(com.sun.javadoc.PackageDoc pkg, com.sun.javadoc.PackageDoc prev, com.sun.javadoc.PackageDoc next)Generate a package summary page for the right-hand frame. Construct
the PackageFrameWriter object and then uses it generate the file.
PackageWriter packgen;
String path = DirectoryManager.getDirectoryPath(pkg);
String filename = "package-summary.html";
try {
packgen = new PackageWriter(path, filename, pkg, prev, next);
packgen.generatePackageFile();
packgen.close();
packgen.copyDocFiles(path);
} catch (IOException exc) {
Standard.configuration().standardmessage.
error("doclet.exception_encountered", exc.toString(), filename);
throw new DocletAbortException();
}
| protected void | generateClassKindListing(com.sun.javadoc.ClassDoc[] arr, java.lang.String label)Generate specific class kind listing. Also add label to the listing.
if(arr.length > 0) {
Arrays.sort(arr);
tableIndexSummary();
printFirstRow(label);
for (int i = 0; i < arr.length; i++) {
boolean deprecated = arr[i].tags("deprecated").length > 0;
if (!Util.isCoreClass(arr[i]) || !isGeneratedDoc(arr[i])) {
continue;
}
trBgcolorStyle("white", "TableRowColor");
summaryRow(15);
bold();
printClassLinkForSameDir(arr[i]);
boldEnd();
summaryRowEnd();
summaryRow(0);
if (deprecated) {
boldText("doclet.Deprecated");
space();
printSummaryDeprecatedComment(
arr[i].tags("deprecated")[0]);
} else {
printSummaryComment(arr[i]);
}
summaryRowEnd();
trEnd();
}
tableEnd();
println(" ");
p();
}
| protected void | generateClassListing()Generate class listing for all the classes in this package. Divide class
listing as per the class kind and generate separate listing for
Classes, Interfaces, Exceptions and Errors.
generateClassKindListing(packagedoc.interfaces(),
getText("doclet.Interface_Summary"));
generateClassKindListing(packagedoc.ordinaryClasses(),
getText("doclet.Class_Summary"));
generateClassKindListing(packagedoc.exceptions(),
getText("doclet.Exception_Summary"));
generateClassKindListing(packagedoc.errors(),
getText("doclet.Error_Summary"));
| protected void | navLinkClassUse()Print "Use" link for this pacakge in the navigation bar.
navCellStart();
printHyperLink("package-use.html", "", getText("doclet.navClassUse"),
true, "NavBarFont1");
navCellEnd();
| protected void | navLinkNext()Print "NEXT PACKAGE" link in the navigation bar.
if (next == null) {
printText("doclet.Next_Package");
} else {
String path = DirectoryManager.getRelativePath(packagedoc.name(),
next.name());
printHyperLink(path + "package-summary.html", "",
getText("doclet.Next_Package"), true);
}
| protected void | navLinkPrevious()Print "PREV PACKAGE" link in the navigation bar.
if (prev == null) {
printText("doclet.Prev_Package");
} else {
String path = DirectoryManager.getRelativePath(packagedoc.name(),
prev.name());
printHyperLink(path + "package-summary.html", "",
getText("doclet.Prev_Package"), true);
}
| protected void | navLinkTree()Print "Tree" link in the navigation bar. This will be link to the package
tree file.
navCellStart();
printHyperLink("package-tree.html", "", getText("doclet.Tree"),
true, "NavBarFont1");
navCellEnd();
| protected void | printFirstRow(java.lang.String label)Print the table heading for the class-listing.
tableHeaderStart("#CCCCFF");
bold(label);
tableHeaderEnd();
| protected void | printPackageComment()Print the package comment as specified in the "packages.html" file in
the source package directory.
if (packagedoc.inlineTags().length > 0) {
anchor("package_description");
h2(getText("doclet.Package_Description", packagedoc.name()));
p();
printInlineComment(packagedoc);
p();
}
| protected void | printPackageDescription()Print the package description and the tag information from the
"packages.html" file.
printPackageComment();
generateTagInfo(packagedoc);
| protected void | printPackageFooter()Print the navigation bar links at the bottom also print the "-bottom"
if specified on the command line.
hr();
navLinks(false);
printBottom();
| protected void | printPackageHeader(java.lang.String heading)Print one line summary cooment for the package at the top of the page and
add link to the description which is generated at the end of the page.
navLinks(true);
hr();
h2(getText("doclet.Package") + " " + heading);
if (packagedoc.inlineTags().length > 0) {
printSummaryComment(packagedoc);
p();
bold(getText("doclet.See"));
br();
printNbsps();
printHyperLink("", "package_description",
getText("doclet.Description"), true);
p();
}
|
|