src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/builders/ConstantsSummaryBuilder.java
changeset 59294 48b88b9c11eb
parent 49879 601277b1d582
equal deleted inserted replaced
59293:5af9fa90cd7b 59294:48b88b9c11eb
    80 
    80 
    81     /**
    81     /**
    82      * The current class being documented.
    82      * The current class being documented.
    83      */
    83      */
    84     private TypeElement currentClass;
    84     private TypeElement currentClass;
    85 
       
    86     /**
       
    87      * The content tree for the constant summary documentation.
       
    88      */
       
    89     private Content contentTree;
       
    90 
    85 
    91     /**
    86     /**
    92      * True if first package is listed.
    87      * True if first package is listed.
    93      */
    88      */
    94     private boolean first = true;
    89     private boolean first = true;
   127     public void build() throws DocletException {
   122     public void build() throws DocletException {
   128         if (writer == null) {
   123         if (writer == null) {
   129             //Doclet does not support this output.
   124             //Doclet does not support this output.
   130             return;
   125             return;
   131         }
   126         }
   132         buildConstantSummary(contentTree);
   127         buildConstantSummary();
   133     }
   128     }
   134 
   129 
   135     /**
   130     /**
   136      * Build the constant summary.
   131      * Build the constant summary.
   137      *
   132      *
   138      * @param contentTree the content tree to which the documentation will be added
       
   139      * @throws DocletException if there is a problem while building the documentation
   133      * @throws DocletException if there is a problem while building the documentation
   140      */
   134      */
   141     protected void buildConstantSummary(Content contentTree) throws DocletException {
   135     protected void buildConstantSummary() throws DocletException {
   142         contentTree = writer.getHeader();
   136         Content contentTree = writer.getHeader();
   143 
   137 
   144         buildContents(contentTree);
   138         buildContents();
   145         buildConstantSummaries(contentTree);
   139         buildConstantSummaries();
   146 
   140 
   147         writer.addFooter(contentTree);
   141         writer.addFooter();
   148         writer.printDocument(contentTree);
   142         writer.printDocument(contentTree);
   149     }
   143     }
   150 
   144 
   151     /**
   145     /**
   152      * Build the list of packages.
   146      * Build the list of packages.
   153      *
   147      */
   154      * @param contentTree the content tree to which the content list will be added
   148     protected void buildContents() {
   155      */
       
   156     protected void buildContents(Content contentTree) {
       
   157         Content contentListTree = writer.getContentsHeader();
   149         Content contentListTree = writer.getContentsHeader();
   158         printedPackageHeaders.clear();
   150         printedPackageHeaders.clear();
   159         for (PackageElement pkg : configuration.packages) {
   151         for (PackageElement pkg : configuration.packages) {
   160             if (hasConstantField(pkg) && !hasPrintedPackageIndex(pkg)) {
   152             if (hasConstantField(pkg) && !hasPrintedPackageIndex(pkg)) {
   161                 writer.addLinkToPackageContent(pkg, printedPackageHeaders, contentListTree);
   153                 writer.addLinkToPackageContent(pkg, printedPackageHeaders, contentListTree);
   162             }
   154             }
   163         }
   155         }
   164         writer.addContentsList(contentTree, contentListTree);
   156         writer.addContentsList(contentListTree);
   165     }
   157     }
   166 
   158 
   167     /**
   159     /**
   168      * Build the summary for each documented package.
   160      * Build the summary for each documented package.
   169      *
   161      *
   170      * @param contentTree the tree to which the summaries will be added
       
   171      * @throws DocletException if there is a problem while building the documentation
   162      * @throws DocletException if there is a problem while building the documentation
   172      */
   163      */
   173     protected void buildConstantSummaries(Content contentTree) throws DocletException {
   164     protected void buildConstantSummaries() throws DocletException {
   174         printedPackageHeaders.clear();
   165         printedPackageHeaders.clear();
   175         Content summariesTree = writer.getConstantSummaries();
   166         Content summariesTree = writer.getConstantSummaries();
   176         for (PackageElement aPackage : configuration.packages) {
   167         for (PackageElement aPackage : configuration.packages) {
   177             if (hasConstantField(aPackage)) {
   168             if (hasConstantField(aPackage)) {
   178                 currentPackage = aPackage;
   169                 currentPackage = aPackage;
   182                 buildClassConstantSummary(summariesTree);
   173                 buildClassConstantSummary(summariesTree);
   183 
   174 
   184                 first = false;
   175                 first = false;
   185             }
   176             }
   186         }
   177         }
   187         writer.addConstantSummaries(contentTree, summariesTree);
   178         writer.addConstantSummaries(summariesTree);
   188     }
   179     }
   189 
   180 
   190     /**
   181     /**
   191      * Build the header for the given package.
   182      * Build the header for the given package.
   192      *
   183      *