langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AllClassesFrameWriter.java
changeset 40587 1c355ea550ed
parent 40500 f293dbb81a53
child 40592 83e85c302cfc
equal deleted inserted replaced
40519:e17429a7e843 40587:1c355ea550ed
    23  * questions.
    23  * questions.
    24  */
    24  */
    25 
    25 
    26 package jdk.javadoc.internal.doclets.formats.html;
    26 package jdk.javadoc.internal.doclets.formats.html;
    27 
    27 
    28 import java.io.IOException;
       
    29 
    28 
    30 import javax.lang.model.element.Element;
    29 import javax.lang.model.element.Element;
    31 import javax.lang.model.element.TypeElement;
    30 import javax.lang.model.element.TypeElement;
    32 
    31 
    33 import jdk.javadoc.internal.doclets.formats.html.markup.HtmlConstants;
    32 import jdk.javadoc.internal.doclets.formats.html.markup.HtmlConstants;
    34 import jdk.javadoc.internal.doclets.formats.html.markup.HtmlStyle;
    33 import jdk.javadoc.internal.doclets.formats.html.markup.HtmlStyle;
    35 import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTag;
    34 import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTag;
    36 import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTree;
    35 import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTree;
    37 import jdk.javadoc.internal.doclets.toolkit.Content;
    36 import jdk.javadoc.internal.doclets.toolkit.Content;
    38 import jdk.javadoc.internal.doclets.toolkit.Messages;
    37 import jdk.javadoc.internal.doclets.toolkit.util.DocFileIOException;
    39 import jdk.javadoc.internal.doclets.toolkit.util.DocPath;
    38 import jdk.javadoc.internal.doclets.toolkit.util.DocPath;
    40 import jdk.javadoc.internal.doclets.toolkit.util.DocPaths;
    39 import jdk.javadoc.internal.doclets.toolkit.util.DocPaths;
    41 import jdk.javadoc.internal.doclets.toolkit.util.DocletAbortException;
       
    42 import jdk.javadoc.internal.doclets.toolkit.util.IndexBuilder;
    40 import jdk.javadoc.internal.doclets.toolkit.util.IndexBuilder;
    43 
    41 
    44 
    42 
    45 /**
    43 /**
    46  * Generate the file with list of all the classes in this run. This page will be
    44  * Generate the file with list of all the classes in this run. This page will be
    73      * Construct AllClassesFrameWriter object. Also initializes the indexbuilder
    71      * Construct AllClassesFrameWriter object. Also initializes the indexbuilder
    74      * variable in this class.
    72      * variable in this class.
    75      * @param configuration  The current configuration
    73      * @param configuration  The current configuration
    76      * @param filename       Path to the file which is getting generated.
    74      * @param filename       Path to the file which is getting generated.
    77      * @param indexbuilder   Unicode based Index from {@link IndexBuilder}
    75      * @param indexbuilder   Unicode based Index from {@link IndexBuilder}
    78      * @throws IOException
       
    79      * @throws DocletAbortException
       
    80      */
    76      */
    81     public AllClassesFrameWriter(ConfigurationImpl configuration,
    77     public AllClassesFrameWriter(ConfigurationImpl configuration,
    82                                  DocPath filename, IndexBuilder indexbuilder) {
    78                                  DocPath filename, IndexBuilder indexbuilder) {
    83         super(configuration, filename);
    79         super(configuration, filename);
    84         this.indexbuilder = indexbuilder;
    80         this.indexbuilder = indexbuilder;
    88      * Create AllClassesFrameWriter object. Then use it to generate the
    84      * Create AllClassesFrameWriter object. Then use it to generate the
    89      * "allclasses-frame.html" file. Generate the file in the current or the
    85      * "allclasses-frame.html" file. Generate the file in the current or the
    90      * destination directory.
    86      * destination directory.
    91      *
    87      *
    92      * @param indexBuilder IndexBuilder object for all classes index.
    88      * @param indexBuilder IndexBuilder object for all classes index.
    93      * @throws DocletAbortException
    89      * @throws DocFileIOException
    94      */
    90      */
    95     public static void generate(ConfigurationImpl configuration,
    91     public static void generate(ConfigurationImpl configuration,
    96             IndexBuilder indexBuilder) {
    92             IndexBuilder indexBuilder) throws DocFileIOException {
    97         if (configuration.frames) {
    93         if (configuration.frames) {
    98             generate(configuration, indexBuilder, DocPaths.ALLCLASSES_FRAME, true);
    94             generate(configuration, indexBuilder, DocPaths.ALLCLASSES_FRAME, true);
    99             generate(configuration, indexBuilder, DocPaths.ALLCLASSES_NOFRAME, false);
    95             generate(configuration, indexBuilder, DocPaths.ALLCLASSES_NOFRAME, false);
   100         } else {
    96         } else {
   101             generate(configuration, indexBuilder, DocPaths.ALLCLASSES, false);
    97             generate(configuration, indexBuilder, DocPaths.ALLCLASSES, false);
   102         }
    98         }
   103     }
    99     }
   104 
   100 
   105     private static void generate(ConfigurationImpl configuration, IndexBuilder indexBuilder,
   101     private static void generate(ConfigurationImpl configuration, IndexBuilder indexBuilder,
   106             DocPath fileName, boolean wantFrames) {
   102         DocPath fileName, boolean wantFrames) throws DocFileIOException {
   107         try {
   103         AllClassesFrameWriter allclassgen = new AllClassesFrameWriter(configuration,
   108             AllClassesFrameWriter allclassgen = new AllClassesFrameWriter(configuration,
   104                 fileName, indexBuilder);
   109                     fileName, indexBuilder);
   105         allclassgen.buildAllClassesFile(wantFrames);
   110             allclassgen.buildAllClassesFile(wantFrames);
   106         allclassgen = new AllClassesFrameWriter(configuration,
   111             allclassgen = new AllClassesFrameWriter(configuration,
   107                                                 fileName, indexBuilder);
   112                                                     fileName, indexBuilder);
   108         allclassgen.buildAllClassesFile(false);
   113             allclassgen.buildAllClassesFile(false);
       
   114         } catch (IOException exc) {
       
   115             Messages messages = configuration.getMessages();
       
   116             messages.error("doclet.exception_encountered",
       
   117                            exc.toString(), fileName);
       
   118             throw new DocletAbortException(exc);
       
   119         }
       
   120     }
   109     }
   121 
   110 
   122     /**
   111     /**
   123      * Print all the classes in the file.
   112      * Print all the classes in the file.
   124      * @param wantFrames True if we want frames.
   113      * @param wantFrames True if we want frames.
   125      */
   114      */
   126     protected void buildAllClassesFile(boolean wantFrames) throws IOException {
   115     protected void buildAllClassesFile(boolean wantFrames) throws DocFileIOException {
   127         String label = configuration.getText("doclet.All_Classes");
   116         String label = configuration.getText("doclet.All_Classes");
   128         Content body = getBody(false, getWindowTitle(label));
   117         Content body = getBody(false, getWindowTitle(label));
   129         Content heading = HtmlTree.HEADING(HtmlConstants.TITLE_HEADING,
   118         Content heading = HtmlTree.HEADING(HtmlConstants.TITLE_HEADING,
   130                 HtmlStyle.bar, contents.allClassesLabel);
   119                 HtmlStyle.bar, contents.allClassesLabel);
   131         body.addContent(heading);
   120         body.addContent(heading);