src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/DocFilesHandlerImpl.java
author jjg
Wed, 07 Feb 2018 11:28:23 -0800
changeset 48759 ffa68af7da87
parent 48552 f94706337b07
child 49551 0d4786e42471
permissions -rw-r--r--
8195795: Organize output files by module/package, not just package Reviewed-by: ksrini, mchung, erikj
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;
f94706337b07 8194953: doclet corrupts HTML files when adding navbar
ksrini
parents: 48029
diff changeset
    30
import com.sun.source.doctree.DocRootTree;
48029
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.DocTree;
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.EndElementTree;
48552
f94706337b07 8194953: doclet corrupts HTML files when adding navbar
ksrini
parents: 48029
diff changeset
    33
import com.sun.source.doctree.LinkTree;
48029
e9dab2492924 8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff changeset
    34
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
    35
import com.sun.source.doctree.TextTree;
48552
f94706337b07 8194953: doclet corrupts HTML files when adding navbar
ksrini
parents: 48029
diff changeset
    36
import com.sun.source.util.SimpleDocTreeVisitor;
f94706337b07 8194953: doclet corrupts HTML files when adding navbar
ksrini
parents: 48029
diff changeset
    37
import com.sun.tools.doclint.HtmlTag;
f94706337b07 8194953: doclet corrupts HTML files when adding navbar
ksrini
parents: 48029
diff changeset
    38
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
    39
import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTree;
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.Content;
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.DocFileElement;
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.DocFilesHandler;
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.DocFile;
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.DocFileIOException;
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.DocPath;
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.DocPaths;
e9dab2492924 8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff changeset
    47
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
    48
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.Element;
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.ModuleElement;
e9dab2492924 8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff changeset
    51
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
    52
import javax.tools.FileObject;
e9dab2492924 8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff changeset
    53
import javax.tools.JavaFileManager.Location;
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
e9dab2492924 8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff changeset
    57
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
    58
e9dab2492924 8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff changeset
    59
    public final Element element;
e9dab2492924 8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff changeset
    60
    public final Location location;
e9dab2492924 8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff changeset
    61
    public final DocPath  source;
e9dab2492924 8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff changeset
    62
    public final HtmlConfiguration configuration;
e9dab2492924 8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff changeset
    63
e9dab2492924 8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff changeset
    64
    /**
e9dab2492924 8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff changeset
    65
     * 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
    66
     *
e9dab2492924 8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff changeset
    67
     * @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
    68
     * @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
    69
     *
e9dab2492924 8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff changeset
    70
     */
e9dab2492924 8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff changeset
    71
    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
    72
        this.configuration = configuration;
e9dab2492924 8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff changeset
    73
        this.element = element;
e9dab2492924 8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff changeset
    74
e9dab2492924 8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff changeset
    75
        switch (element.getKind()) {
e9dab2492924 8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff changeset
    76
            case MODULE:
48759
ffa68af7da87 8195795: Organize output files by module/package, not just package
jjg
parents: 48552
diff changeset
    77
                ModuleElement mdle = (ModuleElement)element;
ffa68af7da87 8195795: Organize output files by module/package, not just package
jjg
parents: 48552
diff changeset
    78
                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
    79
                source = DocPaths.DOC_FILES;
e9dab2492924 8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff changeset
    80
                break;
e9dab2492924 8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff changeset
    81
            case PACKAGE:
48759
ffa68af7da87 8195795: Organize output files by module/package, not just package
jjg
parents: 48552
diff changeset
    82
                PackageElement pkg = (PackageElement)element;
ffa68af7da87 8195795: Organize output files by module/package, not just package
jjg
parents: 48552
diff changeset
    83
                location = configuration.utils.getLocationForPackage(pkg);
ffa68af7da87 8195795: Organize output files by module/package, not just package
jjg
parents: 48552
diff changeset
    84
                // 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
    85
                // 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
    86
                // standard path that may include the module directory
ffa68af7da87 8195795: Organize output files by module/package, not just package
jjg
parents: 48552
diff changeset
    87
                source = DocPath.create(pkg.getQualifiedName().toString().replace('.', '/'))
ffa68af7da87 8195795: Organize output files by module/package, not just package
jjg
parents: 48552
diff changeset
    88
                        .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
    89
                break;
e9dab2492924 8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff changeset
    90
            default:
e9dab2492924 8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff changeset
    91
                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
    92
        }
e9dab2492924 8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff changeset
    93
    }
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
     * 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
    97
     * 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
    98
     *
e9dab2492924 8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff changeset
    99
     * @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
   100
     *         the documentation files
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
e9dab2492924 8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff changeset
   103
    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
   104
        boolean first = true;
e9dab2492924 8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff changeset
   105
        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
   106
            if (!srcdir.isDirectory()) {
e9dab2492924 8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff changeset
   107
                continue;
e9dab2492924 8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff changeset
   108
            }
e9dab2492924 8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff changeset
   109
            DocPath path = null;
e9dab2492924 8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff changeset
   110
            switch (this.element.getKind()) {
e9dab2492924 8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff changeset
   111
                case MODULE:
48759
ffa68af7da87 8195795: Organize output files by module/package, not just package
jjg
parents: 48552
diff changeset
   112
                    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
   113
                    break;
e9dab2492924 8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff changeset
   114
                case PACKAGE:
48759
ffa68af7da87 8195795: Organize output files by module/package, not just package
jjg
parents: 48552
diff changeset
   115
                    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
   116
                    break;
e9dab2492924 8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff changeset
   117
                default:
e9dab2492924 8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff changeset
   118
                    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
   119
            }
e9dab2492924 8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff changeset
   120
            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
   121
            first = false;
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
    }
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
    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
   127
                               boolean first) throws DocFileIOException {
e9dab2492924 8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff changeset
   128
        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
   129
        if (srcdir.isSameFile(dstdir)) {
e9dab2492924 8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff changeset
   130
            return;
e9dab2492924 8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff changeset
   131
        }
e9dab2492924 8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff changeset
   132
        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
   133
            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
   134
            if (srcfile.isFile()) {
e9dab2492924 8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff changeset
   135
                if (destfile.exists() && !first) {
e9dab2492924 8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff changeset
   136
                    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
   137
                            srcfile.getPath(), dstdir.getPath());
e9dab2492924 8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff changeset
   138
                } else {
48552
f94706337b07 8194953: doclet corrupts HTML files when adding navbar
ksrini
parents: 48029
diff changeset
   139
                    if (Utils.toLowerCase(srcfile.getPath()).endsWith(".html")) {
f94706337b07 8194953: doclet corrupts HTML files when adding navbar
ksrini
parents: 48029
diff changeset
   140
                        if (handleHtmlFile(srcfile, dstDocPath)) {
f94706337b07 8194953: doclet corrupts HTML files when adding navbar
ksrini
parents: 48029
diff changeset
   141
                            continue;
f94706337b07 8194953: doclet corrupts HTML files when adding navbar
ksrini
parents: 48029
diff changeset
   142
                        }
f94706337b07 8194953: doclet corrupts HTML files when adding navbar
ksrini
parents: 48029
diff changeset
   143
                    }
48029
e9dab2492924 8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff changeset
   144
                    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
   145
                            srcfile.getPath(), dstdir.getPath());
48552
f94706337b07 8194953: doclet corrupts HTML files when adding navbar
ksrini
parents: 48029
diff changeset
   146
                    destfile.copyFile(srcfile);
48029
e9dab2492924 8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff changeset
   147
                }
e9dab2492924 8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff changeset
   148
            } else if (srcfile.isDirectory()) {
e9dab2492924 8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff changeset
   149
                if (configuration.copydocfilesubdirs
e9dab2492924 8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff changeset
   150
                        && !configuration.shouldExcludeDocFileDir(srcfile.getName())) {
e9dab2492924 8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff changeset
   151
                    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
   152
                    copyDirectory(srcfile, dirDocPath, first);
e9dab2492924 8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff changeset
   153
                }
e9dab2492924 8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff changeset
   154
            }
e9dab2492924 8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff changeset
   155
        }
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
48552
f94706337b07 8194953: doclet corrupts HTML files when adding navbar
ksrini
parents: 48029
diff changeset
   158
    private boolean handleHtmlFile(DocFile srcfile, DocPath dstPath) throws DocFileIOException {
f94706337b07 8194953: doclet corrupts HTML files when adding navbar
ksrini
parents: 48029
diff changeset
   159
        Utils utils = configuration.utils;
f94706337b07 8194953: doclet corrupts HTML files when adding navbar
ksrini
parents: 48029
diff changeset
   160
        FileObject fileObject = srcfile.getFileObject();
f94706337b07 8194953: doclet corrupts HTML files when adding navbar
ksrini
parents: 48029
diff changeset
   161
        DocFileElement dfElement = new DocFileElement(element, fileObject);
f94706337b07 8194953: doclet corrupts HTML files when adding navbar
ksrini
parents: 48029
diff changeset
   162
f94706337b07 8194953: doclet corrupts HTML files when adding navbar
ksrini
parents: 48029
diff changeset
   163
        if (shouldPassThrough(utils.getPreamble(dfElement))) {
f94706337b07 8194953: doclet corrupts HTML files when adding navbar
ksrini
parents: 48029
diff changeset
   164
            return false;
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
48029
e9dab2492924 8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff changeset
   167
        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
   168
        HtmlDocletWriter docletWriter = new DocFileWriter(configuration, dfilePath, element);
48552
f94706337b07 8194953: doclet corrupts HTML files when adding navbar
ksrini
parents: 48029
diff changeset
   169
        configuration.messages.notice("doclet.Generating_0", docletWriter.filename);
48029
e9dab2492924 8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff changeset
   170
e9dab2492924 8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff changeset
   171
        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
   172
        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
   173
        docletWriter.addTop(htmlContent);
e9dab2492924 8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff changeset
   174
        docletWriter.addNavLinks(true, htmlContent);
e9dab2492924 8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff changeset
   175
        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
   176
        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
   177
e9dab2492924 8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff changeset
   178
        docletWriter.addTagsInfo(dfElement, bodyContent);
e9dab2492924 8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff changeset
   179
        htmlContent.addContent(bodyContent);
e9dab2492924 8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff changeset
   180
e9dab2492924 8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff changeset
   181
        docletWriter.addNavLinks(false, htmlContent);
e9dab2492924 8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff changeset
   182
        docletWriter.addBottom(htmlContent);
e9dab2492924 8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff changeset
   183
        docletWriter.printHtmlDocument(Collections.emptyList(), false, htmlContent);
48552
f94706337b07 8194953: doclet corrupts HTML files when adding navbar
ksrini
parents: 48029
diff changeset
   184
        return true;
f94706337b07 8194953: doclet corrupts HTML files when adding navbar
ksrini
parents: 48029
diff changeset
   185
    }
f94706337b07 8194953: doclet corrupts HTML files when adding navbar
ksrini
parents: 48029
diff changeset
   186
f94706337b07 8194953: doclet corrupts HTML files when adding navbar
ksrini
parents: 48029
diff changeset
   187
f94706337b07 8194953: doclet corrupts HTML files when adding navbar
ksrini
parents: 48029
diff changeset
   188
    private boolean shouldPassThrough(List<? extends DocTree> dtrees) {
f94706337b07 8194953: doclet corrupts HTML files when adding navbar
ksrini
parents: 48029
diff changeset
   189
        SimpleDocTreeVisitor<Boolean, Boolean> check = new SimpleDocTreeVisitor<Boolean, Boolean>() {
f94706337b07 8194953: doclet corrupts HTML files when adding navbar
ksrini
parents: 48029
diff changeset
   190
            @Override
f94706337b07 8194953: doclet corrupts HTML files when adding navbar
ksrini
parents: 48029
diff changeset
   191
            public Boolean visitStartElement(StartElementTree node, Boolean p) {
f94706337b07 8194953: doclet corrupts HTML files when adding navbar
ksrini
parents: 48029
diff changeset
   192
                if (Utils.toLowerCase(node.getName().toString()).equals((Attr.STYLE.getText()))) {
f94706337b07 8194953: doclet corrupts HTML files when adding navbar
ksrini
parents: 48029
diff changeset
   193
                    return true;
f94706337b07 8194953: doclet corrupts HTML files when adding navbar
ksrini
parents: 48029
diff changeset
   194
                }
f94706337b07 8194953: doclet corrupts HTML files when adding navbar
ksrini
parents: 48029
diff changeset
   195
                if (Utils.toLowerCase(node.getName().toString()).equals(HtmlTag.LINK.getText())) {
f94706337b07 8194953: doclet corrupts HTML files when adding navbar
ksrini
parents: 48029
diff changeset
   196
                    for (DocTree dt : node.getAttributes()) {
f94706337b07 8194953: doclet corrupts HTML files when adding navbar
ksrini
parents: 48029
diff changeset
   197
                        if (this.visit(dt, true))
f94706337b07 8194953: doclet corrupts HTML files when adding navbar
ksrini
parents: 48029
diff changeset
   198
                            return true;
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
                return false;
f94706337b07 8194953: doclet corrupts HTML files when adding navbar
ksrini
parents: 48029
diff changeset
   202
            }
f94706337b07 8194953: doclet corrupts HTML files when adding navbar
ksrini
parents: 48029
diff changeset
   203
f94706337b07 8194953: doclet corrupts HTML files when adding navbar
ksrini
parents: 48029
diff changeset
   204
            @Override
f94706337b07 8194953: doclet corrupts HTML files when adding navbar
ksrini
parents: 48029
diff changeset
   205
            public Boolean visitAttribute(AttributeTree node, Boolean p) {
f94706337b07 8194953: doclet corrupts HTML files when adding navbar
ksrini
parents: 48029
diff changeset
   206
                if (p == null || p == false) {
f94706337b07 8194953: doclet corrupts HTML files when adding navbar
ksrini
parents: 48029
diff changeset
   207
                    return false;
f94706337b07 8194953: doclet corrupts HTML files when adding navbar
ksrini
parents: 48029
diff changeset
   208
                }
f94706337b07 8194953: doclet corrupts HTML files when adding navbar
ksrini
parents: 48029
diff changeset
   209
                if (Utils.toLowerCase(node.getName().toString()).equals("rel")) {
f94706337b07 8194953: doclet corrupts HTML files when adding navbar
ksrini
parents: 48029
diff changeset
   210
                    for (DocTree dt :  node.getValue()) {
f94706337b07 8194953: doclet corrupts HTML files when adding navbar
ksrini
parents: 48029
diff changeset
   211
                        Boolean found = new SimpleDocTreeVisitor<Boolean, ValueKind>() {
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
                            @Override
f94706337b07 8194953: doclet corrupts HTML files when adding navbar
ksrini
parents: 48029
diff changeset
   214
                            public Boolean visitText(TextTree node, ValueKind valueKind) {
f94706337b07 8194953: doclet corrupts HTML files when adding navbar
ksrini
parents: 48029
diff changeset
   215
                                switch (valueKind) {
f94706337b07 8194953: doclet corrupts HTML files when adding navbar
ksrini
parents: 48029
diff changeset
   216
                                    case EMPTY:
f94706337b07 8194953: doclet corrupts HTML files when adding navbar
ksrini
parents: 48029
diff changeset
   217
                                        return false;
f94706337b07 8194953: doclet corrupts HTML files when adding navbar
ksrini
parents: 48029
diff changeset
   218
                                    default:
f94706337b07 8194953: doclet corrupts HTML files when adding navbar
ksrini
parents: 48029
diff changeset
   219
                                        return Utils.toLowerCase(node.getBody()).equals("stylesheet");
f94706337b07 8194953: doclet corrupts HTML files when adding navbar
ksrini
parents: 48029
diff changeset
   220
                                }
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
f94706337b07 8194953: doclet corrupts HTML files when adding navbar
ksrini
parents: 48029
diff changeset
   223
                            @Override
f94706337b07 8194953: doclet corrupts HTML files when adding navbar
ksrini
parents: 48029
diff changeset
   224
                            protected Boolean defaultAction(DocTree node, ValueKind valueKind) {
f94706337b07 8194953: doclet corrupts HTML files when adding navbar
ksrini
parents: 48029
diff changeset
   225
                                return false;
f94706337b07 8194953: doclet corrupts HTML files when adding navbar
ksrini
parents: 48029
diff changeset
   226
                            }
f94706337b07 8194953: doclet corrupts HTML files when adding navbar
ksrini
parents: 48029
diff changeset
   227
f94706337b07 8194953: doclet corrupts HTML files when adding navbar
ksrini
parents: 48029
diff changeset
   228
                        }.visit(dt, node.getValueKind());
f94706337b07 8194953: doclet corrupts HTML files when adding navbar
ksrini
parents: 48029
diff changeset
   229
f94706337b07 8194953: doclet corrupts HTML files when adding navbar
ksrini
parents: 48029
diff changeset
   230
                        if (found)
f94706337b07 8194953: doclet corrupts HTML files when adding navbar
ksrini
parents: 48029
diff changeset
   231
                            return true;
f94706337b07 8194953: doclet corrupts HTML files when adding navbar
ksrini
parents: 48029
diff changeset
   232
                    }
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
                return false;
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
f94706337b07 8194953: doclet corrupts HTML files when adding navbar
ksrini
parents: 48029
diff changeset
   237
            @Override
f94706337b07 8194953: doclet corrupts HTML files when adding navbar
ksrini
parents: 48029
diff changeset
   238
            protected Boolean defaultAction(DocTree node, Boolean p) {
f94706337b07 8194953: doclet corrupts HTML files when adding navbar
ksrini
parents: 48029
diff changeset
   239
                return false;
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
        };
f94706337b07 8194953: doclet corrupts HTML files when adding navbar
ksrini
parents: 48029
diff changeset
   242
        for (DocTree dt : dtrees) {
f94706337b07 8194953: doclet corrupts HTML files when adding navbar
ksrini
parents: 48029
diff changeset
   243
            if (check.visit(dt, false))
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
        return false;
48029
e9dab2492924 8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff changeset
   247
    }
e9dab2492924 8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff changeset
   248
e9dab2492924 8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff changeset
   249
    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
   250
        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
   251
        StringBuilder sb = new StringBuilder();
e9dab2492924 8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff changeset
   252
        boolean titleFound = false;
e9dab2492924 8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff changeset
   253
        loop:
e9dab2492924 8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff changeset
   254
        for (DocTree dt : preamble) {
e9dab2492924 8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff changeset
   255
            switch (dt.getKind()) {
e9dab2492924 8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff changeset
   256
                case START_ELEMENT:
e9dab2492924 8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff changeset
   257
                    StartElementTree nodeStart = (StartElementTree)dt;
e9dab2492924 8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff changeset
   258
                    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
   259
                        titleFound = true;
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
                    break;
e9dab2492924 8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff changeset
   262
e9dab2492924 8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff changeset
   263
                case END_ELEMENT:
e9dab2492924 8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff changeset
   264
                    EndElementTree nodeEnd = (EndElementTree)dt;
e9dab2492924 8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff changeset
   265
                    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
   266
                        break loop;
e9dab2492924 8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff changeset
   267
                    }
e9dab2492924 8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff changeset
   268
                    break;
e9dab2492924 8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff changeset
   269
e9dab2492924 8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff changeset
   270
                case TEXT:
e9dab2492924 8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff changeset
   271
                    TextTree nodeText = (TextTree)dt;
e9dab2492924 8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff changeset
   272
                    if (titleFound)
e9dab2492924 8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff changeset
   273
                        sb.append(nodeText.getBody());
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
                default:
e9dab2492924 8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff changeset
   277
                    // do nothing
e9dab2492924 8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff changeset
   278
            }
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
        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
   281
    }
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
    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
   284
e9dab2492924 8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff changeset
   285
        final PackageElement pkg;
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
        /**
e9dab2492924 8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff changeset
   288
         * 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
   289
         *
e9dab2492924 8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff changeset
   290
         * @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
   291
         * @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
   292
         * @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
   293
         */
e9dab2492924 8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff changeset
   294
        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
   295
            super(configuration, path);
e9dab2492924 8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff changeset
   296
            switch (e.getKind()) {
e9dab2492924 8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff changeset
   297
                case PACKAGE:
e9dab2492924 8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff changeset
   298
                    pkg = (PackageElement)e;
e9dab2492924 8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff changeset
   299
                    break;
e9dab2492924 8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff changeset
   300
                default:
e9dab2492924 8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff changeset
   301
                    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
   302
            }
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
        /**
e9dab2492924 8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff changeset
   306
         * Get the module link.
e9dab2492924 8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff changeset
   307
         *
e9dab2492924 8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff changeset
   308
         * @return a content tree for the module link
e9dab2492924 8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff changeset
   309
         */
e9dab2492924 8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff changeset
   310
        @Override
e9dab2492924 8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff changeset
   311
        protected Content getNavLinkModule() {
e9dab2492924 8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff changeset
   312
            Content linkContent = getModuleLink(utils.elementUtils.getModuleOf(pkg),
e9dab2492924 8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff changeset
   313
                    contents.moduleLabel);
e9dab2492924 8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff changeset
   314
            Content li = HtmlTree.LI(linkContent);
e9dab2492924 8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff changeset
   315
            return li;
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
        /**
e9dab2492924 8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff changeset
   319
         * Get this package link.
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
         * @return a content tree for the package link
e9dab2492924 8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff changeset
   322
         */
e9dab2492924 8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff changeset
   323
        @Override
e9dab2492924 8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff changeset
   324
        protected Content getNavLinkPackage() {
e9dab2492924 8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff changeset
   325
            Content linkContent = getPackageLink(pkg,
e9dab2492924 8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff changeset
   326
                    contents.packageLabel);
e9dab2492924 8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff changeset
   327
            Content li = HtmlTree.LI(linkContent);
e9dab2492924 8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff changeset
   328
            return li;
e9dab2492924 8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff changeset
   329
        }
e9dab2492924 8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff changeset
   330
    }
e9dab2492924 8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff changeset
   331
}