< prev index next >

src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/PackageFrameWriter.java

Print this page




  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any
  23  * questions.
  24  */
  25 
  26 package jdk.javadoc.internal.doclets.formats.html;
  27 
  28 import java.util.*;
  29 
  30 import javax.lang.model.element.PackageElement;
  31 import javax.lang.model.element.TypeElement;
  32 
  33 import jdk.javadoc.internal.doclets.formats.html.markup.HtmlConstants;
  34 import jdk.javadoc.internal.doclets.formats.html.markup.HtmlStyle;
  35 import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTag;
  36 import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTree;
  37 import jdk.javadoc.internal.doclets.formats.html.markup.StringContent;
  38 import jdk.javadoc.internal.doclets.toolkit.BaseConfiguration;
  39 import jdk.javadoc.internal.doclets.toolkit.Content;
  40 import jdk.javadoc.internal.doclets.toolkit.util.DocFileIOException;
  41 import jdk.javadoc.internal.doclets.toolkit.util.DocPath;
  42 import jdk.javadoc.internal.doclets.toolkit.util.DocPaths;
  43 
  44 /**
  45  * Class to generate file for each package contents in the left-hand bottom
  46  * frame. This will list all the Class Kinds in the package. A click on any
  47  * class-kind will update the right-hand frame with the clicked class-kind page.
  48  *
  49  *  <p><b>This is NOT part of any supported API.
  50  *  If you write code that depends on this, you do so at your own risk.
  51  *  This code and its internal interfaces are subject to change or
  52  *  deletion without notice.</b>
  53  *
  54  * @author Atul M Dambalkar
  55  * @author Bhavesh Patel (Modified)
  56  */
  57 public class PackageFrameWriter extends HtmlDocletWriter {
  58 
  59     /**
  60      * The package being documented.
  61      */
  62     private final PackageElement packageElement;
  63 
  64     /**
  65      * The classes to be documented.  Use this to filter out classes
  66      * that will not be documented.
  67      */
  68     private SortedSet<TypeElement> documentedClasses;
  69 
  70     /**
  71      * Constructor to construct PackageFrameWriter object and to generate
  72      * "package-frame.html" file in the respective package directory.
  73      * For example for package "java.lang" this will generate file
  74      * "package-frame.html" file in the "java/lang" directory. It will also
  75      * create "java/lang" directory in the current or the destination directory
  76      * if it doesn't exist.
  77      *
  78      * @param configuration the configuration of the doclet.
  79      * @param packageElement PackageElement under consideration.
  80      */
  81     public PackageFrameWriter(HtmlConfiguration configuration, PackageElement packageElement) {
  82         super(configuration, DocPath.forPackage(packageElement).resolve(DocPaths.PACKAGE_FRAME));

  83         this.packageElement = packageElement;
  84         if (configuration.getSpecifiedPackageElements().isEmpty()) {
  85             documentedClasses = new TreeSet<>(utils.makeGeneralPurposeComparator());
  86             documentedClasses.addAll(configuration.getIncludedTypeElements());
  87         }
  88     }
  89 
  90     /**
  91      * Generate a package summary page for the left-hand bottom frame. Construct
  92      * the PackageFrameWriter object and then uses it generate the file.
  93      *
  94      * @param configuration the current configuration of the doclet.
  95      * @param packageElement The package for which "pacakge-frame.html" is to be generated.
  96      * @throws DocFileIOException if there is a problem generating the package summary page
  97      */
  98     public static void generate(HtmlConfiguration configuration, PackageElement packageElement)
  99             throws DocFileIOException {
 100         PackageFrameWriter packgen = new PackageFrameWriter(configuration, packageElement);
 101         String pkgName = configuration.utils.getPackageName(packageElement);
 102         HtmlTree body = packgen.getBody(false, packgen.getWindowTitle(pkgName));




  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any
  23  * questions.
  24  */
  25 
  26 package jdk.javadoc.internal.doclets.formats.html;
  27 
  28 import java.util.*;
  29 
  30 import javax.lang.model.element.PackageElement;
  31 import javax.lang.model.element.TypeElement;
  32 
  33 import jdk.javadoc.internal.doclets.formats.html.markup.HtmlConstants;
  34 import jdk.javadoc.internal.doclets.formats.html.markup.HtmlStyle;
  35 import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTag;
  36 import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTree;
  37 import jdk.javadoc.internal.doclets.formats.html.markup.StringContent;
  38 import jdk.javadoc.internal.doclets.toolkit.BaseConfiguration;
  39 import jdk.javadoc.internal.doclets.toolkit.Content;
  40 import jdk.javadoc.internal.doclets.toolkit.util.DocFileIOException;

  41 import jdk.javadoc.internal.doclets.toolkit.util.DocPaths;
  42 
  43 /**
  44  * Class to generate file for each package contents in the left-hand bottom
  45  * frame. This will list all the Class Kinds in the package. A click on any
  46  * class-kind will update the right-hand frame with the clicked class-kind page.
  47  *
  48  *  <p><b>This is NOT part of any supported API.
  49  *  If you write code that depends on this, you do so at your own risk.
  50  *  This code and its internal interfaces are subject to change or
  51  *  deletion without notice.</b>
  52  *
  53  * @author Atul M Dambalkar
  54  * @author Bhavesh Patel (Modified)
  55  */
  56 public class PackageFrameWriter extends HtmlDocletWriter {
  57 
  58     /**
  59      * The package being documented.
  60      */
  61     private final PackageElement packageElement;
  62 
  63     /**
  64      * The classes to be documented.  Use this to filter out classes
  65      * that will not be documented.
  66      */
  67     private SortedSet<TypeElement> documentedClasses;
  68 
  69     /**
  70      * Constructor to construct PackageFrameWriter object and to generate
  71      * "package-frame.html" file in the respective package directory.
  72      * For example for package "java.lang" this will generate file
  73      * "package-frame.html" file in the "java/lang" directory. It will also
  74      * create "java/lang" directory in the current or the destination directory
  75      * if it doesn't exist.
  76      *
  77      * @param configuration the configuration of the doclet.
  78      * @param packageElement PackageElement under consideration.
  79      */
  80     public PackageFrameWriter(HtmlConfiguration configuration, PackageElement packageElement) {
  81         super(configuration, 
  82                 configuration.docPaths.forPackage(packageElement).resolve(DocPaths.PACKAGE_FRAME));
  83         this.packageElement = packageElement;
  84         if (configuration.getSpecifiedPackageElements().isEmpty()) {
  85             documentedClasses = new TreeSet<>(utils.makeGeneralPurposeComparator());
  86             documentedClasses.addAll(configuration.getIncludedTypeElements());
  87         }
  88     }
  89 
  90     /**
  91      * Generate a package summary page for the left-hand bottom frame. Construct
  92      * the PackageFrameWriter object and then uses it generate the file.
  93      *
  94      * @param configuration the current configuration of the doclet.
  95      * @param packageElement The package for which "pacakge-frame.html" is to be generated.
  96      * @throws DocFileIOException if there is a problem generating the package summary page
  97      */
  98     public static void generate(HtmlConfiguration configuration, PackageElement packageElement)
  99             throws DocFileIOException {
 100         PackageFrameWriter packgen = new PackageFrameWriter(configuration, packageElement);
 101         String pkgName = configuration.utils.getPackageName(packageElement);
 102         HtmlTree body = packgen.getBody(false, packgen.getWindowTitle(pkgName));


< prev index next >