src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/DocFilesHandlerImpl.java
author jjg
Mon, 26 Nov 2018 11:00:32 -0800
changeset 52685 6d243dcde190
parent 49551 0d4786e42471
child 53164 f2140eebd91b
permissions -rw-r--r--
8213956: javadoc crash using {@index} in doc-files file Reviewed-by: jlahoda, hannesw, pmuthuswamy
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
/*
48552
f94706337b07 8194953: doclet corrupts HTML files when adding navbar
ksrini
parents: 48029
diff changeset
     2
 * Copyright (c) 2017, 2018, 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
48552
f94706337b07 8194953: doclet corrupts HTML files when adding navbar
ksrini
parents: 48029
diff changeset
    28
import com.sun.source.doctree.AttributeTree;
f94706337b07 8194953: doclet corrupts HTML files when adding navbar
ksrini
parents: 48029
diff changeset
    29
import com.sun.source.doctree.AttributeTree.ValueKind;
48029
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.DocTree;
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.EndElementTree;
e9dab2492924 8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff changeset
    32
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
    33
import com.sun.source.doctree.TextTree;
48552
f94706337b07 8194953: doclet corrupts HTML files when adding navbar
ksrini
parents: 48029
diff changeset
    34
import com.sun.source.util.SimpleDocTreeVisitor;
f94706337b07 8194953: doclet corrupts HTML files when adding navbar
ksrini
parents: 48029
diff changeset
    35
import com.sun.tools.doclint.HtmlTag;
f94706337b07 8194953: doclet corrupts HTML files when adding navbar
ksrini
parents: 48029
diff changeset
    36
import com.sun.tools.doclint.HtmlTag.Attr;
48029
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.formats.html.markup.HtmlTree;
49551
0d4786e42471 8196200: Implement a navigation builder in javadoc
bpatel
parents: 48759
diff changeset
    38
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
    39
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
    40
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
    41
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
    42
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
    43
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
    44
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
    45
import jdk.javadoc.internal.doclets.toolkit.util.DocPaths;
e9dab2492924 8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff changeset
    46
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
    47
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.Element;
e9dab2492924 8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff changeset
    49
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
    50
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
    51
import javax.tools.FileObject;
e9dab2492924 8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff changeset
    52
import javax.tools.JavaFileManager.Location;
49551
0d4786e42471 8196200: Implement a navigation builder in javadoc
bpatel
parents: 48759
diff changeset
    53
48029
e9dab2492924 8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff changeset
    54
import java.util.Collections;
e9dab2492924 8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff changeset
    55
import java.util.List;
e9dab2492924 8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff changeset
    56
49551
0d4786e42471 8196200: Implement a navigation builder in javadoc
bpatel
parents: 48759
diff changeset
    57
import jdk.javadoc.internal.doclets.formats.html.markup.Navigation.PageMode;
0d4786e42471 8196200: Implement a navigation builder in javadoc
bpatel
parents: 48759
diff changeset
    58
48029
e9dab2492924 8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff changeset
    59
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
    60
e9dab2492924 8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff changeset
    61
    public final Element element;
e9dab2492924 8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff changeset
    62
    public final Location location;
e9dab2492924 8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff changeset
    63
    public final DocPath  source;
e9dab2492924 8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff changeset
    64
    public final HtmlConfiguration configuration;
49551
0d4786e42471 8196200: Implement a navigation builder in javadoc
bpatel
parents: 48759
diff changeset
    65
    private Navigation navBar;
48029
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
    /**
e9dab2492924 8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff changeset
    68
     * 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
    69
     *
e9dab2492924 8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff changeset
    70
     * @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
    71
     * @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
    72
     *
e9dab2492924 8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff changeset
    73
     */
e9dab2492924 8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff changeset
    74
    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
    75
        this.configuration = configuration;
e9dab2492924 8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff changeset
    76
        this.element = element;
e9dab2492924 8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff changeset
    77
e9dab2492924 8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff changeset
    78
        switch (element.getKind()) {
e9dab2492924 8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff changeset
    79
            case MODULE:
48759
ffa68af7da87 8195795: Organize output files by module/package, not just package
jjg
parents: 48552
diff changeset
    80
                ModuleElement mdle = (ModuleElement)element;
ffa68af7da87 8195795: Organize output files by module/package, not just package
jjg
parents: 48552
diff changeset
    81
                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
    82
                source = DocPaths.DOC_FILES;
e9dab2492924 8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff changeset
    83
                break;
e9dab2492924 8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff changeset
    84
            case PACKAGE:
48759
ffa68af7da87 8195795: Organize output files by module/package, not just package
jjg
parents: 48552
diff changeset
    85
                PackageElement pkg = (PackageElement)element;
ffa68af7da87 8195795: Organize output files by module/package, not just package
jjg
parents: 48552
diff changeset
    86
                location = configuration.utils.getLocationForPackage(pkg);
ffa68af7da87 8195795: Organize output files by module/package, not just package
jjg
parents: 48552
diff changeset
    87
                // 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
    88
                // 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
    89
                // standard path that may include the module directory
ffa68af7da87 8195795: Organize output files by module/package, not just package
jjg
parents: 48552
diff changeset
    90
                source = DocPath.create(pkg.getQualifiedName().toString().replace('.', '/'))
ffa68af7da87 8195795: Organize output files by module/package, not just package
jjg
parents: 48552
diff changeset
    91
                        .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
    92
                break;
e9dab2492924 8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff changeset
    93
            default:
e9dab2492924 8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff changeset
    94
                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
    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
    /**
e9dab2492924 8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff changeset
    99
     * 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
   100
     * 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
   101
     *
e9dab2492924 8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff changeset
   102
     * @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
   103
     *         the documentation files
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
e9dab2492924 8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff changeset
   106
    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
   107
        boolean first = true;
e9dab2492924 8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff changeset
   108
        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
   109
            if (!srcdir.isDirectory()) {
e9dab2492924 8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff changeset
   110
                continue;
e9dab2492924 8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff changeset
   111
            }
e9dab2492924 8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff changeset
   112
            DocPath path = null;
e9dab2492924 8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff changeset
   113
            switch (this.element.getKind()) {
e9dab2492924 8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff changeset
   114
                case MODULE:
48759
ffa68af7da87 8195795: Organize output files by module/package, not just package
jjg
parents: 48552
diff changeset
   115
                    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
   116
                    break;
e9dab2492924 8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff changeset
   117
                case PACKAGE:
48759
ffa68af7da87 8195795: Organize output files by module/package, not just package
jjg
parents: 48552
diff changeset
   118
                    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
   119
                    break;
e9dab2492924 8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff changeset
   120
                default:
e9dab2492924 8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff changeset
   121
                    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
   122
            }
e9dab2492924 8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff changeset
   123
            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
   124
            first = false;
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
    }
e9dab2492924 8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff changeset
   127
e9dab2492924 8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff changeset
   128
e9dab2492924 8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff changeset
   129
    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
   130
                               boolean first) throws DocFileIOException {
e9dab2492924 8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff changeset
   131
        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
   132
        if (srcdir.isSameFile(dstdir)) {
e9dab2492924 8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff changeset
   133
            return;
e9dab2492924 8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff changeset
   134
        }
e9dab2492924 8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff changeset
   135
        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
   136
            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
   137
            if (srcfile.isFile()) {
e9dab2492924 8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff changeset
   138
                if (destfile.exists() && !first) {
e9dab2492924 8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff changeset
   139
                    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
   140
                            srcfile.getPath(), dstdir.getPath());
e9dab2492924 8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff changeset
   141
                } else {
48552
f94706337b07 8194953: doclet corrupts HTML files when adding navbar
ksrini
parents: 48029
diff changeset
   142
                    if (Utils.toLowerCase(srcfile.getPath()).endsWith(".html")) {
f94706337b07 8194953: doclet corrupts HTML files when adding navbar
ksrini
parents: 48029
diff changeset
   143
                        if (handleHtmlFile(srcfile, dstDocPath)) {
f94706337b07 8194953: doclet corrupts HTML files when adding navbar
ksrini
parents: 48029
diff changeset
   144
                            continue;
f94706337b07 8194953: doclet corrupts HTML files when adding navbar
ksrini
parents: 48029
diff changeset
   145
                        }
f94706337b07 8194953: doclet corrupts HTML files when adding navbar
ksrini
parents: 48029
diff changeset
   146
                    }
48029
e9dab2492924 8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff changeset
   147
                    configuration.messages.notice("doclet.Copying_File_0_To_Dir_1",
e9dab2492924 8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff changeset
   148
                            srcfile.getPath(), dstdir.getPath());
48552
f94706337b07 8194953: doclet corrupts HTML files when adding navbar
ksrini
parents: 48029
diff changeset
   149
                    destfile.copyFile(srcfile);
48029
e9dab2492924 8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff changeset
   150
                }
e9dab2492924 8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff changeset
   151
            } else if (srcfile.isDirectory()) {
e9dab2492924 8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff changeset
   152
                if (configuration.copydocfilesubdirs
e9dab2492924 8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff changeset
   153
                        && !configuration.shouldExcludeDocFileDir(srcfile.getName())) {
e9dab2492924 8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff changeset
   154
                    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
   155
                    copyDirectory(srcfile, dirDocPath, first);
e9dab2492924 8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff changeset
   156
                }
e9dab2492924 8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff changeset
   157
            }
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
    }
e9dab2492924 8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff changeset
   160
48552
f94706337b07 8194953: doclet corrupts HTML files when adding navbar
ksrini
parents: 48029
diff changeset
   161
    private boolean handleHtmlFile(DocFile srcfile, DocPath dstPath) throws DocFileIOException {
f94706337b07 8194953: doclet corrupts HTML files when adding navbar
ksrini
parents: 48029
diff changeset
   162
        Utils utils = configuration.utils;
f94706337b07 8194953: doclet corrupts HTML files when adding navbar
ksrini
parents: 48029
diff changeset
   163
        FileObject fileObject = srcfile.getFileObject();
f94706337b07 8194953: doclet corrupts HTML files when adding navbar
ksrini
parents: 48029
diff changeset
   164
        DocFileElement dfElement = new DocFileElement(element, fileObject);
f94706337b07 8194953: doclet corrupts HTML files when adding navbar
ksrini
parents: 48029
diff changeset
   165
f94706337b07 8194953: doclet corrupts HTML files when adding navbar
ksrini
parents: 48029
diff changeset
   166
        if (shouldPassThrough(utils.getPreamble(dfElement))) {
f94706337b07 8194953: doclet corrupts HTML files when adding navbar
ksrini
parents: 48029
diff changeset
   167
            return false;
f94706337b07 8194953: doclet corrupts HTML files when adding navbar
ksrini
parents: 48029
diff changeset
   168
        }
f94706337b07 8194953: doclet corrupts HTML files when adding navbar
ksrini
parents: 48029
diff changeset
   169
48029
e9dab2492924 8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff changeset
   170
        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
   171
        HtmlDocletWriter docletWriter = new DocFileWriter(configuration, dfilePath, element);
52685
6d243dcde190 8213956: javadoc crash using {@index} in doc-files file
jjg
parents: 49551
diff changeset
   172
        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
   173
e9dab2492924 8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff changeset
   174
        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
   175
        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
   176
        docletWriter.addTop(htmlContent);
49551
0d4786e42471 8196200: Implement a navigation builder in javadoc
bpatel
parents: 48759
diff changeset
   177
        PackageElement pkg = (PackageElement) element;
0d4786e42471 8196200: Implement a navigation builder in javadoc
bpatel
parents: 48759
diff changeset
   178
        this.navBar = new Navigation(pkg, configuration, docletWriter.fixedNavDiv,
0d4786e42471 8196200: Implement a navigation builder in javadoc
bpatel
parents: 48759
diff changeset
   179
                PageMode.DOCFILE, docletWriter.path);
0d4786e42471 8196200: Implement a navigation builder in javadoc
bpatel
parents: 48759
diff changeset
   180
        Content mdleLinkContent = docletWriter.getModuleLink(utils.elementUtils.getModuleOf(pkg),
0d4786e42471 8196200: Implement a navigation builder in javadoc
bpatel
parents: 48759
diff changeset
   181
                docletWriter.contents.moduleLabel);
0d4786e42471 8196200: Implement a navigation builder in javadoc
bpatel
parents: 48759
diff changeset
   182
        navBar.setNavLinkModule(mdleLinkContent);
0d4786e42471 8196200: Implement a navigation builder in javadoc
bpatel
parents: 48759
diff changeset
   183
        Content pkgLinkContent = docletWriter.getPackageLink(pkg, docletWriter.contents.packageLabel);
0d4786e42471 8196200: Implement a navigation builder in javadoc
bpatel
parents: 48759
diff changeset
   184
        navBar.setNavLinkPackage(pkgLinkContent);
0d4786e42471 8196200: Implement a navigation builder in javadoc
bpatel
parents: 48759
diff changeset
   185
        navBar.setUserHeader(docletWriter.getUserHeaderFooter(true));
0d4786e42471 8196200: Implement a navigation builder in javadoc
bpatel
parents: 48759
diff changeset
   186
        htmlContent.addContent(navBar.getContent(true));
48029
e9dab2492924 8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff changeset
   187
        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
   188
        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
   189
e9dab2492924 8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff changeset
   190
        docletWriter.addTagsInfo(dfElement, bodyContent);
e9dab2492924 8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff changeset
   191
        htmlContent.addContent(bodyContent);
e9dab2492924 8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff changeset
   192
49551
0d4786e42471 8196200: Implement a navigation builder in javadoc
bpatel
parents: 48759
diff changeset
   193
        navBar.setUserFooter(docletWriter.getUserHeaderFooter(false));
0d4786e42471 8196200: Implement a navigation builder in javadoc
bpatel
parents: 48759
diff changeset
   194
        htmlContent.addContent(navBar.getContent(false));
48029
e9dab2492924 8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff changeset
   195
        docletWriter.addBottom(htmlContent);
e9dab2492924 8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff changeset
   196
        docletWriter.printHtmlDocument(Collections.emptyList(), false, htmlContent);
48552
f94706337b07 8194953: doclet corrupts HTML files when adding navbar
ksrini
parents: 48029
diff changeset
   197
        return true;
f94706337b07 8194953: doclet corrupts HTML files when adding navbar
ksrini
parents: 48029
diff changeset
   198
    }
f94706337b07 8194953: doclet corrupts HTML files when adding navbar
ksrini
parents: 48029
diff changeset
   199
f94706337b07 8194953: doclet corrupts HTML files when adding navbar
ksrini
parents: 48029
diff changeset
   200
f94706337b07 8194953: doclet corrupts HTML files when adding navbar
ksrini
parents: 48029
diff changeset
   201
    private boolean shouldPassThrough(List<? extends DocTree> dtrees) {
f94706337b07 8194953: doclet corrupts HTML files when adding navbar
ksrini
parents: 48029
diff changeset
   202
        SimpleDocTreeVisitor<Boolean, Boolean> check = new SimpleDocTreeVisitor<Boolean, Boolean>() {
f94706337b07 8194953: doclet corrupts HTML files when adding navbar
ksrini
parents: 48029
diff changeset
   203
            @Override
f94706337b07 8194953: doclet corrupts HTML files when adding navbar
ksrini
parents: 48029
diff changeset
   204
            public Boolean visitStartElement(StartElementTree node, Boolean p) {
f94706337b07 8194953: doclet corrupts HTML files when adding navbar
ksrini
parents: 48029
diff changeset
   205
                if (Utils.toLowerCase(node.getName().toString()).equals((Attr.STYLE.getText()))) {
f94706337b07 8194953: doclet corrupts HTML files when adding navbar
ksrini
parents: 48029
diff changeset
   206
                    return true;
f94706337b07 8194953: doclet corrupts HTML files when adding navbar
ksrini
parents: 48029
diff changeset
   207
                }
f94706337b07 8194953: doclet corrupts HTML files when adding navbar
ksrini
parents: 48029
diff changeset
   208
                if (Utils.toLowerCase(node.getName().toString()).equals(HtmlTag.LINK.getText())) {
f94706337b07 8194953: doclet corrupts HTML files when adding navbar
ksrini
parents: 48029
diff changeset
   209
                    for (DocTree dt : node.getAttributes()) {
f94706337b07 8194953: doclet corrupts HTML files when adding navbar
ksrini
parents: 48029
diff changeset
   210
                        if (this.visit(dt, true))
f94706337b07 8194953: doclet corrupts HTML files when adding navbar
ksrini
parents: 48029
diff changeset
   211
                            return true;
f94706337b07 8194953: doclet corrupts HTML files when adding navbar
ksrini
parents: 48029
diff changeset
   212
                    }
f94706337b07 8194953: doclet corrupts HTML files when adding navbar
ksrini
parents: 48029
diff changeset
   213
                }
f94706337b07 8194953: doclet corrupts HTML files when adding navbar
ksrini
parents: 48029
diff changeset
   214
                return false;
f94706337b07 8194953: doclet corrupts HTML files when adding navbar
ksrini
parents: 48029
diff changeset
   215
            }
f94706337b07 8194953: doclet corrupts HTML files when adding navbar
ksrini
parents: 48029
diff changeset
   216
f94706337b07 8194953: doclet corrupts HTML files when adding navbar
ksrini
parents: 48029
diff changeset
   217
            @Override
f94706337b07 8194953: doclet corrupts HTML files when adding navbar
ksrini
parents: 48029
diff changeset
   218
            public Boolean visitAttribute(AttributeTree node, Boolean p) {
f94706337b07 8194953: doclet corrupts HTML files when adding navbar
ksrini
parents: 48029
diff changeset
   219
                if (p == null || p == false) {
f94706337b07 8194953: doclet corrupts HTML files when adding navbar
ksrini
parents: 48029
diff changeset
   220
                    return false;
f94706337b07 8194953: doclet corrupts HTML files when adding navbar
ksrini
parents: 48029
diff changeset
   221
                }
f94706337b07 8194953: doclet corrupts HTML files when adding navbar
ksrini
parents: 48029
diff changeset
   222
                if (Utils.toLowerCase(node.getName().toString()).equals("rel")) {
f94706337b07 8194953: doclet corrupts HTML files when adding navbar
ksrini
parents: 48029
diff changeset
   223
                    for (DocTree dt :  node.getValue()) {
f94706337b07 8194953: doclet corrupts HTML files when adding navbar
ksrini
parents: 48029
diff changeset
   224
                        Boolean found = new SimpleDocTreeVisitor<Boolean, ValueKind>() {
f94706337b07 8194953: doclet corrupts HTML files when adding navbar
ksrini
parents: 48029
diff changeset
   225
f94706337b07 8194953: doclet corrupts HTML files when adding navbar
ksrini
parents: 48029
diff changeset
   226
                            @Override
f94706337b07 8194953: doclet corrupts HTML files when adding navbar
ksrini
parents: 48029
diff changeset
   227
                            public Boolean visitText(TextTree node, ValueKind valueKind) {
f94706337b07 8194953: doclet corrupts HTML files when adding navbar
ksrini
parents: 48029
diff changeset
   228
                                switch (valueKind) {
f94706337b07 8194953: doclet corrupts HTML files when adding navbar
ksrini
parents: 48029
diff changeset
   229
                                    case EMPTY:
f94706337b07 8194953: doclet corrupts HTML files when adding navbar
ksrini
parents: 48029
diff changeset
   230
                                        return false;
f94706337b07 8194953: doclet corrupts HTML files when adding navbar
ksrini
parents: 48029
diff changeset
   231
                                    default:
f94706337b07 8194953: doclet corrupts HTML files when adding navbar
ksrini
parents: 48029
diff changeset
   232
                                        return Utils.toLowerCase(node.getBody()).equals("stylesheet");
f94706337b07 8194953: doclet corrupts HTML files when adding navbar
ksrini
parents: 48029
diff changeset
   233
                                }
f94706337b07 8194953: doclet corrupts HTML files when adding navbar
ksrini
parents: 48029
diff changeset
   234
                            }
f94706337b07 8194953: doclet corrupts HTML files when adding navbar
ksrini
parents: 48029
diff changeset
   235
f94706337b07 8194953: doclet corrupts HTML files when adding navbar
ksrini
parents: 48029
diff changeset
   236
                            @Override
f94706337b07 8194953: doclet corrupts HTML files when adding navbar
ksrini
parents: 48029
diff changeset
   237
                            protected Boolean defaultAction(DocTree node, ValueKind valueKind) {
f94706337b07 8194953: doclet corrupts HTML files when adding navbar
ksrini
parents: 48029
diff changeset
   238
                                return false;
f94706337b07 8194953: doclet corrupts HTML files when adding navbar
ksrini
parents: 48029
diff changeset
   239
                            }
f94706337b07 8194953: doclet corrupts HTML files when adding navbar
ksrini
parents: 48029
diff changeset
   240
f94706337b07 8194953: doclet corrupts HTML files when adding navbar
ksrini
parents: 48029
diff changeset
   241
                        }.visit(dt, node.getValueKind());
f94706337b07 8194953: doclet corrupts HTML files when adding navbar
ksrini
parents: 48029
diff changeset
   242
f94706337b07 8194953: doclet corrupts HTML files when adding navbar
ksrini
parents: 48029
diff changeset
   243
                        if (found)
f94706337b07 8194953: doclet corrupts HTML files when adding navbar
ksrini
parents: 48029
diff changeset
   244
                            return true;
f94706337b07 8194953: doclet corrupts HTML files when adding navbar
ksrini
parents: 48029
diff changeset
   245
                    }
f94706337b07 8194953: doclet corrupts HTML files when adding navbar
ksrini
parents: 48029
diff changeset
   246
                }
f94706337b07 8194953: doclet corrupts HTML files when adding navbar
ksrini
parents: 48029
diff changeset
   247
                return false;
f94706337b07 8194953: doclet corrupts HTML files when adding navbar
ksrini
parents: 48029
diff changeset
   248
            }
f94706337b07 8194953: doclet corrupts HTML files when adding navbar
ksrini
parents: 48029
diff changeset
   249
f94706337b07 8194953: doclet corrupts HTML files when adding navbar
ksrini
parents: 48029
diff changeset
   250
            @Override
f94706337b07 8194953: doclet corrupts HTML files when adding navbar
ksrini
parents: 48029
diff changeset
   251
            protected Boolean defaultAction(DocTree node, Boolean p) {
f94706337b07 8194953: doclet corrupts HTML files when adding navbar
ksrini
parents: 48029
diff changeset
   252
                return false;
f94706337b07 8194953: doclet corrupts HTML files when adding navbar
ksrini
parents: 48029
diff changeset
   253
            }
f94706337b07 8194953: doclet corrupts HTML files when adding navbar
ksrini
parents: 48029
diff changeset
   254
        };
f94706337b07 8194953: doclet corrupts HTML files when adding navbar
ksrini
parents: 48029
diff changeset
   255
        for (DocTree dt : dtrees) {
f94706337b07 8194953: doclet corrupts HTML files when adding navbar
ksrini
parents: 48029
diff changeset
   256
            if (check.visit(dt, false))
f94706337b07 8194953: doclet corrupts HTML files when adding navbar
ksrini
parents: 48029
diff changeset
   257
                return true;
f94706337b07 8194953: doclet corrupts HTML files when adding navbar
ksrini
parents: 48029
diff changeset
   258
        }
f94706337b07 8194953: doclet corrupts HTML files when adding navbar
ksrini
parents: 48029
diff changeset
   259
        return false;
48029
e9dab2492924 8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff changeset
   260
    }
e9dab2492924 8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff changeset
   261
e9dab2492924 8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff changeset
   262
    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
   263
        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
   264
        StringBuilder sb = new StringBuilder();
e9dab2492924 8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff changeset
   265
        boolean titleFound = false;
e9dab2492924 8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff changeset
   266
        loop:
e9dab2492924 8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff changeset
   267
        for (DocTree dt : preamble) {
e9dab2492924 8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff changeset
   268
            switch (dt.getKind()) {
e9dab2492924 8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff changeset
   269
                case START_ELEMENT:
e9dab2492924 8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff changeset
   270
                    StartElementTree nodeStart = (StartElementTree)dt;
e9dab2492924 8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff changeset
   271
                    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
   272
                        titleFound = true;
e9dab2492924 8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff changeset
   273
                    }
e9dab2492924 8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff changeset
   274
                    break;
e9dab2492924 8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff changeset
   275
e9dab2492924 8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff changeset
   276
                case END_ELEMENT:
e9dab2492924 8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff changeset
   277
                    EndElementTree nodeEnd = (EndElementTree)dt;
e9dab2492924 8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff changeset
   278
                    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
   279
                        break loop;
e9dab2492924 8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff changeset
   280
                    }
e9dab2492924 8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff changeset
   281
                    break;
e9dab2492924 8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff changeset
   282
e9dab2492924 8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff changeset
   283
                case TEXT:
e9dab2492924 8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff changeset
   284
                    TextTree nodeText = (TextTree)dt;
e9dab2492924 8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff changeset
   285
                    if (titleFound)
e9dab2492924 8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff changeset
   286
                        sb.append(nodeText.getBody());
e9dab2492924 8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff changeset
   287
                    break;
e9dab2492924 8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff changeset
   288
e9dab2492924 8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff changeset
   289
                default:
e9dab2492924 8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff changeset
   290
                    // do nothing
e9dab2492924 8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff changeset
   291
            }
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
        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
   294
    }
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
    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
   297
e9dab2492924 8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff changeset
   298
        final PackageElement pkg;
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
        /**
e9dab2492924 8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff changeset
   301
         * 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
   302
         *
e9dab2492924 8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff changeset
   303
         * @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
   304
         * @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
   305
         * @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
   306
         */
e9dab2492924 8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff changeset
   307
        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
   308
            super(configuration, path);
e9dab2492924 8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff changeset
   309
            switch (e.getKind()) {
e9dab2492924 8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff changeset
   310
                case PACKAGE:
e9dab2492924 8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff changeset
   311
                    pkg = (PackageElement)e;
e9dab2492924 8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff changeset
   312
                    break;
e9dab2492924 8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff changeset
   313
                default:
e9dab2492924 8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff changeset
   314
                    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
   315
            }
e9dab2492924 8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff changeset
   316
        }
e9dab2492924 8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff changeset
   317
    }
e9dab2492924 8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff changeset
   318
}