langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/PackageFrameWriter.java
changeset 45417 f7479ee8de69
parent 42277 2668b0bc7ad7
equal deleted inserted replaced
45416:0d8bb33bdfa7 45417:f7479ee8de69
     1 /*
     1 /*
     2  * Copyright (c) 1998, 2016, Oracle and/or its affiliates. All rights reserved.
     2  * Copyright (c) 1998, 2017, Oracle and/or its affiliates. All rights reserved.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     4  *
     4  *
     5  * This code is free software; you can redistribute it and/or modify it
     5  * This code is free software; you can redistribute it and/or modify it
     6  * under the terms of the GNU General Public License version 2 only, as
     6  * under the terms of the GNU General Public License version 2 only, as
     7  * published by the Free Software Foundation.  Oracle designates this
     7  * published by the Free Software Foundation.  Oracle designates this
    28 import java.util.*;
    28 import java.util.*;
    29 
    29 
    30 import javax.lang.model.element.PackageElement;
    30 import javax.lang.model.element.PackageElement;
    31 import javax.lang.model.element.TypeElement;
    31 import javax.lang.model.element.TypeElement;
    32 
    32 
    33 import jdk.javadoc.doclet.DocletEnvironment;
       
    34 import jdk.javadoc.internal.doclets.formats.html.markup.HtmlConstants;
    33 import jdk.javadoc.internal.doclets.formats.html.markup.HtmlConstants;
    35 import jdk.javadoc.internal.doclets.formats.html.markup.HtmlStyle;
    34 import jdk.javadoc.internal.doclets.formats.html.markup.HtmlStyle;
    36 import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTag;
    35 import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTag;
    37 import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTree;
    36 import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTree;
    38 import jdk.javadoc.internal.doclets.formats.html.markup.StringContent;
    37 import jdk.javadoc.internal.doclets.formats.html.markup.StringContent;
    39 import jdk.javadoc.internal.doclets.toolkit.Configuration;
    38 import jdk.javadoc.internal.doclets.toolkit.BaseConfiguration;
    40 import jdk.javadoc.internal.doclets.toolkit.Content;
    39 import jdk.javadoc.internal.doclets.toolkit.Content;
    41 import jdk.javadoc.internal.doclets.toolkit.util.DocFileIOException;
    40 import jdk.javadoc.internal.doclets.toolkit.util.DocFileIOException;
    42 import jdk.javadoc.internal.doclets.toolkit.util.DocPath;
    41 import jdk.javadoc.internal.doclets.toolkit.util.DocPath;
    43 import jdk.javadoc.internal.doclets.toolkit.util.DocPaths;
    42 import jdk.javadoc.internal.doclets.toolkit.util.DocPaths;
    44 
    43 
    77      * if it doesn't exist.
    76      * if it doesn't exist.
    78      *
    77      *
    79      * @param configuration the configuration of the doclet.
    78      * @param configuration the configuration of the doclet.
    80      * @param packageElement PackageElement under consideration.
    79      * @param packageElement PackageElement under consideration.
    81      */
    80      */
    82     public PackageFrameWriter(ConfigurationImpl configuration, PackageElement packageElement) {
    81     public PackageFrameWriter(HtmlConfiguration configuration, PackageElement packageElement) {
    83         super(configuration, DocPath.forPackage(packageElement).resolve(DocPaths.PACKAGE_FRAME));
    82         super(configuration, DocPath.forPackage(packageElement).resolve(DocPaths.PACKAGE_FRAME));
    84         this.packageElement = packageElement;
    83         this.packageElement = packageElement;
    85         if (configuration.getSpecifiedPackageElements().isEmpty()) {
    84         if (configuration.getSpecifiedPackageElements().isEmpty()) {
    86             documentedClasses = new TreeSet<>(utils.makeGeneralPurposeComparator());
    85             documentedClasses = new TreeSet<>(utils.makeGeneralPurposeComparator());
    87             documentedClasses.addAll(configuration.getIncludedTypeElements());
    86             documentedClasses.addAll(configuration.getIncludedTypeElements());
    94      *
    93      *
    95      * @param configuration the current configuration of the doclet.
    94      * @param configuration the current configuration of the doclet.
    96      * @param packageElement The package for which "pacakge-frame.html" is to be generated.
    95      * @param packageElement The package for which "pacakge-frame.html" is to be generated.
    97      * @throws DocFileIOException if there is a problem generating the package summary page
    96      * @throws DocFileIOException if there is a problem generating the package summary page
    98      */
    97      */
    99     public static void generate(ConfigurationImpl configuration, PackageElement packageElement)
    98     public static void generate(HtmlConfiguration configuration, PackageElement packageElement)
   100             throws DocFileIOException {
    99             throws DocFileIOException {
   101         PackageFrameWriter packgen = new PackageFrameWriter(configuration, packageElement);
   100         PackageFrameWriter packgen = new PackageFrameWriter(configuration, packageElement);
   102         String pkgName = configuration.utils.getPackageName(packageElement);
   101         String pkgName = configuration.utils.getPackageName(packageElement);
   103         HtmlTree body = packgen.getBody(false, packgen.getWindowTitle(pkgName));
   102         HtmlTree body = packgen.getBody(false, packgen.getWindowTitle(pkgName));
   104         Content pkgNameContent = new StringContent(pkgName);
   103         Content pkgNameContent = new StringContent(pkgName);
   125      * Classes, Interfaces, Exceptions and Errors.
   124      * Classes, Interfaces, Exceptions and Errors.
   126      *
   125      *
   127      * @param contentTree the content tree to which the listing will be added
   126      * @param contentTree the content tree to which the listing will be added
   128      */
   127      */
   129     protected void addClassListing(HtmlTree contentTree) {
   128     protected void addClassListing(HtmlTree contentTree) {
   130         Configuration config = configuration;
   129         BaseConfiguration config = configuration;
   131         if (utils.isSpecified(packageElement)) {
   130         if (utils.isSpecified(packageElement)) {
   132             addClassKindListing(utils.getInterfaces(packageElement),
   131             addClassKindListing(utils.getInterfaces(packageElement),
   133                 contents.interfaces, contentTree);
   132                 contents.interfaces, contentTree);
   134             addClassKindListing(utils.getOrdinaryClasses(packageElement),
   133             addClassKindListing(utils.getOrdinaryClasses(packageElement),
   135                 contents.classes, contentTree);
   134                 contents.classes, contentTree);