langtools/src/share/classes/com/sun/tools/doclets/formats/html/ProfilePackageWriterImpl.java
author bpatel
Mon, 21 Jan 2013 00:45:35 -0500
changeset 15723 58a73dac9ee4
child 21008 af0b915df7cc
permissions -rw-r--r--
8006124: javadoc/doclet should be updated to support profiles Reviewed-by: jjg
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
15723
58a73dac9ee4 8006124: javadoc/doclet should be updated to support profiles
bpatel
parents:
diff changeset
     1
/*
58a73dac9ee4 8006124: javadoc/doclet should be updated to support profiles
bpatel
parents:
diff changeset
     2
 * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
58a73dac9ee4 8006124: javadoc/doclet should be updated to support profiles
bpatel
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
58a73dac9ee4 8006124: javadoc/doclet should be updated to support profiles
bpatel
parents:
diff changeset
     4
 *
58a73dac9ee4 8006124: javadoc/doclet should be updated to support profiles
bpatel
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
58a73dac9ee4 8006124: javadoc/doclet should be updated to support profiles
bpatel
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
58a73dac9ee4 8006124: javadoc/doclet should be updated to support profiles
bpatel
parents:
diff changeset
     7
 * published by the Free Software Foundation.  Oracle designates this
58a73dac9ee4 8006124: javadoc/doclet should be updated to support profiles
bpatel
parents:
diff changeset
     8
 * particular file as subject to the "Classpath" exception as provided
58a73dac9ee4 8006124: javadoc/doclet should be updated to support profiles
bpatel
parents:
diff changeset
     9
 * by Oracle in the LICENSE file that accompanied this code.
58a73dac9ee4 8006124: javadoc/doclet should be updated to support profiles
bpatel
parents:
diff changeset
    10
 *
58a73dac9ee4 8006124: javadoc/doclet should be updated to support profiles
bpatel
parents:
diff changeset
    11
 * This code is distributed in the hope that it will be useful, but WITHOUT
58a73dac9ee4 8006124: javadoc/doclet should be updated to support profiles
bpatel
parents:
diff changeset
    12
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
58a73dac9ee4 8006124: javadoc/doclet should be updated to support profiles
bpatel
parents:
diff changeset
    13
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
58a73dac9ee4 8006124: javadoc/doclet should be updated to support profiles
bpatel
parents:
diff changeset
    14
 * version 2 for more details (a copy is included in the LICENSE file that
58a73dac9ee4 8006124: javadoc/doclet should be updated to support profiles
bpatel
parents:
diff changeset
    15
 * accompanied this code).
58a73dac9ee4 8006124: javadoc/doclet should be updated to support profiles
bpatel
parents:
diff changeset
    16
 *
58a73dac9ee4 8006124: javadoc/doclet should be updated to support profiles
bpatel
parents:
diff changeset
    17
 * You should have received a copy of the GNU General Public License version
58a73dac9ee4 8006124: javadoc/doclet should be updated to support profiles
bpatel
parents:
diff changeset
    18
 * 2 along with this work; if not, write to the Free Software Foundation,
58a73dac9ee4 8006124: javadoc/doclet should be updated to support profiles
bpatel
parents:
diff changeset
    19
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
58a73dac9ee4 8006124: javadoc/doclet should be updated to support profiles
bpatel
parents:
diff changeset
    20
 *
58a73dac9ee4 8006124: javadoc/doclet should be updated to support profiles
bpatel
parents:
diff changeset
    21
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
58a73dac9ee4 8006124: javadoc/doclet should be updated to support profiles
bpatel
parents:
diff changeset
    22
 * or visit www.oracle.com if you need additional information or have any
58a73dac9ee4 8006124: javadoc/doclet should be updated to support profiles
bpatel
parents:
diff changeset
    23
 * questions.
58a73dac9ee4 8006124: javadoc/doclet should be updated to support profiles
bpatel
parents:
diff changeset
    24
 */
58a73dac9ee4 8006124: javadoc/doclet should be updated to support profiles
bpatel
parents:
diff changeset
    25
58a73dac9ee4 8006124: javadoc/doclet should be updated to support profiles
bpatel
parents:
diff changeset
    26
package com.sun.tools.doclets.formats.html;
58a73dac9ee4 8006124: javadoc/doclet should be updated to support profiles
bpatel
parents:
diff changeset
    27
58a73dac9ee4 8006124: javadoc/doclet should be updated to support profiles
bpatel
parents:
diff changeset
    28
import java.io.*;
58a73dac9ee4 8006124: javadoc/doclet should be updated to support profiles
bpatel
parents:
diff changeset
    29
import java.util.*;
58a73dac9ee4 8006124: javadoc/doclet should be updated to support profiles
bpatel
parents:
diff changeset
    30
58a73dac9ee4 8006124: javadoc/doclet should be updated to support profiles
bpatel
parents:
diff changeset
    31
import com.sun.javadoc.*;
58a73dac9ee4 8006124: javadoc/doclet should be updated to support profiles
bpatel
parents:
diff changeset
    32
import com.sun.tools.javac.jvm.Profile;
58a73dac9ee4 8006124: javadoc/doclet should be updated to support profiles
bpatel
parents:
diff changeset
    33
import com.sun.tools.doclets.formats.html.markup.*;
58a73dac9ee4 8006124: javadoc/doclet should be updated to support profiles
bpatel
parents:
diff changeset
    34
import com.sun.tools.doclets.internal.toolkit.*;
58a73dac9ee4 8006124: javadoc/doclet should be updated to support profiles
bpatel
parents:
diff changeset
    35
import com.sun.tools.doclets.internal.toolkit.util.*;
58a73dac9ee4 8006124: javadoc/doclet should be updated to support profiles
bpatel
parents:
diff changeset
    36
58a73dac9ee4 8006124: javadoc/doclet should be updated to support profiles
bpatel
parents:
diff changeset
    37
/**
58a73dac9ee4 8006124: javadoc/doclet should be updated to support profiles
bpatel
parents:
diff changeset
    38
 * Class to generate file for each profile package contents in the right-hand
58a73dac9ee4 8006124: javadoc/doclet should be updated to support profiles
bpatel
parents:
diff changeset
    39
 * frame. This will list all the Class Kinds in the package. A click on any
58a73dac9ee4 8006124: javadoc/doclet should be updated to support profiles
bpatel
parents:
diff changeset
    40
 * class-kind will update the frame with the clicked class-kind page.
58a73dac9ee4 8006124: javadoc/doclet should be updated to support profiles
bpatel
parents:
diff changeset
    41
 *
58a73dac9ee4 8006124: javadoc/doclet should be updated to support profiles
bpatel
parents:
diff changeset
    42
 *  <p><b>This is NOT part of any supported API.
58a73dac9ee4 8006124: javadoc/doclet should be updated to support profiles
bpatel
parents:
diff changeset
    43
 *  If you write code that depends on this, you do so at your own risk.
58a73dac9ee4 8006124: javadoc/doclet should be updated to support profiles
bpatel
parents:
diff changeset
    44
 *  This code and its internal interfaces are subject to change or
58a73dac9ee4 8006124: javadoc/doclet should be updated to support profiles
bpatel
parents:
diff changeset
    45
 *  deletion without notice.</b>
58a73dac9ee4 8006124: javadoc/doclet should be updated to support profiles
bpatel
parents:
diff changeset
    46
 *
58a73dac9ee4 8006124: javadoc/doclet should be updated to support profiles
bpatel
parents:
diff changeset
    47
 * @author Bhavesh Patel
58a73dac9ee4 8006124: javadoc/doclet should be updated to support profiles
bpatel
parents:
diff changeset
    48
 */
58a73dac9ee4 8006124: javadoc/doclet should be updated to support profiles
bpatel
parents:
diff changeset
    49
public class ProfilePackageWriterImpl extends HtmlDocletWriter
58a73dac9ee4 8006124: javadoc/doclet should be updated to support profiles
bpatel
parents:
diff changeset
    50
    implements ProfilePackageSummaryWriter {
58a73dac9ee4 8006124: javadoc/doclet should be updated to support profiles
bpatel
parents:
diff changeset
    51
58a73dac9ee4 8006124: javadoc/doclet should be updated to support profiles
bpatel
parents:
diff changeset
    52
    /**
58a73dac9ee4 8006124: javadoc/doclet should be updated to support profiles
bpatel
parents:
diff changeset
    53
     * The prev package name in the alpha-order list.
58a73dac9ee4 8006124: javadoc/doclet should be updated to support profiles
bpatel
parents:
diff changeset
    54
     */
58a73dac9ee4 8006124: javadoc/doclet should be updated to support profiles
bpatel
parents:
diff changeset
    55
    protected PackageDoc prev;
58a73dac9ee4 8006124: javadoc/doclet should be updated to support profiles
bpatel
parents:
diff changeset
    56
58a73dac9ee4 8006124: javadoc/doclet should be updated to support profiles
bpatel
parents:
diff changeset
    57
    /**
58a73dac9ee4 8006124: javadoc/doclet should be updated to support profiles
bpatel
parents:
diff changeset
    58
     * The next package name in the alpha-order list.
58a73dac9ee4 8006124: javadoc/doclet should be updated to support profiles
bpatel
parents:
diff changeset
    59
     */
58a73dac9ee4 8006124: javadoc/doclet should be updated to support profiles
bpatel
parents:
diff changeset
    60
    protected PackageDoc next;
58a73dac9ee4 8006124: javadoc/doclet should be updated to support profiles
bpatel
parents:
diff changeset
    61
58a73dac9ee4 8006124: javadoc/doclet should be updated to support profiles
bpatel
parents:
diff changeset
    62
    /**
58a73dac9ee4 8006124: javadoc/doclet should be updated to support profiles
bpatel
parents:
diff changeset
    63
     * The profile package being documented.
58a73dac9ee4 8006124: javadoc/doclet should be updated to support profiles
bpatel
parents:
diff changeset
    64
     */
58a73dac9ee4 8006124: javadoc/doclet should be updated to support profiles
bpatel
parents:
diff changeset
    65
    protected PackageDoc packageDoc;
58a73dac9ee4 8006124: javadoc/doclet should be updated to support profiles
bpatel
parents:
diff changeset
    66
58a73dac9ee4 8006124: javadoc/doclet should be updated to support profiles
bpatel
parents:
diff changeset
    67
    /**
58a73dac9ee4 8006124: javadoc/doclet should be updated to support profiles
bpatel
parents:
diff changeset
    68
     * The name of the profile being documented.
58a73dac9ee4 8006124: javadoc/doclet should be updated to support profiles
bpatel
parents:
diff changeset
    69
     */
58a73dac9ee4 8006124: javadoc/doclet should be updated to support profiles
bpatel
parents:
diff changeset
    70
    protected String profileName;
58a73dac9ee4 8006124: javadoc/doclet should be updated to support profiles
bpatel
parents:
diff changeset
    71
58a73dac9ee4 8006124: javadoc/doclet should be updated to support profiles
bpatel
parents:
diff changeset
    72
    /**
58a73dac9ee4 8006124: javadoc/doclet should be updated to support profiles
bpatel
parents:
diff changeset
    73
     * The value of the profile being documented.
58a73dac9ee4 8006124: javadoc/doclet should be updated to support profiles
bpatel
parents:
diff changeset
    74
     */
58a73dac9ee4 8006124: javadoc/doclet should be updated to support profiles
bpatel
parents:
diff changeset
    75
    protected int profileValue;
58a73dac9ee4 8006124: javadoc/doclet should be updated to support profiles
bpatel
parents:
diff changeset
    76
58a73dac9ee4 8006124: javadoc/doclet should be updated to support profiles
bpatel
parents:
diff changeset
    77
    /**
58a73dac9ee4 8006124: javadoc/doclet should be updated to support profiles
bpatel
parents:
diff changeset
    78
     * Constructor to construct ProfilePackageWriter object and to generate
58a73dac9ee4 8006124: javadoc/doclet should be updated to support profiles
bpatel
parents:
diff changeset
    79
     * "profilename-package-summary.html" file in the respective package directory.
58a73dac9ee4 8006124: javadoc/doclet should be updated to support profiles
bpatel
parents:
diff changeset
    80
     * For example for profile compact1 and package "java.lang" this will generate file
58a73dac9ee4 8006124: javadoc/doclet should be updated to support profiles
bpatel
parents:
diff changeset
    81
     * "compact1-package-summary.html" file in the "java/lang" directory. It will also
58a73dac9ee4 8006124: javadoc/doclet should be updated to support profiles
bpatel
parents:
diff changeset
    82
     * create "java/lang" directory in the current or the destination directory
58a73dac9ee4 8006124: javadoc/doclet should be updated to support profiles
bpatel
parents:
diff changeset
    83
     * if it doesn't exist.
58a73dac9ee4 8006124: javadoc/doclet should be updated to support profiles
bpatel
parents:
diff changeset
    84
     *
58a73dac9ee4 8006124: javadoc/doclet should be updated to support profiles
bpatel
parents:
diff changeset
    85
     * @param configuration the configuration of the doclet.
58a73dac9ee4 8006124: javadoc/doclet should be updated to support profiles
bpatel
parents:
diff changeset
    86
     * @param packageDoc    PackageDoc under consideration.
58a73dac9ee4 8006124: javadoc/doclet should be updated to support profiles
bpatel
parents:
diff changeset
    87
     * @param prev          Previous package in the sorted array.
58a73dac9ee4 8006124: javadoc/doclet should be updated to support profiles
bpatel
parents:
diff changeset
    88
     * @param next          Next package in the sorted array.
58a73dac9ee4 8006124: javadoc/doclet should be updated to support profiles
bpatel
parents:
diff changeset
    89
     * @param profile       The profile being documented.
58a73dac9ee4 8006124: javadoc/doclet should be updated to support profiles
bpatel
parents:
diff changeset
    90
     */
58a73dac9ee4 8006124: javadoc/doclet should be updated to support profiles
bpatel
parents:
diff changeset
    91
    public ProfilePackageWriterImpl(ConfigurationImpl configuration,
58a73dac9ee4 8006124: javadoc/doclet should be updated to support profiles
bpatel
parents:
diff changeset
    92
            PackageDoc packageDoc, PackageDoc prev, PackageDoc next,
58a73dac9ee4 8006124: javadoc/doclet should be updated to support profiles
bpatel
parents:
diff changeset
    93
            Profile profile) throws IOException {
58a73dac9ee4 8006124: javadoc/doclet should be updated to support profiles
bpatel
parents:
diff changeset
    94
        super(configuration, DocPath.forPackage(packageDoc).resolve(
58a73dac9ee4 8006124: javadoc/doclet should be updated to support profiles
bpatel
parents:
diff changeset
    95
                DocPaths.profilePackageSummary(profile.name)));
58a73dac9ee4 8006124: javadoc/doclet should be updated to support profiles
bpatel
parents:
diff changeset
    96
        this.prev = prev;
58a73dac9ee4 8006124: javadoc/doclet should be updated to support profiles
bpatel
parents:
diff changeset
    97
        this.next = next;
58a73dac9ee4 8006124: javadoc/doclet should be updated to support profiles
bpatel
parents:
diff changeset
    98
        this.packageDoc = packageDoc;
58a73dac9ee4 8006124: javadoc/doclet should be updated to support profiles
bpatel
parents:
diff changeset
    99
        this.profileName = profile.name;
58a73dac9ee4 8006124: javadoc/doclet should be updated to support profiles
bpatel
parents:
diff changeset
   100
        this.profileValue = profile.value;
58a73dac9ee4 8006124: javadoc/doclet should be updated to support profiles
bpatel
parents:
diff changeset
   101
    }
58a73dac9ee4 8006124: javadoc/doclet should be updated to support profiles
bpatel
parents:
diff changeset
   102
58a73dac9ee4 8006124: javadoc/doclet should be updated to support profiles
bpatel
parents:
diff changeset
   103
    /**
58a73dac9ee4 8006124: javadoc/doclet should be updated to support profiles
bpatel
parents:
diff changeset
   104
     * {@inheritDoc}
58a73dac9ee4 8006124: javadoc/doclet should be updated to support profiles
bpatel
parents:
diff changeset
   105
     */
58a73dac9ee4 8006124: javadoc/doclet should be updated to support profiles
bpatel
parents:
diff changeset
   106
    public Content getPackageHeader(String heading) {
58a73dac9ee4 8006124: javadoc/doclet should be updated to support profiles
bpatel
parents:
diff changeset
   107
        String pkgName = packageDoc.name();
58a73dac9ee4 8006124: javadoc/doclet should be updated to support profiles
bpatel
parents:
diff changeset
   108
        Content bodyTree = getBody(true, getWindowTitle(pkgName));
58a73dac9ee4 8006124: javadoc/doclet should be updated to support profiles
bpatel
parents:
diff changeset
   109
        addTop(bodyTree);
58a73dac9ee4 8006124: javadoc/doclet should be updated to support profiles
bpatel
parents:
diff changeset
   110
        addNavLinks(true, bodyTree);
58a73dac9ee4 8006124: javadoc/doclet should be updated to support profiles
bpatel
parents:
diff changeset
   111
        HtmlTree div = new HtmlTree(HtmlTag.DIV);
58a73dac9ee4 8006124: javadoc/doclet should be updated to support profiles
bpatel
parents:
diff changeset
   112
        div.addStyle(HtmlStyle.header);
58a73dac9ee4 8006124: javadoc/doclet should be updated to support profiles
bpatel
parents:
diff changeset
   113
        Content profileContent = new StringContent(profileName);
58a73dac9ee4 8006124: javadoc/doclet should be updated to support profiles
bpatel
parents:
diff changeset
   114
        Content profileNameDiv = HtmlTree.DIV(HtmlStyle.subTitle, profileContent);
58a73dac9ee4 8006124: javadoc/doclet should be updated to support profiles
bpatel
parents:
diff changeset
   115
        div.addContent(profileNameDiv);
58a73dac9ee4 8006124: javadoc/doclet should be updated to support profiles
bpatel
parents:
diff changeset
   116
        Content annotationContent = new HtmlTree(HtmlTag.P);
58a73dac9ee4 8006124: javadoc/doclet should be updated to support profiles
bpatel
parents:
diff changeset
   117
        addAnnotationInfo(packageDoc, annotationContent);
58a73dac9ee4 8006124: javadoc/doclet should be updated to support profiles
bpatel
parents:
diff changeset
   118
        div.addContent(annotationContent);
58a73dac9ee4 8006124: javadoc/doclet should be updated to support profiles
bpatel
parents:
diff changeset
   119
        Content tHeading = HtmlTree.HEADING(HtmlConstants.TITLE_HEADING, true,
58a73dac9ee4 8006124: javadoc/doclet should be updated to support profiles
bpatel
parents:
diff changeset
   120
                HtmlStyle.title, packageLabel);
58a73dac9ee4 8006124: javadoc/doclet should be updated to support profiles
bpatel
parents:
diff changeset
   121
        tHeading.addContent(getSpace());
58a73dac9ee4 8006124: javadoc/doclet should be updated to support profiles
bpatel
parents:
diff changeset
   122
        Content packageHead = new RawHtml(heading);
58a73dac9ee4 8006124: javadoc/doclet should be updated to support profiles
bpatel
parents:
diff changeset
   123
        tHeading.addContent(packageHead);
58a73dac9ee4 8006124: javadoc/doclet should be updated to support profiles
bpatel
parents:
diff changeset
   124
        div.addContent(tHeading);
58a73dac9ee4 8006124: javadoc/doclet should be updated to support profiles
bpatel
parents:
diff changeset
   125
        addDeprecationInfo(div);
58a73dac9ee4 8006124: javadoc/doclet should be updated to support profiles
bpatel
parents:
diff changeset
   126
        if (packageDoc.inlineTags().length > 0 && ! configuration.nocomment) {
58a73dac9ee4 8006124: javadoc/doclet should be updated to support profiles
bpatel
parents:
diff changeset
   127
            HtmlTree docSummaryDiv = new HtmlTree(HtmlTag.DIV);
58a73dac9ee4 8006124: javadoc/doclet should be updated to support profiles
bpatel
parents:
diff changeset
   128
            docSummaryDiv.addStyle(HtmlStyle.docSummary);
58a73dac9ee4 8006124: javadoc/doclet should be updated to support profiles
bpatel
parents:
diff changeset
   129
            addSummaryComment(packageDoc, docSummaryDiv);
58a73dac9ee4 8006124: javadoc/doclet should be updated to support profiles
bpatel
parents:
diff changeset
   130
            div.addContent(docSummaryDiv);
58a73dac9ee4 8006124: javadoc/doclet should be updated to support profiles
bpatel
parents:
diff changeset
   131
            Content space = getSpace();
58a73dac9ee4 8006124: javadoc/doclet should be updated to support profiles
bpatel
parents:
diff changeset
   132
            Content descLink = getHyperLink(DocLink.fragment("package_description"),
58a73dac9ee4 8006124: javadoc/doclet should be updated to support profiles
bpatel
parents:
diff changeset
   133
                    descriptionLabel, "", "");
58a73dac9ee4 8006124: javadoc/doclet should be updated to support profiles
bpatel
parents:
diff changeset
   134
            Content descPara = new HtmlTree(HtmlTag.P, seeLabel, space, descLink);
58a73dac9ee4 8006124: javadoc/doclet should be updated to support profiles
bpatel
parents:
diff changeset
   135
            div.addContent(descPara);
58a73dac9ee4 8006124: javadoc/doclet should be updated to support profiles
bpatel
parents:
diff changeset
   136
        }
58a73dac9ee4 8006124: javadoc/doclet should be updated to support profiles
bpatel
parents:
diff changeset
   137
        bodyTree.addContent(div);
58a73dac9ee4 8006124: javadoc/doclet should be updated to support profiles
bpatel
parents:
diff changeset
   138
        return bodyTree;
58a73dac9ee4 8006124: javadoc/doclet should be updated to support profiles
bpatel
parents:
diff changeset
   139
    }
58a73dac9ee4 8006124: javadoc/doclet should be updated to support profiles
bpatel
parents:
diff changeset
   140
58a73dac9ee4 8006124: javadoc/doclet should be updated to support profiles
bpatel
parents:
diff changeset
   141
    /**
58a73dac9ee4 8006124: javadoc/doclet should be updated to support profiles
bpatel
parents:
diff changeset
   142
     * {@inheritDoc}
58a73dac9ee4 8006124: javadoc/doclet should be updated to support profiles
bpatel
parents:
diff changeset
   143
     */
58a73dac9ee4 8006124: javadoc/doclet should be updated to support profiles
bpatel
parents:
diff changeset
   144
    public Content getContentHeader() {
58a73dac9ee4 8006124: javadoc/doclet should be updated to support profiles
bpatel
parents:
diff changeset
   145
        HtmlTree div = new HtmlTree(HtmlTag.DIV);
58a73dac9ee4 8006124: javadoc/doclet should be updated to support profiles
bpatel
parents:
diff changeset
   146
        div.addStyle(HtmlStyle.contentContainer);
58a73dac9ee4 8006124: javadoc/doclet should be updated to support profiles
bpatel
parents:
diff changeset
   147
        return div;
58a73dac9ee4 8006124: javadoc/doclet should be updated to support profiles
bpatel
parents:
diff changeset
   148
    }
58a73dac9ee4 8006124: javadoc/doclet should be updated to support profiles
bpatel
parents:
diff changeset
   149
58a73dac9ee4 8006124: javadoc/doclet should be updated to support profiles
bpatel
parents:
diff changeset
   150
    /**
58a73dac9ee4 8006124: javadoc/doclet should be updated to support profiles
bpatel
parents:
diff changeset
   151
     * Add the package deprecation information to the documentation tree.
58a73dac9ee4 8006124: javadoc/doclet should be updated to support profiles
bpatel
parents:
diff changeset
   152
     *
58a73dac9ee4 8006124: javadoc/doclet should be updated to support profiles
bpatel
parents:
diff changeset
   153
     * @param div the content tree to which the deprecation information will be added
58a73dac9ee4 8006124: javadoc/doclet should be updated to support profiles
bpatel
parents:
diff changeset
   154
     */
58a73dac9ee4 8006124: javadoc/doclet should be updated to support profiles
bpatel
parents:
diff changeset
   155
    public void addDeprecationInfo(Content div) {
58a73dac9ee4 8006124: javadoc/doclet should be updated to support profiles
bpatel
parents:
diff changeset
   156
        Tag[] deprs = packageDoc.tags("deprecated");
58a73dac9ee4 8006124: javadoc/doclet should be updated to support profiles
bpatel
parents:
diff changeset
   157
        if (Util.isDeprecated(packageDoc)) {
58a73dac9ee4 8006124: javadoc/doclet should be updated to support profiles
bpatel
parents:
diff changeset
   158
            HtmlTree deprDiv = new HtmlTree(HtmlTag.DIV);
58a73dac9ee4 8006124: javadoc/doclet should be updated to support profiles
bpatel
parents:
diff changeset
   159
            deprDiv.addStyle(HtmlStyle.deprecatedContent);
58a73dac9ee4 8006124: javadoc/doclet should be updated to support profiles
bpatel
parents:
diff changeset
   160
            Content deprPhrase = HtmlTree.SPAN(HtmlStyle.strong, deprecatedPhrase);
58a73dac9ee4 8006124: javadoc/doclet should be updated to support profiles
bpatel
parents:
diff changeset
   161
            deprDiv.addContent(deprPhrase);
58a73dac9ee4 8006124: javadoc/doclet should be updated to support profiles
bpatel
parents:
diff changeset
   162
            if (deprs.length > 0) {
58a73dac9ee4 8006124: javadoc/doclet should be updated to support profiles
bpatel
parents:
diff changeset
   163
                Tag[] commentTags = deprs[0].inlineTags();
58a73dac9ee4 8006124: javadoc/doclet should be updated to support profiles
bpatel
parents:
diff changeset
   164
                if (commentTags.length > 0) {
58a73dac9ee4 8006124: javadoc/doclet should be updated to support profiles
bpatel
parents:
diff changeset
   165
                    addInlineDeprecatedComment(packageDoc, deprs[0], deprDiv);
58a73dac9ee4 8006124: javadoc/doclet should be updated to support profiles
bpatel
parents:
diff changeset
   166
                }
58a73dac9ee4 8006124: javadoc/doclet should be updated to support profiles
bpatel
parents:
diff changeset
   167
            }
58a73dac9ee4 8006124: javadoc/doclet should be updated to support profiles
bpatel
parents:
diff changeset
   168
            div.addContent(deprDiv);
58a73dac9ee4 8006124: javadoc/doclet should be updated to support profiles
bpatel
parents:
diff changeset
   169
        }
58a73dac9ee4 8006124: javadoc/doclet should be updated to support profiles
bpatel
parents:
diff changeset
   170
    }
58a73dac9ee4 8006124: javadoc/doclet should be updated to support profiles
bpatel
parents:
diff changeset
   171
58a73dac9ee4 8006124: javadoc/doclet should be updated to support profiles
bpatel
parents:
diff changeset
   172
    /**
58a73dac9ee4 8006124: javadoc/doclet should be updated to support profiles
bpatel
parents:
diff changeset
   173
     * {@inheritDoc}
58a73dac9ee4 8006124: javadoc/doclet should be updated to support profiles
bpatel
parents:
diff changeset
   174
     */
58a73dac9ee4 8006124: javadoc/doclet should be updated to support profiles
bpatel
parents:
diff changeset
   175
    public void addClassesSummary(ClassDoc[] classes, String label,
58a73dac9ee4 8006124: javadoc/doclet should be updated to support profiles
bpatel
parents:
diff changeset
   176
            String tableSummary, String[] tableHeader, Content packageSummaryContentTree) {
58a73dac9ee4 8006124: javadoc/doclet should be updated to support profiles
bpatel
parents:
diff changeset
   177
        addClassesSummary(classes, label, tableSummary, tableHeader,
58a73dac9ee4 8006124: javadoc/doclet should be updated to support profiles
bpatel
parents:
diff changeset
   178
                packageSummaryContentTree, profileValue);
58a73dac9ee4 8006124: javadoc/doclet should be updated to support profiles
bpatel
parents:
diff changeset
   179
    }
58a73dac9ee4 8006124: javadoc/doclet should be updated to support profiles
bpatel
parents:
diff changeset
   180
58a73dac9ee4 8006124: javadoc/doclet should be updated to support profiles
bpatel
parents:
diff changeset
   181
    /**
58a73dac9ee4 8006124: javadoc/doclet should be updated to support profiles
bpatel
parents:
diff changeset
   182
     * {@inheritDoc}
58a73dac9ee4 8006124: javadoc/doclet should be updated to support profiles
bpatel
parents:
diff changeset
   183
     */
58a73dac9ee4 8006124: javadoc/doclet should be updated to support profiles
bpatel
parents:
diff changeset
   184
    public Content getSummaryHeader() {
58a73dac9ee4 8006124: javadoc/doclet should be updated to support profiles
bpatel
parents:
diff changeset
   185
        HtmlTree ul = new HtmlTree(HtmlTag.UL);
58a73dac9ee4 8006124: javadoc/doclet should be updated to support profiles
bpatel
parents:
diff changeset
   186
        ul.addStyle(HtmlStyle.blockList);
58a73dac9ee4 8006124: javadoc/doclet should be updated to support profiles
bpatel
parents:
diff changeset
   187
        return ul;
58a73dac9ee4 8006124: javadoc/doclet should be updated to support profiles
bpatel
parents:
diff changeset
   188
    }
58a73dac9ee4 8006124: javadoc/doclet should be updated to support profiles
bpatel
parents:
diff changeset
   189
58a73dac9ee4 8006124: javadoc/doclet should be updated to support profiles
bpatel
parents:
diff changeset
   190
    /**
58a73dac9ee4 8006124: javadoc/doclet should be updated to support profiles
bpatel
parents:
diff changeset
   191
     * {@inheritDoc}
58a73dac9ee4 8006124: javadoc/doclet should be updated to support profiles
bpatel
parents:
diff changeset
   192
     */
58a73dac9ee4 8006124: javadoc/doclet should be updated to support profiles
bpatel
parents:
diff changeset
   193
    public void addPackageDescription(Content packageContentTree) {
58a73dac9ee4 8006124: javadoc/doclet should be updated to support profiles
bpatel
parents:
diff changeset
   194
        if (packageDoc.inlineTags().length > 0) {
58a73dac9ee4 8006124: javadoc/doclet should be updated to support profiles
bpatel
parents:
diff changeset
   195
            packageContentTree.addContent(getMarkerAnchor("package_description"));
58a73dac9ee4 8006124: javadoc/doclet should be updated to support profiles
bpatel
parents:
diff changeset
   196
            Content h2Content = new StringContent(
58a73dac9ee4 8006124: javadoc/doclet should be updated to support profiles
bpatel
parents:
diff changeset
   197
                    configuration.getText("doclet.Package_Description",
58a73dac9ee4 8006124: javadoc/doclet should be updated to support profiles
bpatel
parents:
diff changeset
   198
                    packageDoc.name()));
58a73dac9ee4 8006124: javadoc/doclet should be updated to support profiles
bpatel
parents:
diff changeset
   199
            packageContentTree.addContent(HtmlTree.HEADING(HtmlConstants.PACKAGE_HEADING,
58a73dac9ee4 8006124: javadoc/doclet should be updated to support profiles
bpatel
parents:
diff changeset
   200
                    true, h2Content));
58a73dac9ee4 8006124: javadoc/doclet should be updated to support profiles
bpatel
parents:
diff changeset
   201
            addInlineComment(packageDoc, packageContentTree);
58a73dac9ee4 8006124: javadoc/doclet should be updated to support profiles
bpatel
parents:
diff changeset
   202
        }
58a73dac9ee4 8006124: javadoc/doclet should be updated to support profiles
bpatel
parents:
diff changeset
   203
    }
58a73dac9ee4 8006124: javadoc/doclet should be updated to support profiles
bpatel
parents:
diff changeset
   204
58a73dac9ee4 8006124: javadoc/doclet should be updated to support profiles
bpatel
parents:
diff changeset
   205
    /**
58a73dac9ee4 8006124: javadoc/doclet should be updated to support profiles
bpatel
parents:
diff changeset
   206
     * {@inheritDoc}
58a73dac9ee4 8006124: javadoc/doclet should be updated to support profiles
bpatel
parents:
diff changeset
   207
     */
58a73dac9ee4 8006124: javadoc/doclet should be updated to support profiles
bpatel
parents:
diff changeset
   208
    public void addPackageTags(Content packageContentTree) {
58a73dac9ee4 8006124: javadoc/doclet should be updated to support profiles
bpatel
parents:
diff changeset
   209
        addTagsInfo(packageDoc, packageContentTree);
58a73dac9ee4 8006124: javadoc/doclet should be updated to support profiles
bpatel
parents:
diff changeset
   210
    }
58a73dac9ee4 8006124: javadoc/doclet should be updated to support profiles
bpatel
parents:
diff changeset
   211
58a73dac9ee4 8006124: javadoc/doclet should be updated to support profiles
bpatel
parents:
diff changeset
   212
    /**
58a73dac9ee4 8006124: javadoc/doclet should be updated to support profiles
bpatel
parents:
diff changeset
   213
     * {@inheritDoc}
58a73dac9ee4 8006124: javadoc/doclet should be updated to support profiles
bpatel
parents:
diff changeset
   214
     */
58a73dac9ee4 8006124: javadoc/doclet should be updated to support profiles
bpatel
parents:
diff changeset
   215
    public void addPackageFooter(Content contentTree) {
58a73dac9ee4 8006124: javadoc/doclet should be updated to support profiles
bpatel
parents:
diff changeset
   216
        addNavLinks(false, contentTree);
58a73dac9ee4 8006124: javadoc/doclet should be updated to support profiles
bpatel
parents:
diff changeset
   217
        addBottom(contentTree);
58a73dac9ee4 8006124: javadoc/doclet should be updated to support profiles
bpatel
parents:
diff changeset
   218
    }
58a73dac9ee4 8006124: javadoc/doclet should be updated to support profiles
bpatel
parents:
diff changeset
   219
58a73dac9ee4 8006124: javadoc/doclet should be updated to support profiles
bpatel
parents:
diff changeset
   220
    /**
58a73dac9ee4 8006124: javadoc/doclet should be updated to support profiles
bpatel
parents:
diff changeset
   221
     * {@inheritDoc}
58a73dac9ee4 8006124: javadoc/doclet should be updated to support profiles
bpatel
parents:
diff changeset
   222
     */
58a73dac9ee4 8006124: javadoc/doclet should be updated to support profiles
bpatel
parents:
diff changeset
   223
    public void printDocument(Content contentTree) throws IOException {
58a73dac9ee4 8006124: javadoc/doclet should be updated to support profiles
bpatel
parents:
diff changeset
   224
        printHtmlDocument(configuration.metakeywords.getMetaKeywords(packageDoc),
58a73dac9ee4 8006124: javadoc/doclet should be updated to support profiles
bpatel
parents:
diff changeset
   225
                true, contentTree);
58a73dac9ee4 8006124: javadoc/doclet should be updated to support profiles
bpatel
parents:
diff changeset
   226
    }
58a73dac9ee4 8006124: javadoc/doclet should be updated to support profiles
bpatel
parents:
diff changeset
   227
58a73dac9ee4 8006124: javadoc/doclet should be updated to support profiles
bpatel
parents:
diff changeset
   228
    /**
58a73dac9ee4 8006124: javadoc/doclet should be updated to support profiles
bpatel
parents:
diff changeset
   229
     * Get "Use" link for this package in the navigation bar.
58a73dac9ee4 8006124: javadoc/doclet should be updated to support profiles
bpatel
parents:
diff changeset
   230
     *
58a73dac9ee4 8006124: javadoc/doclet should be updated to support profiles
bpatel
parents:
diff changeset
   231
     * @return a content tree for the class use link
58a73dac9ee4 8006124: javadoc/doclet should be updated to support profiles
bpatel
parents:
diff changeset
   232
     */
58a73dac9ee4 8006124: javadoc/doclet should be updated to support profiles
bpatel
parents:
diff changeset
   233
    protected Content getNavLinkClassUse() {
58a73dac9ee4 8006124: javadoc/doclet should be updated to support profiles
bpatel
parents:
diff changeset
   234
        Content useLink = getHyperLink(DocPaths.PACKAGE_USE,
58a73dac9ee4 8006124: javadoc/doclet should be updated to support profiles
bpatel
parents:
diff changeset
   235
                useLabel, "", "");
58a73dac9ee4 8006124: javadoc/doclet should be updated to support profiles
bpatel
parents:
diff changeset
   236
        Content li = HtmlTree.LI(useLink);
58a73dac9ee4 8006124: javadoc/doclet should be updated to support profiles
bpatel
parents:
diff changeset
   237
        return li;
58a73dac9ee4 8006124: javadoc/doclet should be updated to support profiles
bpatel
parents:
diff changeset
   238
    }
58a73dac9ee4 8006124: javadoc/doclet should be updated to support profiles
bpatel
parents:
diff changeset
   239
58a73dac9ee4 8006124: javadoc/doclet should be updated to support profiles
bpatel
parents:
diff changeset
   240
    /**
58a73dac9ee4 8006124: javadoc/doclet should be updated to support profiles
bpatel
parents:
diff changeset
   241
     * Get "PREV PACKAGE" link in the navigation bar.
58a73dac9ee4 8006124: javadoc/doclet should be updated to support profiles
bpatel
parents:
diff changeset
   242
     *
58a73dac9ee4 8006124: javadoc/doclet should be updated to support profiles
bpatel
parents:
diff changeset
   243
     * @return a content tree for the previous link
58a73dac9ee4 8006124: javadoc/doclet should be updated to support profiles
bpatel
parents:
diff changeset
   244
     */
58a73dac9ee4 8006124: javadoc/doclet should be updated to support profiles
bpatel
parents:
diff changeset
   245
    public Content getNavLinkPrevious() {
58a73dac9ee4 8006124: javadoc/doclet should be updated to support profiles
bpatel
parents:
diff changeset
   246
        Content li;
58a73dac9ee4 8006124: javadoc/doclet should be updated to support profiles
bpatel
parents:
diff changeset
   247
        if (prev == null) {
58a73dac9ee4 8006124: javadoc/doclet should be updated to support profiles
bpatel
parents:
diff changeset
   248
            li = HtmlTree.LI(prevpackageLabel);
58a73dac9ee4 8006124: javadoc/doclet should be updated to support profiles
bpatel
parents:
diff changeset
   249
        } else {
58a73dac9ee4 8006124: javadoc/doclet should be updated to support profiles
bpatel
parents:
diff changeset
   250
            DocPath path = DocPath.relativePath(packageDoc, prev);
58a73dac9ee4 8006124: javadoc/doclet should be updated to support profiles
bpatel
parents:
diff changeset
   251
            li = HtmlTree.LI(getHyperLink(path.resolve(DocPaths.profilePackageSummary(profileName)),
58a73dac9ee4 8006124: javadoc/doclet should be updated to support profiles
bpatel
parents:
diff changeset
   252
                prevpackageLabel, "", ""));
58a73dac9ee4 8006124: javadoc/doclet should be updated to support profiles
bpatel
parents:
diff changeset
   253
        }
58a73dac9ee4 8006124: javadoc/doclet should be updated to support profiles
bpatel
parents:
diff changeset
   254
        return li;
58a73dac9ee4 8006124: javadoc/doclet should be updated to support profiles
bpatel
parents:
diff changeset
   255
    }
58a73dac9ee4 8006124: javadoc/doclet should be updated to support profiles
bpatel
parents:
diff changeset
   256
58a73dac9ee4 8006124: javadoc/doclet should be updated to support profiles
bpatel
parents:
diff changeset
   257
    /**
58a73dac9ee4 8006124: javadoc/doclet should be updated to support profiles
bpatel
parents:
diff changeset
   258
     * Get "NEXT PACKAGE" link in the navigation bar.
58a73dac9ee4 8006124: javadoc/doclet should be updated to support profiles
bpatel
parents:
diff changeset
   259
     *
58a73dac9ee4 8006124: javadoc/doclet should be updated to support profiles
bpatel
parents:
diff changeset
   260
     * @return a content tree for the next link
58a73dac9ee4 8006124: javadoc/doclet should be updated to support profiles
bpatel
parents:
diff changeset
   261
     */
58a73dac9ee4 8006124: javadoc/doclet should be updated to support profiles
bpatel
parents:
diff changeset
   262
    public Content getNavLinkNext() {
58a73dac9ee4 8006124: javadoc/doclet should be updated to support profiles
bpatel
parents:
diff changeset
   263
        Content li;
58a73dac9ee4 8006124: javadoc/doclet should be updated to support profiles
bpatel
parents:
diff changeset
   264
        if (next == null) {
58a73dac9ee4 8006124: javadoc/doclet should be updated to support profiles
bpatel
parents:
diff changeset
   265
            li = HtmlTree.LI(nextpackageLabel);
58a73dac9ee4 8006124: javadoc/doclet should be updated to support profiles
bpatel
parents:
diff changeset
   266
        } else {
58a73dac9ee4 8006124: javadoc/doclet should be updated to support profiles
bpatel
parents:
diff changeset
   267
            DocPath path = DocPath.relativePath(packageDoc, next);
58a73dac9ee4 8006124: javadoc/doclet should be updated to support profiles
bpatel
parents:
diff changeset
   268
            li = HtmlTree.LI(getHyperLink(path.resolve(DocPaths.profilePackageSummary(profileName)),
58a73dac9ee4 8006124: javadoc/doclet should be updated to support profiles
bpatel
parents:
diff changeset
   269
                nextpackageLabel, "", ""));
58a73dac9ee4 8006124: javadoc/doclet should be updated to support profiles
bpatel
parents:
diff changeset
   270
        }
58a73dac9ee4 8006124: javadoc/doclet should be updated to support profiles
bpatel
parents:
diff changeset
   271
        return li;
58a73dac9ee4 8006124: javadoc/doclet should be updated to support profiles
bpatel
parents:
diff changeset
   272
    }
58a73dac9ee4 8006124: javadoc/doclet should be updated to support profiles
bpatel
parents:
diff changeset
   273
58a73dac9ee4 8006124: javadoc/doclet should be updated to support profiles
bpatel
parents:
diff changeset
   274
    /**
58a73dac9ee4 8006124: javadoc/doclet should be updated to support profiles
bpatel
parents:
diff changeset
   275
     * Get "Tree" link in the navigation bar. This will be link to the package
58a73dac9ee4 8006124: javadoc/doclet should be updated to support profiles
bpatel
parents:
diff changeset
   276
     * tree file.
58a73dac9ee4 8006124: javadoc/doclet should be updated to support profiles
bpatel
parents:
diff changeset
   277
     *
58a73dac9ee4 8006124: javadoc/doclet should be updated to support profiles
bpatel
parents:
diff changeset
   278
     * @return a content tree for the tree link
58a73dac9ee4 8006124: javadoc/doclet should be updated to support profiles
bpatel
parents:
diff changeset
   279
     */
58a73dac9ee4 8006124: javadoc/doclet should be updated to support profiles
bpatel
parents:
diff changeset
   280
    protected Content getNavLinkTree() {
58a73dac9ee4 8006124: javadoc/doclet should be updated to support profiles
bpatel
parents:
diff changeset
   281
        Content useLink = getHyperLink(DocPaths.PACKAGE_TREE,
58a73dac9ee4 8006124: javadoc/doclet should be updated to support profiles
bpatel
parents:
diff changeset
   282
                treeLabel, "", "");
58a73dac9ee4 8006124: javadoc/doclet should be updated to support profiles
bpatel
parents:
diff changeset
   283
        Content li = HtmlTree.LI(useLink);
58a73dac9ee4 8006124: javadoc/doclet should be updated to support profiles
bpatel
parents:
diff changeset
   284
        return li;
58a73dac9ee4 8006124: javadoc/doclet should be updated to support profiles
bpatel
parents:
diff changeset
   285
    }
58a73dac9ee4 8006124: javadoc/doclet should be updated to support profiles
bpatel
parents:
diff changeset
   286
58a73dac9ee4 8006124: javadoc/doclet should be updated to support profiles
bpatel
parents:
diff changeset
   287
    /**
58a73dac9ee4 8006124: javadoc/doclet should be updated to support profiles
bpatel
parents:
diff changeset
   288
     * Highlight "Package" in the navigation bar, as this is the package page.
58a73dac9ee4 8006124: javadoc/doclet should be updated to support profiles
bpatel
parents:
diff changeset
   289
     *
58a73dac9ee4 8006124: javadoc/doclet should be updated to support profiles
bpatel
parents:
diff changeset
   290
     * @return a content tree for the package link
58a73dac9ee4 8006124: javadoc/doclet should be updated to support profiles
bpatel
parents:
diff changeset
   291
     */
58a73dac9ee4 8006124: javadoc/doclet should be updated to support profiles
bpatel
parents:
diff changeset
   292
    protected Content getNavLinkPackage() {
58a73dac9ee4 8006124: javadoc/doclet should be updated to support profiles
bpatel
parents:
diff changeset
   293
        Content li = HtmlTree.LI(HtmlStyle.navBarCell1Rev, packageLabel);
58a73dac9ee4 8006124: javadoc/doclet should be updated to support profiles
bpatel
parents:
diff changeset
   294
        return li;
58a73dac9ee4 8006124: javadoc/doclet should be updated to support profiles
bpatel
parents:
diff changeset
   295
    }
58a73dac9ee4 8006124: javadoc/doclet should be updated to support profiles
bpatel
parents:
diff changeset
   296
}