home *** CD-ROM | disk | FTP | other *** search
/ Internet News 1999 October / INEWS_10_CD.ISO / pc / jdk / jdk1.2.2 / docs / tooldocs / javadoc / source / standard / AbstractPackageWriter.java < prev    next >
Encoding:
Java Source  |  1999-09-19  |  3.0 KB  |  98 lines

  1. /*
  2.  * @(#)AbstractPackageWriter.java    1.11 98/08/18
  3.  *
  4.  * Copyright 1998 by Sun Microsystems, Inc.,
  5.  * 901 San Antonio Road, Palo Alto, California, 94303, U.S.A.
  6.  * All rights reserved.
  7.  *
  8.  * This software is the confidential and proprietary information
  9.  * of Sun Microsystems, Inc. ("Confidential Information").  You
  10.  * shall not disclose such Confidential Information and shall use
  11.  * it only in accordance with the terms of the license agreement
  12.  * you entered into with Sun.
  13.  */
  14.  
  15. package com.sun.tools.doclets.standard;
  16.  
  17. import com.sun.tools.doclets.*;
  18. import com.sun.javadoc.*;
  19. import java.io.*;
  20. import java.lang.*;
  21. import java.util.*;
  22.  
  23. /**
  24.  * Abstract class to generate file for each package contents. Sub-classed to
  25.  * generate specific formats Frame and Non-Frame Output by 
  26.  * {@link PackageIndexFrameWriter} and {@link PackageIndexFrameWriter} 
  27.  * respectively.
  28.  *
  29.  * @author Atul M Dambalkar
  30.  */
  31. public abstract class AbstractPackageWriter extends HtmlStandardWriter {
  32.  
  33.     /**
  34.      * The package under consideration.
  35.      */
  36.     PackageDoc packagedoc;
  37.  
  38.     /**
  39.      * Create appropriate directory for the package and also initilise the 
  40.      * relative path from this generated file to the current or
  41.      * the destination directory.
  42.      *
  43.      * @param path Directories in this path will be created if they are not 
  44.      * already there.
  45.      * @param filename Name of the package summary file to be generated.
  46.      * @param packagedoc PackageDoc under consideration.
  47.      */
  48.     public AbstractPackageWriter(String path, String filename, 
  49.                                  PackageDoc packagedoc) 
  50.                                  throws IOException, DocletAbortException {
  51.         super(path, filename,
  52.               DirectoryManager.getRelativePath(packagedoc.name()));
  53.         this.packagedoc = packagedoc;
  54.     }
  55.  
  56.     protected abstract void generateClassListing();
  57.  
  58.     protected abstract void printPackageDescription() throws IOException;
  59.  
  60.     protected abstract void printPackageHeader(String head);
  61.  
  62.     protected abstract void printPackageFooter();
  63.  
  64.     /**
  65.      * Generate Individual Package File with Class/Interface/Exceptions and
  66.      * Error Listing with the appropriate links. Calls the methods from the
  67.      * sub-classes to generate the file contents.
  68.      */
  69.     protected void generatePackageFile() throws IOException {
  70.         String pkgName = packagedoc.toString();
  71.         String heading = getText("doclet.Window_Package", 
  72.                                   Standard.configuration().windowtitle,
  73.                               pkgName);
  74.         printHeader(heading);
  75.         printPackageHeader(pkgName);
  76.  
  77.         generateClassListing();
  78.         printPackageDescription();
  79.  
  80.         printPackageFooter();
  81.         printBodyHtmlEnd();
  82.     }
  83.    
  84.     /**
  85.      * Highlight "Package" in the navigation bar, as this is the package page.
  86.      */
  87.     protected void navLinkPackage() {
  88.         navCellRevStart();
  89.         fontStyle("NavBarFont1Rev");
  90.         boldText("doclet.Package");
  91.         fontEnd();
  92.         navCellEnd();
  93.     }
  94. }
  95.  
  96.  
  97.  
  98.