langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/HtmlDocletWriter.java
author bpatel
Tue, 12 Jul 2016 12:55:18 -0700
changeset 39670 9d1eafbf29c6
parent 37943 2efb75c09230
child 40303 96a1226aca18
permissions -rw-r--r--
8154261: Module summary page should display directives for the module Reviewed-by: jjg, ksrini
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
10
06bc494ca11e Initial load
duke
parents:
diff changeset
     1
/*
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
     2
 * Copyright (c) 1998, 2016, Oracle and/or its affiliates. All rights reserved.
10
06bc494ca11e Initial load
duke
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
06bc494ca11e Initial load
duke
parents:
diff changeset
     4
 *
06bc494ca11e Initial load
duke
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
06bc494ca11e Initial load
duke
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
5520
86e4b9a9da40 6943119: Rebrand source copyright notices
ohair
parents: 3891
diff changeset
     7
 * published by the Free Software Foundation.  Oracle designates this
10
06bc494ca11e Initial load
duke
parents:
diff changeset
     8
 * particular file as subject to the "Classpath" exception as provided
5520
86e4b9a9da40 6943119: Rebrand source copyright notices
ohair
parents: 3891
diff changeset
     9
 * by Oracle in the LICENSE file that accompanied this code.
10
06bc494ca11e Initial load
duke
parents:
diff changeset
    10
 *
06bc494ca11e Initial load
duke
parents:
diff changeset
    11
 * This code is distributed in the hope that it will be useful, but WITHOUT
06bc494ca11e Initial load
duke
parents:
diff changeset
    12
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
06bc494ca11e Initial load
duke
parents:
diff changeset
    13
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
06bc494ca11e Initial load
duke
parents:
diff changeset
    14
 * version 2 for more details (a copy is included in the LICENSE file that
06bc494ca11e Initial load
duke
parents:
diff changeset
    15
 * accompanied this code).
06bc494ca11e Initial load
duke
parents:
diff changeset
    16
 *
06bc494ca11e Initial load
duke
parents:
diff changeset
    17
 * You should have received a copy of the GNU General Public License version
06bc494ca11e Initial load
duke
parents:
diff changeset
    18
 * 2 along with this work; if not, write to the Free Software Foundation,
06bc494ca11e Initial load
duke
parents:
diff changeset
    19
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
06bc494ca11e Initial load
duke
parents:
diff changeset
    20
 *
5520
86e4b9a9da40 6943119: Rebrand source copyright notices
ohair
parents: 3891
diff changeset
    21
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
86e4b9a9da40 6943119: Rebrand source copyright notices
ohair
parents: 3891
diff changeset
    22
 * or visit www.oracle.com if you need additional information or have any
86e4b9a9da40 6943119: Rebrand source copyright notices
ohair
parents: 3891
diff changeset
    23
 * questions.
10
06bc494ca11e Initial load
duke
parents:
diff changeset
    24
 */
06bc494ca11e Initial load
duke
parents:
diff changeset
    25
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
    26
package jdk.javadoc.internal.doclets.formats.html;
10
06bc494ca11e Initial load
duke
parents:
diff changeset
    27
06bc494ca11e Initial load
duke
parents:
diff changeset
    28
import java.io.*;
06bc494ca11e Initial load
duke
parents:
diff changeset
    29
import java.text.SimpleDateFormat;
06bc494ca11e Initial load
duke
parents:
diff changeset
    30
import java.util.*;
24603
43e7e44d63da 8043186: javac test langtools/tools/javac/util/StringUtilsTest.java fails
jlahoda
parents: 24221
diff changeset
    31
import java.util.regex.Matcher;
43e7e44d63da 8043186: javac test langtools/tools/javac/util/StringUtilsTest.java fails
jlahoda
parents: 24221
diff changeset
    32
import java.util.regex.Pattern;
10
06bc494ca11e Initial load
duke
parents:
diff changeset
    33
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
    34
import javax.lang.model.element.AnnotationMirror;
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
    35
import javax.lang.model.element.AnnotationValue;
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
    36
import javax.lang.model.element.Element;
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
    37
import javax.lang.model.element.ExecutableElement;
36526
3b41f1c69604 8142968: Module System implementation
alanb
parents: 36500
diff changeset
    38
import javax.lang.model.element.ModuleElement;
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
    39
import javax.lang.model.element.Name;
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
    40
import javax.lang.model.element.PackageElement;
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
    41
import javax.lang.model.element.TypeElement;
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
    42
import javax.lang.model.element.VariableElement;
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
    43
import javax.lang.model.type.DeclaredType;
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
    44
import javax.lang.model.type.TypeMirror;
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
    45
import javax.lang.model.util.SimpleAnnotationValueVisitor9;
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
    46
import javax.lang.model.util.SimpleElementVisitor9;
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
    47
import javax.lang.model.util.SimpleTypeVisitor9;
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
    48
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
    49
import com.sun.source.doctree.AttributeTree;
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
    50
import com.sun.source.doctree.AttributeTree.ValueKind;
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
    51
import com.sun.source.doctree.CommentTree;
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
    52
import com.sun.source.doctree.DocRootTree;
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
    53
import com.sun.source.doctree.DocTree;
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
    54
import com.sun.source.doctree.DocTree.Kind;
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
    55
import com.sun.source.doctree.EndElementTree;
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
    56
import com.sun.source.doctree.EntityTree;
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
    57
import com.sun.source.doctree.ErroneousTree;
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
    58
import com.sun.source.doctree.InheritDocTree;
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
    59
import com.sun.source.doctree.IndexTree;
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
    60
import com.sun.source.doctree.LinkTree;
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
    61
import com.sun.source.doctree.LiteralTree;
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
    62
import com.sun.source.doctree.SeeTree;
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
    63
import com.sun.source.doctree.StartElementTree;
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
    64
import com.sun.source.doctree.TextTree;
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
    65
import com.sun.source.util.SimpleDocTreeVisitor;
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
    66
import com.sun.tools.javac.util.DefinedBy;
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
    67
import com.sun.tools.javac.util.DefinedBy.Api;
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
    68
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
    69
import jdk.javadoc.internal.doclets.formats.html.markup.Comment;
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
    70
import jdk.javadoc.internal.doclets.formats.html.markup.ContentBuilder;
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
    71
import jdk.javadoc.internal.doclets.formats.html.markup.DocType;
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
    72
import jdk.javadoc.internal.doclets.formats.html.markup.HtmlAttr;
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
    73
import jdk.javadoc.internal.doclets.formats.html.markup.HtmlConstants;
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
    74
import jdk.javadoc.internal.doclets.formats.html.markup.HtmlDocWriter;
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
    75
import jdk.javadoc.internal.doclets.formats.html.markup.HtmlDocument;
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
    76
import jdk.javadoc.internal.doclets.formats.html.markup.HtmlStyle;
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
    77
import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTag;
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
    78
import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTree;
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
    79
import jdk.javadoc.internal.doclets.formats.html.markup.RawHtml;
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
    80
import jdk.javadoc.internal.doclets.formats.html.markup.StringContent;
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
    81
import jdk.javadoc.internal.doclets.toolkit.AnnotationTypeWriter;
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
    82
import jdk.javadoc.internal.doclets.toolkit.ClassWriter;
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
    83
import jdk.javadoc.internal.doclets.toolkit.Configuration;
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
    84
import jdk.javadoc.internal.doclets.toolkit.Content;
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
    85
import jdk.javadoc.internal.doclets.toolkit.PackageSummaryWriter;
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
    86
import jdk.javadoc.internal.doclets.toolkit.taglets.DocRootTaglet;
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
    87
import jdk.javadoc.internal.doclets.toolkit.taglets.TagletWriter;
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
    88
import jdk.javadoc.internal.doclets.toolkit.util.DocFile;
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
    89
import jdk.javadoc.internal.doclets.toolkit.util.DocLink;
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
    90
import jdk.javadoc.internal.doclets.toolkit.util.DocPath;
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
    91
import jdk.javadoc.internal.doclets.toolkit.util.DocPaths;
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
    92
import jdk.javadoc.internal.doclets.toolkit.util.DocletConstants;
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
    93
import jdk.javadoc.internal.doclets.toolkit.util.ImplementedMethods;
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
    94
import jdk.javadoc.internal.doclets.toolkit.util.Utils;
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
    95
import jdk.javadoc.internal.doclets.toolkit.util.CommentHelper;
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
    96
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
    97
import static com.sun.source.doctree.AttributeTree.ValueKind.*;
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
    98
import static com.sun.source.doctree.DocTree.Kind.*;
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
    99
import static jdk.javadoc.internal.doclets.formats.html.markup.HtmlDocWriter.CONTENT_TYPE;
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
   100
import static jdk.javadoc.internal.doclets.toolkit.util.CommentHelper.SPACER;
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
   101
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   102
06bc494ca11e Initial load
duke
parents:
diff changeset
   103
/**
06bc494ca11e Initial load
duke
parents:
diff changeset
   104
 * Class for the Html Format Code Generation specific to JavaDoc.
06bc494ca11e Initial load
duke
parents:
diff changeset
   105
 * This Class contains methods related to the Html Code Generation which
06bc494ca11e Initial load
duke
parents:
diff changeset
   106
 * are used extensively while generating the entire documentation.
06bc494ca11e Initial load
duke
parents:
diff changeset
   107
 *
14260
727a84636f12 8000665: fix "internal API" comments on javadoc files
jjg
parents: 14259
diff changeset
   108
 *  <p><b>This is NOT part of any supported API.
727a84636f12 8000665: fix "internal API" comments on javadoc files
jjg
parents: 14259
diff changeset
   109
 *  If you write code that depends on this, you do so at your own risk.
727a84636f12 8000665: fix "internal API" comments on javadoc files
jjg
parents: 14259
diff changeset
   110
 *  This code and its internal interfaces are subject to change or
727a84636f12 8000665: fix "internal API" comments on javadoc files
jjg
parents: 14259
diff changeset
   111
 *  deletion without notice.</b>
727a84636f12 8000665: fix "internal API" comments on javadoc files
jjg
parents: 14259
diff changeset
   112
 *
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   113
 * @author Atul M Dambalkar
06bc494ca11e Initial load
duke
parents:
diff changeset
   114
 * @author Robert Field
2216
b124d5c924eb 6786690: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - DL tag and nesting issue
bpatel
parents: 2086
diff changeset
   115
 * @author Bhavesh Patel (Modified)
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   116
 */
06bc494ca11e Initial load
duke
parents:
diff changeset
   117
public class HtmlDocletWriter extends HtmlDocWriter {
06bc494ca11e Initial load
duke
parents:
diff changeset
   118
06bc494ca11e Initial load
duke
parents:
diff changeset
   119
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
   120
     * Relative path from the file getting generated to the destination
06bc494ca11e Initial load
duke
parents:
diff changeset
   121
     * directory. For example, if the file getting generated is
14357
faf9cde2817b 8000741: refactor javadoc to use abstraction to handle relative paths
jjg
parents: 14266
diff changeset
   122
     * "java/lang/Object.html", then the path to the root is "../..".
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   123
     * This string can be empty if the file getting generated is in
06bc494ca11e Initial load
duke
parents:
diff changeset
   124
     * the destination directory.
06bc494ca11e Initial load
duke
parents:
diff changeset
   125
     */
14357
faf9cde2817b 8000741: refactor javadoc to use abstraction to handle relative paths
jjg
parents: 14266
diff changeset
   126
    public final DocPath pathToRoot;
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   127
06bc494ca11e Initial load
duke
parents:
diff changeset
   128
    /**
14357
faf9cde2817b 8000741: refactor javadoc to use abstraction to handle relative paths
jjg
parents: 14266
diff changeset
   129
     * Platform-independent path from the current or the
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   130
     * destination directory to the file getting generated.
06bc494ca11e Initial load
duke
parents:
diff changeset
   131
     * Used when creating the file.
06bc494ca11e Initial load
duke
parents:
diff changeset
   132
     */
14357
faf9cde2817b 8000741: refactor javadoc to use abstraction to handle relative paths
jjg
parents: 14266
diff changeset
   133
    public final DocPath path;
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   134
06bc494ca11e Initial load
duke
parents:
diff changeset
   135
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
   136
     * Name of the file getting generated. If the file getting generated is
06bc494ca11e Initial load
duke
parents:
diff changeset
   137
     * "java/lang/Object.html", then the filename is "Object.html".
06bc494ca11e Initial load
duke
parents:
diff changeset
   138
     */
14357
faf9cde2817b 8000741: refactor javadoc to use abstraction to handle relative paths
jjg
parents: 14266
diff changeset
   139
    public final DocPath filename;
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   140
06bc494ca11e Initial load
duke
parents:
diff changeset
   141
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
   142
     * The global configuration information for this run.
06bc494ca11e Initial load
duke
parents:
diff changeset
   143
     */
14542
7062120649c2 8000800: javadoc uses static non-final fields
jjg
parents: 14368
diff changeset
   144
    public final ConfigurationImpl configuration;
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   145
25454
376a52c9540c 8039028: [javadoc] refactor the usage of Util.java
ksrini
parents: 24603
diff changeset
   146
    protected final Utils utils;
376a52c9540c 8039028: [javadoc] refactor the usage of Util.java
ksrini
parents: 24603
diff changeset
   147
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   148
    /**
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   149
     * To check whether annotation heading is printed or not.
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   150
     */
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   151
    protected boolean printedAnnotationHeading = false;
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   152
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   153
    /**
20237
b6d89903c867 8015249: javadoc fails to document static final fields in annotation types
bpatel
parents: 19920
diff changeset
   154
     * To check whether annotation field heading is printed or not.
b6d89903c867 8015249: javadoc fails to document static final fields in annotation types
bpatel
parents: 19920
diff changeset
   155
     */
b6d89903c867 8015249: javadoc fails to document static final fields in annotation types
bpatel
parents: 19920
diff changeset
   156
    protected boolean printedAnnotationFieldHeading = false;
b6d89903c867 8015249: javadoc fails to document static final fields in annotation types
bpatel
parents: 19920
diff changeset
   157
b6d89903c867 8015249: javadoc fails to document static final fields in annotation types
bpatel
parents: 19920
diff changeset
   158
    /**
15035
d03c311f44e6 8005092: javadoc should check for synthesized bit on an annotation
bpatel
parents: 14549
diff changeset
   159
     * To check whether the repeated annotations is documented or not.
d03c311f44e6 8005092: javadoc should check for synthesized bit on an annotation
bpatel
parents: 14549
diff changeset
   160
     */
d03c311f44e6 8005092: javadoc should check for synthesized bit on an annotation
bpatel
parents: 14549
diff changeset
   161
    private boolean isAnnotationDocumented = false;
d03c311f44e6 8005092: javadoc should check for synthesized bit on an annotation
bpatel
parents: 14549
diff changeset
   162
d03c311f44e6 8005092: javadoc should check for synthesized bit on an annotation
bpatel
parents: 14549
diff changeset
   163
    /**
d03c311f44e6 8005092: javadoc should check for synthesized bit on an annotation
bpatel
parents: 14549
diff changeset
   164
     * To check whether the container annotations is documented or not.
d03c311f44e6 8005092: javadoc should check for synthesized bit on an annotation
bpatel
parents: 14549
diff changeset
   165
     */
d03c311f44e6 8005092: javadoc should check for synthesized bit on an annotation
bpatel
parents: 14549
diff changeset
   166
    private boolean isContainerDocumented = false;
d03c311f44e6 8005092: javadoc should check for synthesized bit on an annotation
bpatel
parents: 14549
diff changeset
   167
33920
bd731341c405 8141492: Implement search feature in javadoc
bpatel
parents: 31943
diff changeset
   168
    HtmlTree fixedNavDiv = new HtmlTree(HtmlTag.DIV);
bd731341c405 8141492: Implement search feature in javadoc
bpatel
parents: 31943
diff changeset
   169
36500
d31e4986dc8b 8149139: [javadoc] Modify Content to accept CharSequence
ksrini
parents: 36038
diff changeset
   170
    final static Pattern IMPROPER_HTML_CHARS = Pattern.compile(".*[&<>].*");
d31e4986dc8b 8149139: [javadoc] Modify Content to accept CharSequence
ksrini
parents: 36038
diff changeset
   171
15035
d03c311f44e6 8005092: javadoc should check for synthesized bit on an annotation
bpatel
parents: 14549
diff changeset
   172
    /**
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   173
     * Constructor to construct the HtmlStandardWriter object.
06bc494ca11e Initial load
duke
parents:
diff changeset
   174
     *
14357
faf9cde2817b 8000741: refactor javadoc to use abstraction to handle relative paths
jjg
parents: 14266
diff changeset
   175
     * @param path File to be generated.
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   176
     */
14357
faf9cde2817b 8000741: refactor javadoc to use abstraction to handle relative paths
jjg
parents: 14266
diff changeset
   177
    public HtmlDocletWriter(ConfigurationImpl configuration, DocPath path)
faf9cde2817b 8000741: refactor javadoc to use abstraction to handle relative paths
jjg
parents: 14266
diff changeset
   178
            throws IOException {
faf9cde2817b 8000741: refactor javadoc to use abstraction to handle relative paths
jjg
parents: 14266
diff changeset
   179
        super(configuration, path);
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   180
        this.configuration = configuration;
25454
376a52c9540c 8039028: [javadoc] refactor the usage of Util.java
ksrini
parents: 24603
diff changeset
   181
        this.utils = configuration.utils;
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   182
        this.path = path;
14357
faf9cde2817b 8000741: refactor javadoc to use abstraction to handle relative paths
jjg
parents: 14266
diff changeset
   183
        this.pathToRoot = path.parent().invert();
faf9cde2817b 8000741: refactor javadoc to use abstraction to handle relative paths
jjg
parents: 14266
diff changeset
   184
        this.filename = path.basename();
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   185
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   186
06bc494ca11e Initial load
duke
parents:
diff changeset
   187
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
   188
     * Replace {&#064;docRoot} tag used in options that accept HTML text, such
06bc494ca11e Initial load
duke
parents:
diff changeset
   189
     * as -header, -footer, -top and -bottom, and when converting a relative
06bc494ca11e Initial load
duke
parents:
diff changeset
   190
     * HREF where commentTagsToString inserts a {&#064;docRoot} where one was
06bc494ca11e Initial load
duke
parents:
diff changeset
   191
     * missing.  (Also see DocRootTaglet for {&#064;docRoot} tags in doc
06bc494ca11e Initial load
duke
parents:
diff changeset
   192
     * comments.)
06bc494ca11e Initial load
duke
parents:
diff changeset
   193
     * <p>
06bc494ca11e Initial load
duke
parents:
diff changeset
   194
     * Replace {&#064;docRoot} tag in htmlstr with the relative path to the
06bc494ca11e Initial load
duke
parents:
diff changeset
   195
     * destination directory from the directory where the file is being
06bc494ca11e Initial load
duke
parents:
diff changeset
   196
     * written, looping to handle all such tags in htmlstr.
06bc494ca11e Initial load
duke
parents:
diff changeset
   197
     * <p>
06bc494ca11e Initial load
duke
parents:
diff changeset
   198
     * For example, for "-d docs" and -header containing {&#064;docRoot}, when
06bc494ca11e Initial load
duke
parents:
diff changeset
   199
     * the HTML page for source file p/C1.java is being generated, the
06bc494ca11e Initial load
duke
parents:
diff changeset
   200
     * {&#064;docRoot} tag would be inserted into the header as "../",
06bc494ca11e Initial load
duke
parents:
diff changeset
   201
     * the relative path from docs/p/ to docs/ (the document root).
06bc494ca11e Initial load
duke
parents:
diff changeset
   202
     * <p>
06bc494ca11e Initial load
duke
parents:
diff changeset
   203
     * Note: This doc comment was written with '&amp;#064;' representing '@'
06bc494ca11e Initial load
duke
parents:
diff changeset
   204
     * to prevent the inline tag from being interpreted.
06bc494ca11e Initial load
duke
parents:
diff changeset
   205
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   206
    public String replaceDocRootDir(String htmlstr) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   207
        // Return if no inline tags exist
06bc494ca11e Initial load
duke
parents:
diff changeset
   208
        int index = htmlstr.indexOf("{@");
06bc494ca11e Initial load
duke
parents:
diff changeset
   209
        if (index < 0) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   210
            return htmlstr;
06bc494ca11e Initial load
duke
parents:
diff changeset
   211
        }
24603
43e7e44d63da 8043186: javac test langtools/tools/javac/util/StringUtilsTest.java fails
jlahoda
parents: 24221
diff changeset
   212
        Matcher docrootMatcher = docrootPattern.matcher(htmlstr);
43e7e44d63da 8043186: javac test langtools/tools/javac/util/StringUtilsTest.java fails
jlahoda
parents: 24221
diff changeset
   213
        if (!docrootMatcher.find()) {
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   214
            return htmlstr;
06bc494ca11e Initial load
duke
parents:
diff changeset
   215
        }
8631
664f84942e74 6866185: Util.getPackageSourcePath should use lastIndexOf not indexOf and related cleanup
jjg
parents: 7681
diff changeset
   216
        StringBuilder buf = new StringBuilder();
24603
43e7e44d63da 8043186: javac test langtools/tools/javac/util/StringUtilsTest.java fails
jlahoda
parents: 24221
diff changeset
   217
        int prevEnd = 0;
43e7e44d63da 8043186: javac test langtools/tools/javac/util/StringUtilsTest.java fails
jlahoda
parents: 24221
diff changeset
   218
        do {
43e7e44d63da 8043186: javac test langtools/tools/javac/util/StringUtilsTest.java fails
jlahoda
parents: 24221
diff changeset
   219
            int match = docrootMatcher.start();
43e7e44d63da 8043186: javac test langtools/tools/javac/util/StringUtilsTest.java fails
jlahoda
parents: 24221
diff changeset
   220
            // append htmlstr up to start of next {@docroot}
43e7e44d63da 8043186: javac test langtools/tools/javac/util/StringUtilsTest.java fails
jlahoda
parents: 24221
diff changeset
   221
            buf.append(htmlstr.substring(prevEnd, match));
43e7e44d63da 8043186: javac test langtools/tools/javac/util/StringUtilsTest.java fails
jlahoda
parents: 24221
diff changeset
   222
            prevEnd = docrootMatcher.end();
43e7e44d63da 8043186: javac test langtools/tools/javac/util/StringUtilsTest.java fails
jlahoda
parents: 24221
diff changeset
   223
            if (configuration.docrootparent.length() > 0 && htmlstr.startsWith("/..", prevEnd)) {
22005
4270ada5dcd1 8025416: doclet not substituting {@docRoot} in some cases
bpatel
parents: 21494
diff changeset
   224
                // Insert the absolute link if {@docRoot} is followed by "/..".
9608
385a828ba236 6553182: Need to modify javadoc doclet for GPL
bpatel
parents: 9606
diff changeset
   225
                buf.append(configuration.docrootparent);
24603
43e7e44d63da 8043186: javac test langtools/tools/javac/util/StringUtilsTest.java fails
jlahoda
parents: 24221
diff changeset
   226
                prevEnd += 3;
9608
385a828ba236 6553182: Need to modify javadoc doclet for GPL
bpatel
parents: 9606
diff changeset
   227
            } else {
385a828ba236 6553182: Need to modify javadoc doclet for GPL
bpatel
parents: 9606
diff changeset
   228
                // Insert relative path where {@docRoot} was located
14357
faf9cde2817b 8000741: refactor javadoc to use abstraction to handle relative paths
jjg
parents: 14266
diff changeset
   229
                buf.append(pathToRoot.isEmpty() ? "." : pathToRoot.getPath());
22005
4270ada5dcd1 8025416: doclet not substituting {@docRoot} in some cases
bpatel
parents: 21494
diff changeset
   230
            }
4270ada5dcd1 8025416: doclet not substituting {@docRoot} in some cases
bpatel
parents: 21494
diff changeset
   231
            // Append slash if next character is not a slash
24603
43e7e44d63da 8043186: javac test langtools/tools/javac/util/StringUtilsTest.java fails
jlahoda
parents: 24221
diff changeset
   232
            if (prevEnd < htmlstr.length() && htmlstr.charAt(prevEnd) != '/') {
22005
4270ada5dcd1 8025416: doclet not substituting {@docRoot} in some cases
bpatel
parents: 21494
diff changeset
   233
                buf.append('/');
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   234
            }
24603
43e7e44d63da 8043186: javac test langtools/tools/javac/util/StringUtilsTest.java fails
jlahoda
parents: 24221
diff changeset
   235
        } while (docrootMatcher.find());
43e7e44d63da 8043186: javac test langtools/tools/javac/util/StringUtilsTest.java fails
jlahoda
parents: 24221
diff changeset
   236
        buf.append(htmlstr.substring(prevEnd));
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   237
        return buf.toString();
06bc494ca11e Initial load
duke
parents:
diff changeset
   238
    }
24603
43e7e44d63da 8043186: javac test langtools/tools/javac/util/StringUtilsTest.java fails
jlahoda
parents: 24221
diff changeset
   239
    //where:
43e7e44d63da 8043186: javac test langtools/tools/javac/util/StringUtilsTest.java fails
jlahoda
parents: 24221
diff changeset
   240
        // Note: {@docRoot} is not case sensitive when passed in w/command line option:
43e7e44d63da 8043186: javac test langtools/tools/javac/util/StringUtilsTest.java fails
jlahoda
parents: 24221
diff changeset
   241
        private static final Pattern docrootPattern =
43e7e44d63da 8043186: javac test langtools/tools/javac/util/StringUtilsTest.java fails
jlahoda
parents: 24221
diff changeset
   242
                Pattern.compile(Pattern.quote("{@docroot}"), Pattern.CASE_INSENSITIVE);
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   243
06bc494ca11e Initial load
duke
parents:
diff changeset
   244
    /**
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   245
     * Get the script to show or hide the All classes link.
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   246
     *
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   247
     * @param id id of the element to show or hide
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   248
     * @return a content tree for the script
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   249
     */
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   250
    public Content getAllClassesLinkScript(String id) {
29957
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 26900
diff changeset
   251
        HtmlTree script = HtmlTree.SCRIPT();
7641
8b552db25f99 7006270: Several javadoc regression tests are failing on windows
bpatel
parents: 7614
diff changeset
   252
        String scriptCode = "<!--" + DocletConstants.NL +
8b552db25f99 7006270: Several javadoc regression tests are failing on windows
bpatel
parents: 7614
diff changeset
   253
                "  allClassesLink = document.getElementById(\"" + id + "\");" + DocletConstants.NL +
8b552db25f99 7006270: Several javadoc regression tests are failing on windows
bpatel
parents: 7614
diff changeset
   254
                "  if(window==top) {" + DocletConstants.NL +
8b552db25f99 7006270: Several javadoc regression tests are failing on windows
bpatel
parents: 7614
diff changeset
   255
                "    allClassesLink.style.display = \"block\";" + DocletConstants.NL +
8b552db25f99 7006270: Several javadoc regression tests are failing on windows
bpatel
parents: 7614
diff changeset
   256
                "  }" + DocletConstants.NL +
8b552db25f99 7006270: Several javadoc regression tests are failing on windows
bpatel
parents: 7614
diff changeset
   257
                "  else {" + DocletConstants.NL +
8b552db25f99 7006270: Several javadoc regression tests are failing on windows
bpatel
parents: 7614
diff changeset
   258
                "    allClassesLink.style.display = \"none\";" + DocletConstants.NL +
8b552db25f99 7006270: Several javadoc regression tests are failing on windows
bpatel
parents: 7614
diff changeset
   259
                "  }" + DocletConstants.NL +
8b552db25f99 7006270: Several javadoc regression tests are failing on windows
bpatel
parents: 7614
diff changeset
   260
                "  //-->" + DocletConstants.NL;
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   261
        Content scriptContent = new RawHtml(scriptCode);
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   262
        script.addContent(scriptContent);
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   263
        Content div = HtmlTree.DIV(script);
29957
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 26900
diff changeset
   264
        Content div_noscript = HtmlTree.DIV(getResource("doclet.No_Script_Message"));
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 26900
diff changeset
   265
        Content noScript = HtmlTree.NOSCRIPT(div_noscript);
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 26900
diff changeset
   266
        div.addContent(noScript);
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   267
        return div;
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   268
    }
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   269
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   270
    /**
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   271
     * Add method information.
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   272
     *
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   273
     * @param method the method to be documented
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   274
     * @param dl the content tree to which the method information will be added
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   275
     */
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
   276
    private void addMethodInfo(ExecutableElement method, Content dl) {
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
   277
        TypeElement enclosing = utils.getEnclosingTypeElement(method);
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
   278
        List<? extends TypeMirror> intfacs = enclosing.getInterfaces();
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
   279
        ExecutableElement overriddenMethod = utils.overriddenMethod(method);
2216
b124d5c924eb 6786690: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - DL tag and nesting issue
bpatel
parents: 2086
diff changeset
   280
        // Check whether there is any implementation or overridden info to be
b124d5c924eb 6786690: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - DL tag and nesting issue
bpatel
parents: 2086
diff changeset
   281
        // printed. If no overridden or implementation info needs to be
b124d5c924eb 6786690: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - DL tag and nesting issue
bpatel
parents: 2086
diff changeset
   282
        // printed, do not print this section.
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
   283
        if ((!intfacs.isEmpty()
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
   284
                && new ImplementedMethods(method, this.configuration).build().isEmpty() == false)
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
   285
                || overriddenMethod != null) {
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   286
            MethodWriterImpl.addImplementsInfo(this, method, dl);
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   287
            if (overriddenMethod != null) {
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   288
                MethodWriterImpl.addOverridden(this,
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
   289
                        utils.overriddenType(method),
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
   290
                        overriddenMethod,
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
   291
                        dl);
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   292
            }
06bc494ca11e Initial load
duke
parents:
diff changeset
   293
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
   294
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   295
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   296
    /**
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   297
     * Adds the tags information.
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   298
     *
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
   299
     * @param e the Element for which the tags will be generated
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   300
     * @param htmltree the documentation tree to which the tags will be added
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   301
     */
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
   302
    protected void addTagsInfo(Element e, Content htmltree) {
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   303
        if (configuration.nocomment) {
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   304
            return;
06bc494ca11e Initial load
duke
parents:
diff changeset
   305
        }
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   306
        Content dl = new HtmlTree(HtmlTag.DL);
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
   307
        if (utils.isExecutableElement(e) && !utils.isConstructor(e)) {
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
   308
            addMethodInfo((ExecutableElement)e, dl);
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   309
        }
17574
044c7e1e4d53 8012308: Remove TagletOutput in favor of direct use of Content
jjg
parents: 17573
diff changeset
   310
        Content output = new ContentBuilder();
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
   311
        TagletWriter.genTagOutput(configuration.tagletManager, e,
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
   312
            configuration.tagletManager.getCustomTaglets(e),
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   313
                getTagletWriterInstance(false), output);
17574
044c7e1e4d53 8012308: Remove TagletOutput in favor of direct use of Content
jjg
parents: 17573
diff changeset
   314
        dl.addContent(output);
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   315
        htmltree.addContent(dl);
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   316
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   317
06bc494ca11e Initial load
duke
parents:
diff changeset
   318
    /**
2216
b124d5c924eb 6786690: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - DL tag and nesting issue
bpatel
parents: 2086
diff changeset
   319
     * Check whether there are any tags for Serialization Overview
b124d5c924eb 6786690: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - DL tag and nesting issue
bpatel
parents: 2086
diff changeset
   320
     * section to be printed.
2086
cca2603eab0b 6802694: Javadoc doclet does not display deprecated information with -nocomment option for serialized form
bpatel
parents: 1789
diff changeset
   321
     *
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
   322
     * @param field the VariableElement object to check for tags.
2086
cca2603eab0b 6802694: Javadoc doclet does not display deprecated information with -nocomment option for serialized form
bpatel
parents: 1789
diff changeset
   323
     * @return true if there are tags to be printed else return false.
cca2603eab0b 6802694: Javadoc doclet does not display deprecated information with -nocomment option for serialized form
bpatel
parents: 1789
diff changeset
   324
     */
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
   325
    protected boolean hasSerializationOverviewTags(VariableElement field) {
17574
044c7e1e4d53 8012308: Remove TagletOutput in favor of direct use of Content
jjg
parents: 17573
diff changeset
   326
        Content output = new ContentBuilder();
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
   327
        TagletWriter.genTagOutput(configuration.tagletManager, field,
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
   328
                configuration.tagletManager.getCustomTaglets(field),
2086
cca2603eab0b 6802694: Javadoc doclet does not display deprecated information with -nocomment option for serialized form
bpatel
parents: 1789
diff changeset
   329
                getTagletWriterInstance(false), output);
17574
044c7e1e4d53 8012308: Remove TagletOutput in favor of direct use of Content
jjg
parents: 17573
diff changeset
   330
        return !output.isEmpty();
2086
cca2603eab0b 6802694: Javadoc doclet does not display deprecated information with -nocomment option for serialized form
bpatel
parents: 1789
diff changeset
   331
    }
cca2603eab0b 6802694: Javadoc doclet does not display deprecated information with -nocomment option for serialized form
bpatel
parents: 1789
diff changeset
   332
cca2603eab0b 6802694: Javadoc doclet does not display deprecated information with -nocomment option for serialized form
bpatel
parents: 1789
diff changeset
   333
    /**
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   334
     * Returns a TagletWriter that knows how to write HTML.
06bc494ca11e Initial load
duke
parents:
diff changeset
   335
     *
06bc494ca11e Initial load
duke
parents:
diff changeset
   336
     * @return a TagletWriter that knows how to write HTML.
06bc494ca11e Initial load
duke
parents:
diff changeset
   337
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   338
    public TagletWriter getTagletWriterInstance(boolean isFirstSentence) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   339
        return new TagletWriterImpl(this, isFirstSentence);
06bc494ca11e Initial load
duke
parents:
diff changeset
   340
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   341
06bc494ca11e Initial load
duke
parents:
diff changeset
   342
    /**
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   343
     * Get Package link, with target frame.
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   344
     *
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
   345
     * @param pkg The link will be to the "package-summary.html" page for this package
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   346
     * @param target name of the target frame
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   347
     * @param label tag for the link
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   348
     * @return a content for the target package link
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   349
     */
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
   350
    public Content getTargetPackageLink(PackageElement pkg, String target,
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   351
            Content label) {
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
   352
        return getHyperLink(pathString(pkg, DocPaths.PACKAGE_SUMMARY), label, "", target);
15723
58a73dac9ee4 8006124: javadoc/doclet should be updated to support profiles
bpatel
parents: 15035
diff changeset
   353
    }
58a73dac9ee4 8006124: javadoc/doclet should be updated to support profiles
bpatel
parents: 15035
diff changeset
   354
36526
3b41f1c69604 8142968: Module System implementation
alanb
parents: 36500
diff changeset
   355
    /**
3b41f1c69604 8142968: Module System implementation
alanb
parents: 36500
diff changeset
   356
     * Get Module Package link, with target frame.
3b41f1c69604 8142968: Module System implementation
alanb
parents: 36500
diff changeset
   357
     *
3b41f1c69604 8142968: Module System implementation
alanb
parents: 36500
diff changeset
   358
     * @param pkg the PackageElement
3b41f1c69604 8142968: Module System implementation
alanb
parents: 36500
diff changeset
   359
     * @param target name of the target frame
3b41f1c69604 8142968: Module System implementation
alanb
parents: 36500
diff changeset
   360
     * @param label tag for the link
3b41f1c69604 8142968: Module System implementation
alanb
parents: 36500
diff changeset
   361
     * @param mdle the module being documented
3b41f1c69604 8142968: Module System implementation
alanb
parents: 36500
diff changeset
   362
     * @return a content for the target module packages link
3b41f1c69604 8142968: Module System implementation
alanb
parents: 36500
diff changeset
   363
     */
3b41f1c69604 8142968: Module System implementation
alanb
parents: 36500
diff changeset
   364
    public Content getTargetModulePackageLink(PackageElement pkg, String target,
3b41f1c69604 8142968: Module System implementation
alanb
parents: 36500
diff changeset
   365
            Content label, ModuleElement mdle) {
3b41f1c69604 8142968: Module System implementation
alanb
parents: 36500
diff changeset
   366
        return getHyperLink(pathString(pkg, DocPaths.PACKAGE_SUMMARY),
3b41f1c69604 8142968: Module System implementation
alanb
parents: 36500
diff changeset
   367
                label, "", target);
3b41f1c69604 8142968: Module System implementation
alanb
parents: 36500
diff changeset
   368
    }
3b41f1c69604 8142968: Module System implementation
alanb
parents: 36500
diff changeset
   369
3b41f1c69604 8142968: Module System implementation
alanb
parents: 36500
diff changeset
   370
    /**
3b41f1c69604 8142968: Module System implementation
alanb
parents: 36500
diff changeset
   371
     * Get Module link, with target frame.
3b41f1c69604 8142968: Module System implementation
alanb
parents: 36500
diff changeset
   372
     *
3b41f1c69604 8142968: Module System implementation
alanb
parents: 36500
diff changeset
   373
     * @param target name of the target frame
3b41f1c69604 8142968: Module System implementation
alanb
parents: 36500
diff changeset
   374
     * @param label tag for the link
3b41f1c69604 8142968: Module System implementation
alanb
parents: 36500
diff changeset
   375
     * @param mdle the module being documented
3b41f1c69604 8142968: Module System implementation
alanb
parents: 36500
diff changeset
   376
     * @return a content for the target module link
3b41f1c69604 8142968: Module System implementation
alanb
parents: 36500
diff changeset
   377
     */
3b41f1c69604 8142968: Module System implementation
alanb
parents: 36500
diff changeset
   378
    public Content getTargetModuleLink(String target, Content label, ModuleElement mdle) {
3b41f1c69604 8142968: Module System implementation
alanb
parents: 36500
diff changeset
   379
        return getHyperLink(pathToRoot.resolve(
3b41f1c69604 8142968: Module System implementation
alanb
parents: 36500
diff changeset
   380
                DocPaths.moduleSummary(mdle)), label, "", target);
3b41f1c69604 8142968: Module System implementation
alanb
parents: 36500
diff changeset
   381
    }
15723
58a73dac9ee4 8006124: javadoc/doclet should be updated to support profiles
bpatel
parents: 15035
diff changeset
   382
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
   383
    public void addClassesSummary(SortedSet<TypeElement> classes, String label,
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
   384
            String tableSummary, List<String> tableHeader, Content summaryContentTree) {
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
   385
        if (!classes.isEmpty()) {
17570
78512b2899db 8012183: replace some uses of Configuration.getText with Configuration.getResource
jjg
parents: 17569
diff changeset
   386
            Content caption = getTableCaption(new RawHtml(label));
29957
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 26900
diff changeset
   387
            Content table = (configuration.isOutputHtml5())
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 26900
diff changeset
   388
                    ? HtmlTree.TABLE(HtmlStyle.typeSummary, caption)
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 26900
diff changeset
   389
                    : HtmlTree.TABLE(HtmlStyle.typeSummary, tableSummary, caption);
15723
58a73dac9ee4 8006124: javadoc/doclet should be updated to support profiles
bpatel
parents: 15035
diff changeset
   390
            table.addContent(getSummaryTableHeader(tableHeader, "col"));
58a73dac9ee4 8006124: javadoc/doclet should be updated to support profiles
bpatel
parents: 15035
diff changeset
   391
            Content tbody = new HtmlTree(HtmlTag.TBODY);
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
   392
            boolean altColor = true;
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
   393
            for (TypeElement te : classes) {
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
   394
                if (!utils.isCoreClass(te) ||
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
   395
                    !configuration.isGeneratedDoc(te)) {
15723
58a73dac9ee4 8006124: javadoc/doclet should be updated to support profiles
bpatel
parents: 15035
diff changeset
   396
                    continue;
58a73dac9ee4 8006124: javadoc/doclet should be updated to support profiles
bpatel
parents: 15035
diff changeset
   397
                }
17559
87c28ee29329 8011642: Remove LinkOutput in favor of direct use of Content
jjg
parents: 17558
diff changeset
   398
                Content classContent = getLink(new LinkInfoImpl(
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
   399
                        configuration, LinkInfoImpl.Kind.PACKAGE, te));
15723
58a73dac9ee4 8006124: javadoc/doclet should be updated to support profiles
bpatel
parents: 15035
diff changeset
   400
                Content tdClass = HtmlTree.TD(HtmlStyle.colFirst, classContent);
58a73dac9ee4 8006124: javadoc/doclet should be updated to support profiles
bpatel
parents: 15035
diff changeset
   401
                HtmlTree tr = HtmlTree.TR(tdClass);
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
   402
                tr.addStyle(altColor ? HtmlStyle.altColor : HtmlStyle.rowColor);
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
   403
                altColor = !altColor;
15723
58a73dac9ee4 8006124: javadoc/doclet should be updated to support profiles
bpatel
parents: 15035
diff changeset
   404
                HtmlTree tdClassDescription = new HtmlTree(HtmlTag.TD);
58a73dac9ee4 8006124: javadoc/doclet should be updated to support profiles
bpatel
parents: 15035
diff changeset
   405
                tdClassDescription.addStyle(HtmlStyle.colLast);
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
   406
                if (utils.isDeprecated(te)) {
15723
58a73dac9ee4 8006124: javadoc/doclet should be updated to support profiles
bpatel
parents: 15035
diff changeset
   407
                    tdClassDescription.addContent(deprecatedLabel);
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
   408
                    List<? extends DocTree> tags = utils.getDeprecatedTrees(te);
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
   409
                    if (!tags.isEmpty()) {
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
   410
                        addSummaryDeprecatedComment(te, tags.get(0), tdClassDescription);
15723
58a73dac9ee4 8006124: javadoc/doclet should be updated to support profiles
bpatel
parents: 15035
diff changeset
   411
                    }
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
   412
                } else {
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
   413
                    addSummaryComment(te, tdClassDescription);
15723
58a73dac9ee4 8006124: javadoc/doclet should be updated to support profiles
bpatel
parents: 15035
diff changeset
   414
                }
58a73dac9ee4 8006124: javadoc/doclet should be updated to support profiles
bpatel
parents: 15035
diff changeset
   415
                tr.addContent(tdClassDescription);
58a73dac9ee4 8006124: javadoc/doclet should be updated to support profiles
bpatel
parents: 15035
diff changeset
   416
                tbody.addContent(tr);
58a73dac9ee4 8006124: javadoc/doclet should be updated to support profiles
bpatel
parents: 15035
diff changeset
   417
            }
58a73dac9ee4 8006124: javadoc/doclet should be updated to support profiles
bpatel
parents: 15035
diff changeset
   418
            table.addContent(tbody);
21494
eb34dbccfb60 8026770: javadoc creates invalid HTML in profile summary pages
bpatel
parents: 21478
diff changeset
   419
            summaryContentTree.addContent(table);
15723
58a73dac9ee4 8006124: javadoc/doclet should be updated to support profiles
bpatel
parents: 15035
diff changeset
   420
        }
58a73dac9ee4 8006124: javadoc/doclet should be updated to support profiles
bpatel
parents: 15035
diff changeset
   421
    }
58a73dac9ee4 8006124: javadoc/doclet should be updated to support profiles
bpatel
parents: 15035
diff changeset
   422
58a73dac9ee4 8006124: javadoc/doclet should be updated to support profiles
bpatel
parents: 15035
diff changeset
   423
    /**
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   424
     * Generates the HTML document tree and prints it out.
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   425
     *
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   426
     * @param metakeywords Array of String keywords for META tag. Each element
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   427
     *                     of the array is assigned to a separate META tag.
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   428
     *                     Pass in null for no array
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   429
     * @param includeScript true if printing windowtitle script
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   430
     *                      false for files that appear in the left-hand frames
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   431
     * @param body the body htmltree to be included in the document
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   432
     */
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
   433
    public void printHtmlDocument(List<String> metakeywords, boolean includeScript,
14265
4e8e488eeae0 8000666: javadoc should write directly to Writer instead of composing strings
jjg
parents: 14263
diff changeset
   434
            Content body) throws IOException {
29957
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 26900
diff changeset
   435
        Content htmlDocType = configuration.isOutputHtml5()
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 26900
diff changeset
   436
                ? DocType.HTML5
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 26900
diff changeset
   437
                : DocType.TRANSITIONAL;
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   438
        Content htmlComment = new Comment(configuration.getText("doclet.New_Page"));
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   439
        Content head = new HtmlTree(HtmlTag.HEAD);
19920
ead15bfdcfa0 8024288: javadoc generated-by comment should always be present
jjg
parents: 19909
diff changeset
   440
        head.addContent(getGeneratedBy(!configuration.notimestamp));
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   441
        head.addContent(getTitle());
26665
e813baa25bf2 8047745: Javadoc should include encoding information in generated html files
bpatel
parents: 25874
diff changeset
   442
        Content meta = HtmlTree.META("Content-Type", CONTENT_TYPE,
e813baa25bf2 8047745: Javadoc should include encoding information in generated html files
bpatel
parents: 25874
diff changeset
   443
                (configuration.charset.length() > 0) ?
e813baa25bf2 8047745: Javadoc should include encoding information in generated html files
bpatel
parents: 25874
diff changeset
   444
                        configuration.charset : HtmlConstants.HTML_DEFAULT_CHARSET);
e813baa25bf2 8047745: Javadoc should include encoding information in generated html files
bpatel
parents: 25874
diff changeset
   445
        head.addContent(meta);
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   446
        if (!configuration.notimestamp) {
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   447
            SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
29957
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 26900
diff changeset
   448
            meta = HtmlTree.META(configuration.isOutputHtml5()
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 26900
diff changeset
   449
                    ? "dc.created"
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 26900
diff changeset
   450
                    : "date", dateFormat.format(new Date()));
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   451
            head.addContent(meta);
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   452
        }
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   453
        if (metakeywords != null) {
22159
682da512ec17 8030253: Update langtools to use strings-in-switch
briangoetz
parents: 22153
diff changeset
   454
            for (String metakeyword : metakeywords) {
26665
e813baa25bf2 8047745: Javadoc should include encoding information in generated html files
bpatel
parents: 25874
diff changeset
   455
                meta = HtmlTree.META("keywords", metakeyword);
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   456
                head.addContent(meta);
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   457
            }
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   458
        }
33920
bd731341c405 8141492: Implement search feature in javadoc
bpatel
parents: 31943
diff changeset
   459
        addStyleSheetProperties(head);
bd731341c405 8141492: Implement search feature in javadoc
bpatel
parents: 31943
diff changeset
   460
        addScriptProperties(head);
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   461
        Content htmlTree = HtmlTree.HTML(configuration.getLocale().getLanguage(),
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   462
                head, body);
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   463
        Content htmlDocument = new HtmlDocument(htmlDocType,
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   464
                htmlComment, htmlTree);
14266
69453558960d 8000673: remove dead code from HtmlWriter and subtypes
jjg
parents: 14265
diff changeset
   465
        write(htmlDocument);
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   466
    }
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   467
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   468
    /**
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   469
     * Get the window title.
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   470
     *
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   471
     * @param title the title string to construct the complete window title
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   472
     * @return the window title string
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   473
     */
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   474
    public String getWindowTitle(String title) {
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   475
        if (configuration.windowtitle.length() > 0) {
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   476
            title += " (" + configuration.windowtitle  + ")";
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   477
        }
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   478
        return title;
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   479
    }
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   480
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   481
    /**
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   482
     * Get user specified header and the footer.
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   483
     *
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   484
     * @param header if true print the user provided header else print the
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   485
     * user provided footer.
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   486
     */
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   487
    public Content getUserHeaderFooter(boolean header) {
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   488
        String content;
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   489
        if (header) {
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   490
            content = replaceDocRootDir(configuration.header);
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   491
        } else {
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   492
            if (configuration.footer.length() != 0) {
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   493
                content = replaceDocRootDir(configuration.footer);
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   494
            } else {
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   495
                content = replaceDocRootDir(configuration.header);
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   496
            }
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   497
        }
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   498
        Content rawContent = new RawHtml(content);
19254
0988183c8164 4749567: stddoclet: Add CSS style for setting header/footer to be italic
bpatel
parents: 19253
diff changeset
   499
        return rawContent;
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   500
    }
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   501
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   502
    /**
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   503
     * Adds the user specified top.
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   504
     *
29957
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 26900
diff changeset
   505
     * @param htmlTree the content tree to which user specified top will be added
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   506
     */
29957
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 26900
diff changeset
   507
    public void addTop(Content htmlTree) {
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   508
        Content top = new RawHtml(replaceDocRootDir(configuration.top));
33920
bd731341c405 8141492: Implement search feature in javadoc
bpatel
parents: 31943
diff changeset
   509
        fixedNavDiv.addContent(top);
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   510
    }
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   511
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   512
    /**
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   513
     * Adds the user specified bottom.
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   514
     *
29957
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 26900
diff changeset
   515
     * @param htmlTree the content tree to which user specified bottom will be added
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   516
     */
29957
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 26900
diff changeset
   517
    public void addBottom(Content htmlTree) {
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   518
        Content bottom = new RawHtml(replaceDocRootDir(configuration.bottom));
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   519
        Content small = HtmlTree.SMALL(bottom);
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   520
        Content p = HtmlTree.P(HtmlStyle.legalCopy, small);
29957
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 26900
diff changeset
   521
        htmlTree.addContent(p);
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   522
    }
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   523
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   524
    /**
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   525
     * Adds the navigation bar for the Html page at the top and and the bottom.
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   526
     *
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   527
     * @param header If true print navigation bar at the top of the page else
29957
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 26900
diff changeset
   528
     * @param htmlTree the HtmlTree to which the nav links will be added
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   529
     */
29957
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 26900
diff changeset
   530
    protected void addNavLinks(boolean header, Content htmlTree) {
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   531
        if (!configuration.nonavbar) {
29957
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 26900
diff changeset
   532
            Content tree = (configuration.allowTag(HtmlTag.NAV))
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 26900
diff changeset
   533
                    ? HtmlTree.NAV()
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 26900
diff changeset
   534
                    : htmlTree;
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   535
            String allClassesId = "allclasses_";
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   536
            HtmlTree navDiv = new HtmlTree(HtmlTag.DIV);
33920
bd731341c405 8141492: Implement search feature in javadoc
bpatel
parents: 31943
diff changeset
   537
            fixedNavDiv.addStyle(HtmlStyle.fixedNav);
19909
784c68032a36 7198273: RFE : Javadoc Accessibility : Hyperlinks should contain text or an image with alt text
bpatel
parents: 19663
diff changeset
   538
            Content skipNavLinks = configuration.getResource("doclet.Skip_navigation_links");
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   539
            if (header) {
33920
bd731341c405 8141492: Implement search feature in javadoc
bpatel
parents: 31943
diff changeset
   540
                fixedNavDiv.addContent(HtmlConstants.START_OF_TOP_NAVBAR);
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   541
                navDiv.addStyle(HtmlStyle.topNav);
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   542
                allClassesId += "navbar_top";
21008
af0b915df7cc 8025633: Fix javadoc to generate valid anchor names
bpatel
parents: 20613
diff changeset
   543
                Content a = getMarkerAnchor(SectionName.NAVBAR_TOP);
19909
784c68032a36 7198273: RFE : Javadoc Accessibility : Hyperlinks should contain text or an image with alt text
bpatel
parents: 19663
diff changeset
   544
                //WCAG - Hyperlinks should contain text or an image with alt text - for AT tools
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   545
                navDiv.addContent(a);
19909
784c68032a36 7198273: RFE : Javadoc Accessibility : Hyperlinks should contain text or an image with alt text
bpatel
parents: 19663
diff changeset
   546
                Content skipLinkContent = HtmlTree.DIV(HtmlStyle.skipNav, getHyperLink(
21008
af0b915df7cc 8025633: Fix javadoc to generate valid anchor names
bpatel
parents: 20613
diff changeset
   547
                    getDocLink(SectionName.SKIP_NAVBAR_TOP), skipNavLinks,
19909
784c68032a36 7198273: RFE : Javadoc Accessibility : Hyperlinks should contain text or an image with alt text
bpatel
parents: 19663
diff changeset
   548
                    skipNavLinks.toString(), ""));
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   549
                navDiv.addContent(skipLinkContent);
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   550
            } else {
29957
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 26900
diff changeset
   551
                tree.addContent(HtmlConstants.START_OF_BOTTOM_NAVBAR);
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   552
                navDiv.addStyle(HtmlStyle.bottomNav);
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   553
                allClassesId += "navbar_bottom";
21008
af0b915df7cc 8025633: Fix javadoc to generate valid anchor names
bpatel
parents: 20613
diff changeset
   554
                Content a = getMarkerAnchor(SectionName.NAVBAR_BOTTOM);
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   555
                navDiv.addContent(a);
19909
784c68032a36 7198273: RFE : Javadoc Accessibility : Hyperlinks should contain text or an image with alt text
bpatel
parents: 19663
diff changeset
   556
                Content skipLinkContent = HtmlTree.DIV(HtmlStyle.skipNav, getHyperLink(
21008
af0b915df7cc 8025633: Fix javadoc to generate valid anchor names
bpatel
parents: 20613
diff changeset
   557
                    getDocLink(SectionName.SKIP_NAVBAR_BOTTOM), skipNavLinks,
19909
784c68032a36 7198273: RFE : Javadoc Accessibility : Hyperlinks should contain text or an image with alt text
bpatel
parents: 19663
diff changeset
   558
                    skipNavLinks.toString(), ""));
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   559
                navDiv.addContent(skipLinkContent);
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   560
            }
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   561
            if (header) {
21008
af0b915df7cc 8025633: Fix javadoc to generate valid anchor names
bpatel
parents: 20613
diff changeset
   562
                navDiv.addContent(getMarkerAnchor(SectionName.NAVBAR_TOP_FIRSTROW));
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   563
            } else {
21008
af0b915df7cc 8025633: Fix javadoc to generate valid anchor names
bpatel
parents: 20613
diff changeset
   564
                navDiv.addContent(getMarkerAnchor(SectionName.NAVBAR_BOTTOM_FIRSTROW));
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   565
            }
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   566
            HtmlTree navList = new HtmlTree(HtmlTag.UL);
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   567
            navList.addStyle(HtmlStyle.navList);
16319
e586bfeb39c5 7112427: The doclet needs to be able to generate JavaFX documentation.
jjg
parents: 15725
diff changeset
   568
            navList.addAttr(HtmlAttr.TITLE,
e586bfeb39c5 7112427: The doclet needs to be able to generate JavaFX documentation.
jjg
parents: 15725
diff changeset
   569
                            configuration.getText("doclet.Navigation"));
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   570
            if (configuration.createoverview) {
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   571
                navList.addContent(getNavLinkContents());
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   572
            }
37943
2efb75c09230 8154262: Navigation bar in javadoc generated pages needs to be updated to display module information
bpatel
parents: 36526
diff changeset
   573
            if (configuration.modules.size() == 1) {
2efb75c09230 8154262: Navigation bar in javadoc generated pages needs to be updated to display module information
bpatel
parents: 36526
diff changeset
   574
                navList.addContent(getNavLinkModule(configuration.modules.first()));
2efb75c09230 8154262: Navigation bar in javadoc generated pages needs to be updated to display module information
bpatel
parents: 36526
diff changeset
   575
            } else if (!configuration.modules.isEmpty()) {
2efb75c09230 8154262: Navigation bar in javadoc generated pages needs to be updated to display module information
bpatel
parents: 36526
diff changeset
   576
                navList.addContent(getNavLinkModule());
2efb75c09230 8154262: Navigation bar in javadoc generated pages needs to be updated to display module information
bpatel
parents: 36526
diff changeset
   577
            }
24221
2376793dd33b 8038583: [javadoc] Refactor uses of arrays to Collections
ksrini
parents: 23794
diff changeset
   578
            if (configuration.packages.size() == 1) {
2376793dd33b 8038583: [javadoc] Refactor uses of arrays to Collections
ksrini
parents: 23794
diff changeset
   579
                navList.addContent(getNavLinkPackage(configuration.packages.first()));
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
   580
            } else if (!configuration.packages.isEmpty()) {
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   581
                navList.addContent(getNavLinkPackage());
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   582
            }
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   583
            navList.addContent(getNavLinkClass());
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   584
            if(configuration.classuse) {
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   585
                navList.addContent(getNavLinkClassUse());
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   586
            }
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   587
            if(configuration.createtree) {
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   588
                navList.addContent(getNavLinkTree());
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   589
            }
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   590
            if(!(configuration.nodeprecated ||
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   591
                     configuration.nodeprecatedlist)) {
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   592
                navList.addContent(getNavLinkDeprecated());
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   593
            }
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   594
            if(configuration.createindex) {
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   595
                navList.addContent(getNavLinkIndex());
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   596
            }
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   597
            if (!configuration.nohelp) {
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   598
                navList.addContent(getNavLinkHelp());
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   599
            }
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   600
            navDiv.addContent(navList);
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   601
            Content aboutDiv = HtmlTree.DIV(HtmlStyle.aboutLanguage, getUserHeaderFooter(header));
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   602
            navDiv.addContent(aboutDiv);
33920
bd731341c405 8141492: Implement search feature in javadoc
bpatel
parents: 31943
diff changeset
   603
            if (header) {
bd731341c405 8141492: Implement search feature in javadoc
bpatel
parents: 31943
diff changeset
   604
                fixedNavDiv.addContent(navDiv);
bd731341c405 8141492: Implement search feature in javadoc
bpatel
parents: 31943
diff changeset
   605
            } else {
bd731341c405 8141492: Implement search feature in javadoc
bpatel
parents: 31943
diff changeset
   606
                tree.addContent(navDiv);
bd731341c405 8141492: Implement search feature in javadoc
bpatel
parents: 31943
diff changeset
   607
            }
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   608
            Content ulNav = HtmlTree.UL(HtmlStyle.navList, getNavLinkPrevious());
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   609
            ulNav.addContent(getNavLinkNext());
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   610
            Content subDiv = HtmlTree.DIV(HtmlStyle.subNav, ulNav);
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   611
            Content ulFrames = HtmlTree.UL(HtmlStyle.navList, getNavShowLists());
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   612
            ulFrames.addContent(getNavHideLists(filename));
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   613
            subDiv.addContent(ulFrames);
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   614
            HtmlTree ulAllClasses = HtmlTree.UL(HtmlStyle.navList, getNavLinkClassIndex());
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
   615
            ulAllClasses.addAttr(HtmlAttr.ID, allClassesId);
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   616
            subDiv.addContent(ulAllClasses);
33920
bd731341c405 8141492: Implement search feature in javadoc
bpatel
parents: 31943
diff changeset
   617
            if (header && configuration.createindex) {
bd731341c405 8141492: Implement search feature in javadoc
bpatel
parents: 31943
diff changeset
   618
                HtmlTree inputText = HtmlTree.INPUT("text", "search");
bd731341c405 8141492: Implement search feature in javadoc
bpatel
parents: 31943
diff changeset
   619
                HtmlTree inputReset = HtmlTree.INPUT("reset", "reset");
bd731341c405 8141492: Implement search feature in javadoc
bpatel
parents: 31943
diff changeset
   620
                Content searchTxt = configuration.getResource("doclet.search");
bd731341c405 8141492: Implement search feature in javadoc
bpatel
parents: 31943
diff changeset
   621
                searchTxt.addContent(getSpace());
bd731341c405 8141492: Implement search feature in javadoc
bpatel
parents: 31943
diff changeset
   622
                HtmlTree liInput = HtmlTree.LI(HtmlTree.SPAN(searchTxt));
bd731341c405 8141492: Implement search feature in javadoc
bpatel
parents: 31943
diff changeset
   623
                liInput.addContent(inputText);
bd731341c405 8141492: Implement search feature in javadoc
bpatel
parents: 31943
diff changeset
   624
                liInput.addContent(inputReset);
bd731341c405 8141492: Implement search feature in javadoc
bpatel
parents: 31943
diff changeset
   625
                HtmlTree ulSearch = HtmlTree.UL(HtmlStyle.navListSearch, liInput);
bd731341c405 8141492: Implement search feature in javadoc
bpatel
parents: 31943
diff changeset
   626
                subDiv.addContent(ulSearch);
bd731341c405 8141492: Implement search feature in javadoc
bpatel
parents: 31943
diff changeset
   627
            }
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
   628
            subDiv.addContent(getAllClassesLinkScript(allClassesId));
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   629
            addSummaryDetailLinks(subDiv);
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   630
            if (header) {
21008
af0b915df7cc 8025633: Fix javadoc to generate valid anchor names
bpatel
parents: 20613
diff changeset
   631
                subDiv.addContent(getMarkerAnchor(SectionName.SKIP_NAVBAR_TOP));
33920
bd731341c405 8141492: Implement search feature in javadoc
bpatel
parents: 31943
diff changeset
   632
                fixedNavDiv.addContent(subDiv);
bd731341c405 8141492: Implement search feature in javadoc
bpatel
parents: 31943
diff changeset
   633
                fixedNavDiv.addContent(HtmlConstants.END_OF_TOP_NAVBAR);
bd731341c405 8141492: Implement search feature in javadoc
bpatel
parents: 31943
diff changeset
   634
                tree.addContent(fixedNavDiv);
36526
3b41f1c69604 8142968: Module System implementation
alanb
parents: 36500
diff changeset
   635
                HtmlTree paddingDiv = HtmlTree.DIV(HtmlStyle.navPadding, getSpace());
3b41f1c69604 8142968: Module System implementation
alanb
parents: 36500
diff changeset
   636
                tree.addContent(paddingDiv);
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   637
            } else {
21008
af0b915df7cc 8025633: Fix javadoc to generate valid anchor names
bpatel
parents: 20613
diff changeset
   638
                subDiv.addContent(getMarkerAnchor(SectionName.SKIP_NAVBAR_BOTTOM));
29957
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 26900
diff changeset
   639
                tree.addContent(subDiv);
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 26900
diff changeset
   640
                tree.addContent(HtmlConstants.END_OF_BOTTOM_NAVBAR);
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 26900
diff changeset
   641
            }
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 26900
diff changeset
   642
            if (configuration.allowTag(HtmlTag.NAV)) {
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 26900
diff changeset
   643
                htmlTree.addContent(tree);
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   644
            }
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   645
        }
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   646
    }
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   647
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   648
    /**
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   649
     * Get the word "NEXT" to indicate that no link is available.  Override
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   650
     * this method to customize next link.
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   651
     *
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   652
     * @return a content tree for the link
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   653
     */
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   654
    protected Content getNavLinkNext() {
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   655
        return getNavLinkNext(null);
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   656
    }
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   657
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   658
    /**
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   659
     * Get the word "PREV" to indicate that no link is available.  Override
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   660
     * this method to customize prev link.
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   661
     *
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   662
     * @return a content tree for the link
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   663
     */
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   664
    protected Content getNavLinkPrevious() {
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   665
        return getNavLinkPrevious(null);
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   666
    }
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   667
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   668
    /**
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   669
     * Do nothing. This is the default method.
06bc494ca11e Initial load
duke
parents:
diff changeset
   670
     */
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   671
    protected void addSummaryDetailLinks(Content navDiv) {
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   672
    }
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   673
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   674
    /**
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   675
     * Get link to the "overview-summary.html" page.
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   676
     *
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   677
     * @return a content tree for the link
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   678
     */
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   679
    protected Content getNavLinkContents() {
14357
faf9cde2817b 8000741: refactor javadoc to use abstraction to handle relative paths
jjg
parents: 14266
diff changeset
   680
        Content linkContent = getHyperLink(pathToRoot.resolve(DocPaths.OVERVIEW_SUMMARY),
14358
9eda9239cba0 8000416: refactor javadoc to provide and use an abstraction for relative URIs
jjg
parents: 14357
diff changeset
   681
                overviewLabel, "", "");
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   682
        Content li = HtmlTree.LI(linkContent);
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   683
        return li;
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   684
    }
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   685
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   686
    /**
37943
2efb75c09230 8154262: Navigation bar in javadoc generated pages needs to be updated to display module information
bpatel
parents: 36526
diff changeset
   687
     * Get link to the module summary page for the module passed.
2efb75c09230 8154262: Navigation bar in javadoc generated pages needs to be updated to display module information
bpatel
parents: 36526
diff changeset
   688
     *
2efb75c09230 8154262: Navigation bar in javadoc generated pages needs to be updated to display module information
bpatel
parents: 36526
diff changeset
   689
     * @param mdle Module to which link will be generated
2efb75c09230 8154262: Navigation bar in javadoc generated pages needs to be updated to display module information
bpatel
parents: 36526
diff changeset
   690
     * @return a content tree for the link
2efb75c09230 8154262: Navigation bar in javadoc generated pages needs to be updated to display module information
bpatel
parents: 36526
diff changeset
   691
     */
2efb75c09230 8154262: Navigation bar in javadoc generated pages needs to be updated to display module information
bpatel
parents: 36526
diff changeset
   692
    protected Content getNavLinkModule(ModuleElement mdle) {
2efb75c09230 8154262: Navigation bar in javadoc generated pages needs to be updated to display module information
bpatel
parents: 36526
diff changeset
   693
        Content linkContent = getModuleLink(mdle, moduleLabel);
2efb75c09230 8154262: Navigation bar in javadoc generated pages needs to be updated to display module information
bpatel
parents: 36526
diff changeset
   694
        Content li = HtmlTree.LI(linkContent);
2efb75c09230 8154262: Navigation bar in javadoc generated pages needs to be updated to display module information
bpatel
parents: 36526
diff changeset
   695
        return li;
2efb75c09230 8154262: Navigation bar in javadoc generated pages needs to be updated to display module information
bpatel
parents: 36526
diff changeset
   696
    }
2efb75c09230 8154262: Navigation bar in javadoc generated pages needs to be updated to display module information
bpatel
parents: 36526
diff changeset
   697
2efb75c09230 8154262: Navigation bar in javadoc generated pages needs to be updated to display module information
bpatel
parents: 36526
diff changeset
   698
    /**
2efb75c09230 8154262: Navigation bar in javadoc generated pages needs to be updated to display module information
bpatel
parents: 36526
diff changeset
   699
     * Get the word "Module", to indicate that link is not available here.
2efb75c09230 8154262: Navigation bar in javadoc generated pages needs to be updated to display module information
bpatel
parents: 36526
diff changeset
   700
     *
2efb75c09230 8154262: Navigation bar in javadoc generated pages needs to be updated to display module information
bpatel
parents: 36526
diff changeset
   701
     * @return a content tree for the link
2efb75c09230 8154262: Navigation bar in javadoc generated pages needs to be updated to display module information
bpatel
parents: 36526
diff changeset
   702
     */
2efb75c09230 8154262: Navigation bar in javadoc generated pages needs to be updated to display module information
bpatel
parents: 36526
diff changeset
   703
    protected Content getNavLinkModule() {
2efb75c09230 8154262: Navigation bar in javadoc generated pages needs to be updated to display module information
bpatel
parents: 36526
diff changeset
   704
        Content li = HtmlTree.LI(moduleLabel);
2efb75c09230 8154262: Navigation bar in javadoc generated pages needs to be updated to display module information
bpatel
parents: 36526
diff changeset
   705
        return li;
2efb75c09230 8154262: Navigation bar in javadoc generated pages needs to be updated to display module information
bpatel
parents: 36526
diff changeset
   706
    }
2efb75c09230 8154262: Navigation bar in javadoc generated pages needs to be updated to display module information
bpatel
parents: 36526
diff changeset
   707
2efb75c09230 8154262: Navigation bar in javadoc generated pages needs to be updated to display module information
bpatel
parents: 36526
diff changeset
   708
    /**
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   709
     * Get link to the "package-summary.html" page for the package passed.
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   710
     *
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   711
     * @param pkg Package to which link will be generated
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   712
     * @return a content tree for the link
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   713
     */
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
   714
    protected Content getNavLinkPackage(PackageElement pkg) {
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
   715
        Content linkContent = getPackageLink(pkg, packageLabel);
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   716
        Content li = HtmlTree.LI(linkContent);
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   717
        return li;
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   718
    }
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   719
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   720
    /**
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   721
     * Get the word "Package" , to indicate that link is not available here.
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   722
     *
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   723
     * @return a content tree for the link
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   724
     */
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   725
    protected Content getNavLinkPackage() {
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   726
        Content li = HtmlTree.LI(packageLabel);
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   727
        return li;
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   728
    }
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   729
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   730
    /**
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   731
     * Get the word "Use", to indicate that link is not available.
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   732
     *
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   733
     * @return a content tree for the link
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   734
     */
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   735
    protected Content getNavLinkClassUse() {
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   736
        Content li = HtmlTree.LI(useLabel);
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   737
        return li;
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   738
    }
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   739
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   740
    /**
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   741
     * Get link for previous file.
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   742
     *
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   743
     * @param prev File name for the prev link
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   744
     * @return a content tree for the link
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   745
     */
14357
faf9cde2817b 8000741: refactor javadoc to use abstraction to handle relative paths
jjg
parents: 14266
diff changeset
   746
    public Content getNavLinkPrevious(DocPath prev) {
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   747
        Content li;
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   748
        if (prev != null) {
14358
9eda9239cba0 8000416: refactor javadoc to provide and use an abstraction for relative URIs
jjg
parents: 14357
diff changeset
   749
            li = HtmlTree.LI(getHyperLink(prev, prevLabel, "", ""));
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   750
        }
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   751
        else
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   752
            li = HtmlTree.LI(prevLabel);
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   753
        return li;
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   754
    }
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   755
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   756
    /**
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   757
     * Get link for next file.  If next is null, just print the label
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   758
     * without linking it anywhere.
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   759
     *
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   760
     * @param next File name for the next link
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   761
     * @return a content tree for the link
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   762
     */
14357
faf9cde2817b 8000741: refactor javadoc to use abstraction to handle relative paths
jjg
parents: 14266
diff changeset
   763
    public Content getNavLinkNext(DocPath next) {
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   764
        Content li;
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   765
        if (next != null) {
14358
9eda9239cba0 8000416: refactor javadoc to provide and use an abstraction for relative URIs
jjg
parents: 14357
diff changeset
   766
            li = HtmlTree.LI(getHyperLink(next, nextLabel, "", ""));
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   767
        }
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   768
        else
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   769
            li = HtmlTree.LI(nextLabel);
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   770
        return li;
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   771
    }
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   772
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   773
    /**
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   774
     * Get "FRAMES" link, to switch to the frame version of the output.
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   775
     *
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   776
     * @param link File to be linked, "index.html"
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   777
     * @return a content tree for the link
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   778
     */
14357
faf9cde2817b 8000741: refactor javadoc to use abstraction to handle relative paths
jjg
parents: 14266
diff changeset
   779
    protected Content getNavShowLists(DocPath link) {
14358
9eda9239cba0 8000416: refactor javadoc to provide and use an abstraction for relative URIs
jjg
parents: 14357
diff changeset
   780
        DocLink dl = new DocLink(link, path.getPath(), null);
9eda9239cba0 8000416: refactor javadoc to provide and use an abstraction for relative URIs
jjg
parents: 14357
diff changeset
   781
        Content framesContent = getHyperLink(dl, framesLabel, "", "_top");
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   782
        Content li = HtmlTree.LI(framesContent);
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   783
        return li;
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   784
    }
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   785
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   786
    /**
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   787
     * Get "FRAMES" link, to switch to the frame version of the output.
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   788
     *
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   789
     * @return a content tree for the link
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   790
     */
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   791
    protected Content getNavShowLists() {
14357
faf9cde2817b 8000741: refactor javadoc to use abstraction to handle relative paths
jjg
parents: 14266
diff changeset
   792
        return getNavShowLists(pathToRoot.resolve(DocPaths.INDEX));
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   793
    }
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   794
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   795
    /**
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   796
     * Get "NO FRAMES" link, to switch to the non-frame version of the output.
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   797
     *
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   798
     * @param link File to be linked
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   799
     * @return a content tree for the link
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   800
     */
14357
faf9cde2817b 8000741: refactor javadoc to use abstraction to handle relative paths
jjg
parents: 14266
diff changeset
   801
    protected Content getNavHideLists(DocPath link) {
14358
9eda9239cba0 8000416: refactor javadoc to provide and use an abstraction for relative URIs
jjg
parents: 14357
diff changeset
   802
        Content noFramesContent = getHyperLink(link, noframesLabel, "", "_top");
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   803
        Content li = HtmlTree.LI(noFramesContent);
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   804
        return li;
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   805
    }
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   806
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   807
    /**
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   808
     * Get "Tree" link in the navigation bar. If there is only one package
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   809
     * specified on the command line, then the "Tree" link will be to the
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   810
     * only "package-tree.html" file otherwise it will be to the
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   811
     * "overview-tree.html" file.
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   812
     *
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   813
     * @return a content tree for the link
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   814
     */
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   815
    protected Content getNavLinkTree() {
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
   816
        List<PackageElement> packages = new ArrayList<>(utils.getSpecifiedPackages());
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
   817
        DocPath docPath = packages.size() == 1 && utils.getSpecifiedClasses().isEmpty()
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
   818
                ? pathString(packages.get(0), DocPaths.PACKAGE_TREE)
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
   819
                : pathToRoot.resolve(DocPaths.OVERVIEW_TREE);
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
   820
        return HtmlTree.LI(getHyperLink(docPath, treeLabel, "", ""));
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   821
    }
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   822
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   823
    /**
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   824
     * Get the overview tree link for the main tree.
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   825
     *
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   826
     * @param label the label for the link
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   827
     * @return a content tree for the link
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   828
     */
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   829
    protected Content getNavLinkMainTree(String label) {
14357
faf9cde2817b 8000741: refactor javadoc to use abstraction to handle relative paths
jjg
parents: 14266
diff changeset
   830
        Content mainTreeContent = getHyperLink(pathToRoot.resolve(DocPaths.OVERVIEW_TREE),
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   831
                new StringContent(label));
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   832
        Content li = HtmlTree.LI(mainTreeContent);
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   833
        return li;
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   834
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   835
06bc494ca11e Initial load
duke
parents:
diff changeset
   836
    /**
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   837
     * Get the word "Class", to indicate that class link is not available.
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   838
     *
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   839
     * @return a content tree for the link
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   840
     */
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   841
    protected Content getNavLinkClass() {
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   842
        Content li = HtmlTree.LI(classLabel);
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   843
        return li;
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   844
    }
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   845
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   846
    /**
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   847
     * Get "Deprecated" API link in the navigation bar.
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   848
     *
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   849
     * @return a content tree for the link
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   850
     */
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   851
    protected Content getNavLinkDeprecated() {
14357
faf9cde2817b 8000741: refactor javadoc to use abstraction to handle relative paths
jjg
parents: 14266
diff changeset
   852
        Content linkContent = getHyperLink(pathToRoot.resolve(DocPaths.DEPRECATED_LIST),
14358
9eda9239cba0 8000416: refactor javadoc to provide and use an abstraction for relative URIs
jjg
parents: 14357
diff changeset
   853
                deprecatedLabel, "", "");
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   854
        Content li = HtmlTree.LI(linkContent);
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   855
        return li;
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   856
    }
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   857
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   858
    /**
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   859
     * Get link for generated index. If the user has used "-splitindex"
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   860
     * command line option, then link to file "index-files/index-1.html" is
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   861
     * generated otherwise link to file "index-all.html" is generated.
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   862
     *
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   863
     * @return a content tree for the link
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   864
     */
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   865
    protected Content getNavLinkClassIndex() {
14357
faf9cde2817b 8000741: refactor javadoc to use abstraction to handle relative paths
jjg
parents: 14266
diff changeset
   866
        Content allClassesContent = getHyperLink(pathToRoot.resolve(
14358
9eda9239cba0 8000416: refactor javadoc to provide and use an abstraction for relative URIs
jjg
parents: 14357
diff changeset
   867
                DocPaths.ALLCLASSES_NOFRAME),
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   868
                allclassesLabel, "", "");
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   869
        Content li = HtmlTree.LI(allClassesContent);
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   870
        return li;
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   871
    }
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   872
06bc494ca11e Initial load
duke
parents:
diff changeset
   873
    /**
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   874
     * Get link for generated class index.
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   875
     *
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   876
     * @return a content tree for the link
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   877
     */
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   878
    protected Content getNavLinkIndex() {
14357
faf9cde2817b 8000741: refactor javadoc to use abstraction to handle relative paths
jjg
parents: 14266
diff changeset
   879
        Content linkContent = getHyperLink(pathToRoot.resolve(
faf9cde2817b 8000741: refactor javadoc to use abstraction to handle relative paths
jjg
parents: 14266
diff changeset
   880
                (configuration.splitindex
faf9cde2817b 8000741: refactor javadoc to use abstraction to handle relative paths
jjg
parents: 14266
diff changeset
   881
                    ? DocPaths.INDEX_FILES.resolve(DocPaths.indexN(1))
14358
9eda9239cba0 8000416: refactor javadoc to provide and use an abstraction for relative URIs
jjg
parents: 14357
diff changeset
   882
                    : DocPaths.INDEX_ALL)),
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   883
            indexLabel, "", "");
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   884
        Content li = HtmlTree.LI(linkContent);
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   885
        return li;
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   886
    }
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   887
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   888
    /**
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   889
     * Get help file link. If user has provided a help file, then generate a
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   890
     * link to the user given file, which is already copied to current or
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   891
     * destination directory.
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   892
     *
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   893
     * @return a content tree for the link
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   894
     */
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   895
    protected Content getNavLinkHelp() {
14357
faf9cde2817b 8000741: refactor javadoc to use abstraction to handle relative paths
jjg
parents: 14266
diff changeset
   896
        String helpfile = configuration.helpfile;
faf9cde2817b 8000741: refactor javadoc to use abstraction to handle relative paths
jjg
parents: 14266
diff changeset
   897
        DocPath helpfilenm;
faf9cde2817b 8000741: refactor javadoc to use abstraction to handle relative paths
jjg
parents: 14266
diff changeset
   898
        if (helpfile.isEmpty()) {
faf9cde2817b 8000741: refactor javadoc to use abstraction to handle relative paths
jjg
parents: 14266
diff changeset
   899
            helpfilenm = DocPaths.HELP_DOC;
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   900
        } else {
14368
6f4c62de6985 8001664: refactor javadoc to use abstraction to handle files
jjg
parents: 14366
diff changeset
   901
            DocFile file = DocFile.createFileForInput(configuration, helpfile);
6f4c62de6985 8001664: refactor javadoc to use abstraction to handle files
jjg
parents: 14366
diff changeset
   902
            helpfilenm = DocPath.create(file.getName());
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   903
        }
14358
9eda9239cba0 8000416: refactor javadoc to provide and use an abstraction for relative URIs
jjg
parents: 14357
diff changeset
   904
        Content linkContent = getHyperLink(pathToRoot.resolve(helpfilenm),
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   905
                helpLabel, "", "");
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   906
        Content li = HtmlTree.LI(linkContent);
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   907
        return li;
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   908
    }
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   909
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   910
    /**
39670
9d1eafbf29c6 8154261: Module summary page should display directives for the module
bpatel
parents: 37943
diff changeset
   911
     * Add gap between navigation bar elements.
9d1eafbf29c6 8154261: Module summary page should display directives for the module
bpatel
parents: 37943
diff changeset
   912
     *
9d1eafbf29c6 8154261: Module summary page should display directives for the module
bpatel
parents: 37943
diff changeset
   913
     * @param liNav the content tree to which the gap will be added
9d1eafbf29c6 8154261: Module summary page should display directives for the module
bpatel
parents: 37943
diff changeset
   914
     */
9d1eafbf29c6 8154261: Module summary page should display directives for the module
bpatel
parents: 37943
diff changeset
   915
    protected void addNavGap(Content liNav) {
9d1eafbf29c6 8154261: Module summary page should display directives for the module
bpatel
parents: 37943
diff changeset
   916
        liNav.addContent(getSpace());
9d1eafbf29c6 8154261: Module summary page should display directives for the module
bpatel
parents: 37943
diff changeset
   917
        liNav.addContent("|");
9d1eafbf29c6 8154261: Module summary page should display directives for the module
bpatel
parents: 37943
diff changeset
   918
        liNav.addContent(getSpace());
9d1eafbf29c6 8154261: Module summary page should display directives for the module
bpatel
parents: 37943
diff changeset
   919
    }
9d1eafbf29c6 8154261: Module summary page should display directives for the module
bpatel
parents: 37943
diff changeset
   920
9d1eafbf29c6 8154261: Module summary page should display directives for the module
bpatel
parents: 37943
diff changeset
   921
    /**
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   922
     * Get summary table header.
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   923
     *
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   924
     * @param header the header for the table
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   925
     * @param scope the scope of the headers
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   926
     * @return a content tree for the header
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   927
     */
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
   928
    public Content getSummaryTableHeader(List<String> header, String scope) {
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   929
        Content tr = new HtmlTree(HtmlTag.TR);
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
   930
        final int size = header.size();
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   931
        Content tableHeader;
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   932
        if (size == 1) {
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
   933
            tableHeader = new StringContent(header.get(0));
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   934
            tr.addContent(HtmlTree.TH(HtmlStyle.colOne, scope, tableHeader));
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   935
            return tr;
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   936
        }
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   937
        for (int i = 0; i < size; i++) {
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
   938
            tableHeader = new StringContent(header.get(i));
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   939
            if(i == 0)
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   940
                tr.addContent(HtmlTree.TH(HtmlStyle.colFirst, scope, tableHeader));
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   941
            else if(i == (size - 1))
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   942
                tr.addContent(HtmlTree.TH(HtmlStyle.colLast, scope, tableHeader));
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   943
            else
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   944
                tr.addContent(HtmlTree.TH(scope, tableHeader));
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   945
        }
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   946
        return tr;
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   947
    }
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   948
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   949
    /**
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   950
     * Get table caption.
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   951
     *
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   952
     * @param rawText the caption for the table which could be raw Html
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   953
     * @return a content tree for the caption
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   954
     */
17570
78512b2899db 8012183: replace some uses of Configuration.getText with Configuration.getResource
jjg
parents: 17569
diff changeset
   955
    public Content getTableCaption(Content title) {
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   956
        Content captionSpan = HtmlTree.SPAN(title);
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   957
        Content space = getSpace();
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   958
        Content tabSpan = HtmlTree.SPAN(HtmlStyle.tabEnd, space);
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   959
        Content caption = HtmlTree.CAPTION(captionSpan);
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   960
        caption.addContent(tabSpan);
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   961
        return caption;
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   962
    }
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   963
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   964
    /**
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   965
     * Get the marker anchor which will be added to the documentation tree.
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   966
     *
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   967
     * @param anchorName the anchor name attribute
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   968
     * @return a content tree for the marker anchor
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   969
     */
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   970
    public Content getMarkerAnchor(String anchorName) {
21008
af0b915df7cc 8025633: Fix javadoc to generate valid anchor names
bpatel
parents: 20613
diff changeset
   971
        return getMarkerAnchor(getName(anchorName), null);
af0b915df7cc 8025633: Fix javadoc to generate valid anchor names
bpatel
parents: 20613
diff changeset
   972
    }
af0b915df7cc 8025633: Fix javadoc to generate valid anchor names
bpatel
parents: 20613
diff changeset
   973
af0b915df7cc 8025633: Fix javadoc to generate valid anchor names
bpatel
parents: 20613
diff changeset
   974
    /**
af0b915df7cc 8025633: Fix javadoc to generate valid anchor names
bpatel
parents: 20613
diff changeset
   975
     * Get the marker anchor which will be added to the documentation tree.
af0b915df7cc 8025633: Fix javadoc to generate valid anchor names
bpatel
parents: 20613
diff changeset
   976
     *
af0b915df7cc 8025633: Fix javadoc to generate valid anchor names
bpatel
parents: 20613
diff changeset
   977
     * @param sectionName the section name anchor attribute for page
af0b915df7cc 8025633: Fix javadoc to generate valid anchor names
bpatel
parents: 20613
diff changeset
   978
     * @return a content tree for the marker anchor
af0b915df7cc 8025633: Fix javadoc to generate valid anchor names
bpatel
parents: 20613
diff changeset
   979
     */
af0b915df7cc 8025633: Fix javadoc to generate valid anchor names
bpatel
parents: 20613
diff changeset
   980
    public Content getMarkerAnchor(SectionName sectionName) {
af0b915df7cc 8025633: Fix javadoc to generate valid anchor names
bpatel
parents: 20613
diff changeset
   981
        return getMarkerAnchor(sectionName.getName(), null);
af0b915df7cc 8025633: Fix javadoc to generate valid anchor names
bpatel
parents: 20613
diff changeset
   982
    }
af0b915df7cc 8025633: Fix javadoc to generate valid anchor names
bpatel
parents: 20613
diff changeset
   983
af0b915df7cc 8025633: Fix javadoc to generate valid anchor names
bpatel
parents: 20613
diff changeset
   984
    /**
af0b915df7cc 8025633: Fix javadoc to generate valid anchor names
bpatel
parents: 20613
diff changeset
   985
     * Get the marker anchor which will be added to the documentation tree.
af0b915df7cc 8025633: Fix javadoc to generate valid anchor names
bpatel
parents: 20613
diff changeset
   986
     *
af0b915df7cc 8025633: Fix javadoc to generate valid anchor names
bpatel
parents: 20613
diff changeset
   987
     * @param sectionName the section name anchor attribute for page
af0b915df7cc 8025633: Fix javadoc to generate valid anchor names
bpatel
parents: 20613
diff changeset
   988
     * @param anchorName the anchor name combined with section name attribute for the page
af0b915df7cc 8025633: Fix javadoc to generate valid anchor names
bpatel
parents: 20613
diff changeset
   989
     * @return a content tree for the marker anchor
af0b915df7cc 8025633: Fix javadoc to generate valid anchor names
bpatel
parents: 20613
diff changeset
   990
     */
af0b915df7cc 8025633: Fix javadoc to generate valid anchor names
bpatel
parents: 20613
diff changeset
   991
    public Content getMarkerAnchor(SectionName sectionName, String anchorName) {
af0b915df7cc 8025633: Fix javadoc to generate valid anchor names
bpatel
parents: 20613
diff changeset
   992
        return getMarkerAnchor(sectionName.getName() + getName(anchorName), null);
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   993
    }
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   994
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   995
    /**
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   996
     * Get the marker anchor which will be added to the documentation tree.
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   997
     *
31297
86fe1414f12c 8081854: Javadoc should generate named anchors for HTML4 output
bpatel
parents: 29957
diff changeset
   998
     * @param anchorName the anchor name or id attribute
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   999
     * @param anchorContent the content that should be added to the anchor
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1000
     * @return a content tree for the marker anchor
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1001
     */
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1002
    public Content getMarkerAnchor(String anchorName, Content anchorContent) {
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1003
        if (anchorContent == null)
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1004
            anchorContent = new Comment(" ");
31297
86fe1414f12c 8081854: Javadoc should generate named anchors for HTML4 output
bpatel
parents: 29957
diff changeset
  1005
        Content markerAnchor = HtmlTree.A(configuration.htmlVersion, anchorName, anchorContent);
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1006
        return markerAnchor;
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1007
    }
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1008
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1009
    /**
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1010
     * Returns a packagename content.
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1011
     *
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  1012
     * @param packageElement the package to check
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1013
     * @return package name content
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1014
     */
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  1015
    public Content getPackageName(PackageElement packageElement) {
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  1016
        return packageElement == null || packageElement.isUnnamed()
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  1017
                ? defaultPackageLabel
36500
d31e4986dc8b 8149139: [javadoc] Modify Content to accept CharSequence
ksrini
parents: 36038
diff changeset
  1018
                : getPackageLabel(packageElement.getQualifiedName());
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1019
    }
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1020
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1021
    /**
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1022
     * Returns a package name label.
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1023
     *
14259
fb94a1df0d53 8000208: fix langtools javadoc comment issues
jjg
parents: 14258
diff changeset
  1024
     * @param packageName the package name
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1025
     * @return the package name content
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1026
     */
36500
d31e4986dc8b 8149139: [javadoc] Modify Content to accept CharSequence
ksrini
parents: 36038
diff changeset
  1027
    public Content getPackageLabel(CharSequence packageName) {
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1028
        return new StringContent(packageName);
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1029
    }
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1030
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1031
    /**
9606
e5a619cb5dd3 6492694: @deprecated tag doesn't work in package-info files.
bpatel
parents: 9592
diff changeset
  1032
     * Add package deprecation information to the documentation tree
e5a619cb5dd3 6492694: @deprecated tag doesn't work in package-info files.
bpatel
parents: 9592
diff changeset
  1033
     *
e5a619cb5dd3 6492694: @deprecated tag doesn't work in package-info files.
bpatel
parents: 9592
diff changeset
  1034
     * @param deprPkgs list of deprecated packages
e5a619cb5dd3 6492694: @deprecated tag doesn't work in package-info files.
bpatel
parents: 9592
diff changeset
  1035
     * @param headingKey the caption for the deprecated package table
e5a619cb5dd3 6492694: @deprecated tag doesn't work in package-info files.
bpatel
parents: 9592
diff changeset
  1036
     * @param tableSummary the summary for the deprecated package table
e5a619cb5dd3 6492694: @deprecated tag doesn't work in package-info files.
bpatel
parents: 9592
diff changeset
  1037
     * @param tableHeader table headers for the deprecated package table
e5a619cb5dd3 6492694: @deprecated tag doesn't work in package-info files.
bpatel
parents: 9592
diff changeset
  1038
     * @param contentTree the content tree to which the deprecated package table will be added
e5a619cb5dd3 6492694: @deprecated tag doesn't work in package-info files.
bpatel
parents: 9592
diff changeset
  1039
     */
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  1040
    protected void addPackageDeprecatedAPI(SortedSet<Element> deprPkgs, String headingKey,
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  1041
            String tableSummary, List<String> tableHeader, Content contentTree) {
9606
e5a619cb5dd3 6492694: @deprecated tag doesn't work in package-info files.
bpatel
parents: 9592
diff changeset
  1042
        if (deprPkgs.size() > 0) {
29957
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 26900
diff changeset
  1043
            Content caption = getTableCaption(configuration.getResource(headingKey));
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 26900
diff changeset
  1044
            Content table = (configuration.isOutputHtml5())
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 26900
diff changeset
  1045
                    ? HtmlTree.TABLE(HtmlStyle.deprecatedSummary, caption)
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 26900
diff changeset
  1046
                    : HtmlTree.TABLE(HtmlStyle.deprecatedSummary, tableSummary, caption);
9606
e5a619cb5dd3 6492694: @deprecated tag doesn't work in package-info files.
bpatel
parents: 9592
diff changeset
  1047
            table.addContent(getSummaryTableHeader(tableHeader, "col"));
e5a619cb5dd3 6492694: @deprecated tag doesn't work in package-info files.
bpatel
parents: 9592
diff changeset
  1048
            Content tbody = new HtmlTree(HtmlTag.TBODY);
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  1049
            boolean altColor = true;
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  1050
            for (Element e : deprPkgs) {
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  1051
                PackageElement pkg = (PackageElement) e;
9606
e5a619cb5dd3 6492694: @deprecated tag doesn't work in package-info files.
bpatel
parents: 9592
diff changeset
  1052
                HtmlTree td = HtmlTree.TD(HtmlStyle.colOne,
e5a619cb5dd3 6492694: @deprecated tag doesn't work in package-info files.
bpatel
parents: 9592
diff changeset
  1053
                        getPackageLink(pkg, getPackageName(pkg)));
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  1054
                List<? extends DocTree> tags = utils.getDeprecatedTrees(pkg);
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  1055
                if (!tags.isEmpty()) {
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  1056
                    addInlineDeprecatedComment(pkg, tags.get(0), td);
9606
e5a619cb5dd3 6492694: @deprecated tag doesn't work in package-info files.
bpatel
parents: 9592
diff changeset
  1057
                }
e5a619cb5dd3 6492694: @deprecated tag doesn't work in package-info files.
bpatel
parents: 9592
diff changeset
  1058
                HtmlTree tr = HtmlTree.TR(td);
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  1059
                tr.addStyle(altColor ? HtmlStyle.altColor : HtmlStyle.rowColor);
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  1060
                altColor = !altColor;
9606
e5a619cb5dd3 6492694: @deprecated tag doesn't work in package-info files.
bpatel
parents: 9592
diff changeset
  1061
                tbody.addContent(tr);
e5a619cb5dd3 6492694: @deprecated tag doesn't work in package-info files.
bpatel
parents: 9592
diff changeset
  1062
            }
e5a619cb5dd3 6492694: @deprecated tag doesn't work in package-info files.
bpatel
parents: 9592
diff changeset
  1063
            table.addContent(tbody);
e5a619cb5dd3 6492694: @deprecated tag doesn't work in package-info files.
bpatel
parents: 9592
diff changeset
  1064
            Content li = HtmlTree.LI(HtmlStyle.blockList, table);
e5a619cb5dd3 6492694: @deprecated tag doesn't work in package-info files.
bpatel
parents: 9592
diff changeset
  1065
            Content ul = HtmlTree.UL(HtmlStyle.blockList, li);
e5a619cb5dd3 6492694: @deprecated tag doesn't work in package-info files.
bpatel
parents: 9592
diff changeset
  1066
            contentTree.addContent(ul);
e5a619cb5dd3 6492694: @deprecated tag doesn't work in package-info files.
bpatel
parents: 9592
diff changeset
  1067
        }
e5a619cb5dd3 6492694: @deprecated tag doesn't work in package-info files.
bpatel
parents: 9592
diff changeset
  1068
    }
e5a619cb5dd3 6492694: @deprecated tag doesn't work in package-info files.
bpatel
parents: 9592
diff changeset
  1069
e5a619cb5dd3 6492694: @deprecated tag doesn't work in package-info files.
bpatel
parents: 9592
diff changeset
  1070
    /**
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  1071
     * Return the path to the class page for a typeElement.
10
06bc494ca11e Initial load
duke
parents:
diff changeset
  1072
     *
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  1073
     * @param te   TypeElement for which the path is requested.
10
06bc494ca11e Initial load
duke
parents:
diff changeset
  1074
     * @param name Name of the file(doesn't include path).
06bc494ca11e Initial load
duke
parents:
diff changeset
  1075
     */
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  1076
    protected DocPath pathString(TypeElement te, DocPath name) {
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  1077
        return pathString(utils.containingPackage(te), name);
10
06bc494ca11e Initial load
duke
parents:
diff changeset
  1078
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1079
06bc494ca11e Initial load
duke
parents:
diff changeset
  1080
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
  1081
     * Return path to the given file name in the given package. So if the name
06bc494ca11e Initial load
duke
parents:
diff changeset
  1082
     * passed is "Object.html" and the name of the package is "java.lang", and
06bc494ca11e Initial load
duke
parents:
diff changeset
  1083
     * if the relative path is "../.." then returned string will be
06bc494ca11e Initial load
duke
parents:
diff changeset
  1084
     * "../../java/lang/Object.html"
06bc494ca11e Initial load
duke
parents:
diff changeset
  1085
     *
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  1086
     * @param packageElement Package in which the file name is assumed to be.
10
06bc494ca11e Initial load
duke
parents:
diff changeset
  1087
     * @param name File name, to which path string is.
06bc494ca11e Initial load
duke
parents:
diff changeset
  1088
     */
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  1089
    protected DocPath pathString(PackageElement packageElement, DocPath name) {
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  1090
        return pathToRoot.resolve(DocPath.forPackage(packageElement).resolve(name));
10
06bc494ca11e Initial load
duke
parents:
diff changeset
  1091
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1092
06bc494ca11e Initial load
duke
parents:
diff changeset
  1093
    /**
26900
dccc7a72526d 8048351: tidy errors for attribute href, name for langtools javadoc tests needs investigation
bpatel
parents: 26665
diff changeset
  1094
     * Given a package, return the name to be used in HTML anchor tag.
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  1095
     * @param packageElement the package.
26900
dccc7a72526d 8048351: tidy errors for attribute href, name for langtools javadoc tests needs investigation
bpatel
parents: 26665
diff changeset
  1096
     * @return the name to be used in HTML anchor tag.
dccc7a72526d 8048351: tidy errors for attribute href, name for langtools javadoc tests needs investigation
bpatel
parents: 26665
diff changeset
  1097
     */
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  1098
    public String getPackageAnchorName(PackageElement packageElement) {
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  1099
        return packageElement == null || packageElement.isUnnamed()
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  1100
                ? SectionName.UNNAMED_PACKAGE_ANCHOR.getName()
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  1101
                : utils.getPackageName(packageElement);
26900
dccc7a72526d 8048351: tidy errors for attribute href, name for langtools javadoc tests needs investigation
bpatel
parents: 26665
diff changeset
  1102
    }
dccc7a72526d 8048351: tidy errors for attribute href, name for langtools javadoc tests needs investigation
bpatel
parents: 26665
diff changeset
  1103
dccc7a72526d 8048351: tidy errors for attribute href, name for langtools javadoc tests needs investigation
bpatel
parents: 26665
diff changeset
  1104
    /**
10
06bc494ca11e Initial load
duke
parents:
diff changeset
  1105
     * Return the link to the given package.
06bc494ca11e Initial load
duke
parents:
diff changeset
  1106
     *
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  1107
     * @param packageElement the package to link to.
10
06bc494ca11e Initial load
duke
parents:
diff changeset
  1108
     * @param label the label for the link.
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1109
     * @return a content tree for the package link.
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1110
     */
36500
d31e4986dc8b 8149139: [javadoc] Modify Content to accept CharSequence
ksrini
parents: 36038
diff changeset
  1111
    public Content getPackageLink(PackageElement packageElement, CharSequence label) {
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  1112
        return getPackageLink(packageElement, new StringContent(label));
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  1113
    }
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  1114
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  1115
    public Content getPackageLink(PackageElement packageElement) {
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  1116
        StringContent content =  packageElement.isUnnamed()
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  1117
                ? new StringContent()
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  1118
                : new StringContent(utils.getPackageName(packageElement));
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  1119
        return getPackageLink(packageElement, content);
17563
e8ddeb9bd17c 8011668: Allow HTMLWriter.getResource to take Content args
jjg
parents: 17561
diff changeset
  1120
    }
e8ddeb9bd17c 8011668: Allow HTMLWriter.getResource to take Content args
jjg
parents: 17561
diff changeset
  1121
e8ddeb9bd17c 8011668: Allow HTMLWriter.getResource to take Content args
jjg
parents: 17561
diff changeset
  1122
    /**
e8ddeb9bd17c 8011668: Allow HTMLWriter.getResource to take Content args
jjg
parents: 17561
diff changeset
  1123
     * Return the link to the given package.
e8ddeb9bd17c 8011668: Allow HTMLWriter.getResource to take Content args
jjg
parents: 17561
diff changeset
  1124
     *
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  1125
     * @param packageElement the package to link to.
17563
e8ddeb9bd17c 8011668: Allow HTMLWriter.getResource to take Content args
jjg
parents: 17561
diff changeset
  1126
     * @param label the label for the link.
e8ddeb9bd17c 8011668: Allow HTMLWriter.getResource to take Content args
jjg
parents: 17561
diff changeset
  1127
     * @return a content tree for the package link.
e8ddeb9bd17c 8011668: Allow HTMLWriter.getResource to take Content args
jjg
parents: 17561
diff changeset
  1128
     */
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  1129
    public Content getPackageLink(PackageElement packageElement, Content label) {
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  1130
        boolean included = packageElement != null && utils.isIncluded(packageElement);
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  1131
        if (!included) {
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  1132
            for (PackageElement p : configuration.packages) {
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  1133
                if (p.equals(packageElement)) {
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1134
                    included = true;
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1135
                    break;
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1136
                }
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1137
            }
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1138
        }
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  1139
        if (included || packageElement == null) {
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  1140
            return getHyperLink(pathString(packageElement, DocPaths.PACKAGE_SUMMARY),
14358
9eda9239cba0 8000416: refactor javadoc to provide and use an abstraction for relative URIs
jjg
parents: 14357
diff changeset
  1141
                    label);
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1142
        } else {
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  1143
            DocLink crossPkgLink = getCrossPackageLink(utils.getPackageName(packageElement));
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1144
            if (crossPkgLink != null) {
14358
9eda9239cba0 8000416: refactor javadoc to provide and use an abstraction for relative URIs
jjg
parents: 14357
diff changeset
  1145
                return getHyperLink(crossPkgLink, label);
10
06bc494ca11e Initial load
duke
parents:
diff changeset
  1146
            } else {
06bc494ca11e Initial load
duke
parents:
diff changeset
  1147
                return label;
06bc494ca11e Initial load
duke
parents:
diff changeset
  1148
            }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1149
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1150
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1151
36526
3b41f1c69604 8142968: Module System implementation
alanb
parents: 36500
diff changeset
  1152
    /**
3b41f1c69604 8142968: Module System implementation
alanb
parents: 36500
diff changeset
  1153
     * Get Module link.
3b41f1c69604 8142968: Module System implementation
alanb
parents: 36500
diff changeset
  1154
     *
3b41f1c69604 8142968: Module System implementation
alanb
parents: 36500
diff changeset
  1155
     * @param mdle the module being documented
3b41f1c69604 8142968: Module System implementation
alanb
parents: 36500
diff changeset
  1156
     * @param label tag for the link
3b41f1c69604 8142968: Module System implementation
alanb
parents: 36500
diff changeset
  1157
     * @return a content for the module link
3b41f1c69604 8142968: Module System implementation
alanb
parents: 36500
diff changeset
  1158
     */
3b41f1c69604 8142968: Module System implementation
alanb
parents: 36500
diff changeset
  1159
    public Content getModuleLink(ModuleElement mdle, Content label) {
3b41f1c69604 8142968: Module System implementation
alanb
parents: 36500
diff changeset
  1160
        return getHyperLink(pathToRoot.resolve(
3b41f1c69604 8142968: Module System implementation
alanb
parents: 36500
diff changeset
  1161
                DocPaths.moduleSummary(mdle)), label, "", "");
3b41f1c69604 8142968: Module System implementation
alanb
parents: 36500
diff changeset
  1162
    }
3b41f1c69604 8142968: Module System implementation
alanb
parents: 36500
diff changeset
  1163
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  1164
    public Content interfaceName(TypeElement typeElement, boolean qual) {
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  1165
        Content name = new StringContent((qual)
36500
d31e4986dc8b 8149139: [javadoc] Modify Content to accept CharSequence
ksrini
parents: 36038
diff changeset
  1166
                ? typeElement.getQualifiedName()
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  1167
                : utils.getSimpleName(typeElement));
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  1168
        return (utils.isInterface(typeElement)) ?  HtmlTree.SPAN(HtmlStyle.interfaceName, name) : name;
10
06bc494ca11e Initial load
duke
parents:
diff changeset
  1169
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1170
06bc494ca11e Initial load
duke
parents:
diff changeset
  1171
    /**
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1172
     * Add the link to the content tree.
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1173
     *
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  1174
     * @param typeElement program element typeElement for which the link will be added
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1175
     * @param label label for the link
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1176
     * @param htmltree the content tree to which the link will be added
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1177
     */
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  1178
    public void addSrcLink(Element typeElement, Content label, Content htmltree) {
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  1179
        if (typeElement == null) {
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1180
            return;
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1181
        }
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  1182
        TypeElement te = utils.getEnclosingTypeElement(typeElement);
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  1183
        if (te == null) {
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  1184
            // must be a typeElement since in has no containing class.
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  1185
            te = (TypeElement) typeElement;
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1186
        }
14357
faf9cde2817b 8000741: refactor javadoc to use abstraction to handle relative paths
jjg
parents: 14266
diff changeset
  1187
        DocPath href = pathToRoot
faf9cde2817b 8000741: refactor javadoc to use abstraction to handle relative paths
jjg
parents: 14266
diff changeset
  1188
                .resolve(DocPaths.SOURCE_OUTPUT)
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  1189
                .resolve(DocPath.forClass(utils, te));
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  1190
        Content linkContent = getHyperLink(href
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  1191
                .fragment(SourceToHTMLConverter.getAnchorName(utils, typeElement)), label, "", "");
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1192
        htmltree.addContent(linkContent);
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1193
    }
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1194
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1195
    /**
10
06bc494ca11e Initial load
duke
parents:
diff changeset
  1196
     * Return the link to the given class.
06bc494ca11e Initial load
duke
parents:
diff changeset
  1197
     *
06bc494ca11e Initial load
duke
parents:
diff changeset
  1198
     * @param linkInfo the information about the link.
06bc494ca11e Initial load
duke
parents:
diff changeset
  1199
     *
06bc494ca11e Initial load
duke
parents:
diff changeset
  1200
     * @return the link for the given class.
06bc494ca11e Initial load
duke
parents:
diff changeset
  1201
     */
17559
87c28ee29329 8011642: Remove LinkOutput in favor of direct use of Content
jjg
parents: 17558
diff changeset
  1202
    public Content getLink(LinkInfoImpl linkInfo) {
10
06bc494ca11e Initial load
duke
parents:
diff changeset
  1203
        LinkFactoryImpl factory = new LinkFactoryImpl(this);
17564
c329fe11193d 8011288: Erratic/inconsistent indentation of signatures
jjg
parents: 17563
diff changeset
  1204
        return factory.getLink(linkInfo);
10
06bc494ca11e Initial load
duke
parents:
diff changeset
  1205
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1206
06bc494ca11e Initial load
duke
parents:
diff changeset
  1207
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
  1208
     * Return the type parameters for the given class.
06bc494ca11e Initial load
duke
parents:
diff changeset
  1209
     *
06bc494ca11e Initial load
duke
parents:
diff changeset
  1210
     * @param linkInfo the information about the link.
06bc494ca11e Initial load
duke
parents:
diff changeset
  1211
     * @return the type for the given class.
06bc494ca11e Initial load
duke
parents:
diff changeset
  1212
     */
17559
87c28ee29329 8011642: Remove LinkOutput in favor of direct use of Content
jjg
parents: 17558
diff changeset
  1213
    public Content getTypeParameterLinks(LinkInfoImpl linkInfo) {
10
06bc494ca11e Initial load
duke
parents:
diff changeset
  1214
        LinkFactoryImpl factory = new LinkFactoryImpl(this);
17559
87c28ee29329 8011642: Remove LinkOutput in favor of direct use of Content
jjg
parents: 17558
diff changeset
  1215
        return factory.getTypeParameterLinks(linkInfo, false);
10
06bc494ca11e Initial load
duke
parents:
diff changeset
  1216
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1217
06bc494ca11e Initial load
duke
parents:
diff changeset
  1218
    /*************************************************************
06bc494ca11e Initial load
duke
parents:
diff changeset
  1219
     * Return a class cross link to external class documentation.
06bc494ca11e Initial load
duke
parents:
diff changeset
  1220
     * The name must be fully qualified to determine which package
06bc494ca11e Initial load
duke
parents:
diff changeset
  1221
     * the class is in.  The -link option does not allow users to
06bc494ca11e Initial load
duke
parents:
diff changeset
  1222
     * link to external classes in the "default" package.
06bc494ca11e Initial load
duke
parents:
diff changeset
  1223
     *
06bc494ca11e Initial load
duke
parents:
diff changeset
  1224
     * @param qualifiedClassName the qualified name of the external class.
06bc494ca11e Initial load
duke
parents:
diff changeset
  1225
     * @param refMemName the name of the member being referenced.  This should
06bc494ca11e Initial load
duke
parents:
diff changeset
  1226
     * be null or empty string if no member is being referenced.
06bc494ca11e Initial load
duke
parents:
diff changeset
  1227
     * @param label the label for the external link.
1787
1aa079321cd2 6786028: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - Bold tags should be strong
bpatel
parents: 1264
diff changeset
  1228
     * @param strong true if the link should be strong.
10
06bc494ca11e Initial load
duke
parents:
diff changeset
  1229
     * @param style the style of the link.
06bc494ca11e Initial load
duke
parents:
diff changeset
  1230
     * @param code true if the label should be code font.
06bc494ca11e Initial load
duke
parents:
diff changeset
  1231
     */
17560
9f6771abbd1a 8011650: reduce use of RawHtml nodes in doclet
jjg
parents: 17559
diff changeset
  1232
    public Content getCrossClassLink(String qualifiedClassName, String refMemName,
9f6771abbd1a 8011650: reduce use of RawHtml nodes in doclet
jjg
parents: 17559
diff changeset
  1233
                                    Content label, boolean strong, String style,
10
06bc494ca11e Initial load
duke
parents:
diff changeset
  1234
                                    boolean code) {
14358
9eda9239cba0 8000416: refactor javadoc to provide and use an abstraction for relative URIs
jjg
parents: 14357
diff changeset
  1235
        String className = "";
9eda9239cba0 8000416: refactor javadoc to provide and use an abstraction for relative URIs
jjg
parents: 14357
diff changeset
  1236
        String packageName = qualifiedClassName == null ? "" : qualifiedClassName;
10
06bc494ca11e Initial load
duke
parents:
diff changeset
  1237
        int periodIndex;
14358
9eda9239cba0 8000416: refactor javadoc to provide and use an abstraction for relative URIs
jjg
parents: 14357
diff changeset
  1238
        while ((periodIndex = packageName.lastIndexOf('.')) != -1) {
10
06bc494ca11e Initial load
duke
parents:
diff changeset
  1239
            className = packageName.substring(periodIndex + 1, packageName.length()) +
06bc494ca11e Initial load
duke
parents:
diff changeset
  1240
                (className.length() > 0 ? "." + className : "");
17560
9f6771abbd1a 8011650: reduce use of RawHtml nodes in doclet
jjg
parents: 17559
diff changeset
  1241
            Content defaultLabel = new StringContent(className);
9f6771abbd1a 8011650: reduce use of RawHtml nodes in doclet
jjg
parents: 17559
diff changeset
  1242
            if (code)
9f6771abbd1a 8011650: reduce use of RawHtml nodes in doclet
jjg
parents: 17559
diff changeset
  1243
                defaultLabel = HtmlTree.CODE(defaultLabel);
10
06bc494ca11e Initial load
duke
parents:
diff changeset
  1244
            packageName = packageName.substring(0, periodIndex);
06bc494ca11e Initial load
duke
parents:
diff changeset
  1245
            if (getCrossPackageLink(packageName) != null) {
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  1246
                /*
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  1247
                The package exists in external documentation, so link to the external
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  1248
                class (assuming that it exists).  This is definitely a limitation of
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  1249
                the -link option.  There are ways to determine if an external package
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  1250
                exists, but no way to determine if the external class exists.  We just
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  1251
                have to assume that it does.
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  1252
                */
14358
9eda9239cba0 8000416: refactor javadoc to provide and use an abstraction for relative URIs
jjg
parents: 14357
diff changeset
  1253
                DocLink link = configuration.extern.getExternalLink(packageName, pathToRoot,
9eda9239cba0 8000416: refactor javadoc to provide and use an abstraction for relative URIs
jjg
parents: 14357
diff changeset
  1254
                                className + ".html", refMemName);
17560
9f6771abbd1a 8011650: reduce use of RawHtml nodes in doclet
jjg
parents: 17559
diff changeset
  1255
                return getHyperLink(link,
9f6771abbd1a 8011650: reduce use of RawHtml nodes in doclet
jjg
parents: 17559
diff changeset
  1256
                    (label == null) || label.isEmpty() ? defaultLabel : label,
1787
1aa079321cd2 6786028: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - Bold tags should be strong
bpatel
parents: 1264
diff changeset
  1257
                    strong, style,
10
06bc494ca11e Initial load
duke
parents:
diff changeset
  1258
                    configuration.getText("doclet.Href_Class_Or_Interface_Title", packageName),
06bc494ca11e Initial load
duke
parents:
diff changeset
  1259
                    "");
06bc494ca11e Initial load
duke
parents:
diff changeset
  1260
            }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1261
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1262
        return null;
06bc494ca11e Initial load
duke
parents:
diff changeset
  1263
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1264
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  1265
    public boolean isClassLinkable(TypeElement typeElement) {
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  1266
        if (utils.isIncluded(typeElement)) {
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  1267
            return configuration.isGeneratedDoc(typeElement);
10
06bc494ca11e Initial load
duke
parents:
diff changeset
  1268
        }
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  1269
        return configuration.extern.isExternal(typeElement);
10
06bc494ca11e Initial load
duke
parents:
diff changeset
  1270
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1271
14358
9eda9239cba0 8000416: refactor javadoc to provide and use an abstraction for relative URIs
jjg
parents: 14357
diff changeset
  1272
    public DocLink getCrossPackageLink(String pkgName) {
14357
faf9cde2817b 8000741: refactor javadoc to use abstraction to handle relative paths
jjg
parents: 14266
diff changeset
  1273
        return configuration.extern.getExternalLink(pkgName, pathToRoot,
14358
9eda9239cba0 8000416: refactor javadoc to provide and use an abstraction for relative URIs
jjg
parents: 14357
diff changeset
  1274
            DocPaths.PACKAGE_SUMMARY.getPath());
10
06bc494ca11e Initial load
duke
parents:
diff changeset
  1275
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1276
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1277
    /**
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1278
     * Get the class link.
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1279
     *
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1280
     * @param context the id of the context where the link will be added
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  1281
     * @param element to link to
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1282
     * @return a content tree for the link
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1283
     */
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  1284
    public Content getQualifiedClassLink(LinkInfoImpl.Kind context, Element element) {
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  1285
        LinkInfoImpl linkInfoImpl = new LinkInfoImpl(configuration, context, (TypeElement)element);
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  1286
        return getLink(linkInfoImpl.label(utils.getFullyQualifiedName(element)));
10
06bc494ca11e Initial load
duke
parents:
diff changeset
  1287
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1288
06bc494ca11e Initial load
duke
parents:
diff changeset
  1289
    /**
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1290
     * Add the class link.
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1291
     *
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1292
     * @param context the id of the context where the link will be added
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  1293
     * @param typeElement to link to
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1294
     * @param contentTree the content tree to which the link will be added
10
06bc494ca11e Initial load
duke
parents:
diff changeset
  1295
     */
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  1296
    public void addPreQualifiedClassLink(LinkInfoImpl.Kind context, TypeElement typeElement, Content contentTree) {
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  1297
        addPreQualifiedClassLink(context, typeElement, false, contentTree);
10
06bc494ca11e Initial load
duke
parents:
diff changeset
  1298
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1299
06bc494ca11e Initial load
duke
parents:
diff changeset
  1300
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
  1301
     * Retrieve the class link with the package portion of the label in
14358
9eda9239cba0 8000416: refactor javadoc to provide and use an abstraction for relative URIs
jjg
parents: 14357
diff changeset
  1302
     * plain text.  If the qualifier is excluded, it will not be included in the
10
06bc494ca11e Initial load
duke
parents:
diff changeset
  1303
     * link label.
06bc494ca11e Initial load
duke
parents:
diff changeset
  1304
     *
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  1305
     * @param typeElement the class to link to.
1787
1aa079321cd2 6786028: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - Bold tags should be strong
bpatel
parents: 1264
diff changeset
  1306
     * @param isStrong true if the link should be strong.
10
06bc494ca11e Initial load
duke
parents:
diff changeset
  1307
     * @return the link with the package portion of the label in plain text.
06bc494ca11e Initial load
duke
parents:
diff changeset
  1308
     */
17560
9f6771abbd1a 8011650: reduce use of RawHtml nodes in doclet
jjg
parents: 17559
diff changeset
  1309
    public Content getPreQualifiedClassLink(LinkInfoImpl.Kind context,
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  1310
            TypeElement typeElement, boolean isStrong) {
17560
9f6771abbd1a 8011650: reduce use of RawHtml nodes in doclet
jjg
parents: 17559
diff changeset
  1311
        ContentBuilder classlink = new ContentBuilder();
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  1312
        PackageElement pkg = utils.containingPackage(typeElement);
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  1313
        if (pkg != null && ! configuration.shouldExcludeQualifier(pkg.getSimpleName().toString())) {
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  1314
            classlink.addContent(getEnclosingPackageName(typeElement));
10
06bc494ca11e Initial load
duke
parents:
diff changeset
  1315
        }
17560
9f6771abbd1a 8011650: reduce use of RawHtml nodes in doclet
jjg
parents: 17559
diff changeset
  1316
        classlink.addContent(getLink(new LinkInfoImpl(configuration,
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  1317
                context, typeElement).label(utils.getSimpleName(typeElement)).strong(isStrong)));
10
06bc494ca11e Initial load
duke
parents:
diff changeset
  1318
        return classlink;
06bc494ca11e Initial load
duke
parents:
diff changeset
  1319
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1320
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1321
    /**
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1322
     * Add the class link with the package portion of the label in
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1323
     * plain text. If the qualifier is excluded, it will not be included in the
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1324
     * link label.
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1325
     *
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1326
     * @param context the id of the context where the link will be added
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  1327
     * @param typeElement the class to link to
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1328
     * @param isStrong true if the link should be strong
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1329
     * @param contentTree the content tree to which the link with be added
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1330
     */
17558
eee4ccf66cfd 8010440: Replace int constants in LinkInfoImpl with enum
jjg
parents: 17547
diff changeset
  1331
    public void addPreQualifiedClassLink(LinkInfoImpl.Kind context,
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  1332
            TypeElement typeElement, boolean isStrong, Content contentTree) {
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  1333
        PackageElement pkg = utils.containingPackage(typeElement);
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  1334
        if(pkg != null && ! configuration.shouldExcludeQualifier(pkg.getSimpleName().toString())) {
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  1335
            contentTree.addContent(getEnclosingPackageName(typeElement));
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1336
        }
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  1337
        LinkInfoImpl linkinfo = new LinkInfoImpl(configuration, context, typeElement)
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  1338
                .label(utils.getSimpleName(typeElement))
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  1339
                .strong(isStrong);
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  1340
        Content link = getLink(linkinfo);
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  1341
        contentTree.addContent(link);
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1342
    }
10
06bc494ca11e Initial load
duke
parents:
diff changeset
  1343
06bc494ca11e Initial load
duke
parents:
diff changeset
  1344
    /**
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1345
     * Add the class link, with only class name as the strong link and prefixing
10
06bc494ca11e Initial load
duke
parents:
diff changeset
  1346
     * plain package name.
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1347
     *
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1348
     * @param context the id of the context where the link will be added
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  1349
     * @param typeElement the class to link to
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1350
     * @param contentTree the content tree to which the link with be added
10
06bc494ca11e Initial load
duke
parents:
diff changeset
  1351
     */
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  1352
    public void addPreQualifiedStrongClassLink(LinkInfoImpl.Kind context, TypeElement typeElement, Content contentTree) {
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  1353
        addPreQualifiedClassLink(context, typeElement, true, contentTree);
10
06bc494ca11e Initial load
duke
parents:
diff changeset
  1354
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1355
06bc494ca11e Initial load
duke
parents:
diff changeset
  1356
    /**
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1357
     * Get the link for the given member.
10
06bc494ca11e Initial load
duke
parents:
diff changeset
  1358
     *
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1359
     * @param context the id of the context where the link will be added
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  1360
     * @param element the member being linked to
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1361
     * @param label the label for the link
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  1362
     * @return a content tree for the element link
10
06bc494ca11e Initial load
duke
parents:
diff changeset
  1363
     */
36500
d31e4986dc8b 8149139: [javadoc] Modify Content to accept CharSequence
ksrini
parents: 36038
diff changeset
  1364
    public Content getDocLink(LinkInfoImpl.Kind context, Element element, CharSequence label) {
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  1365
        return getDocLink(context, utils.getEnclosingTypeElement(element), element,
17560
9f6771abbd1a 8011650: reduce use of RawHtml nodes in doclet
jjg
parents: 17559
diff changeset
  1366
                new StringContent(label));
10
06bc494ca11e Initial load
duke
parents:
diff changeset
  1367
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1368
06bc494ca11e Initial load
duke
parents:
diff changeset
  1369
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
  1370
     * Return the link for the given member.
06bc494ca11e Initial load
duke
parents:
diff changeset
  1371
     *
06bc494ca11e Initial load
duke
parents:
diff changeset
  1372
     * @param context the id of the context where the link will be printed.
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  1373
     * @param element the member being linked to.
10
06bc494ca11e Initial load
duke
parents:
diff changeset
  1374
     * @param label the label for the link.
1787
1aa079321cd2 6786028: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - Bold tags should be strong
bpatel
parents: 1264
diff changeset
  1375
     * @param strong true if the link should be strong.
10
06bc494ca11e Initial load
duke
parents:
diff changeset
  1376
     * @return the link for the given member.
06bc494ca11e Initial load
duke
parents:
diff changeset
  1377
     */
36500
d31e4986dc8b 8149139: [javadoc] Modify Content to accept CharSequence
ksrini
parents: 36038
diff changeset
  1378
    public Content getDocLink(LinkInfoImpl.Kind context, Element element, CharSequence label,
17559
87c28ee29329 8011642: Remove LinkOutput in favor of direct use of Content
jjg
parents: 17558
diff changeset
  1379
            boolean strong) {
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  1380
        return getDocLink(context, utils.getEnclosingTypeElement(element), element, label, strong);
10
06bc494ca11e Initial load
duke
parents:
diff changeset
  1381
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1382
06bc494ca11e Initial load
duke
parents:
diff changeset
  1383
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
  1384
     * Return the link for the given member.
06bc494ca11e Initial load
duke
parents:
diff changeset
  1385
     *
06bc494ca11e Initial load
duke
parents:
diff changeset
  1386
     * @param context the id of the context where the link will be printed.
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  1387
     * @param typeElement the typeElement that we should link to.  This is not
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  1388
                 necessarily equal to element.containingClass().  We may be
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  1389
                 inheriting comments.
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  1390
     * @param element the member being linked to.
10
06bc494ca11e Initial load
duke
parents:
diff changeset
  1391
     * @param label the label for the link.
1787
1aa079321cd2 6786028: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - Bold tags should be strong
bpatel
parents: 1264
diff changeset
  1392
     * @param strong true if the link should be strong.
10
06bc494ca11e Initial load
duke
parents:
diff changeset
  1393
     * @return the link for the given member.
06bc494ca11e Initial load
duke
parents:
diff changeset
  1394
     */
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  1395
    public Content getDocLink(LinkInfoImpl.Kind context, TypeElement typeElement, Element element,
36500
d31e4986dc8b 8149139: [javadoc] Modify Content to accept CharSequence
ksrini
parents: 36038
diff changeset
  1396
            CharSequence label, boolean strong) {
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  1397
        return getDocLink(context, typeElement, element, label, strong, false);
16319
e586bfeb39c5 7112427: The doclet needs to be able to generate JavaFX documentation.
jjg
parents: 15725
diff changeset
  1398
    }
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  1399
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  1400
    public Content getDocLink(LinkInfoImpl.Kind context, TypeElement typeElement, Element element,
17569
ef80738645e2 8012178: Cleanup use of Util.escapeHtmlChars
jjg
parents: 17568
diff changeset
  1401
            Content label, boolean strong) {
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  1402
        return getDocLink(context, typeElement, element, label, strong, false);
17569
ef80738645e2 8012178: Cleanup use of Util.escapeHtmlChars
jjg
parents: 17568
diff changeset
  1403
    }
16319
e586bfeb39c5 7112427: The doclet needs to be able to generate JavaFX documentation.
jjg
parents: 15725
diff changeset
  1404
e586bfeb39c5 7112427: The doclet needs to be able to generate JavaFX documentation.
jjg
parents: 15725
diff changeset
  1405
   /**
e586bfeb39c5 7112427: The doclet needs to be able to generate JavaFX documentation.
jjg
parents: 15725
diff changeset
  1406
     * Return the link for the given member.
e586bfeb39c5 7112427: The doclet needs to be able to generate JavaFX documentation.
jjg
parents: 15725
diff changeset
  1407
     *
e586bfeb39c5 7112427: The doclet needs to be able to generate JavaFX documentation.
jjg
parents: 15725
diff changeset
  1408
     * @param context the id of the context where the link will be printed.
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  1409
     * @param typeElement the typeElement that we should link to.  This is not
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  1410
                 necessarily equal to element.containingClass().  We may be
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  1411
                 inheriting comments.
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  1412
     * @param element the member being linked to.
16319
e586bfeb39c5 7112427: The doclet needs to be able to generate JavaFX documentation.
jjg
parents: 15725
diff changeset
  1413
     * @param label the label for the link.
e586bfeb39c5 7112427: The doclet needs to be able to generate JavaFX documentation.
jjg
parents: 15725
diff changeset
  1414
     * @param strong true if the link should be strong.
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  1415
     * @param isProperty true if the element parameter is a JavaFX property.
16319
e586bfeb39c5 7112427: The doclet needs to be able to generate JavaFX documentation.
jjg
parents: 15725
diff changeset
  1416
     * @return the link for the given member.
e586bfeb39c5 7112427: The doclet needs to be able to generate JavaFX documentation.
jjg
parents: 15725
diff changeset
  1417
     */
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  1418
    public Content getDocLink(LinkInfoImpl.Kind context, TypeElement typeElement, Element element,
36500
d31e4986dc8b 8149139: [javadoc] Modify Content to accept CharSequence
ksrini
parents: 36038
diff changeset
  1419
            CharSequence label, boolean strong, boolean isProperty) {
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  1420
        return getDocLink(context, typeElement, element, new StringContent(check(label)), strong, isProperty);
17569
ef80738645e2 8012178: Cleanup use of Util.escapeHtmlChars
jjg
parents: 17568
diff changeset
  1421
    }
ef80738645e2 8012178: Cleanup use of Util.escapeHtmlChars
jjg
parents: 17568
diff changeset
  1422
36500
d31e4986dc8b 8149139: [javadoc] Modify Content to accept CharSequence
ksrini
parents: 36038
diff changeset
  1423
    CharSequence check(CharSequence s) {
d31e4986dc8b 8149139: [javadoc] Modify Content to accept CharSequence
ksrini
parents: 36038
diff changeset
  1424
        Matcher m = IMPROPER_HTML_CHARS.matcher(s);
d31e4986dc8b 8149139: [javadoc] Modify Content to accept CharSequence
ksrini
parents: 36038
diff changeset
  1425
        if (m.matches()) {
d31e4986dc8b 8149139: [javadoc] Modify Content to accept CharSequence
ksrini
parents: 36038
diff changeset
  1426
            throw new IllegalArgumentException(s.toString());
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  1427
        }
17569
ef80738645e2 8012178: Cleanup use of Util.escapeHtmlChars
jjg
parents: 17568
diff changeset
  1428
        return s;
17560
9f6771abbd1a 8011650: reduce use of RawHtml nodes in doclet
jjg
parents: 17559
diff changeset
  1429
    }
9f6771abbd1a 8011650: reduce use of RawHtml nodes in doclet
jjg
parents: 17559
diff changeset
  1430
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  1431
    public Content getDocLink(LinkInfoImpl.Kind context, TypeElement typeElement, Element element,
17560
9f6771abbd1a 8011650: reduce use of RawHtml nodes in doclet
jjg
parents: 17559
diff changeset
  1432
            Content label, boolean strong, boolean isProperty) {
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  1433
        if (! (utils.isIncluded(element) || utils.isLinkable(typeElement))) {
17560
9f6771abbd1a 8011650: reduce use of RawHtml nodes in doclet
jjg
parents: 17559
diff changeset
  1434
            return label;
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  1435
        } else if (utils.isExecutableElement(element)) {
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  1436
            ExecutableElement ee = (ExecutableElement)element;
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  1437
            return getLink(new LinkInfoImpl(configuration, context, typeElement)
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  1438
                .label(label)
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  1439
                .where(getName(getAnchor(ee, isProperty)))
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  1440
                .strong(strong));
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  1441
        } else if (utils.isVariableElement(element) || utils.isTypeElement(element)) {
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  1442
            return getLink(new LinkInfoImpl(configuration, context, typeElement)
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  1443
                .label(label)
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  1444
                .where(getName(element.getSimpleName().toString()))
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  1445
                .strong(strong));
10
06bc494ca11e Initial load
duke
parents:
diff changeset
  1446
        } else {
17560
9f6771abbd1a 8011650: reduce use of RawHtml nodes in doclet
jjg
parents: 17559
diff changeset
  1447
            return label;
10
06bc494ca11e Initial load
duke
parents:
diff changeset
  1448
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1449
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1450
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1451
    /**
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1452
     * Return the link for the given member.
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1453
     *
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1454
     * @param context the id of the context where the link will be added
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  1455
     * @param typeElement the typeElement that we should link to.  This is not
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  1456
                 necessarily equal to element.containingClass().  We may be
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  1457
                 inheriting comments
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  1458
     * @param element the member being linked to
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1459
     * @param label the label for the link
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1460
     * @return the link for the given member
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1461
     */
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  1462
    public Content getDocLink(LinkInfoImpl.Kind context, TypeElement typeElement, Element element,
17560
9f6771abbd1a 8011650: reduce use of RawHtml nodes in doclet
jjg
parents: 17559
diff changeset
  1463
            Content label) {
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  1464
        if (! (utils.isIncluded(element) || utils.isLinkable(typeElement))) {
17560
9f6771abbd1a 8011650: reduce use of RawHtml nodes in doclet
jjg
parents: 17559
diff changeset
  1465
            return label;
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  1466
        } else if (utils.isExecutableElement(element)) {
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  1467
            ExecutableElement emd = (ExecutableElement) element;
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  1468
            return getLink(new LinkInfoImpl(configuration, context, typeElement)
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  1469
                .label(label)
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  1470
                .where(getName(getAnchor(emd))));
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  1471
        } else if (utils.isVariableElement(element) || utils.isTypeElement(element)) {
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  1472
            return getLink(new LinkInfoImpl(configuration, context, typeElement)
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  1473
                .label(label).where(getName(element.getSimpleName().toString())));
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1474
        } else {
17560
9f6771abbd1a 8011650: reduce use of RawHtml nodes in doclet
jjg
parents: 17559
diff changeset
  1475
            return label;
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1476
        }
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1477
    }
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1478
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  1479
    public String getAnchor(ExecutableElement executableElement) {
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  1480
        return getAnchor(executableElement, false);
16319
e586bfeb39c5 7112427: The doclet needs to be able to generate JavaFX documentation.
jjg
parents: 15725
diff changeset
  1481
    }
e586bfeb39c5 7112427: The doclet needs to be able to generate JavaFX documentation.
jjg
parents: 15725
diff changeset
  1482
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  1483
    public String getAnchor(ExecutableElement executableElement, boolean isProperty) {
16319
e586bfeb39c5 7112427: The doclet needs to be able to generate JavaFX documentation.
jjg
parents: 15725
diff changeset
  1484
        if (isProperty) {
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  1485
            return executableElement.getSimpleName().toString();
16319
e586bfeb39c5 7112427: The doclet needs to be able to generate JavaFX documentation.
jjg
parents: 15725
diff changeset
  1486
        }
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  1487
        String signature = utils.signature(executableElement);
10
06bc494ca11e Initial load
duke
parents:
diff changeset
  1488
        StringBuilder signatureParsed = new StringBuilder();
06bc494ca11e Initial load
duke
parents:
diff changeset
  1489
        int counter = 0;
06bc494ca11e Initial load
duke
parents:
diff changeset
  1490
        for (int i = 0; i < signature.length(); i++) {
06bc494ca11e Initial load
duke
parents:
diff changeset
  1491
            char c = signature.charAt(i);
06bc494ca11e Initial load
duke
parents:
diff changeset
  1492
            if (c == '<') {
06bc494ca11e Initial load
duke
parents:
diff changeset
  1493
                counter++;
06bc494ca11e Initial load
duke
parents:
diff changeset
  1494
            } else if (c == '>') {
06bc494ca11e Initial load
duke
parents:
diff changeset
  1495
                counter--;
06bc494ca11e Initial load
duke
parents:
diff changeset
  1496
            } else if (counter == 0) {
06bc494ca11e Initial load
duke
parents:
diff changeset
  1497
                signatureParsed.append(c);
06bc494ca11e Initial load
duke
parents:
diff changeset
  1498
            }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1499
        }
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  1500
        return utils.getSimpleName(executableElement) + signatureParsed.toString();
10
06bc494ca11e Initial load
duke
parents:
diff changeset
  1501
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1502
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  1503
    public Content seeTagToContent(Element element, DocTree see) {
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  1504
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  1505
        Kind kind = see.getKind();
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  1506
        if (!(kind == LINK || kind == SEE || kind == LINK_PLAIN)) {
17568
d9691936f5f9 8012177: HTMLDocletWriter methods should generate Content, not Strings
jjg
parents: 17567
diff changeset
  1507
            return new ContentBuilder();
10
06bc494ca11e Initial load
duke
parents:
diff changeset
  1508
        }
14266
69453558960d 8000673: remove dead code from HtmlWriter and subtypes
jjg
parents: 14265
diff changeset
  1509
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  1510
        CommentHelper ch = utils.getCommentHelper(element);
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  1511
        String tagName = ch.getTagName(see);
36500
d31e4986dc8b 8149139: [javadoc] Modify Content to accept CharSequence
ksrini
parents: 36038
diff changeset
  1512
        String seetext = replaceDocRootDir(utils.normalizeNewlines(ch.getText(see)).toString());
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  1513
        // Check if @see is an href or "string"
10
06bc494ca11e Initial load
duke
parents:
diff changeset
  1514
        if (seetext.startsWith("<") || seetext.startsWith("\"")) {
17568
d9691936f5f9 8012177: HTMLDocletWriter methods should generate Content, not Strings
jjg
parents: 17567
diff changeset
  1515
            return new RawHtml(seetext);
10
06bc494ca11e Initial load
duke
parents:
diff changeset
  1516
        }
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  1517
        boolean isLinkPlain = kind == LINK_PLAIN;
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  1518
        Content label = plainOrCode(isLinkPlain, new RawHtml(ch.getLabel(configuration, see)));
14266
69453558960d 8000673: remove dead code from HtmlWriter and subtypes
jjg
parents: 14265
diff changeset
  1519
10
06bc494ca11e Initial load
duke
parents:
diff changeset
  1520
        //The text from the @see tag.  We will output this text when a label is not specified.
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  1521
        Content text = plainOrCode(kind == LINK_PLAIN, new RawHtml(seetext));
10
06bc494ca11e Initial load
duke
parents:
diff changeset
  1522
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  1523
        TypeElement refClass = ch.getReferencedClass(configuration, see);
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  1524
        String refClassName =  ch.getReferencedClassName(configuration, see);
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  1525
        Element refMem =       ch.getReferencedMember(configuration, see);
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  1526
        String refMemName =    ch.getReferencedMemberName(see);
14266
69453558960d 8000673: remove dead code from HtmlWriter and subtypes
jjg
parents: 14265
diff changeset
  1527
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  1528
        if (refMemName == null && refMem != null) {
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  1529
            refMemName = refMem.toString();
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  1530
        }
10
06bc494ca11e Initial load
duke
parents:
diff changeset
  1531
        if (refClass == null) {
06bc494ca11e Initial load
duke
parents:
diff changeset
  1532
            //@see is not referencing an included class
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  1533
            PackageElement refPackage = ch.getReferencedPackage(configuration, see);
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  1534
            if (refPackage != null && utils.isIncluded(refPackage)) {
10
06bc494ca11e Initial load
duke
parents:
diff changeset
  1535
                //@see is referencing an included package
14266
69453558960d 8000673: remove dead code from HtmlWriter and subtypes
jjg
parents: 14265
diff changeset
  1536
                if (label.isEmpty())
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  1537
                    label = plainOrCode(isLinkPlain,
36500
d31e4986dc8b 8149139: [javadoc] Modify Content to accept CharSequence
ksrini
parents: 36038
diff changeset
  1538
                            new StringContent(refPackage.getQualifiedName()));
17568
d9691936f5f9 8012177: HTMLDocletWriter methods should generate Content, not Strings
jjg
parents: 17567
diff changeset
  1539
                return getPackageLink(refPackage, label);
10
06bc494ca11e Initial load
duke
parents:
diff changeset
  1540
            } else {
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  1541
                // @see is not referencing an included class or package.  Check for cross links.
17560
9f6771abbd1a 8011650: reduce use of RawHtml nodes in doclet
jjg
parents: 17559
diff changeset
  1542
                Content classCrossLink;
14358
9eda9239cba0 8000416: refactor javadoc to provide and use an abstraction for relative URIs
jjg
parents: 14357
diff changeset
  1543
                DocLink packageCrossLink = getCrossPackageLink(refClassName);
10
06bc494ca11e Initial load
duke
parents:
diff changeset
  1544
                if (packageCrossLink != null) {
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  1545
                    // Package cross link found
17560
9f6771abbd1a 8011650: reduce use of RawHtml nodes in doclet
jjg
parents: 17559
diff changeset
  1546
                    return getHyperLink(packageCrossLink,
17568
d9691936f5f9 8012177: HTMLDocletWriter methods should generate Content, not Strings
jjg
parents: 17567
diff changeset
  1547
                        (label.isEmpty() ? text : label));
10
06bc494ca11e Initial load
duke
parents:
diff changeset
  1548
                } else if ((classCrossLink = getCrossClassLink(refClassName,
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  1549
                        refMemName, label, false, "", !isLinkPlain)) != null) {
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  1550
                    // Class cross link found (possibly to a member in the class)
17568
d9691936f5f9 8012177: HTMLDocletWriter methods should generate Content, not Strings
jjg
parents: 17567
diff changeset
  1551
                    return classCrossLink;
10
06bc494ca11e Initial load
duke
parents:
diff changeset
  1552
                } else {
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  1553
                    // No cross link found so print warning
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  1554
                    configuration.getDocletSpecificMsg().warning(ch.getDocTreePath(see),
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  1555
                            "doclet.see.class_or_package_not_found",
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  1556
                            "@" + tagName,
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  1557
                            seetext);
17568
d9691936f5f9 8012177: HTMLDocletWriter methods should generate Content, not Strings
jjg
parents: 17567
diff changeset
  1558
                    return (label.isEmpty() ? text: label);
10
06bc494ca11e Initial load
duke
parents:
diff changeset
  1559
                }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1560
            }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1561
        } else if (refMemName == null) {
06bc494ca11e Initial load
duke
parents:
diff changeset
  1562
            // Must be a class reference since refClass is not null and refMemName is null.
14266
69453558960d 8000673: remove dead code from HtmlWriter and subtypes
jjg
parents: 14265
diff changeset
  1563
            if (label.isEmpty()) {
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  1564
                /*
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  1565
                 * it seems to me this is the right thing to do, but it causes comparator failures.
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  1566
                 */
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  1567
                if (!configuration.backwardCompatibility) {
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  1568
                    StringContent content = utils.isEnclosingPackageIncluded(refClass)
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  1569
                            ? new StringContent(utils.getSimpleName(refClass))
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  1570
                            : new StringContent(utils.getFullyQualifiedName(refClass));
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  1571
                    label = plainOrCode(isLinkPlain, content);
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  1572
                } else {
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  1573
                    label = plainOrCode(isLinkPlain,
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  1574
                            new StringContent(utils.getSimpleName(refClass)));
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  1575
                }
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  1576
10
06bc494ca11e Initial load
duke
parents:
diff changeset
  1577
            }
17561
9f3505f35da9 8011651: simplify LinkInfoImpl API
jjg
parents: 17560
diff changeset
  1578
            return getLink(new LinkInfoImpl(configuration, LinkInfoImpl.Kind.DEFAULT, refClass)
17568
d9691936f5f9 8012177: HTMLDocletWriter methods should generate Content, not Strings
jjg
parents: 17567
diff changeset
  1579
                    .label(label));
10
06bc494ca11e Initial load
duke
parents:
diff changeset
  1580
        } else if (refMem == null) {
06bc494ca11e Initial load
duke
parents:
diff changeset
  1581
            // Must be a member reference since refClass is not null and refMemName is not null.
06bc494ca11e Initial load
duke
parents:
diff changeset
  1582
            // However, refMem is null, so this referenced member does not exist.
17568
d9691936f5f9 8012177: HTMLDocletWriter methods should generate Content, not Strings
jjg
parents: 17567
diff changeset
  1583
            return (label.isEmpty() ? text: label);
10
06bc494ca11e Initial load
duke
parents:
diff changeset
  1584
        } else {
06bc494ca11e Initial load
duke
parents:
diff changeset
  1585
            // Must be a member reference since refClass is not null and refMemName is not null.
06bc494ca11e Initial load
duke
parents:
diff changeset
  1586
            // refMem is not null, so this @see tag must be referencing a valid member.
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  1587
            TypeElement containing = utils.getEnclosingTypeElement(refMem);
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  1588
            if (ch.getText(see).trim().startsWith("#") &&
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  1589
                ! (utils.isPublic(containing) || utils.isLinkable(containing))) {
10
06bc494ca11e Initial load
duke
parents:
diff changeset
  1590
                // Since the link is relative and the holder is not even being
06bc494ca11e Initial load
duke
parents:
diff changeset
  1591
                // documented, this must be an inherited link.  Redirect it.
06bc494ca11e Initial load
duke
parents:
diff changeset
  1592
                // The current class either overrides the referenced member or
06bc494ca11e Initial load
duke
parents:
diff changeset
  1593
                // inherits it automatically.
3891
69ac41cb327b 5093723: REGRESSION: ClassCastException in SingleIndexWriter
jjg
parents: 2321
diff changeset
  1594
                if (this instanceof ClassWriterImpl) {
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  1595
                    containing = ((ClassWriterImpl) this).getTypeElement();
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  1596
                } else if (!utils.isPublic(containing)) {
3891
69ac41cb327b 5093723: REGRESSION: ClassCastException in SingleIndexWriter
jjg
parents: 2321
diff changeset
  1597
                    configuration.getDocletSpecificMsg().warning(
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  1598
                        ch.getDocTreePath(see), "doclet.see.class_or_package_not_accessible",
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  1599
                        tagName, utils.getFullyQualifiedName(containing));
3891
69ac41cb327b 5093723: REGRESSION: ClassCastException in SingleIndexWriter
jjg
parents: 2321
diff changeset
  1600
                } else {
69ac41cb327b 5093723: REGRESSION: ClassCastException in SingleIndexWriter
jjg
parents: 2321
diff changeset
  1601
                    configuration.getDocletSpecificMsg().warning(
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  1602
                        ch.getDocTreePath(see), "doclet.see.class_or_package_not_found",
3891
69ac41cb327b 5093723: REGRESSION: ClassCastException in SingleIndexWriter
jjg
parents: 2321
diff changeset
  1603
                        tagName, seetext);
69ac41cb327b 5093723: REGRESSION: ClassCastException in SingleIndexWriter
jjg
parents: 2321
diff changeset
  1604
                }
10
06bc494ca11e Initial load
duke
parents:
diff changeset
  1605
            }
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  1606
            if (configuration.currentTypeElement != containing) {
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  1607
                refMemName = (utils.isConstructor(refMem))
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  1608
                        ? refMemName
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  1609
                        : utils.getSimpleName(containing) + "." + refMemName;
10
06bc494ca11e Initial load
duke
parents:
diff changeset
  1610
            }
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  1611
            if (utils.isExecutableElement(refMem)) {
10
06bc494ca11e Initial load
duke
parents:
diff changeset
  1612
                if (refMemName.indexOf('(') < 0) {
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  1613
                    refMemName += utils.makeSignature((ExecutableElement)refMem, true);
10
06bc494ca11e Initial load
duke
parents:
diff changeset
  1614
                }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1615
            }
14266
69453558960d 8000673: remove dead code from HtmlWriter and subtypes
jjg
parents: 14265
diff changeset
  1616
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  1617
            text = plainOrCode(kind == LINK_PLAIN, new StringContent(refMemName));
10
06bc494ca11e Initial load
duke
parents:
diff changeset
  1618
17558
eee4ccf66cfd 8010440: Replace int constants in LinkInfoImpl with enum
jjg
parents: 17547
diff changeset
  1619
            return getDocLink(LinkInfoImpl.Kind.SEE_TAG, containing,
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  1620
                    refMem, (label.isEmpty() ? text: label), false);
10
06bc494ca11e Initial load
duke
parents:
diff changeset
  1621
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1622
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1623
17560
9f6771abbd1a 8011650: reduce use of RawHtml nodes in doclet
jjg
parents: 17559
diff changeset
  1624
    private Content plainOrCode(boolean plain, Content body) {
9f6771abbd1a 8011650: reduce use of RawHtml nodes in doclet
jjg
parents: 17559
diff changeset
  1625
        return (plain || body.isEmpty()) ? body : HtmlTree.CODE(body);
9f6771abbd1a 8011650: reduce use of RawHtml nodes in doclet
jjg
parents: 17559
diff changeset
  1626
    }
9f6771abbd1a 8011650: reduce use of RawHtml nodes in doclet
jjg
parents: 17559
diff changeset
  1627
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1628
    /**
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1629
     * Add the inline comment.
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1630
     *
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  1631
     * @param element the Element for which the inline comment will be added
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1632
     * @param tag the inline tag to be added
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1633
     * @param htmltree the content tree to which the comment will be added
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1634
     */
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  1635
    public void addInlineComment(Element element, DocTree tag, Content htmltree) {
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  1636
        CommentHelper ch = utils.getCommentHelper(element);
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  1637
        List<? extends DocTree> description = ch.getDescription(configuration, tag);
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  1638
        addCommentTags(element, tag, description, false, false, htmltree);
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1639
    }
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1640
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1641
    /**
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1642
     * Add the inline deprecated comment.
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1643
     *
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  1644
     * @param e the Element for which the inline deprecated comment will be added
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1645
     * @param tag the inline tag to be added
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1646
     * @param htmltree the content tree to which the comment will be added
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1647
     */
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  1648
    public void addInlineDeprecatedComment(Element e, DocTree tag, Content htmltree) {
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  1649
        CommentHelper ch = utils.getCommentHelper(e);
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  1650
        addCommentTags(e, ch.getBody(configuration, tag), true, false, htmltree);
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1651
    }
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1652
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1653
    /**
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1654
     * Adds the summary content.
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1655
     *
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  1656
     * @param element the Element for which the summary will be generated
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1657
     * @param htmltree the documentation tree to which the summary will be added
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1658
     */
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  1659
    public void addSummaryComment(Element element, Content htmltree) {
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  1660
        addSummaryComment(element, utils.getFirstSentenceTrees(element), htmltree);
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1661
    }
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1662
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1663
    /**
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1664
     * Adds the summary content.
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1665
     *
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  1666
     * @param element the Element for which the summary will be generated
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1667
     * @param firstSentenceTags the first sentence tags for the doc
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1668
     * @param htmltree the documentation tree to which the summary will be added
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1669
     */
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  1670
    public void addSummaryComment(Element element, List<? extends DocTree> firstSentenceTags, Content htmltree) {
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  1671
        addCommentTags(element, firstSentenceTags, false, true, htmltree);
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1672
    }
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1673
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  1674
    public void addSummaryDeprecatedComment(Element element, DocTree tag, Content htmltree) {
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  1675
        CommentHelper ch = utils.getCommentHelper(element);
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  1676
        List<? extends DocTree> body = ch.getBody(configuration, tag);
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  1677
        addCommentTags(element, ch.getFirstSentenceTrees(configuration, body), true, true, htmltree);
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1678
    }
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1679
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1680
    /**
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1681
     * Adds the inline comment.
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1682
     *
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  1683
     * @param element the Element for which the inline comments will be generated
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1684
     * @param htmltree the documentation tree to which the inline comments will be added
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1685
     */
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  1686
    public void addInlineComment(Element element, Content htmltree) {
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  1687
        addCommentTags(element, utils.getBody(element), false, false, htmltree);
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1688
    }
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1689
10
06bc494ca11e Initial load
duke
parents:
diff changeset
  1690
    /**
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1691
     * Adds the comment tags.
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1692
     *
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  1693
     * @param element the Element for which the comment tags will be generated
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1694
     * @param tags the first sentence tags for the doc
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1695
     * @param depr true if it is deprecated
14357
faf9cde2817b 8000741: refactor javadoc to use abstraction to handle relative paths
jjg
parents: 14266
diff changeset
  1696
     * @param first true if the first sentence tags should be added
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1697
     * @param htmltree the documentation tree to which the comment tags will be added
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1698
     */
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  1699
    private void addCommentTags(Element element, List<? extends DocTree> tags, boolean depr,
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1700
            boolean first, Content htmltree) {
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  1701
        addCommentTags(element, null, tags, depr, first, htmltree);
17547
40f2f9a5a445 8008768: Using {@inheritDoc} in simple tag defined via -tag fails
jjg
parents: 16964
diff changeset
  1702
    }
40f2f9a5a445 8008768: Using {@inheritDoc} in simple tag defined via -tag fails
jjg
parents: 16964
diff changeset
  1703
40f2f9a5a445 8008768: Using {@inheritDoc} in simple tag defined via -tag fails
jjg
parents: 16964
diff changeset
  1704
    /**
40f2f9a5a445 8008768: Using {@inheritDoc} in simple tag defined via -tag fails
jjg
parents: 16964
diff changeset
  1705
     * Adds the comment tags.
40f2f9a5a445 8008768: Using {@inheritDoc} in simple tag defined via -tag fails
jjg
parents: 16964
diff changeset
  1706
     *
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  1707
     * @param element for which the comment tags will be generated
17547
40f2f9a5a445 8008768: Using {@inheritDoc} in simple tag defined via -tag fails
jjg
parents: 16964
diff changeset
  1708
     * @param holderTag the block tag context for the inline tags
40f2f9a5a445 8008768: Using {@inheritDoc} in simple tag defined via -tag fails
jjg
parents: 16964
diff changeset
  1709
     * @param tags the first sentence tags for the doc
40f2f9a5a445 8008768: Using {@inheritDoc} in simple tag defined via -tag fails
jjg
parents: 16964
diff changeset
  1710
     * @param depr true if it is deprecated
40f2f9a5a445 8008768: Using {@inheritDoc} in simple tag defined via -tag fails
jjg
parents: 16964
diff changeset
  1711
     * @param first true if the first sentence tags should be added
40f2f9a5a445 8008768: Using {@inheritDoc} in simple tag defined via -tag fails
jjg
parents: 16964
diff changeset
  1712
     * @param htmltree the documentation tree to which the comment tags will be added
40f2f9a5a445 8008768: Using {@inheritDoc} in simple tag defined via -tag fails
jjg
parents: 16964
diff changeset
  1713
     */
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  1714
    private void addCommentTags(Element element, DocTree holderTag, List<? extends DocTree> tags, boolean depr,
17547
40f2f9a5a445 8008768: Using {@inheritDoc} in simple tag defined via -tag fails
jjg
parents: 16964
diff changeset
  1715
            boolean first, Content htmltree) {
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1716
        if(configuration.nocomment){
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1717
            return;
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1718
        }
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1719
        Content div;
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  1720
        Content result = commentTagsToContent(null, element, tags, first);
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1721
        if (depr) {
21478
fa4c7cda1b41 8026567: Use meaningful style names for strong and italic styles.
bpatel
parents: 21008
diff changeset
  1722
            Content italic = HtmlTree.SPAN(HtmlStyle.deprecationComment, result);
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1723
            div = HtmlTree.DIV(HtmlStyle.block, italic);
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1724
            htmltree.addContent(div);
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1725
        }
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1726
        else {
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1727
            div = HtmlTree.DIV(HtmlStyle.block, result);
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1728
            htmltree.addContent(div);
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1729
        }
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  1730
        if (tags.isEmpty()) {
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1731
            htmltree.addContent(getSpace());
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1732
        }
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1733
    }
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1734
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  1735
    boolean ignoreNonInlineTag(DocTree dtree) {
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  1736
        Name name = null;
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  1737
        if (dtree.getKind() == Kind.START_ELEMENT) {
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  1738
            StartElementTree setree = (StartElementTree)dtree;
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  1739
            name = setree.getName();
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  1740
        } else if (dtree.getKind() == Kind.END_ELEMENT) {
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  1741
            EndElementTree eetree = (EndElementTree)dtree;
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  1742
            name = eetree.getName();
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  1743
        }
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  1744
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  1745
        if (name != null) {
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  1746
            com.sun.tools.doclint.HtmlTag htmlTag = com.sun.tools.doclint.HtmlTag.get(name);
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  1747
            if (htmlTag != null &&
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  1748
                    htmlTag.blockType != com.sun.tools.doclint.HtmlTag.BlockType.INLINE) {
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  1749
                return true;
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  1750
            }
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  1751
        }
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  1752
        return false;
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  1753
    }
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  1754
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  1755
    boolean isAllWhiteSpace(String body) {
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  1756
        for (int i = 0 ; i < body.length(); i++) {
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  1757
            if (!Character.isWhitespace(body.charAt(i)))
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  1758
                return false;
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  1759
        }
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  1760
        return true;
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  1761
    }
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  1762
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1763
    /**
10
06bc494ca11e Initial load
duke
parents:
diff changeset
  1764
     * Converts inline tags and text to text strings, expanding the
06bc494ca11e Initial load
duke
parents:
diff changeset
  1765
     * inline tags along the way.  Called wherever text can contain
06bc494ca11e Initial load
duke
parents:
diff changeset
  1766
     * an inline tag, such as in comments or in free-form text arguments
06bc494ca11e Initial load
duke
parents:
diff changeset
  1767
     * to non-inline tags.
06bc494ca11e Initial load
duke
parents:
diff changeset
  1768
     *
06bc494ca11e Initial load
duke
parents:
diff changeset
  1769
     * @param holderTag    specific tag where comment resides
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  1770
     * @param element    specific element where comment resides
10
06bc494ca11e Initial load
duke
parents:
diff changeset
  1771
     * @param tags   array of text tags and inline tags (often alternating)
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  1772
               present in the text of interest for this element
10
06bc494ca11e Initial load
duke
parents:
diff changeset
  1773
     * @param isFirstSentence  true if text is first sentence
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  1774
     * @return a Content object
10
06bc494ca11e Initial load
duke
parents:
diff changeset
  1775
     */
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  1776
    public Content commentTagsToContent(DocTree holderTag, Element element,
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  1777
            List<? extends DocTree> tags, boolean isFirstSentence) {
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  1778
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  1779
        final Content result = new ContentBuilder() {
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  1780
            @Override
36500
d31e4986dc8b 8149139: [javadoc] Modify Content to accept CharSequence
ksrini
parents: 36038
diff changeset
  1781
            public void addContent(CharSequence text) {
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  1782
                super.addContent(utils.normalizeNewlines(text));
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  1783
            }
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  1784
        };
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  1785
        CommentHelper ch = utils.getCommentHelper(element);
10
06bc494ca11e Initial load
duke
parents:
diff changeset
  1786
        // Array of all possible inline tags for this javadoc run
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  1787
        configuration.tagletManager.checkTags(utils, element, tags, true);
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  1788
        for (ListIterator<? extends DocTree> iterator = tags.listIterator(); iterator.hasNext();) {
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  1789
            DocTree tag = iterator.next();
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  1790
             // zap block tags
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  1791
            if (isFirstSentence && ignoreNonInlineTag(tag))
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  1792
                continue;
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  1793
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  1794
            if (isFirstSentence && iterator.nextIndex() == tags.size() &&
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  1795
                    (tag.getKind() == TEXT && isAllWhiteSpace(ch.getText(tag))))
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  1796
                continue;
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  1797
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  1798
            boolean allDone = new SimpleDocTreeVisitor<Boolean, Content>() {
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  1799
                // notify the next DocTree handler to take necessary action
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  1800
                boolean commentRemoved = false;
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  1801
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  1802
                private boolean isLast(DocTree node) {
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  1803
                    return node.equals(tags.get(tags.size() - 1));
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  1804
                }
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  1805
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  1806
                private boolean isFirst(DocTree node) {
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  1807
                    return node.equals(tags.get(0));
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  1808
                }
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  1809
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  1810
                private boolean inAnAtag() {
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  1811
                    if (utils.isStartElement(tag)) {
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  1812
                        StartElementTree st = (StartElementTree)tag;
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  1813
                        Name name = st.getName();
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  1814
                        if (name != null) {
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  1815
                            com.sun.tools.doclint.HtmlTag htag =
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  1816
                                    com.sun.tools.doclint.HtmlTag.get(name);
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  1817
                            return htag != null && htag.equals(com.sun.tools.doclint.HtmlTag.A);
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  1818
                        }
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  1819
                    }
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  1820
                    return false;
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  1821
                }
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  1822
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  1823
                @Override @DefinedBy(Api.COMPILER_TREE)
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  1824
                public Boolean visitAttribute(AttributeTree node, Content c) {
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  1825
                    StringBuilder sb = new StringBuilder(SPACER).append(node.getName());
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  1826
                    if (node.getValueKind() == ValueKind.EMPTY) {
36500
d31e4986dc8b 8149139: [javadoc] Modify Content to accept CharSequence
ksrini
parents: 36038
diff changeset
  1827
                        result.addContent(sb);
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  1828
                        return false;
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  1829
                    }
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  1830
                    sb.append("=");
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  1831
                    String quote;
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  1832
                    switch (node.getValueKind()) {
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  1833
                        case DOUBLE:
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  1834
                            quote = "\"";
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  1835
                            break;
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  1836
                        case SINGLE:
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  1837
                            quote = "\'";
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  1838
                            break;
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  1839
                        default:
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  1840
                            quote = "";
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  1841
                            break;
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  1842
                    }
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  1843
                    sb.append(quote);
36500
d31e4986dc8b 8149139: [javadoc] Modify Content to accept CharSequence
ksrini
parents: 36038
diff changeset
  1844
                    result.addContent(sb);
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  1845
                    Content docRootContent = new ContentBuilder();
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  1846
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  1847
                    for (DocTree dt : node.getValue()) {
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  1848
                        if (utils.isText(dt) && inAnAtag()) {
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  1849
                            String text = ((TextTree) dt).getBody();
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  1850
                            if (text.startsWith("/..") && !configuration.docrootparent.isEmpty()) {
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  1851
                                result.addContent(configuration.docrootparent);
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  1852
                                docRootContent = new ContentBuilder();
36500
d31e4986dc8b 8149139: [javadoc] Modify Content to accept CharSequence
ksrini
parents: 36038
diff changeset
  1853
                                result.addContent(textCleanup(text.substring(3), isLast(node)));
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  1854
                            } else {
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  1855
                                if (!docRootContent.isEmpty()) {
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  1856
                                    docRootContent = copyDocRootContent(docRootContent);
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  1857
                                } else {
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  1858
                                    text = redirectRelativeLinks(element, (TextTree) dt);
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  1859
                                }
36500
d31e4986dc8b 8149139: [javadoc] Modify Content to accept CharSequence
ksrini
parents: 36038
diff changeset
  1860
                                result.addContent(textCleanup(text, isLast(node)));
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  1861
                            }
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  1862
                        } else {
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  1863
                            docRootContent = copyDocRootContent(docRootContent);
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  1864
                            dt.accept(this, docRootContent);
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  1865
                        }
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  1866
                    }
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  1867
                    copyDocRootContent(docRootContent);
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  1868
                    result.addContent(quote);
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  1869
                    return false;
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  1870
                }
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  1871
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  1872
                @Override @DefinedBy(Api.COMPILER_TREE)
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  1873
                public Boolean visitComment(CommentTree node, Content c) {
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  1874
                    if (isFirstSentence && isFirst(node)) {
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  1875
                        commentRemoved = true;
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  1876
                        return this.visit(iterator.next(), c);
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  1877
                    }
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  1878
                    result.addContent(new RawHtml(node.getBody()));
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  1879
                    return false;
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  1880
                }
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  1881
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  1882
                private Content copyDocRootContent(Content content) {
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  1883
                    if (!content.isEmpty()) {
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  1884
                        result.addContent(content);
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  1885
                        return new ContentBuilder();
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  1886
                    }
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  1887
                    return content;
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  1888
                }
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  1889
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  1890
                @Override @DefinedBy(Api.COMPILER_TREE)
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  1891
                public Boolean visitDocRoot(DocRootTree node, Content c) {
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  1892
                    Content docRootContent = TagletWriter.getInlineTagOutput(element,
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  1893
                            configuration.tagletManager,
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  1894
                            holderTag,
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  1895
                            node,
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  1896
                            getTagletWriterInstance(isFirstSentence));
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  1897
                    if (c != null) {
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  1898
                        c.addContent(docRootContent);
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  1899
                    } else {
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  1900
                        result.addContent(docRootContent);
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  1901
                    }
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  1902
                    return false;
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  1903
                }
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  1904
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  1905
                @Override @DefinedBy(Api.COMPILER_TREE)
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  1906
                public Boolean visitEndElement(EndElementTree node, Content c) {
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  1907
                    RawHtml rawHtml = new RawHtml("</" + node.getName() + ">");
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  1908
                    result.addContent(rawHtml);
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  1909
                    return false;
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  1910
                }
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  1911
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  1912
                @Override @DefinedBy(Api.COMPILER_TREE)
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  1913
                public Boolean visitEntity(EntityTree node, Content c) {
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  1914
                    result.addContent(new RawHtml(node.toString()));
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  1915
                    return false;
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  1916
                }
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  1917
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  1918
                @Override @DefinedBy(Api.COMPILER_TREE)
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  1919
                public Boolean visitErroneous(ErroneousTree node, Content c) {
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  1920
                    configuration.getDocletSpecificMsg().warning(ch.getDocTreePath(node),
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  1921
                            "doclet.tag.invalid_usage", node);
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  1922
                    result.addContent(new RawHtml(node.toString()));
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  1923
                    return false;
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  1924
                }
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  1925
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  1926
                @Override @DefinedBy(Api.COMPILER_TREE)
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  1927
                public Boolean visitInheritDoc(InheritDocTree node, Content c) {
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  1928
                    Content output = TagletWriter.getInlineTagOutput(element,
22005
4270ada5dcd1 8025416: doclet not substituting {@docRoot} in some cases
bpatel
parents: 21494
diff changeset
  1929
                            configuration.tagletManager, holderTag,
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  1930
                            tag, getTagletWriterInstance(isFirstSentence));
17574
044c7e1e4d53 8012308: Remove TagletOutput in favor of direct use of Content
jjg
parents: 17573
diff changeset
  1931
                    result.addContent(output);
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  1932
                    // if we obtained the first sentence successfully, nothing more to do
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  1933
                    return (isFirstSentence && !output.isEmpty());
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  1934
                }
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  1935
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  1936
                @Override @DefinedBy(Api.COMPILER_TREE)
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  1937
                public Boolean visitIndex(IndexTree node, Content p) {
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  1938
                    Content output = TagletWriter.getInlineTagOutput(element,
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  1939
                            configuration.tagletManager, holderTag, tag,
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  1940
                            getTagletWriterInstance(isFirstSentence));
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  1941
                    if (output != null) {
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  1942
                        result.addContent(output);
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  1943
                    }
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  1944
                    return false;
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  1945
                }
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  1946
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  1947
                @Override @DefinedBy(Api.COMPILER_TREE)
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  1948
                public Boolean visitLink(LinkTree node, Content c) {
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  1949
                    // we need to pass the DocTreeImpl here, so ignore node
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  1950
                    result.addContent(seeTagToContent(element, tag));
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  1951
                    return false;
10
06bc494ca11e Initial load
duke
parents:
diff changeset
  1952
                }
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  1953
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  1954
                @Override @DefinedBy(Api.COMPILER_TREE)
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  1955
                public Boolean visitLiteral(LiteralTree node, Content c) {
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  1956
                    String s = node.getBody().toString();
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  1957
                    Content content = new StringContent(utils.normalizeNewlines(s));
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  1958
                    if (node.getKind() == CODE)
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  1959
                        content = HtmlTree.CODE(content);
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  1960
                    result.addContent(content);
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  1961
                    return false;
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  1962
                }
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  1963
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  1964
                @Override @DefinedBy(Api.COMPILER_TREE)
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  1965
                public Boolean visitSee(SeeTree node, Content c) {
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  1966
                    // we need to pass the DocTreeImpl here, so ignore node
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  1967
                    result.addContent(seeTagToContent(element, tag));
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  1968
                    return false;
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  1969
                }
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  1970
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  1971
                @Override @DefinedBy(Api.COMPILER_TREE)
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  1972
                public Boolean visitStartElement(StartElementTree node, Content c) {
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  1973
                    String text = "<" + node.getName();
36500
d31e4986dc8b 8149139: [javadoc] Modify Content to accept CharSequence
ksrini
parents: 36038
diff changeset
  1974
                    RawHtml rawHtml = new RawHtml(utils.normalizeNewlines(text));
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  1975
                    result.addContent(rawHtml);
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  1976
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  1977
                    for (DocTree dt : node.getAttributes()) {
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  1978
                        dt.accept(this, null);
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  1979
                    }
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  1980
                    result.addContent(new RawHtml(node.isSelfClosing() ? "/>" : ">"));
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  1981
                    return false;
9608
385a828ba236 6553182: Need to modify javadoc doclet for GPL
bpatel
parents: 9606
diff changeset
  1982
                }
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  1983
36500
d31e4986dc8b 8149139: [javadoc] Modify Content to accept CharSequence
ksrini
parents: 36038
diff changeset
  1984
                private CharSequence textCleanup(String text, boolean isLast) {
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  1985
                    return textCleanup(text, isLast, false);
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  1986
                }
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  1987
36500
d31e4986dc8b 8149139: [javadoc] Modify Content to accept CharSequence
ksrini
parents: 36038
diff changeset
  1988
                private CharSequence textCleanup(String text, boolean isLast, boolean trimLeader) {
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  1989
                    if (trimLeader) {
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  1990
                        text = removeLeadingWhitespace(text);
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  1991
                    }
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  1992
                    if (isFirstSentence && isLast) {
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  1993
                        text = removeTrailingWhitespace(text);
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  1994
                    }
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  1995
                    text = utils.replaceTabs(text);
36500
d31e4986dc8b 8149139: [javadoc] Modify Content to accept CharSequence
ksrini
parents: 36038
diff changeset
  1996
                    return utils.normalizeNewlines(text);
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  1997
                }
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  1998
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  1999
                @Override @DefinedBy(Api.COMPILER_TREE)
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  2000
                public Boolean visitText(TextTree node, Content c) {
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  2001
                    String text = node.getBody();
36500
d31e4986dc8b 8149139: [javadoc] Modify Content to accept CharSequence
ksrini
parents: 36038
diff changeset
  2002
                    result.addContent(new RawHtml(textCleanup(text, isLast(node), commentRemoved)));
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  2003
                    commentRemoved = false;
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  2004
                    return false;
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  2005
                }
10
06bc494ca11e Initial load
duke
parents:
diff changeset
  2006
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  2007
                @Override @DefinedBy(Api.COMPILER_TREE)
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  2008
                protected Boolean defaultAction(DocTree node, Content c) {
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  2009
                    Content output = TagletWriter.getInlineTagOutput(element,
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  2010
                            configuration.tagletManager, holderTag, tag,
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  2011
                            getTagletWriterInstance(isFirstSentence));
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  2012
                    if (output != null) {
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  2013
                        result.addContent(output);
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  2014
                    }
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  2015
                    return false;
10
06bc494ca11e Initial load
duke
parents:
diff changeset
  2016
                }
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  2017
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  2018
            }.visit(tag, null);
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  2019
            if (allDone)
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  2020
                break;
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  2021
        }
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  2022
        return result;
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  2023
    }
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  2024
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  2025
    private String removeTrailingWhitespace(String text) {
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  2026
        char[] buf = text.toCharArray();
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  2027
        for (int i = buf.length - 1; i > 0 ; i--) {
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  2028
            if (!Character.isWhitespace(buf[i]))
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  2029
                return text.substring(0, i + 1);
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  2030
        }
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  2031
        return text;
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  2032
    }
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  2033
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  2034
    private String removeLeadingWhitespace(String text) {
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  2035
        char[] buf = text.toCharArray();
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  2036
        for (int i = 0; i < buf.length; i++) {
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  2037
            if (!Character.isWhitespace(buf[i])) {
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  2038
                return text.substring(i);
10
06bc494ca11e Initial load
duke
parents:
diff changeset
  2039
            }
06bc494ca11e Initial load
duke
parents:
diff changeset
  2040
        }
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  2041
        return text;
10
06bc494ca11e Initial load
duke
parents:
diff changeset
  2042
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
  2043
06bc494ca11e Initial load
duke
parents:
diff changeset
  2044
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
  2045
     * Return true if relative links should not be redirected.
06bc494ca11e Initial load
duke
parents:
diff changeset
  2046
     *
06bc494ca11e Initial load
duke
parents:
diff changeset
  2047
     * @return Return true if a relative link should not be redirected.
06bc494ca11e Initial load
duke
parents:
diff changeset
  2048
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
  2049
    private boolean shouldNotRedirectRelativeLinks() {
06bc494ca11e Initial load
duke
parents:
diff changeset
  2050
        return  this instanceof AnnotationTypeWriter ||
06bc494ca11e Initial load
duke
parents:
diff changeset
  2051
                this instanceof ClassWriter ||
06bc494ca11e Initial load
duke
parents:
diff changeset
  2052
                this instanceof PackageSummaryWriter;
06bc494ca11e Initial load
duke
parents:
diff changeset
  2053
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
  2054
06bc494ca11e Initial load
duke
parents:
diff changeset
  2055
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
  2056
     * Suppose a piece of documentation has a relative link.  When you copy
14357
faf9cde2817b 8000741: refactor javadoc to use abstraction to handle relative paths
jjg
parents: 14266
diff changeset
  2057
     * that documentation to another place such as the index or class-use page,
10
06bc494ca11e Initial load
duke
parents:
diff changeset
  2058
     * that relative link will no longer work.  We should redirect those links
06bc494ca11e Initial load
duke
parents:
diff changeset
  2059
     * so that they will work again.
06bc494ca11e Initial load
duke
parents:
diff changeset
  2060
     * <p>
06bc494ca11e Initial load
duke
parents:
diff changeset
  2061
     * Here is the algorithm used to fix the link:
06bc494ca11e Initial load
duke
parents:
diff changeset
  2062
     * <p>
13844
56339cf983a3 7177970: fix issues in langtools doc comments
jjg
parents: 9608
diff changeset
  2063
     * {@literal <relative link> => docRoot + <relative path to file> + <relative link> }
10
06bc494ca11e Initial load
duke
parents:
diff changeset
  2064
     * <p>
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  2065
     * For example, suppose DocletEnvironment has this link:
13844
56339cf983a3 7177970: fix issues in langtools doc comments
jjg
parents: 9608
diff changeset
  2066
     * {@literal <a href="package-summary.html">The package Page</a> }
10
06bc494ca11e Initial load
duke
parents:
diff changeset
  2067
     * <p>
06bc494ca11e Initial load
duke
parents:
diff changeset
  2068
     * If this link appeared in the index, we would redirect
06bc494ca11e Initial load
duke
parents:
diff changeset
  2069
     * the link like this:
06bc494ca11e Initial load
duke
parents:
diff changeset
  2070
     *
13844
56339cf983a3 7177970: fix issues in langtools doc comments
jjg
parents: 9608
diff changeset
  2071
     * {@literal <a href="./com/sun/javadoc/package-summary.html">The package Page</a>}
10
06bc494ca11e Initial load
duke
parents:
diff changeset
  2072
     *
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  2073
     * @param element the Element object whose documentation is being written.
10
06bc494ca11e Initial load
duke
parents:
diff changeset
  2074
     * @param text the text being written.
06bc494ca11e Initial load
duke
parents:
diff changeset
  2075
     *
06bc494ca11e Initial load
duke
parents:
diff changeset
  2076
     * @return the text, with all the relative links redirected to work.
06bc494ca11e Initial load
duke
parents:
diff changeset
  2077
     */
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  2078
    private String redirectRelativeLinks(Element element, TextTree tt) {
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  2079
        String text = tt.getBody();
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  2080
        if (element == null || utils.isOverviewElement(element) || shouldNotRedirectRelativeLinks()) {
10
06bc494ca11e Initial load
duke
parents:
diff changeset
  2081
            return text;
06bc494ca11e Initial load
duke
parents:
diff changeset
  2082
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
  2083
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  2084
        DocPath redirectPathFromRoot = new SimpleElementVisitor9<DocPath, Void>() {
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  2085
            @Override @DefinedBy(Api.LANGUAGE_MODEL)
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  2086
            public DocPath visitType(TypeElement e, Void p) {
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  2087
                return DocPath.forPackage(utils.containingPackage(e));
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  2088
            }
10
06bc494ca11e Initial load
duke
parents:
diff changeset
  2089
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  2090
            @Override @DefinedBy(Api.LANGUAGE_MODEL)
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  2091
            public DocPath visitPackage(PackageElement e, Void p) {
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  2092
                return DocPath.forPackage(e);
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  2093
            }
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  2094
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  2095
            @Override @DefinedBy(Api.LANGUAGE_MODEL)
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  2096
            public DocPath visitVariable(VariableElement e, Void p) {
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  2097
                return DocPath.forPackage(utils.containingPackage(e));
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  2098
            }
10
06bc494ca11e Initial load
duke
parents:
diff changeset
  2099
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  2100
            @Override @DefinedBy(Api.LANGUAGE_MODEL)
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  2101
            public DocPath visitExecutable(ExecutableElement e, Void p) {
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  2102
                return DocPath.forPackage(utils.containingPackage(e));
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  2103
            }
23123
fd8ad69ac7fe 6457406: javadoc doesn't handle <a href='http://...'> properly in producing index pages
yan
parents: 22163
diff changeset
  2104
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  2105
            @Override @DefinedBy(Api.LANGUAGE_MODEL)
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  2106
            protected DocPath defaultAction(Element e, Void p) {
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  2107
                return null;
10
06bc494ca11e Initial load
duke
parents:
diff changeset
  2108
            }
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  2109
        }.visit(element);
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  2110
        if (redirectPathFromRoot == null) {
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  2111
            return text;
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  2112
        }
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  2113
        String lower = Utils.toLowerCase(text);
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  2114
        if (!(lower.startsWith("mailto:")
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  2115
                || lower.startsWith("http:")
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  2116
                || lower.startsWith("https:")
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  2117
                || lower.startsWith("file:"))) {
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  2118
            text = "{@" + (new DocRootTaglet()).getName() + "}/"
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  2119
                    + redirectPathFromRoot.resolve(text).getPath();
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  2120
            text = replaceDocRootDir(text);
10
06bc494ca11e Initial load
duke
parents:
diff changeset
  2121
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
  2122
        return text;
06bc494ca11e Initial load
duke
parents:
diff changeset
  2123
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
  2124
22163
3651128c74eb 8030244: Update langtools to use Diamond
briangoetz
parents: 22160
diff changeset
  2125
    static final Set<String> blockTags = new HashSet<>();
17571
50895ba58e0d 8012180: Speed up removeNonInlineHtmlTags
jjg
parents: 17570
diff changeset
  2126
    static {
50895ba58e0d 8012180: Speed up removeNonInlineHtmlTags
jjg
parents: 17570
diff changeset
  2127
        for (HtmlTag t: HtmlTag.values()) {
50895ba58e0d 8012180: Speed up removeNonInlineHtmlTags
jjg
parents: 17570
diff changeset
  2128
            if (t.blockType == HtmlTag.BlockType.BLOCK)
50895ba58e0d 8012180: Speed up removeNonInlineHtmlTags
jjg
parents: 17570
diff changeset
  2129
                blockTags.add(t.value);
50895ba58e0d 8012180: Speed up removeNonInlineHtmlTags
jjg
parents: 17570
diff changeset
  2130
        }
50895ba58e0d 8012180: Speed up removeNonInlineHtmlTags
jjg
parents: 17570
diff changeset
  2131
    }
50895ba58e0d 8012180: Speed up removeNonInlineHtmlTags
jjg
parents: 17570
diff changeset
  2132
10
06bc494ca11e Initial load
duke
parents:
diff changeset
  2133
    /**
33920
bd731341c405 8141492: Implement search feature in javadoc
bpatel
parents: 31943
diff changeset
  2134
     * Add a link to the stylesheet file.
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  2135
     *
33920
bd731341c405 8141492: Implement search feature in javadoc
bpatel
parents: 31943
diff changeset
  2136
     * @param head the content tree to which the files will be added
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  2137
     */
33920
bd731341c405 8141492: Implement search feature in javadoc
bpatel
parents: 31943
diff changeset
  2138
    public void addStyleSheetProperties(Content head) {
14368
6f4c62de6985 8001664: refactor javadoc to use abstraction to handle files
jjg
parents: 14366
diff changeset
  2139
        String stylesheetfile = configuration.stylesheetfile;
14357
faf9cde2817b 8000741: refactor javadoc to use abstraction to handle relative paths
jjg
parents: 14266
diff changeset
  2140
        DocPath stylesheet;
14368
6f4c62de6985 8001664: refactor javadoc to use abstraction to handle files
jjg
parents: 14366
diff changeset
  2141
        if (stylesheetfile.isEmpty()) {
6f4c62de6985 8001664: refactor javadoc to use abstraction to handle files
jjg
parents: 14366
diff changeset
  2142
            stylesheet = DocPaths.STYLESHEET;
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  2143
        } else {
14368
6f4c62de6985 8001664: refactor javadoc to use abstraction to handle files
jjg
parents: 14366
diff changeset
  2144
            DocFile file = DocFile.createFileForInput(configuration, stylesheetfile);
6f4c62de6985 8001664: refactor javadoc to use abstraction to handle files
jjg
parents: 14366
diff changeset
  2145
            stylesheet = DocPath.create(file.getName());
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  2146
        }
14357
faf9cde2817b 8000741: refactor javadoc to use abstraction to handle relative paths
jjg
parents: 14266
diff changeset
  2147
        HtmlTree link = HtmlTree.LINK("stylesheet", "text/css",
faf9cde2817b 8000741: refactor javadoc to use abstraction to handle relative paths
jjg
parents: 14266
diff changeset
  2148
                pathToRoot.resolve(stylesheet).getPath(),
faf9cde2817b 8000741: refactor javadoc to use abstraction to handle relative paths
jjg
parents: 14266
diff changeset
  2149
                "Style");
33920
bd731341c405 8141492: Implement search feature in javadoc
bpatel
parents: 31943
diff changeset
  2150
        head.addContent(link);
bd731341c405 8141492: Implement search feature in javadoc
bpatel
parents: 31943
diff changeset
  2151
        if (configuration.createindex) {
bd731341c405 8141492: Implement search feature in javadoc
bpatel
parents: 31943
diff changeset
  2152
            HtmlTree jq_link = HtmlTree.LINK("stylesheet", "text/css",
bd731341c405 8141492: Implement search feature in javadoc
bpatel
parents: 31943
diff changeset
  2153
                    pathToRoot.resolve(DocPaths.JQUERY_FILES.resolve(DocPaths.JQUERY_STYLESHEET_FILE)).getPath(),
bd731341c405 8141492: Implement search feature in javadoc
bpatel
parents: 31943
diff changeset
  2154
                    "Style");
bd731341c405 8141492: Implement search feature in javadoc
bpatel
parents: 31943
diff changeset
  2155
            head.addContent(jq_link);
bd731341c405 8141492: Implement search feature in javadoc
bpatel
parents: 31943
diff changeset
  2156
        }
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  2157
    }
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  2158
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  2159
    /**
33920
bd731341c405 8141492: Implement search feature in javadoc
bpatel
parents: 31943
diff changeset
  2160
     * Add a link to the JavaScript file.
14549
0599d73bf1da 8002304: Group methods by types in methods summary section
bpatel
parents: 14542
diff changeset
  2161
     *
33920
bd731341c405 8141492: Implement search feature in javadoc
bpatel
parents: 31943
diff changeset
  2162
     * @param head the content tree to which the files will be added
14549
0599d73bf1da 8002304: Group methods by types in methods summary section
bpatel
parents: 14542
diff changeset
  2163
     */
33920
bd731341c405 8141492: Implement search feature in javadoc
bpatel
parents: 31943
diff changeset
  2164
    public void addScriptProperties(Content head) {
bd731341c405 8141492: Implement search feature in javadoc
bpatel
parents: 31943
diff changeset
  2165
        HtmlTree javascript = HtmlTree.SCRIPT(pathToRoot.resolve(DocPaths.JAVASCRIPT).getPath());
bd731341c405 8141492: Implement search feature in javadoc
bpatel
parents: 31943
diff changeset
  2166
        head.addContent(javascript);
bd731341c405 8141492: Implement search feature in javadoc
bpatel
parents: 31943
diff changeset
  2167
        if (configuration.createindex) {
bd731341c405 8141492: Implement search feature in javadoc
bpatel
parents: 31943
diff changeset
  2168
            if (pathToRoot != null && script != null) {
bd731341c405 8141492: Implement search feature in javadoc
bpatel
parents: 31943
diff changeset
  2169
                String path = pathToRoot.isEmpty() ? "." : pathToRoot.getPath();
bd731341c405 8141492: Implement search feature in javadoc
bpatel
parents: 31943
diff changeset
  2170
                script.addContent(new RawHtml("var pathtoroot = \"" + path + "/\";loadScripts(document, \'script\');"));
bd731341c405 8141492: Implement search feature in javadoc
bpatel
parents: 31943
diff changeset
  2171
            }
bd731341c405 8141492: Implement search feature in javadoc
bpatel
parents: 31943
diff changeset
  2172
            addJQueryFile(head, DocPaths.JSZIP_MIN);
bd731341c405 8141492: Implement search feature in javadoc
bpatel
parents: 31943
diff changeset
  2173
            addJQueryFile(head, DocPaths.JSZIPUTILS_MIN);
bd731341c405 8141492: Implement search feature in javadoc
bpatel
parents: 31943
diff changeset
  2174
            head.addContent(new RawHtml("<!--[if IE]>"));
bd731341c405 8141492: Implement search feature in javadoc
bpatel
parents: 31943
diff changeset
  2175
            addJQueryFile(head, DocPaths.JSZIPUTILS_IE_MIN);
bd731341c405 8141492: Implement search feature in javadoc
bpatel
parents: 31943
diff changeset
  2176
            head.addContent(new RawHtml("<![endif]-->"));
bd731341c405 8141492: Implement search feature in javadoc
bpatel
parents: 31943
diff changeset
  2177
            addJQueryFile(head, DocPaths.JQUERY_JS_1_10);
bd731341c405 8141492: Implement search feature in javadoc
bpatel
parents: 31943
diff changeset
  2178
            addJQueryFile(head, DocPaths.JQUERY_JS);
bd731341c405 8141492: Implement search feature in javadoc
bpatel
parents: 31943
diff changeset
  2179
        }
bd731341c405 8141492: Implement search feature in javadoc
bpatel
parents: 31943
diff changeset
  2180
    }
bd731341c405 8141492: Implement search feature in javadoc
bpatel
parents: 31943
diff changeset
  2181
bd731341c405 8141492: Implement search feature in javadoc
bpatel
parents: 31943
diff changeset
  2182
    /**
bd731341c405 8141492: Implement search feature in javadoc
bpatel
parents: 31943
diff changeset
  2183
     * Add a link to the JQuery javascript file.
bd731341c405 8141492: Implement search feature in javadoc
bpatel
parents: 31943
diff changeset
  2184
     *
bd731341c405 8141492: Implement search feature in javadoc
bpatel
parents: 31943
diff changeset
  2185
     * @param head the content tree to which the files will be added
bd731341c405 8141492: Implement search feature in javadoc
bpatel
parents: 31943
diff changeset
  2186
     * @param filePath the DocPath of the file that needs to be added
bd731341c405 8141492: Implement search feature in javadoc
bpatel
parents: 31943
diff changeset
  2187
     */
bd731341c405 8141492: Implement search feature in javadoc
bpatel
parents: 31943
diff changeset
  2188
    private void addJQueryFile(Content head, DocPath filePath) {
bd731341c405 8141492: Implement search feature in javadoc
bpatel
parents: 31943
diff changeset
  2189
        HtmlTree jqyeryScriptFile = HtmlTree.SCRIPT(
bd731341c405 8141492: Implement search feature in javadoc
bpatel
parents: 31943
diff changeset
  2190
                pathToRoot.resolve(DocPaths.JQUERY_FILES.resolve(filePath)).getPath());
bd731341c405 8141492: Implement search feature in javadoc
bpatel
parents: 31943
diff changeset
  2191
        head.addContent(jqyeryScriptFile);
14549
0599d73bf1da 8002304: Group methods by types in methods summary section
bpatel
parents: 14542
diff changeset
  2192
    }
0599d73bf1da 8002304: Group methods by types in methods summary section
bpatel
parents: 14542
diff changeset
  2193
0599d73bf1da 8002304: Group methods by types in methods summary section
bpatel
parents: 14542
diff changeset
  2194
    /**
9303
eae35c201e19 7032975: API files in javax.annotation.processing need to be updated for references to JLS
jjh
parents: 8631
diff changeset
  2195
     * According to
eae35c201e19 7032975: API files in javax.annotation.processing need to be updated for references to JLS
jjh
parents: 8631
diff changeset
  2196
     * <cite>The Java&trade; Language Specification</cite>,
eae35c201e19 7032975: API files in javax.annotation.processing need to be updated for references to JLS
jjh
parents: 8631
diff changeset
  2197
     * all the outer classes and static nested classes are core classes.
10
06bc494ca11e Initial load
duke
parents:
diff changeset
  2198
     */
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  2199
    public boolean isCoreClass(TypeElement typeElement) {
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  2200
        return utils.getEnclosingTypeElement(typeElement) == null || utils.isStatic(typeElement);
10
06bc494ca11e Initial load
duke
parents:
diff changeset
  2201
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
  2202
06bc494ca11e Initial load
duke
parents:
diff changeset
  2203
    /**
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  2204
     * Adds the annotation types for the given packageElement.
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  2205
     *
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  2206
     * @param packageElement the package to write annotations for.
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  2207
     * @param htmltree the documentation tree to which the annotation info will be
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  2208
     *        added
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  2209
     */
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  2210
    public void addAnnotationInfo(PackageElement packageElement, Content htmltree) {
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  2211
        addAnnotationInfo(packageElement, packageElement.getAnnotationMirrors(), htmltree);
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  2212
    }
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  2213
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  2214
    /**
15385
ee1eebe7e210 8006775: JSR 308: Compiler changes in JDK8
jjg
parents: 15035
diff changeset
  2215
     * Add the annotation types of the executable receiver.
ee1eebe7e210 8006775: JSR 308: Compiler changes in JDK8
jjg
parents: 15035
diff changeset
  2216
     *
ee1eebe7e210 8006775: JSR 308: Compiler changes in JDK8
jjg
parents: 15035
diff changeset
  2217
     * @param method the executable to write the receiver annotations for.
16964
096de5815398 8005091: javadoc should be able to return the receiver type
bpatel
parents: 16319
diff changeset
  2218
     * @param descList list of annotation description.
15385
ee1eebe7e210 8006775: JSR 308: Compiler changes in JDK8
jjg
parents: 15035
diff changeset
  2219
     * @param htmltree the documentation tree to which the annotation info will be
ee1eebe7e210 8006775: JSR 308: Compiler changes in JDK8
jjg
parents: 15035
diff changeset
  2220
     *        added
ee1eebe7e210 8006775: JSR 308: Compiler changes in JDK8
jjg
parents: 15035
diff changeset
  2221
     */
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  2222
    public void addReceiverAnnotationInfo(ExecutableElement method, List<AnnotationMirror> descList,
16964
096de5815398 8005091: javadoc should be able to return the receiver type
bpatel
parents: 16319
diff changeset
  2223
            Content htmltree) {
096de5815398 8005091: javadoc should be able to return the receiver type
bpatel
parents: 16319
diff changeset
  2224
        addAnnotationInfo(0, method, descList, false, htmltree);
15385
ee1eebe7e210 8006775: JSR 308: Compiler changes in JDK8
jjg
parents: 15035
diff changeset
  2225
    }
ee1eebe7e210 8006775: JSR 308: Compiler changes in JDK8
jjg
parents: 15035
diff changeset
  2226
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  2227
    /*
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  2228
     * this is a hack to delay dealing with Annotations in the writers, the assumption
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  2229
     * is that all necessary checks have been made to get here.
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  2230
     */
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  2231
    public void addReceiverAnnotationInfo(ExecutableElement method, TypeMirror rcvrTypeMirror,
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  2232
            List<? extends AnnotationMirror> annotationMirrors, Content htmltree) {
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  2233
        TypeMirror rcvrType = method.getReceiverType();
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  2234
        List<? extends AnnotationMirror> annotationMirrors1 = rcvrType.getAnnotationMirrors();
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  2235
        addAnnotationInfo(0, method, annotationMirrors1, false, htmltree);
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  2236
    }
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  2237
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  2238
    /**
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  2239
     * Adds the annotatation types for the given element.
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  2240
     *
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  2241
     * @param element the package to write annotations for
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  2242
     * @param htmltree the content tree to which the annotation types will be added
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  2243
     */
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  2244
    public void addAnnotationInfo(Element element, Content htmltree) {
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  2245
        addAnnotationInfo(element, element.getAnnotationMirrors(), htmltree);
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  2246
    }
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  2247
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  2248
    /**
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  2249
     * Add the annotatation types for the given element and parameter.
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  2250
     *
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  2251
     * @param indent the number of spaces to indent the parameters.
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  2252
     * @param element the element to write annotations for.
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  2253
     * @param param the parameter to write annotations for.
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  2254
     * @param tree the content tree to which the annotation types will be added
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  2255
     */
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  2256
    public boolean addAnnotationInfo(int indent, Element element, VariableElement param,
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  2257
            Content tree) {
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  2258
        return addAnnotationInfo(indent, element, param.getAnnotationMirrors(), false, tree);
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  2259
    }
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  2260
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  2261
    /**
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  2262
     * Adds the annotatation types for the given Element.
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  2263
     *
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  2264
     * @param element the element to write annotations for.
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  2265
     * @param descList the array of {@link AnnotationDesc}.
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  2266
     * @param htmltree the documentation tree to which the annotation info will be
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  2267
     *        added
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  2268
     */
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  2269
    private void addAnnotationInfo(Element element, List<? extends AnnotationMirror> descList,
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  2270
            Content htmltree) {
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  2271
        addAnnotationInfo(0, element, descList, true, htmltree);
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  2272
    }
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  2273
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  2274
    /**
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  2275
     * Adds the annotation types for the given element.
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  2276
     *
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  2277
     * @param indent the number of extra spaces to indent the annotations.
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  2278
     * @param element the element to write annotations for.
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  2279
     * @param descList the array of {@link AnnotationDesc}.
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  2280
     * @param htmltree the documentation tree to which the annotation info will be
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  2281
     *        added
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  2282
     */
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  2283
    private boolean addAnnotationInfo(int indent, Element element,
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  2284
            List<? extends AnnotationMirror> descList, boolean lineBreak, Content htmltree) {
17570
78512b2899db 8012183: replace some uses of Configuration.getText with Configuration.getResource
jjg
parents: 17569
diff changeset
  2285
        List<Content> annotations = getAnnotations(indent, descList, lineBreak);
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  2286
        String sep = "";
17570
78512b2899db 8012183: replace some uses of Configuration.getText with Configuration.getResource
jjg
parents: 17569
diff changeset
  2287
        if (annotations.isEmpty()) {
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  2288
            return false;
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  2289
        }
17570
78512b2899db 8012183: replace some uses of Configuration.getText with Configuration.getResource
jjg
parents: 17569
diff changeset
  2290
        for (Content annotation: annotations) {
16964
096de5815398 8005091: javadoc should be able to return the receiver type
bpatel
parents: 16319
diff changeset
  2291
            htmltree.addContent(sep);
17570
78512b2899db 8012183: replace some uses of Configuration.getText with Configuration.getResource
jjg
parents: 17569
diff changeset
  2292
            htmltree.addContent(annotation);
31943
72b69ab429c9 8062647: Wrong indentation of arguments of annotated methods
igerasim
parents: 31297
diff changeset
  2293
            if (!lineBreak) {
72b69ab429c9 8062647: Wrong indentation of arguments of annotated methods
igerasim
parents: 31297
diff changeset
  2294
                sep = " ";
72b69ab429c9 8062647: Wrong indentation of arguments of annotated methods
igerasim
parents: 31297
diff changeset
  2295
            }
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  2296
        }
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  2297
        return true;
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  2298
    }
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  2299
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  2300
   /**
10
06bc494ca11e Initial load
duke
parents:
diff changeset
  2301
     * Return the string representations of the annotation types for
06bc494ca11e Initial load
duke
parents:
diff changeset
  2302
     * the given doc.
06bc494ca11e Initial load
duke
parents:
diff changeset
  2303
     *
06bc494ca11e Initial load
duke
parents:
diff changeset
  2304
     * @param indent the number of extra spaces to indent the annotations.
06bc494ca11e Initial load
duke
parents:
diff changeset
  2305
     * @param descList the array of {@link AnnotationDesc}.
06bc494ca11e Initial load
duke
parents:
diff changeset
  2306
     * @param linkBreak if true, add new line between each member value.
06bc494ca11e Initial load
duke
parents:
diff changeset
  2307
     * @return an array of strings representing the annotations being
06bc494ca11e Initial load
duke
parents:
diff changeset
  2308
     *         documented.
06bc494ca11e Initial load
duke
parents:
diff changeset
  2309
     */
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  2310
    private List<Content> getAnnotations(int indent, List<? extends AnnotationMirror> descList, boolean linkBreak) {
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  2311
        return getAnnotations(indent, descList, linkBreak, true);
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  2312
    }
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  2313
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  2314
    private List<Content> getAnnotations(int indent, AnnotationMirror amirror, boolean linkBreak) {
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  2315
        List<AnnotationMirror> descList = new ArrayList<>();
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  2316
        descList.add(amirror);
15385
ee1eebe7e210 8006775: JSR 308: Compiler changes in JDK8
jjg
parents: 15035
diff changeset
  2317
        return getAnnotations(indent, descList, linkBreak, true);
ee1eebe7e210 8006775: JSR 308: Compiler changes in JDK8
jjg
parents: 15035
diff changeset
  2318
    }
ee1eebe7e210 8006775: JSR 308: Compiler changes in JDK8
jjg
parents: 15035
diff changeset
  2319
ee1eebe7e210 8006775: JSR 308: Compiler changes in JDK8
jjg
parents: 15035
diff changeset
  2320
    /**
ee1eebe7e210 8006775: JSR 308: Compiler changes in JDK8
jjg
parents: 15035
diff changeset
  2321
     * Return the string representations of the annotation types for
ee1eebe7e210 8006775: JSR 308: Compiler changes in JDK8
jjg
parents: 15035
diff changeset
  2322
     * the given doc.
ee1eebe7e210 8006775: JSR 308: Compiler changes in JDK8
jjg
parents: 15035
diff changeset
  2323
     *
ee1eebe7e210 8006775: JSR 308: Compiler changes in JDK8
jjg
parents: 15035
diff changeset
  2324
     * A {@code null} {@code elementType} indicates that all the
ee1eebe7e210 8006775: JSR 308: Compiler changes in JDK8
jjg
parents: 15035
diff changeset
  2325
     * annotations should be returned without any filtering.
ee1eebe7e210 8006775: JSR 308: Compiler changes in JDK8
jjg
parents: 15035
diff changeset
  2326
     *
ee1eebe7e210 8006775: JSR 308: Compiler changes in JDK8
jjg
parents: 15035
diff changeset
  2327
     * @param indent the number of extra spaces to indent the annotations.
ee1eebe7e210 8006775: JSR 308: Compiler changes in JDK8
jjg
parents: 15035
diff changeset
  2328
     * @param descList the array of {@link AnnotationDesc}.
ee1eebe7e210 8006775: JSR 308: Compiler changes in JDK8
jjg
parents: 15035
diff changeset
  2329
     * @param linkBreak if true, add new line between each member value.
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  2330
     * @param isJava5DeclarationLocation
15385
ee1eebe7e210 8006775: JSR 308: Compiler changes in JDK8
jjg
parents: 15035
diff changeset
  2331
     * @return an array of strings representing the annotations being
ee1eebe7e210 8006775: JSR 308: Compiler changes in JDK8
jjg
parents: 15035
diff changeset
  2332
     *         documented.
ee1eebe7e210 8006775: JSR 308: Compiler changes in JDK8
jjg
parents: 15035
diff changeset
  2333
     */
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  2334
    public List<Content> getAnnotations(int indent, List<? extends AnnotationMirror> descList,
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  2335
            boolean linkBreak, boolean isJava5DeclarationLocation) {
22163
3651128c74eb 8030244: Update langtools to use Diamond
briangoetz
parents: 22160
diff changeset
  2336
        List<Content> results = new ArrayList<>();
17570
78512b2899db 8012183: replace some uses of Configuration.getText with Configuration.getResource
jjg
parents: 17569
diff changeset
  2337
        ContentBuilder annotation;
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  2338
        for (AnnotationMirror aDesc : descList) {
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  2339
            TypeElement annotationElement = (TypeElement)aDesc.getAnnotationType().asElement();
15035
d03c311f44e6 8005092: javadoc should check for synthesized bit on an annotation
bpatel
parents: 14549
diff changeset
  2340
            // If an annotation is not documented, do not add it to the list. If
d03c311f44e6 8005092: javadoc should check for synthesized bit on an annotation
bpatel
parents: 14549
diff changeset
  2341
            // the annotation is of a repeatable type, and if it is not documented
d03c311f44e6 8005092: javadoc should check for synthesized bit on an annotation
bpatel
parents: 14549
diff changeset
  2342
            // and also if its container annotation is not documented, do not add it
d03c311f44e6 8005092: javadoc should check for synthesized bit on an annotation
bpatel
parents: 14549
diff changeset
  2343
            // to the list. If an annotation of a repeatable type is not documented
d03c311f44e6 8005092: javadoc should check for synthesized bit on an annotation
bpatel
parents: 14549
diff changeset
  2344
            // but its container is documented, it will be added to the list.
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  2345
            if (!utils.isDocumentedAnnotation(annotationElement) &&
22159
682da512ec17 8030253: Update langtools to use strings-in-switch
briangoetz
parents: 22153
diff changeset
  2346
                (!isAnnotationDocumented && !isContainerDocumented)) {
10
06bc494ca11e Initial load
duke
parents:
diff changeset
  2347
                continue;
06bc494ca11e Initial load
duke
parents:
diff changeset
  2348
            }
15385
ee1eebe7e210 8006775: JSR 308: Compiler changes in JDK8
jjg
parents: 15035
diff changeset
  2349
            /* TODO: check logic here to correctly handle declaration
ee1eebe7e210 8006775: JSR 308: Compiler changes in JDK8
jjg
parents: 15035
diff changeset
  2350
             * and type annotations.
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  2351
            if  (utils.isDeclarationAnnotation(annotationElement, isJava5DeclarationLocation)) {
15385
ee1eebe7e210 8006775: JSR 308: Compiler changes in JDK8
jjg
parents: 15035
diff changeset
  2352
                continue;
ee1eebe7e210 8006775: JSR 308: Compiler changes in JDK8
jjg
parents: 15035
diff changeset
  2353
            }*/
17570
78512b2899db 8012183: replace some uses of Configuration.getText with Configuration.getResource
jjg
parents: 17569
diff changeset
  2354
            annotation = new ContentBuilder();
15035
d03c311f44e6 8005092: javadoc should check for synthesized bit on an annotation
bpatel
parents: 14549
diff changeset
  2355
            isAnnotationDocumented = false;
14542
7062120649c2 8000800: javadoc uses static non-final fields
jjg
parents: 14368
diff changeset
  2356
            LinkInfoImpl linkInfo = new LinkInfoImpl(configuration,
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  2357
                                                     LinkInfoImpl.Kind.ANNOTATION, annotationElement);
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  2358
            Map<? extends ExecutableElement, ? extends AnnotationValue> pairs = aDesc.getElementValues();
15035
d03c311f44e6 8005092: javadoc should check for synthesized bit on an annotation
bpatel
parents: 14549
diff changeset
  2359
            // If the annotation is synthesized, do not print the container.
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  2360
            if (utils.configuration.workArounds.isSynthesized(aDesc)) {
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  2361
                for (ExecutableElement ee : pairs.keySet()) {
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  2362
                    AnnotationValue annotationValue = pairs.get(ee);
22163
3651128c74eb 8030244: Update langtools to use Diamond
briangoetz
parents: 22160
diff changeset
  2363
                    List<AnnotationValue> annotationTypeValues = new ArrayList<>();
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  2364
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  2365
                    new SimpleAnnotationValueVisitor9<Void, List<AnnotationValue>>() {
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  2366
                        @Override @DefinedBy(Api.LANGUAGE_MODEL)
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  2367
                        public Void visitArray(List<? extends AnnotationValue> vals, List<AnnotationValue> p) {
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  2368
                            p.addAll(vals);
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  2369
                            return null;
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  2370
                        }
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  2371
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  2372
                        @Override @DefinedBy(Api.LANGUAGE_MODEL)
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  2373
                        protected Void defaultAction(Object o, List<AnnotationValue> p) {
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  2374
                            p.add(annotationValue);
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  2375
                            return null;
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  2376
                        }
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  2377
                    }.visit(annotationValue, annotationTypeValues);
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  2378
15035
d03c311f44e6 8005092: javadoc should check for synthesized bit on an annotation
bpatel
parents: 14549
diff changeset
  2379
                    String sep = "";
d03c311f44e6 8005092: javadoc should check for synthesized bit on an annotation
bpatel
parents: 14549
diff changeset
  2380
                    for (AnnotationValue av : annotationTypeValues) {
17570
78512b2899db 8012183: replace some uses of Configuration.getText with Configuration.getResource
jjg
parents: 17569
diff changeset
  2381
                        annotation.addContent(sep);
78512b2899db 8012183: replace some uses of Configuration.getText with Configuration.getResource
jjg
parents: 17569
diff changeset
  2382
                        annotation.addContent(annotationValueToContent(av));
15035
d03c311f44e6 8005092: javadoc should check for synthesized bit on an annotation
bpatel
parents: 14549
diff changeset
  2383
                        sep = " ";
10
06bc494ca11e Initial load
duke
parents:
diff changeset
  2384
                    }
06bc494ca11e Initial load
duke
parents:
diff changeset
  2385
                }
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  2386
            } else if (isAnnotationArray(pairs)) {
15035
d03c311f44e6 8005092: javadoc should check for synthesized bit on an annotation
bpatel
parents: 14549
diff changeset
  2387
                // If the container has 1 or more value defined and if the
d03c311f44e6 8005092: javadoc should check for synthesized bit on an annotation
bpatel
parents: 14549
diff changeset
  2388
                // repeatable type annotation is not documented, do not print
d03c311f44e6 8005092: javadoc should check for synthesized bit on an annotation
bpatel
parents: 14549
diff changeset
  2389
                // the container.
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  2390
                if (pairs.size() == 1 && isAnnotationDocumented) {
22163
3651128c74eb 8030244: Update langtools to use Diamond
briangoetz
parents: 22160
diff changeset
  2391
                    List<AnnotationValue> annotationTypeValues = new ArrayList<>();
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  2392
                    for (AnnotationValue a :  pairs.values()) {
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  2393
                        new SimpleAnnotationValueVisitor9<Void, List<AnnotationValue>>() {
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  2394
                            @Override @DefinedBy(Api.LANGUAGE_MODEL)
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  2395
                            public Void visitArray(List<? extends AnnotationValue> vals, List<AnnotationValue> annotationTypeValues) {
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  2396
                               for (AnnotationValue av : vals) {
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  2397
                                   annotationTypeValues.add(av);
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  2398
                               }
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  2399
                               return null;
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  2400
                            }
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  2401
                        }.visit(a, annotationTypeValues);
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  2402
                    }
15035
d03c311f44e6 8005092: javadoc should check for synthesized bit on an annotation
bpatel
parents: 14549
diff changeset
  2403
                    String sep = "";
d03c311f44e6 8005092: javadoc should check for synthesized bit on an annotation
bpatel
parents: 14549
diff changeset
  2404
                    for (AnnotationValue av : annotationTypeValues) {
17570
78512b2899db 8012183: replace some uses of Configuration.getText with Configuration.getResource
jjg
parents: 17569
diff changeset
  2405
                        annotation.addContent(sep);
78512b2899db 8012183: replace some uses of Configuration.getText with Configuration.getResource
jjg
parents: 17569
diff changeset
  2406
                        annotation.addContent(annotationValueToContent(av));
15035
d03c311f44e6 8005092: javadoc should check for synthesized bit on an annotation
bpatel
parents: 14549
diff changeset
  2407
                        sep = " ";
d03c311f44e6 8005092: javadoc should check for synthesized bit on an annotation
bpatel
parents: 14549
diff changeset
  2408
                    }
d03c311f44e6 8005092: javadoc should check for synthesized bit on an annotation
bpatel
parents: 14549
diff changeset
  2409
                }
d03c311f44e6 8005092: javadoc should check for synthesized bit on an annotation
bpatel
parents: 14549
diff changeset
  2410
                // If the container has 1 or more value defined and if the
d03c311f44e6 8005092: javadoc should check for synthesized bit on an annotation
bpatel
parents: 14549
diff changeset
  2411
                // repeatable type annotation is not documented, print the container.
d03c311f44e6 8005092: javadoc should check for synthesized bit on an annotation
bpatel
parents: 14549
diff changeset
  2412
                else {
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  2413
                    addAnnotations(annotationElement, linkInfo, annotation, pairs,
22159
682da512ec17 8030253: Update langtools to use strings-in-switch
briangoetz
parents: 22153
diff changeset
  2414
                                   indent, false);
15035
d03c311f44e6 8005092: javadoc should check for synthesized bit on an annotation
bpatel
parents: 14549
diff changeset
  2415
                }
d03c311f44e6 8005092: javadoc should check for synthesized bit on an annotation
bpatel
parents: 14549
diff changeset
  2416
            }
d03c311f44e6 8005092: javadoc should check for synthesized bit on an annotation
bpatel
parents: 14549
diff changeset
  2417
            else {
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  2418
                addAnnotations(annotationElement, linkInfo, annotation, pairs,
22159
682da512ec17 8030253: Update langtools to use strings-in-switch
briangoetz
parents: 22153
diff changeset
  2419
                               indent, linkBreak);
10
06bc494ca11e Initial load
duke
parents:
diff changeset
  2420
            }
17570
78512b2899db 8012183: replace some uses of Configuration.getText with Configuration.getResource
jjg
parents: 17569
diff changeset
  2421
            annotation.addContent(linkBreak ? DocletConstants.NL : "");
78512b2899db 8012183: replace some uses of Configuration.getText with Configuration.getResource
jjg
parents: 17569
diff changeset
  2422
            results.add(annotation);
10
06bc494ca11e Initial load
duke
parents:
diff changeset
  2423
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
  2424
        return results;
06bc494ca11e Initial load
duke
parents:
diff changeset
  2425
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
  2426
15035
d03c311f44e6 8005092: javadoc should check for synthesized bit on an annotation
bpatel
parents: 14549
diff changeset
  2427
    /**
d03c311f44e6 8005092: javadoc should check for synthesized bit on an annotation
bpatel
parents: 14549
diff changeset
  2428
     * Add annotation to the annotation string.
d03c311f44e6 8005092: javadoc should check for synthesized bit on an annotation
bpatel
parents: 14549
diff changeset
  2429
     *
d03c311f44e6 8005092: javadoc should check for synthesized bit on an annotation
bpatel
parents: 14549
diff changeset
  2430
     * @param annotationDoc the annotation being documented
d03c311f44e6 8005092: javadoc should check for synthesized bit on an annotation
bpatel
parents: 14549
diff changeset
  2431
     * @param linkInfo the information about the link
d03c311f44e6 8005092: javadoc should check for synthesized bit on an annotation
bpatel
parents: 14549
diff changeset
  2432
     * @param annotation the annotation string to which the annotation will be added
d03c311f44e6 8005092: javadoc should check for synthesized bit on an annotation
bpatel
parents: 14549
diff changeset
  2433
     * @param pairs annotation type element and value pairs
d03c311f44e6 8005092: javadoc should check for synthesized bit on an annotation
bpatel
parents: 14549
diff changeset
  2434
     * @param indent the number of extra spaces to indent the annotations.
d03c311f44e6 8005092: javadoc should check for synthesized bit on an annotation
bpatel
parents: 14549
diff changeset
  2435
     * @param linkBreak if true, add new line between each member value
d03c311f44e6 8005092: javadoc should check for synthesized bit on an annotation
bpatel
parents: 14549
diff changeset
  2436
     */
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  2437
    private void addAnnotations(TypeElement annotationDoc, LinkInfoImpl linkInfo,
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  2438
        ContentBuilder annotation, Map<? extends ExecutableElement,? extends AnnotationValue>map,
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  2439
        int indent, boolean linkBreak) {
36500
d31e4986dc8b 8149139: [javadoc] Modify Content to accept CharSequence
ksrini
parents: 36038
diff changeset
  2440
        linkInfo.label = new StringContent("@");
d31e4986dc8b 8149139: [javadoc] Modify Content to accept CharSequence
ksrini
parents: 36038
diff changeset
  2441
        linkInfo.label.addContent(annotationDoc.getSimpleName());
17570
78512b2899db 8012183: replace some uses of Configuration.getText with Configuration.getResource
jjg
parents: 17569
diff changeset
  2442
        annotation.addContent(getLink(linkInfo));
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  2443
        if (!map.isEmpty()) {
17570
78512b2899db 8012183: replace some uses of Configuration.getText with Configuration.getResource
jjg
parents: 17569
diff changeset
  2444
            annotation.addContent("(");
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  2445
            boolean isFirst = true;
36038
39c5445924b9 6469561: javadoc for annotation types should not display "public abstract" modifiers on methods
darcy
parents: 35426
diff changeset
  2446
            Set<? extends ExecutableElement> keys = map.keySet();
39c5445924b9 6469561: javadoc for annotation types should not display "public abstract" modifiers on methods
darcy
parents: 35426
diff changeset
  2447
            boolean multipleValues = keys.size() > 1;
39c5445924b9 6469561: javadoc for annotation types should not display "public abstract" modifiers on methods
darcy
parents: 35426
diff changeset
  2448
            for (ExecutableElement element : keys) {
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  2449
                if (isFirst) {
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  2450
                    isFirst = false;
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  2451
                } else {
17570
78512b2899db 8012183: replace some uses of Configuration.getText with Configuration.getResource
jjg
parents: 17569
diff changeset
  2452
                    annotation.addContent(",");
15035
d03c311f44e6 8005092: javadoc should check for synthesized bit on an annotation
bpatel
parents: 14549
diff changeset
  2453
                    if (linkBreak) {
17570
78512b2899db 8012183: replace some uses of Configuration.getText with Configuration.getResource
jjg
parents: 17569
diff changeset
  2454
                        annotation.addContent(DocletConstants.NL);
36500
d31e4986dc8b 8149139: [javadoc] Modify Content to accept CharSequence
ksrini
parents: 36038
diff changeset
  2455
                        int spaces = annotationDoc.getSimpleName().length() + 2;
15035
d03c311f44e6 8005092: javadoc should check for synthesized bit on an annotation
bpatel
parents: 14549
diff changeset
  2456
                        for (int k = 0; k < (spaces + indent); k++) {
17570
78512b2899db 8012183: replace some uses of Configuration.getText with Configuration.getResource
jjg
parents: 17569
diff changeset
  2457
                            annotation.addContent(" ");
15035
d03c311f44e6 8005092: javadoc should check for synthesized bit on an annotation
bpatel
parents: 14549
diff changeset
  2458
                        }
d03c311f44e6 8005092: javadoc should check for synthesized bit on an annotation
bpatel
parents: 14549
diff changeset
  2459
                    }
d03c311f44e6 8005092: javadoc should check for synthesized bit on an annotation
bpatel
parents: 14549
diff changeset
  2460
                }
36038
39c5445924b9 6469561: javadoc for annotation types should not display "public abstract" modifiers on methods
darcy
parents: 35426
diff changeset
  2461
                String simpleName = element.getSimpleName().toString();
39c5445924b9 6469561: javadoc for annotation types should not display "public abstract" modifiers on methods
darcy
parents: 35426
diff changeset
  2462
                if (multipleValues || !"value".equals(simpleName)) { // Omit "value=" where unnecessary
39c5445924b9 6469561: javadoc for annotation types should not display "public abstract" modifiers on methods
darcy
parents: 35426
diff changeset
  2463
                    annotation.addContent(getDocLink(LinkInfoImpl.Kind.ANNOTATION,
39c5445924b9 6469561: javadoc for annotation types should not display "public abstract" modifiers on methods
darcy
parents: 35426
diff changeset
  2464
                                                     element, simpleName, false));
39c5445924b9 6469561: javadoc for annotation types should not display "public abstract" modifiers on methods
darcy
parents: 35426
diff changeset
  2465
                    annotation.addContent("=");
39c5445924b9 6469561: javadoc for annotation types should not display "public abstract" modifiers on methods
darcy
parents: 35426
diff changeset
  2466
                }
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  2467
                AnnotationValue annotationValue = map.get(element);
22163
3651128c74eb 8030244: Update langtools to use Diamond
briangoetz
parents: 22160
diff changeset
  2468
                List<AnnotationValue> annotationTypeValues = new ArrayList<>();
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  2469
                new SimpleAnnotationValueVisitor9<Void, AnnotationValue>() {
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  2470
                    @Override @DefinedBy(Api.LANGUAGE_MODEL)
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  2471
                    public Void visitArray(List<? extends AnnotationValue> vals, AnnotationValue p) {
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  2472
                        annotationTypeValues.addAll(vals);
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  2473
                        return null;
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  2474
                    }
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  2475
                    @Override @DefinedBy(Api.LANGUAGE_MODEL)
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  2476
                    protected Void defaultAction(Object o, AnnotationValue p) {
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  2477
                        annotationTypeValues.add(p);
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  2478
                        return null;
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  2479
                    }
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  2480
                }.visit(annotationValue, annotationValue);
17570
78512b2899db 8012183: replace some uses of Configuration.getText with Configuration.getResource
jjg
parents: 17569
diff changeset
  2481
                annotation.addContent(annotationTypeValues.size() == 1 ? "" : "{");
15035
d03c311f44e6 8005092: javadoc should check for synthesized bit on an annotation
bpatel
parents: 14549
diff changeset
  2482
                String sep = "";
d03c311f44e6 8005092: javadoc should check for synthesized bit on an annotation
bpatel
parents: 14549
diff changeset
  2483
                for (AnnotationValue av : annotationTypeValues) {
17570
78512b2899db 8012183: replace some uses of Configuration.getText with Configuration.getResource
jjg
parents: 17569
diff changeset
  2484
                    annotation.addContent(sep);
78512b2899db 8012183: replace some uses of Configuration.getText with Configuration.getResource
jjg
parents: 17569
diff changeset
  2485
                    annotation.addContent(annotationValueToContent(av));
15035
d03c311f44e6 8005092: javadoc should check for synthesized bit on an annotation
bpatel
parents: 14549
diff changeset
  2486
                    sep = ",";
d03c311f44e6 8005092: javadoc should check for synthesized bit on an annotation
bpatel
parents: 14549
diff changeset
  2487
                }
17570
78512b2899db 8012183: replace some uses of Configuration.getText with Configuration.getResource
jjg
parents: 17569
diff changeset
  2488
                annotation.addContent(annotationTypeValues.size() == 1 ? "" : "}");
15035
d03c311f44e6 8005092: javadoc should check for synthesized bit on an annotation
bpatel
parents: 14549
diff changeset
  2489
                isContainerDocumented = false;
d03c311f44e6 8005092: javadoc should check for synthesized bit on an annotation
bpatel
parents: 14549
diff changeset
  2490
            }
17570
78512b2899db 8012183: replace some uses of Configuration.getText with Configuration.getResource
jjg
parents: 17569
diff changeset
  2491
            annotation.addContent(")");
15035
d03c311f44e6 8005092: javadoc should check for synthesized bit on an annotation
bpatel
parents: 14549
diff changeset
  2492
        }
d03c311f44e6 8005092: javadoc should check for synthesized bit on an annotation
bpatel
parents: 14549
diff changeset
  2493
    }
d03c311f44e6 8005092: javadoc should check for synthesized bit on an annotation
bpatel
parents: 14549
diff changeset
  2494
d03c311f44e6 8005092: javadoc should check for synthesized bit on an annotation
bpatel
parents: 14549
diff changeset
  2495
    /**
d03c311f44e6 8005092: javadoc should check for synthesized bit on an annotation
bpatel
parents: 14549
diff changeset
  2496
     * Check if the annotation contains an array of annotation as a value. This
d03c311f44e6 8005092: javadoc should check for synthesized bit on an annotation
bpatel
parents: 14549
diff changeset
  2497
     * check is to verify if a repeatable type annotation is present or not.
d03c311f44e6 8005092: javadoc should check for synthesized bit on an annotation
bpatel
parents: 14549
diff changeset
  2498
     *
d03c311f44e6 8005092: javadoc should check for synthesized bit on an annotation
bpatel
parents: 14549
diff changeset
  2499
     * @param pairs annotation type element and value pairs
d03c311f44e6 8005092: javadoc should check for synthesized bit on an annotation
bpatel
parents: 14549
diff changeset
  2500
     *
d03c311f44e6 8005092: javadoc should check for synthesized bit on an annotation
bpatel
parents: 14549
diff changeset
  2501
     * @return true if the annotation contains an array of annotation as a value.
d03c311f44e6 8005092: javadoc should check for synthesized bit on an annotation
bpatel
parents: 14549
diff changeset
  2502
     */
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  2503
    private boolean isAnnotationArray(Map<? extends ExecutableElement, ? extends AnnotationValue> pairs) {
15035
d03c311f44e6 8005092: javadoc should check for synthesized bit on an annotation
bpatel
parents: 14549
diff changeset
  2504
        AnnotationValue annotationValue;
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  2505
        for (ExecutableElement ee : pairs.keySet()) {
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  2506
            annotationValue = pairs.get(ee);
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  2507
            boolean rvalue = new SimpleAnnotationValueVisitor9<Boolean, Void>() {
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  2508
                @Override @DefinedBy(Api.LANGUAGE_MODEL)
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  2509
                public Boolean visitArray(List<? extends AnnotationValue> vals, Void p) {
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  2510
                    if (vals.size() > 1) {
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  2511
                        if (vals.get(0) instanceof AnnotationMirror) {
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  2512
                            isContainerDocumented = true;
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  2513
                            return new SimpleAnnotationValueVisitor9<Boolean, Void>() {
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  2514
                                @Override @DefinedBy(Api.LANGUAGE_MODEL)
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  2515
                                public Boolean visitAnnotation(AnnotationMirror a, Void p) {
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  2516
                                    isContainerDocumented = true;
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  2517
                                    Element asElement = a.getAnnotationType().asElement();
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  2518
                                    if (utils.isDocumentedAnnotation((TypeElement)asElement)) {
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  2519
                                        isAnnotationDocumented = true;
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  2520
                                    }
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  2521
                                    return true;
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  2522
                                }
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  2523
                                @Override @DefinedBy(Api.LANGUAGE_MODEL)
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  2524
                                protected Boolean defaultAction(Object o, Void p) {
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  2525
                                    return false;
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  2526
                                }
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  2527
                            }.visit(vals.get(0));
15035
d03c311f44e6 8005092: javadoc should check for synthesized bit on an annotation
bpatel
parents: 14549
diff changeset
  2528
                        }
d03c311f44e6 8005092: javadoc should check for synthesized bit on an annotation
bpatel
parents: 14549
diff changeset
  2529
                    }
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  2530
                    return false;
15035
d03c311f44e6 8005092: javadoc should check for synthesized bit on an annotation
bpatel
parents: 14549
diff changeset
  2531
                }
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  2532
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  2533
                @Override @DefinedBy(Api.LANGUAGE_MODEL)
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  2534
                protected Boolean defaultAction(Object o, Void p) {
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  2535
                    return false;
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  2536
                }
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  2537
            }.visit(annotationValue);
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  2538
            if (rvalue) {
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  2539
                return true;
15035
d03c311f44e6 8005092: javadoc should check for synthesized bit on an annotation
bpatel
parents: 14549
diff changeset
  2540
            }
d03c311f44e6 8005092: javadoc should check for synthesized bit on an annotation
bpatel
parents: 14549
diff changeset
  2541
        }
d03c311f44e6 8005092: javadoc should check for synthesized bit on an annotation
bpatel
parents: 14549
diff changeset
  2542
        return false;
d03c311f44e6 8005092: javadoc should check for synthesized bit on an annotation
bpatel
parents: 14549
diff changeset
  2543
    }
d03c311f44e6 8005092: javadoc should check for synthesized bit on an annotation
bpatel
parents: 14549
diff changeset
  2544
17570
78512b2899db 8012183: replace some uses of Configuration.getText with Configuration.getResource
jjg
parents: 17569
diff changeset
  2545
    private Content annotationValueToContent(AnnotationValue annotationValue) {
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  2546
        return new SimpleAnnotationValueVisitor9<Content, Void>() {
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  2547
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  2548
            @Override @DefinedBy(Api.LANGUAGE_MODEL)
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  2549
            public Content visitType(TypeMirror t, Void p) {
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  2550
                return new SimpleTypeVisitor9<Content, Void>() {
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  2551
                    @Override @DefinedBy(Api.LANGUAGE_MODEL)
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  2552
                    public Content visitDeclared(DeclaredType t, Void p) {
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  2553
                        LinkInfoImpl linkInfo = new LinkInfoImpl(configuration,
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  2554
                                LinkInfoImpl.Kind.ANNOTATION, t);
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  2555
                        String name = utils.isIncluded(t.asElement())
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  2556
                                ? t.asElement().getSimpleName().toString()
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  2557
                                : utils.getFullyQualifiedName(t.asElement());
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  2558
                        linkInfo.label = new StringContent(name + utils.getDimension(t) + ".class");
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  2559
                        return getLink(linkInfo);
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  2560
                    }
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  2561
                    @Override @DefinedBy(Api.LANGUAGE_MODEL)
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  2562
                    protected Content defaultAction(TypeMirror e, Void p) {
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  2563
                        return new StringContent(t + utils.getDimension(t) + ".class");
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  2564
                    }
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  2565
                }.visit(t);
10
06bc494ca11e Initial load
duke
parents:
diff changeset
  2566
            }
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  2567
            @Override @DefinedBy(Api.LANGUAGE_MODEL)
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  2568
            public Content visitAnnotation(AnnotationMirror a, Void p) {
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  2569
                List<Content> list = getAnnotations(0, a, false);
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  2570
                ContentBuilder buf = new ContentBuilder();
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  2571
                for (Content c : list) {
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  2572
                    buf.addContent(c);
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  2573
                }
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  2574
                return buf;
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  2575
            }
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  2576
            @Override @DefinedBy(Api.LANGUAGE_MODEL)
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  2577
            public Content visitEnumConstant(VariableElement c, Void p) {
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  2578
                return getDocLink(LinkInfoImpl.Kind.ANNOTATION,
36500
d31e4986dc8b 8149139: [javadoc] Modify Content to accept CharSequence
ksrini
parents: 36038
diff changeset
  2579
                        c, c.getSimpleName(), false);
10
06bc494ca11e Initial load
duke
parents:
diff changeset
  2580
            }
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  2581
            @Override @DefinedBy(Api.LANGUAGE_MODEL)
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  2582
            public Content visitArray(List<? extends AnnotationValue> vals, Void p) {
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  2583
                ContentBuilder buf = new ContentBuilder();
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  2584
                String sep = "";
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  2585
                for (AnnotationValue av : vals) {
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  2586
                    buf.addContent(sep);
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  2587
                    buf.addContent(visit(av));
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  2588
                    sep = " ";
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  2589
                }
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  2590
                return buf;
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  2591
            }
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  2592
            @Override @DefinedBy(Api.LANGUAGE_MODEL)
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  2593
            protected Content defaultAction(Object o, Void p) {
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  2594
                return new StringContent(annotationValue.toString());
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  2595
            }
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  2596
        }.visit(annotationValue);
10
06bc494ca11e Initial load
duke
parents:
diff changeset
  2597
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
  2598
06bc494ca11e Initial load
duke
parents:
diff changeset
  2599
    /**
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
  2600
     * Return the configuration for this doclet.
10
06bc494ca11e Initial load
duke
parents:
diff changeset
  2601
     *
06bc494ca11e Initial load
duke
parents:
diff changeset
  2602
     * @return the configuration for this doclet.
06bc494ca11e Initial load
duke
parents:
diff changeset
  2603
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
  2604
    public Configuration configuration() {
06bc494ca11e Initial load
duke
parents:
diff changeset
  2605
        return configuration;
06bc494ca11e Initial load
duke
parents:
diff changeset
  2606
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
  2607
}