src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/DocFilesHandlerImpl.java
author jjg
Thu, 21 Feb 2019 15:05:47 -0800
changeset 53880 3f1e9372557f
parent 53866 880baf6db17b
child 54060 53a95878619f
permissions -rw-r--r--
8219497: Unused parameter in HtmlDocletWriter::printHtmlDocument Reviewed-by: hannesw
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
48029
e9dab2492924 8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff changeset
     1
/*
53863
d001808c57e8 8218998: Add metadata to generated API documentation files
jjg
parents: 53562
diff changeset
     2
 * Copyright (c) 2017, 2019, Oracle and/or its affiliates. All rights reserved.
48029
e9dab2492924 8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
e9dab2492924 8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff changeset
     4
 *
e9dab2492924 8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
e9dab2492924 8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
e9dab2492924 8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff changeset
     7
 * published by the Free Software Foundation.  Oracle designates this
e9dab2492924 8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff changeset
     8
 * particular file as subject to the "Classpath" exception as provided
e9dab2492924 8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff changeset
     9
 * by Oracle in the LICENSE file that accompanied this code.
e9dab2492924 8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff changeset
    10
 *
e9dab2492924 8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff changeset
    11
 * This code is distributed in the hope that it will be useful, but WITHOUT
e9dab2492924 8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff changeset
    12
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
e9dab2492924 8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff changeset
    13
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
e9dab2492924 8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff changeset
    14
 * version 2 for more details (a copy is included in the LICENSE file that
e9dab2492924 8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff changeset
    15
 * accompanied this code).
e9dab2492924 8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff changeset
    16
 *
e9dab2492924 8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff changeset
    17
 * You should have received a copy of the GNU General Public License version
e9dab2492924 8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff changeset
    18
 * 2 along with this work; if not, write to the Free Software Foundation,
e9dab2492924 8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff changeset
    19
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
e9dab2492924 8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff changeset
    20
 *
e9dab2492924 8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff changeset
    21
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
e9dab2492924 8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff changeset
    22
 * or visit www.oracle.com if you need additional information or have any
e9dab2492924 8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff changeset
    23
 * questions.
e9dab2492924 8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff changeset
    24
 */
e9dab2492924 8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff changeset
    25
e9dab2492924 8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff changeset
    26
package jdk.javadoc.internal.doclets.formats.html;
e9dab2492924 8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff changeset
    27
e9dab2492924 8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff changeset
    28
import com.sun.source.doctree.DocTree;
e9dab2492924 8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff changeset
    29
import com.sun.source.doctree.EndElementTree;
e9dab2492924 8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff changeset
    30
import com.sun.source.doctree.StartElementTree;
e9dab2492924 8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff changeset
    31
import com.sun.source.doctree.TextTree;
53164
f2140eebd91b 8214738: javadoc should honor styles in doc-files
pmuthuswamy
parents: 52685
diff changeset
    32
import com.sun.source.util.DocTreeFactory;
48552
f94706337b07 8194953: doclet corrupts HTML files when adding navbar
ksrini
parents: 48029
diff changeset
    33
import com.sun.tools.doclint.HtmlTag;
48029
e9dab2492924 8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff changeset
    34
import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTree;
49551
0d4786e42471 8196200: Implement a navigation builder in javadoc
bpatel
parents: 48759
diff changeset
    35
import jdk.javadoc.internal.doclets.formats.html.markup.Navigation;
48029
e9dab2492924 8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff changeset
    36
import jdk.javadoc.internal.doclets.toolkit.Content;
e9dab2492924 8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff changeset
    37
import jdk.javadoc.internal.doclets.toolkit.DocFileElement;
e9dab2492924 8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff changeset
    38
import jdk.javadoc.internal.doclets.toolkit.DocFilesHandler;
e9dab2492924 8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff changeset
    39
import jdk.javadoc.internal.doclets.toolkit.util.DocFile;
e9dab2492924 8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff changeset
    40
import jdk.javadoc.internal.doclets.toolkit.util.DocFileIOException;
e9dab2492924 8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff changeset
    41
import jdk.javadoc.internal.doclets.toolkit.util.DocPath;
e9dab2492924 8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff changeset
    42
import jdk.javadoc.internal.doclets.toolkit.util.DocPaths;
53164
f2140eebd91b 8214738: javadoc should honor styles in doc-files
pmuthuswamy
parents: 52685
diff changeset
    43
import jdk.javadoc.internal.doclets.toolkit.util.DocletConstants;
48029
e9dab2492924 8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff changeset
    44
import jdk.javadoc.internal.doclets.toolkit.util.Utils;
e9dab2492924 8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff changeset
    45
e9dab2492924 8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff changeset
    46
import javax.lang.model.element.Element;
e9dab2492924 8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff changeset
    47
import javax.lang.model.element.ModuleElement;
e9dab2492924 8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff changeset
    48
import javax.lang.model.element.PackageElement;
e9dab2492924 8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff changeset
    49
import javax.tools.FileObject;
e9dab2492924 8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff changeset
    50
import javax.tools.JavaFileManager.Location;
49551
0d4786e42471 8196200: Implement a navigation builder in javadoc
bpatel
parents: 48759
diff changeset
    51
53164
f2140eebd91b 8214738: javadoc should honor styles in doc-files
pmuthuswamy
parents: 52685
diff changeset
    52
import java.util.ArrayList;
48029
e9dab2492924 8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff changeset
    53
import java.util.Collections;
e9dab2492924 8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff changeset
    54
import java.util.List;
e9dab2492924 8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff changeset
    55
49551
0d4786e42471 8196200: Implement a navigation builder in javadoc
bpatel
parents: 48759
diff changeset
    56
import jdk.javadoc.internal.doclets.formats.html.markup.Navigation.PageMode;
0d4786e42471 8196200: Implement a navigation builder in javadoc
bpatel
parents: 48759
diff changeset
    57
48029
e9dab2492924 8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff changeset
    58
public class DocFilesHandlerImpl implements DocFilesHandler {
e9dab2492924 8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff changeset
    59
e9dab2492924 8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff changeset
    60
    public final Element element;
e9dab2492924 8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff changeset
    61
    public final Location location;
e9dab2492924 8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff changeset
    62
    public final DocPath  source;
e9dab2492924 8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff changeset
    63
    public final HtmlConfiguration configuration;
49551
0d4786e42471 8196200: Implement a navigation builder in javadoc
bpatel
parents: 48759
diff changeset
    64
    private Navigation navBar;
48029
e9dab2492924 8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff changeset
    65
e9dab2492924 8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff changeset
    66
    /**
e9dab2492924 8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff changeset
    67
     * Constructor to construct the DocFilesWriter object.
e9dab2492924 8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff changeset
    68
     *
e9dab2492924 8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff changeset
    69
     * @param configuration the configuration of this doclet.
e9dab2492924 8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff changeset
    70
     * @param element the containing element of the doc-files.
e9dab2492924 8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff changeset
    71
     *
e9dab2492924 8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff changeset
    72
     */
e9dab2492924 8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff changeset
    73
    public DocFilesHandlerImpl(HtmlConfiguration configuration, Element element) {
e9dab2492924 8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff changeset
    74
        this.configuration = configuration;
e9dab2492924 8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff changeset
    75
        this.element = element;
e9dab2492924 8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff changeset
    76
e9dab2492924 8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff changeset
    77
        switch (element.getKind()) {
e9dab2492924 8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff changeset
    78
            case MODULE:
48759
ffa68af7da87 8195795: Organize output files by module/package, not just package
jjg
parents: 48552
diff changeset
    79
                ModuleElement mdle = (ModuleElement)element;
ffa68af7da87 8195795: Organize output files by module/package, not just package
jjg
parents: 48552
diff changeset
    80
                location = configuration.utils.getLocationForModule(mdle);
48029
e9dab2492924 8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff changeset
    81
                source = DocPaths.DOC_FILES;
e9dab2492924 8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff changeset
    82
                break;
e9dab2492924 8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff changeset
    83
            case PACKAGE:
48759
ffa68af7da87 8195795: Organize output files by module/package, not just package
jjg
parents: 48552
diff changeset
    84
                PackageElement pkg = (PackageElement)element;
ffa68af7da87 8195795: Organize output files by module/package, not just package
jjg
parents: 48552
diff changeset
    85
                location = configuration.utils.getLocationForPackage(pkg);
ffa68af7da87 8195795: Organize output files by module/package, not just package
jjg
parents: 48552
diff changeset
    86
                // Note, given that we have a module-specific location,
ffa68af7da87 8195795: Organize output files by module/package, not just package
jjg
parents: 48552
diff changeset
    87
                // we want a module-relative path for the source, and not the
ffa68af7da87 8195795: Organize output files by module/package, not just package
jjg
parents: 48552
diff changeset
    88
                // standard path that may include the module directory
ffa68af7da87 8195795: Organize output files by module/package, not just package
jjg
parents: 48552
diff changeset
    89
                source = DocPath.create(pkg.getQualifiedName().toString().replace('.', '/'))
ffa68af7da87 8195795: Organize output files by module/package, not just package
jjg
parents: 48552
diff changeset
    90
                        .resolve(DocPaths.DOC_FILES);
48029
e9dab2492924 8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff changeset
    91
                break;
e9dab2492924 8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff changeset
    92
            default:
e9dab2492924 8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff changeset
    93
                throw new AssertionError("unsupported element " + element);
e9dab2492924 8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff changeset
    94
        }
e9dab2492924 8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff changeset
    95
    }
e9dab2492924 8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff changeset
    96
e9dab2492924 8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff changeset
    97
    /**
e9dab2492924 8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff changeset
    98
     * Copy doc-files directory and its contents from the source
e9dab2492924 8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff changeset
    99
     * elements directory to the generated documentation directory.
e9dab2492924 8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff changeset
   100
     *
e9dab2492924 8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff changeset
   101
     * @throws DocFileIOException if there is a problem while copying
e9dab2492924 8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff changeset
   102
     *         the documentation files
e9dab2492924 8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff changeset
   103
     */
e9dab2492924 8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff changeset
   104
e9dab2492924 8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff changeset
   105
    public void copyDocFiles()  throws DocFileIOException {
e9dab2492924 8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff changeset
   106
        boolean first = true;
e9dab2492924 8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff changeset
   107
        for (DocFile srcdir : DocFile.list(configuration, location, source)) {
e9dab2492924 8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff changeset
   108
            if (!srcdir.isDirectory()) {
e9dab2492924 8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff changeset
   109
                continue;
e9dab2492924 8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff changeset
   110
            }
e9dab2492924 8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff changeset
   111
            DocPath path = null;
e9dab2492924 8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff changeset
   112
            switch (this.element.getKind()) {
e9dab2492924 8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff changeset
   113
                case MODULE:
48759
ffa68af7da87 8195795: Organize output files by module/package, not just package
jjg
parents: 48552
diff changeset
   114
                    path = DocPaths.forModule((ModuleElement)this.element);
48029
e9dab2492924 8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff changeset
   115
                    break;
e9dab2492924 8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff changeset
   116
                case PACKAGE:
48759
ffa68af7da87 8195795: Organize output files by module/package, not just package
jjg
parents: 48552
diff changeset
   117
                    path = configuration.docPaths.forPackage((PackageElement)this.element);
48029
e9dab2492924 8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff changeset
   118
                    break;
e9dab2492924 8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff changeset
   119
                default:
e9dab2492924 8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff changeset
   120
                    throw new AssertionError("unknown kind:" + this.element.getKind());
e9dab2492924 8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff changeset
   121
            }
e9dab2492924 8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff changeset
   122
            copyDirectory(srcdir, path.resolve(DocPaths.DOC_FILES), first);
e9dab2492924 8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff changeset
   123
            first = false;
e9dab2492924 8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff changeset
   124
        }
e9dab2492924 8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff changeset
   125
    }
e9dab2492924 8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff changeset
   126
53866
880baf6db17b 8213354: Support package-specific stylesheets
pmuthuswamy
parents: 53863
diff changeset
   127
    public List<DocPath> getStylesheets() throws DocFileIOException {
880baf6db17b 8213354: Support package-specific stylesheets
pmuthuswamy
parents: 53863
diff changeset
   128
        List<DocPath> stylesheets = new ArrayList<DocPath>();
880baf6db17b 8213354: Support package-specific stylesheets
pmuthuswamy
parents: 53863
diff changeset
   129
        for (DocFile srcdir : DocFile.list(configuration, location, source)) {
880baf6db17b 8213354: Support package-specific stylesheets
pmuthuswamy
parents: 53863
diff changeset
   130
            for (DocFile srcFile : srcdir.list()) {
880baf6db17b 8213354: Support package-specific stylesheets
pmuthuswamy
parents: 53863
diff changeset
   131
                if (srcFile.getName().endsWith(".css"))
880baf6db17b 8213354: Support package-specific stylesheets
pmuthuswamy
parents: 53863
diff changeset
   132
                    stylesheets.add(DocPaths.DOC_FILES.resolve(srcFile.getName()));
880baf6db17b 8213354: Support package-specific stylesheets
pmuthuswamy
parents: 53863
diff changeset
   133
            }
880baf6db17b 8213354: Support package-specific stylesheets
pmuthuswamy
parents: 53863
diff changeset
   134
        }
880baf6db17b 8213354: Support package-specific stylesheets
pmuthuswamy
parents: 53863
diff changeset
   135
        return stylesheets;
880baf6db17b 8213354: Support package-specific stylesheets
pmuthuswamy
parents: 53863
diff changeset
   136
    }
48029
e9dab2492924 8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff changeset
   137
e9dab2492924 8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff changeset
   138
    private void copyDirectory(DocFile srcdir, final DocPath dstDocPath,
e9dab2492924 8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff changeset
   139
                               boolean first) throws DocFileIOException {
e9dab2492924 8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff changeset
   140
        DocFile dstdir = DocFile.createFileForOutput(configuration, dstDocPath);
e9dab2492924 8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff changeset
   141
        if (srcdir.isSameFile(dstdir)) {
e9dab2492924 8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff changeset
   142
            return;
e9dab2492924 8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff changeset
   143
        }
e9dab2492924 8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff changeset
   144
        for (DocFile srcfile: srcdir.list()) {
e9dab2492924 8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff changeset
   145
            DocFile destfile = dstdir.resolve(srcfile.getName());
e9dab2492924 8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff changeset
   146
            if (srcfile.isFile()) {
e9dab2492924 8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff changeset
   147
                if (destfile.exists() && !first) {
e9dab2492924 8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff changeset
   148
                    configuration.messages.warning("doclet.Copy_Overwrite_warning",
e9dab2492924 8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff changeset
   149
                            srcfile.getPath(), dstdir.getPath());
e9dab2492924 8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff changeset
   150
                } else {
48552
f94706337b07 8194953: doclet corrupts HTML files when adding navbar
ksrini
parents: 48029
diff changeset
   151
                    if (Utils.toLowerCase(srcfile.getPath()).endsWith(".html")) {
53164
f2140eebd91b 8214738: javadoc should honor styles in doc-files
pmuthuswamy
parents: 52685
diff changeset
   152
                        handleHtmlFile(srcfile, dstDocPath);
f2140eebd91b 8214738: javadoc should honor styles in doc-files
pmuthuswamy
parents: 52685
diff changeset
   153
                    } else {
f2140eebd91b 8214738: javadoc should honor styles in doc-files
pmuthuswamy
parents: 52685
diff changeset
   154
                        configuration.messages.notice("doclet.Copying_File_0_To_Dir_1",
f2140eebd91b 8214738: javadoc should honor styles in doc-files
pmuthuswamy
parents: 52685
diff changeset
   155
                                srcfile.getPath(), dstdir.getPath());
f2140eebd91b 8214738: javadoc should honor styles in doc-files
pmuthuswamy
parents: 52685
diff changeset
   156
                        destfile.copyFile(srcfile);
48552
f94706337b07 8194953: doclet corrupts HTML files when adding navbar
ksrini
parents: 48029
diff changeset
   157
                    }
48029
e9dab2492924 8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff changeset
   158
                }
e9dab2492924 8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff changeset
   159
            } else if (srcfile.isDirectory()) {
e9dab2492924 8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff changeset
   160
                if (configuration.copydocfilesubdirs
e9dab2492924 8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff changeset
   161
                        && !configuration.shouldExcludeDocFileDir(srcfile.getName())) {
e9dab2492924 8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff changeset
   162
                    DocPath dirDocPath = dstDocPath.resolve(srcfile.getName());
e9dab2492924 8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff changeset
   163
                    copyDirectory(srcfile, dirDocPath, first);
e9dab2492924 8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff changeset
   164
                }
e9dab2492924 8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff changeset
   165
            }
e9dab2492924 8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff changeset
   166
        }
e9dab2492924 8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff changeset
   167
    }
e9dab2492924 8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff changeset
   168
53164
f2140eebd91b 8214738: javadoc should honor styles in doc-files
pmuthuswamy
parents: 52685
diff changeset
   169
    private void handleHtmlFile(DocFile srcfile, DocPath dstPath) throws DocFileIOException {
48552
f94706337b07 8194953: doclet corrupts HTML files when adding navbar
ksrini
parents: 48029
diff changeset
   170
        Utils utils = configuration.utils;
f94706337b07 8194953: doclet corrupts HTML files when adding navbar
ksrini
parents: 48029
diff changeset
   171
        FileObject fileObject = srcfile.getFileObject();
f94706337b07 8194953: doclet corrupts HTML files when adding navbar
ksrini
parents: 48029
diff changeset
   172
        DocFileElement dfElement = new DocFileElement(element, fileObject);
f94706337b07 8194953: doclet corrupts HTML files when adding navbar
ksrini
parents: 48029
diff changeset
   173
48029
e9dab2492924 8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff changeset
   174
        DocPath dfilePath = dstPath.resolve(srcfile.getName());
e9dab2492924 8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff changeset
   175
        HtmlDocletWriter docletWriter = new DocFileWriter(configuration, dfilePath, element);
52685
6d243dcde190 8213956: javadoc crash using {@index} in doc-files file
jjg
parents: 49551
diff changeset
   176
        configuration.messages.notice("doclet.Generating_0", docletWriter.filename.getPath());
48029
e9dab2492924 8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff changeset
   177
53164
f2140eebd91b 8214738: javadoc should honor styles in doc-files
pmuthuswamy
parents: 52685
diff changeset
   178
        List<? extends DocTree> localTags = getLocalHeaderTags(utils.getPreamble(dfElement));
f2140eebd91b 8214738: javadoc should honor styles in doc-files
pmuthuswamy
parents: 52685
diff changeset
   179
        Content localTagsContent = docletWriter.commentTagsToContent(null, dfElement, localTags, false);
f2140eebd91b 8214738: javadoc should honor styles in doc-files
pmuthuswamy
parents: 52685
diff changeset
   180
48029
e9dab2492924 8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff changeset
   181
        String title = getWindowTitle(docletWriter, dfElement).trim();
e9dab2492924 8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff changeset
   182
        HtmlTree htmlContent = docletWriter.getBody(true, title);
e9dab2492924 8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff changeset
   183
        docletWriter.addTop(htmlContent);
49551
0d4786e42471 8196200: Implement a navigation builder in javadoc
bpatel
parents: 48759
diff changeset
   184
        PackageElement pkg = (PackageElement) element;
0d4786e42471 8196200: Implement a navigation builder in javadoc
bpatel
parents: 48759
diff changeset
   185
        this.navBar = new Navigation(pkg, configuration, docletWriter.fixedNavDiv,
0d4786e42471 8196200: Implement a navigation builder in javadoc
bpatel
parents: 48759
diff changeset
   186
                PageMode.DOCFILE, docletWriter.path);
0d4786e42471 8196200: Implement a navigation builder in javadoc
bpatel
parents: 48759
diff changeset
   187
        Content mdleLinkContent = docletWriter.getModuleLink(utils.elementUtils.getModuleOf(pkg),
0d4786e42471 8196200: Implement a navigation builder in javadoc
bpatel
parents: 48759
diff changeset
   188
                docletWriter.contents.moduleLabel);
0d4786e42471 8196200: Implement a navigation builder in javadoc
bpatel
parents: 48759
diff changeset
   189
        navBar.setNavLinkModule(mdleLinkContent);
0d4786e42471 8196200: Implement a navigation builder in javadoc
bpatel
parents: 48759
diff changeset
   190
        Content pkgLinkContent = docletWriter.getPackageLink(pkg, docletWriter.contents.packageLabel);
0d4786e42471 8196200: Implement a navigation builder in javadoc
bpatel
parents: 48759
diff changeset
   191
        navBar.setNavLinkPackage(pkgLinkContent);
0d4786e42471 8196200: Implement a navigation builder in javadoc
bpatel
parents: 48759
diff changeset
   192
        navBar.setUserHeader(docletWriter.getUserHeaderFooter(true));
53562
0d9dee001667 8215577: Remove javadoc support for HTML 4
pmuthuswamy
parents: 53270
diff changeset
   193
        Content header = HtmlTree.HEADER();
53270
f3a42c440fcb 8199892: Missing landmarks when generating docs using html sources
pmuthuswamy
parents: 53164
diff changeset
   194
        header.addContent(navBar.getContent(true));
f3a42c440fcb 8199892: Missing landmarks when generating docs using html sources
pmuthuswamy
parents: 53164
diff changeset
   195
        htmlContent.addContent(header);
f3a42c440fcb 8199892: Missing landmarks when generating docs using html sources
pmuthuswamy
parents: 53164
diff changeset
   196
48029
e9dab2492924 8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff changeset
   197
        List<? extends DocTree> fullBody = utils.getFullBody(dfElement);
e9dab2492924 8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff changeset
   198
        Content bodyContent = docletWriter.commentTagsToContent(null, dfElement, fullBody, false);
e9dab2492924 8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff changeset
   199
        docletWriter.addTagsInfo(dfElement, bodyContent);
53562
0d9dee001667 8215577: Remove javadoc support for HTML 4
pmuthuswamy
parents: 53270
diff changeset
   200
        Content main = HtmlTree.MAIN();
53270
f3a42c440fcb 8199892: Missing landmarks when generating docs using html sources
pmuthuswamy
parents: 53164
diff changeset
   201
        main.addContent(bodyContent);
f3a42c440fcb 8199892: Missing landmarks when generating docs using html sources
pmuthuswamy
parents: 53164
diff changeset
   202
        htmlContent.addContent(main);
48029
e9dab2492924 8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff changeset
   203
49551
0d4786e42471 8196200: Implement a navigation builder in javadoc
bpatel
parents: 48759
diff changeset
   204
        navBar.setUserFooter(docletWriter.getUserHeaderFooter(false));
53562
0d9dee001667 8215577: Remove javadoc support for HTML 4
pmuthuswamy
parents: 53270
diff changeset
   205
        Content footer = HtmlTree.FOOTER();
53270
f3a42c440fcb 8199892: Missing landmarks when generating docs using html sources
pmuthuswamy
parents: 53164
diff changeset
   206
        footer.addContent(navBar.getContent(false));
f3a42c440fcb 8199892: Missing landmarks when generating docs using html sources
pmuthuswamy
parents: 53164
diff changeset
   207
        docletWriter.addBottom(footer);
f3a42c440fcb 8199892: Missing landmarks when generating docs using html sources
pmuthuswamy
parents: 53164
diff changeset
   208
        htmlContent.addContent(footer);
53880
3f1e9372557f 8219497: Unused parameter in HtmlDocletWriter::printHtmlDocument
jjg
parents: 53866
diff changeset
   209
        docletWriter.printHtmlDocument(Collections.emptyList(), null, localTagsContent, htmlContent);
48552
f94706337b07 8194953: doclet corrupts HTML files when adding navbar
ksrini
parents: 48029
diff changeset
   210
    }
f94706337b07 8194953: doclet corrupts HTML files when adding navbar
ksrini
parents: 48029
diff changeset
   211
f94706337b07 8194953: doclet corrupts HTML files when adding navbar
ksrini
parents: 48029
diff changeset
   212
53164
f2140eebd91b 8214738: javadoc should honor styles in doc-files
pmuthuswamy
parents: 52685
diff changeset
   213
    private List<? extends DocTree> getLocalHeaderTags(List<? extends DocTree> dtrees) {
f2140eebd91b 8214738: javadoc should honor styles in doc-files
pmuthuswamy
parents: 52685
diff changeset
   214
        List<DocTree> localTags = new ArrayList<>();
f2140eebd91b 8214738: javadoc should honor styles in doc-files
pmuthuswamy
parents: 52685
diff changeset
   215
        DocTreeFactory docTreeFactory = configuration.docEnv.getDocTrees().getDocTreeFactory();
f2140eebd91b 8214738: javadoc should honor styles in doc-files
pmuthuswamy
parents: 52685
diff changeset
   216
        boolean inHead = false;
f2140eebd91b 8214738: javadoc should honor styles in doc-files
pmuthuswamy
parents: 52685
diff changeset
   217
        boolean inTitle = false;
f2140eebd91b 8214738: javadoc should honor styles in doc-files
pmuthuswamy
parents: 52685
diff changeset
   218
        loop:
f2140eebd91b 8214738: javadoc should honor styles in doc-files
pmuthuswamy
parents: 52685
diff changeset
   219
        for (DocTree dt : dtrees) {
f2140eebd91b 8214738: javadoc should honor styles in doc-files
pmuthuswamy
parents: 52685
diff changeset
   220
            switch (dt.getKind()) {
f2140eebd91b 8214738: javadoc should honor styles in doc-files
pmuthuswamy
parents: 52685
diff changeset
   221
                case START_ELEMENT:
f2140eebd91b 8214738: javadoc should honor styles in doc-files
pmuthuswamy
parents: 52685
diff changeset
   222
                    StartElementTree startElem = (StartElementTree)dt;
f2140eebd91b 8214738: javadoc should honor styles in doc-files
pmuthuswamy
parents: 52685
diff changeset
   223
                    switch (HtmlTag.get(startElem.getName())) {
f2140eebd91b 8214738: javadoc should honor styles in doc-files
pmuthuswamy
parents: 52685
diff changeset
   224
                        case HEAD:
f2140eebd91b 8214738: javadoc should honor styles in doc-files
pmuthuswamy
parents: 52685
diff changeset
   225
                            inHead = true;
f2140eebd91b 8214738: javadoc should honor styles in doc-files
pmuthuswamy
parents: 52685
diff changeset
   226
                            break;
f2140eebd91b 8214738: javadoc should honor styles in doc-files
pmuthuswamy
parents: 52685
diff changeset
   227
                        case META:
f2140eebd91b 8214738: javadoc should honor styles in doc-files
pmuthuswamy
parents: 52685
diff changeset
   228
                            break;
f2140eebd91b 8214738: javadoc should honor styles in doc-files
pmuthuswamy
parents: 52685
diff changeset
   229
                        case TITLE:
f2140eebd91b 8214738: javadoc should honor styles in doc-files
pmuthuswamy
parents: 52685
diff changeset
   230
                            inTitle = true;
f2140eebd91b 8214738: javadoc should honor styles in doc-files
pmuthuswamy
parents: 52685
diff changeset
   231
                            break;
f2140eebd91b 8214738: javadoc should honor styles in doc-files
pmuthuswamy
parents: 52685
diff changeset
   232
                        default:
f2140eebd91b 8214738: javadoc should honor styles in doc-files
pmuthuswamy
parents: 52685
diff changeset
   233
                            if (inHead) {
f2140eebd91b 8214738: javadoc should honor styles in doc-files
pmuthuswamy
parents: 52685
diff changeset
   234
                                localTags.add(startElem);
f2140eebd91b 8214738: javadoc should honor styles in doc-files
pmuthuswamy
parents: 52685
diff changeset
   235
                                localTags.add(docTreeFactory.newTextTree(DocletConstants.NL));
f2140eebd91b 8214738: javadoc should honor styles in doc-files
pmuthuswamy
parents: 52685
diff changeset
   236
                            }
48552
f94706337b07 8194953: doclet corrupts HTML files when adding navbar
ksrini
parents: 48029
diff changeset
   237
                    }
53164
f2140eebd91b 8214738: javadoc should honor styles in doc-files
pmuthuswamy
parents: 52685
diff changeset
   238
                    break;
f2140eebd91b 8214738: javadoc should honor styles in doc-files
pmuthuswamy
parents: 52685
diff changeset
   239
                case END_ELEMENT:
f2140eebd91b 8214738: javadoc should honor styles in doc-files
pmuthuswamy
parents: 52685
diff changeset
   240
                    EndElementTree endElem = (EndElementTree)dt;
f2140eebd91b 8214738: javadoc should honor styles in doc-files
pmuthuswamy
parents: 52685
diff changeset
   241
                    switch (HtmlTag.get(endElem.getName())) {
f2140eebd91b 8214738: javadoc should honor styles in doc-files
pmuthuswamy
parents: 52685
diff changeset
   242
                        case HEAD:
f2140eebd91b 8214738: javadoc should honor styles in doc-files
pmuthuswamy
parents: 52685
diff changeset
   243
                            inHead = false;
f2140eebd91b 8214738: javadoc should honor styles in doc-files
pmuthuswamy
parents: 52685
diff changeset
   244
                            break loop;
f2140eebd91b 8214738: javadoc should honor styles in doc-files
pmuthuswamy
parents: 52685
diff changeset
   245
                        case TITLE:
f2140eebd91b 8214738: javadoc should honor styles in doc-files
pmuthuswamy
parents: 52685
diff changeset
   246
                            inTitle = false;
f2140eebd91b 8214738: javadoc should honor styles in doc-files
pmuthuswamy
parents: 52685
diff changeset
   247
                            break;
f2140eebd91b 8214738: javadoc should honor styles in doc-files
pmuthuswamy
parents: 52685
diff changeset
   248
                        default:
f2140eebd91b 8214738: javadoc should honor styles in doc-files
pmuthuswamy
parents: 52685
diff changeset
   249
                            if (inHead) {
f2140eebd91b 8214738: javadoc should honor styles in doc-files
pmuthuswamy
parents: 52685
diff changeset
   250
                                localTags.add(endElem);
f2140eebd91b 8214738: javadoc should honor styles in doc-files
pmuthuswamy
parents: 52685
diff changeset
   251
                                localTags.add(docTreeFactory.newTextTree(DocletConstants.NL));
f2140eebd91b 8214738: javadoc should honor styles in doc-files
pmuthuswamy
parents: 52685
diff changeset
   252
                            }
f2140eebd91b 8214738: javadoc should honor styles in doc-files
pmuthuswamy
parents: 52685
diff changeset
   253
                    }
f2140eebd91b 8214738: javadoc should honor styles in doc-files
pmuthuswamy
parents: 52685
diff changeset
   254
                    break;
f2140eebd91b 8214738: javadoc should honor styles in doc-files
pmuthuswamy
parents: 52685
diff changeset
   255
                case ENTITY:
f2140eebd91b 8214738: javadoc should honor styles in doc-files
pmuthuswamy
parents: 52685
diff changeset
   256
                case TEXT:
f2140eebd91b 8214738: javadoc should honor styles in doc-files
pmuthuswamy
parents: 52685
diff changeset
   257
                    if (inHead && !inTitle) {
f2140eebd91b 8214738: javadoc should honor styles in doc-files
pmuthuswamy
parents: 52685
diff changeset
   258
                        localTags.add(dt);
f2140eebd91b 8214738: javadoc should honor styles in doc-files
pmuthuswamy
parents: 52685
diff changeset
   259
                    }
f2140eebd91b 8214738: javadoc should honor styles in doc-files
pmuthuswamy
parents: 52685
diff changeset
   260
                    break;
48552
f94706337b07 8194953: doclet corrupts HTML files when adding navbar
ksrini
parents: 48029
diff changeset
   261
            }
f94706337b07 8194953: doclet corrupts HTML files when adding navbar
ksrini
parents: 48029
diff changeset
   262
        }
53164
f2140eebd91b 8214738: javadoc should honor styles in doc-files
pmuthuswamy
parents: 52685
diff changeset
   263
        return localTags;
48029
e9dab2492924 8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff changeset
   264
    }
e9dab2492924 8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff changeset
   265
e9dab2492924 8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff changeset
   266
    private String getWindowTitle(HtmlDocletWriter docletWriter, Element element) {
e9dab2492924 8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff changeset
   267
        List<? extends DocTree> preamble = configuration.utils.getPreamble(element);
e9dab2492924 8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff changeset
   268
        StringBuilder sb = new StringBuilder();
e9dab2492924 8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff changeset
   269
        boolean titleFound = false;
e9dab2492924 8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff changeset
   270
        loop:
e9dab2492924 8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff changeset
   271
        for (DocTree dt : preamble) {
e9dab2492924 8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff changeset
   272
            switch (dt.getKind()) {
e9dab2492924 8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff changeset
   273
                case START_ELEMENT:
e9dab2492924 8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff changeset
   274
                    StartElementTree nodeStart = (StartElementTree)dt;
e9dab2492924 8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff changeset
   275
                    if (Utils.toLowerCase(nodeStart.getName().toString()).equals("title")) {
e9dab2492924 8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff changeset
   276
                        titleFound = true;
e9dab2492924 8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff changeset
   277
                    }
e9dab2492924 8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff changeset
   278
                    break;
e9dab2492924 8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff changeset
   279
e9dab2492924 8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff changeset
   280
                case END_ELEMENT:
e9dab2492924 8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff changeset
   281
                    EndElementTree nodeEnd = (EndElementTree)dt;
e9dab2492924 8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff changeset
   282
                    if (Utils.toLowerCase(nodeEnd.getName().toString()).equals("title")) {
e9dab2492924 8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff changeset
   283
                        break loop;
e9dab2492924 8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff changeset
   284
                    }
e9dab2492924 8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff changeset
   285
                    break;
e9dab2492924 8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff changeset
   286
e9dab2492924 8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff changeset
   287
                case TEXT:
e9dab2492924 8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff changeset
   288
                    TextTree nodeText = (TextTree)dt;
e9dab2492924 8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff changeset
   289
                    if (titleFound)
e9dab2492924 8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff changeset
   290
                        sb.append(nodeText.getBody());
e9dab2492924 8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff changeset
   291
                    break;
e9dab2492924 8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff changeset
   292
e9dab2492924 8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff changeset
   293
                default:
e9dab2492924 8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff changeset
   294
                    // do nothing
e9dab2492924 8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff changeset
   295
            }
e9dab2492924 8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff changeset
   296
        }
e9dab2492924 8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff changeset
   297
        return docletWriter.getWindowTitle(sb.toString().trim());
e9dab2492924 8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff changeset
   298
    }
e9dab2492924 8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff changeset
   299
e9dab2492924 8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff changeset
   300
    private static class DocFileWriter extends HtmlDocletWriter {
e9dab2492924 8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff changeset
   301
e9dab2492924 8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff changeset
   302
        final PackageElement pkg;
e9dab2492924 8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff changeset
   303
e9dab2492924 8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff changeset
   304
        /**
e9dab2492924 8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff changeset
   305
         * Constructor to construct the HtmlDocletWriter object.
e9dab2492924 8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff changeset
   306
         *
e9dab2492924 8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff changeset
   307
         * @param configuration the configuruation of this doclet.
e9dab2492924 8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff changeset
   308
         * @param path          the file to be generated.
e9dab2492924 8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff changeset
   309
         * @param e             the anchoring element.
e9dab2492924 8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff changeset
   310
         */
e9dab2492924 8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff changeset
   311
        public DocFileWriter(HtmlConfiguration configuration, DocPath path, Element e) {
e9dab2492924 8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff changeset
   312
            super(configuration, path);
e9dab2492924 8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff changeset
   313
            switch (e.getKind()) {
e9dab2492924 8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff changeset
   314
                case PACKAGE:
e9dab2492924 8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff changeset
   315
                    pkg = (PackageElement)e;
e9dab2492924 8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff changeset
   316
                    break;
e9dab2492924 8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff changeset
   317
                default:
e9dab2492924 8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff changeset
   318
                    throw new AssertionError("unsupported element: " + e.getKind());
e9dab2492924 8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff changeset
   319
            }
e9dab2492924 8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff changeset
   320
        }
e9dab2492924 8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff changeset
   321
    }
e9dab2492924 8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff changeset
   322
}