FileDocCategorySizeDatePackage
AbstractTreeWriter.javaAPI DocExample5689Wed Apr 19 11:17:10 BST 2000com.sun.tools.doclets.standard

AbstractTreeWriter

public abstract class AbstractTreeWriter extends HtmlStandardWriter
Abstract class to print the class hierarchy page for all the Classes. This is sub-classed by {@link PackageTreeWriter} and {@link TreeWriter} to generate the Package Tree and global Tree(for all the classes and packages) pages.
author
Atul M Dambalkar

Fields Summary
protected final ClassTree
classtree
The class and interface tree built by using {@link ClassTree}
Constructors Summary
protected AbstractTreeWriter(String filename, ClassTree classtree)
Constructor initilises classtree variable. This constructor will be used while generating global tree file "overview-tree.html".

param
filename File to be generated.
param
classtree Tree built by {@link com.sun.tools.doclets.ClassTree}

        super(filename);
        this.classtree = classtree;
    
protected AbstractTreeWriter(String path, String filename, ClassTree classtree, PackageDoc pkg)
Create appropriate directory for the package and also initilise the relative path from this generated file to the current or the destination directory. This constructor will be used while generating "package tree" file.

param
path Directories in this path will be created if they are not already there.
param
filename Name of the package tree file to be generated.
classtree
The tree built using {@link com.sun.tools.doclets.ClassTree} for the package pkg.
param
pkg PackageDoc for which tree file will be generated.

        super(path, filename, DirectoryManager.getRelativePath(pkg.name()));
        this.classtree = classtree;
    
Methods Summary
protected voidgenerateLevelInfo(com.sun.javadoc.ClassDoc parent, java.util.List list)
Generate each level of the class tree. For each sub-class or sub-interface indents the next level information. Recurses itself to generate subclasses info. To iterate is human, to recurse is divine - L. Peter Deutsch.

param
parent the superclass or superinterface of the list.
param
list list of the sub-classes at this level.

        if (list.size() > 0) {
            ul();
            for (int i = 0; i < list.size(); i++) {
                ClassDoc local = (ClassDoc)list.get(i);
                printPartialInfo(local);
                printExtendsImplements(parent, local);
                generateLevelInfo(local, classtree.subs(local));   // Recurse 
            }
            ulEnd();
        }
    
protected voidgenerateTree(java.util.List list, java.lang.String heading)
Generate the heading for the tree depending upon tree type if it's a Class Tree or Interface tree and also print the tree.

param
list List of classes which are at the most base level, all the other classes in this run will derive from these classes.
param
heading Heading for the tree.

        if (list.size() > 0) {
            ClassDoc cd = (ClassDoc)list.get(0);   
            printTreeHeading(heading);
            generateLevelInfo(cd.isClass()? (ClassDoc)list.get(0): null, list);
        }
    
protected voidnavLinkTree()
Highlight "Tree" word in the navigation bar, since this is the tree page.

        navCellRevStart();
        fontStyle("NavBarFont1Rev");
        boldText("doclet.Tree");
        fontEnd();
        navCellEnd();
    
protected voidprintExtendsImplements(com.sun.javadoc.ClassDoc parent, com.sun.javadoc.ClassDoc cd)
Print the information regarding the classes which this class extends or implements.

param
cd The classdoc under consideration.

        ClassDoc[] interfaces = cd.interfaces();
        if (interfaces.length > (cd.isInterface()? 1 : 0)) {
            Arrays.sort(interfaces);
            if (cd.isInterface()) {
                print(" (" + getText("doclet.also") + " extends ");
            } else {
                print(" (implements ");
            }
            boolean printcomma = false;
            for (int i = 0; i < interfaces.length; i++) {
                if (parent != interfaces[i]) {
                    if (printcomma) {
                        print(", ");
                    }
                    printPreQualifiedClassLink(interfaces[i]);
                    printcomma = true;
                }
            }
            println(")");
        }
    
protected voidprintPartialInfo(com.sun.javadoc.ClassDoc cd)
Print information about the class kind, if it's a "class" or "interface".

param
cd classdoc.

        boolean isInterface = cd.isInterface();
        li("circle");
        print(isInterface? "interface " : "class ");
        printPreQualifiedBoldClassLink(cd);
    
protected voidprintTreeHeading(java.lang.String heading)
Print the heading for the tree.

param
heading Heading for the tree.

        h2();
        println(getText(heading));
        h2End();