/* * @(#)AbstractPackageIndexWriter.java 1.8 98/04/17 * * Copyright 1998 by Sun Microsystems, Inc., * 901 San Antonio Road, Palo Alto, California, 94303, U.S.A. * All rights reserved. * * This software is the confidential and proprietary information * of Sun Microsystems, Inc. ("Confidential Information"). You * shall not disclose such Confidential Information and shall use * it only in accordance with the terms of the license agreement * you entered into with Sun. */ package com.sun.tools.doclets.standard; import com.sun.tools.doclets.*; import com.sun.javadoc.*; import java.io.*; import java.lang.*; import java.util.*; /** * Abstract class to generate the package index. The package index needs to be * generated in 1.1 compliant, Frame and Non-Frame format. * * @author Atul M Dambalkar */ public abstract class AbstractPackageIndexWriter extends HtmlStandardWriter { /** * Array of Packages. */ protected PackageDoc[] packages; /** * Constructor. */ public AbstractPackageIndexWriter(String filename, RootDoc root) throws IOException { super(filename); packages = root.specifiedPackages(); Arrays.sort(packages); } protected abstract void printNavigationBarHeader(); protected abstract void printNavigationBarFooter(); protected abstract void printIndexHeader(String textKey); protected abstract void printIndexRow(PackageDoc pkg); protected abstract void printIndexFooter(); /** * Generate the contants in the package index file. Call appropriate * methods from the sub-class in order to generate 1.1 or Frame or Non * Frame format. */ protected void generatePackageIndexFile() throws IOException { printHeader(getText("doclet.Package_Summary")); printNavigationBarHeader(); generateIndex(); printOverview(); printNavigationBarFooter(); printFooter(); } /** * Default to no overview, overwrite to add overview. */ protected void printOverview() throws IOException { } protected void generateIndex() { printIndexContents(packages, "doclet.Package_Summary"); } /** * Generate code for package index contents. Call appropriate methods from * the sub-classes. */ protected void printIndexContents(PackageDoc[] packages, String textKey) { if (packages.length > 0) { Arrays.sort(packages); printIndexHeader(textKey); printAllClassesPackagesLink(); for(int i = 0; i < packages.length; i++) { PackageDoc packagedoc = packages[i]; printIndexRow(packagedoc); } printIndexFooter(); } } /** * Print the configuration title. */ protected void printConfigurationTitle() { if (Standard.configuration().title.length() > 0) { center(); h2(); print(Standard.configuration().title); h2End(); centerEnd(); } } protected void navLinkContents() { boldText("doclet.Overview"); } protected void printAllClassesPackagesLink() { } }