langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/ProfilePackageSummaryBuilder.java
changeset 25454 376a52c9540c
parent 15723 58a73dac9ee4
equal deleted inserted replaced
25453:be80cf0463b3 25454:376a52c9540c
     1 /*
     1 /*
     2  * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
     2  * Copyright (c) 2013, 2014, 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.io.*;
    28 import java.io.*;
    29 
    29 
    30 import com.sun.javadoc.*;
    30 import com.sun.javadoc.*;
    31 import com.sun.tools.javac.jvm.Profile;
    31 import com.sun.tools.javac.jvm.Profile;
    32 import com.sun.tools.doclets.internal.toolkit.*;
    32 import com.sun.tools.doclets.internal.toolkit.*;
    33 import com.sun.tools.doclets.internal.toolkit.util.*;
       
    34 
    33 
    35 /**
    34 /**
    36  * Builds the summary for a given profile package.
    35  * Builds the summary for a given profile package.
    37  *
    36  *
    38  *  <p><b>This is NOT part of any supported API.
    37  *  <p><b>This is NOT part of any supported API.
   134      * @param node the XML element that specifies which components to document
   133      * @param node the XML element that specifies which components to document
   135      * @param contentTree the content tree to which the documentation will be added
   134      * @param contentTree the content tree to which the documentation will be added
   136      */
   135      */
   137     public void buildPackageDoc(XMLNode node, Content contentTree) throws Exception {
   136     public void buildPackageDoc(XMLNode node, Content contentTree) throws Exception {
   138         contentTree = profilePackageWriter.getPackageHeader(
   137         contentTree = profilePackageWriter.getPackageHeader(
   139                 Util.getPackageName(packageDoc));
   138                 utils.getPackageName(packageDoc));
   140         buildChildren(node, contentTree);
   139         buildChildren(node, contentTree);
   141         profilePackageWriter.addPackageFooter(contentTree);
   140         profilePackageWriter.addPackageFooter(contentTree);
   142         profilePackageWriter.printDocument(contentTree);
   141         profilePackageWriter.printDocument(contentTree);
   143         profilePackageWriter.close();
   142         profilePackageWriter.close();
   144         Util.copyDocFiles(configuration, packageDoc);
   143         utils.copyDocFiles(configuration, packageDoc);
   145     }
   144     }
   146 
   145 
   147     /**
   146     /**
   148      * Build the content for the profile package doc.
   147      * Build the content for the profile package doc.
   149      *
   148      *
   188         };
   187         };
   189         ClassDoc[] interfaces =
   188         ClassDoc[] interfaces =
   190                 packageDoc.isIncluded()
   189                 packageDoc.isIncluded()
   191                         ? packageDoc.interfaces()
   190                         ? packageDoc.interfaces()
   192                         : configuration.classDocCatalog.interfaces(
   191                         : configuration.classDocCatalog.interfaces(
   193                                 Util.getPackageName(packageDoc));
   192                                 utils.getPackageName(packageDoc));
   194         if (interfaces.length > 0) {
   193         if (interfaces.length > 0) {
   195             profilePackageWriter.addClassesSummary(
   194             profilePackageWriter.addClassesSummary(
   196                     interfaces,
   195                     interfaces,
   197                     configuration.getText("doclet.Interface_Summary"),
   196                     configuration.getText("doclet.Interface_Summary"),
   198                     interfaceTableSummary, interfaceTableHeader, summaryContentTree);
   197                     interfaceTableSummary, interfaceTableHeader, summaryContentTree);
   217         };
   216         };
   218         ClassDoc[] classes =
   217         ClassDoc[] classes =
   219                 packageDoc.isIncluded()
   218                 packageDoc.isIncluded()
   220                         ? packageDoc.ordinaryClasses()
   219                         ? packageDoc.ordinaryClasses()
   221                         : configuration.classDocCatalog.ordinaryClasses(
   220                         : configuration.classDocCatalog.ordinaryClasses(
   222                                 Util.getPackageName(packageDoc));
   221                                 utils.getPackageName(packageDoc));
   223         if (classes.length > 0) {
   222         if (classes.length > 0) {
   224             profilePackageWriter.addClassesSummary(
   223             profilePackageWriter.addClassesSummary(
   225                     classes,
   224                     classes,
   226                     configuration.getText("doclet.Class_Summary"),
   225                     configuration.getText("doclet.Class_Summary"),
   227                     classTableSummary, classTableHeader, summaryContentTree);
   226                     classTableSummary, classTableHeader, summaryContentTree);
   246         };
   245         };
   247         ClassDoc[] enums =
   246         ClassDoc[] enums =
   248                 packageDoc.isIncluded()
   247                 packageDoc.isIncluded()
   249                         ? packageDoc.enums()
   248                         ? packageDoc.enums()
   250                         : configuration.classDocCatalog.enums(
   249                         : configuration.classDocCatalog.enums(
   251                                 Util.getPackageName(packageDoc));
   250                                 utils.getPackageName(packageDoc));
   252         if (enums.length > 0) {
   251         if (enums.length > 0) {
   253             profilePackageWriter.addClassesSummary(
   252             profilePackageWriter.addClassesSummary(
   254                     enums,
   253                     enums,
   255                     configuration.getText("doclet.Enum_Summary"),
   254                     configuration.getText("doclet.Enum_Summary"),
   256                     enumTableSummary, enumTableHeader, summaryContentTree);
   255                     enumTableSummary, enumTableHeader, summaryContentTree);
   275         };
   274         };
   276         ClassDoc[] exceptions =
   275         ClassDoc[] exceptions =
   277                 packageDoc.isIncluded()
   276                 packageDoc.isIncluded()
   278                         ? packageDoc.exceptions()
   277                         ? packageDoc.exceptions()
   279                         : configuration.classDocCatalog.exceptions(
   278                         : configuration.classDocCatalog.exceptions(
   280                                 Util.getPackageName(packageDoc));
   279                                 utils.getPackageName(packageDoc));
   281         if (exceptions.length > 0) {
   280         if (exceptions.length > 0) {
   282             profilePackageWriter.addClassesSummary(
   281             profilePackageWriter.addClassesSummary(
   283                     exceptions,
   282                     exceptions,
   284                     configuration.getText("doclet.Exception_Summary"),
   283                     configuration.getText("doclet.Exception_Summary"),
   285                     exceptionTableSummary, exceptionTableHeader, summaryContentTree);
   284                     exceptionTableSummary, exceptionTableHeader, summaryContentTree);
   304         };
   303         };
   305         ClassDoc[] errors =
   304         ClassDoc[] errors =
   306                 packageDoc.isIncluded()
   305                 packageDoc.isIncluded()
   307                         ? packageDoc.errors()
   306                         ? packageDoc.errors()
   308                         : configuration.classDocCatalog.errors(
   307                         : configuration.classDocCatalog.errors(
   309                                 Util.getPackageName(packageDoc));
   308                                 utils.getPackageName(packageDoc));
   310         if (errors.length > 0) {
   309         if (errors.length > 0) {
   311             profilePackageWriter.addClassesSummary(
   310             profilePackageWriter.addClassesSummary(
   312                     errors,
   311                     errors,
   313                     configuration.getText("doclet.Error_Summary"),
   312                     configuration.getText("doclet.Error_Summary"),
   314                     errorTableSummary, errorTableHeader, summaryContentTree);
   313                     errorTableSummary, errorTableHeader, summaryContentTree);
   333         };
   332         };
   334         ClassDoc[] annotationTypes =
   333         ClassDoc[] annotationTypes =
   335                 packageDoc.isIncluded()
   334                 packageDoc.isIncluded()
   336                         ? packageDoc.annotationTypes()
   335                         ? packageDoc.annotationTypes()
   337                         : configuration.classDocCatalog.annotationTypes(
   336                         : configuration.classDocCatalog.annotationTypes(
   338                                 Util.getPackageName(packageDoc));
   337                                 utils.getPackageName(packageDoc));
   339         if (annotationTypes.length > 0) {
   338         if (annotationTypes.length > 0) {
   340             profilePackageWriter.addClassesSummary(
   339             profilePackageWriter.addClassesSummary(
   341                     annotationTypes,
   340                     annotationTypes,
   342                     configuration.getText("doclet.Annotation_Types_Summary"),
   341                     configuration.getText("doclet.Annotation_Types_Summary"),
   343                     annotationtypeTableSummary, annotationtypeTableHeader,
   342                     annotationtypeTableSummary, annotationtypeTableHeader,