langtools/src/share/classes/com/sun/tools/doclets/formats/html/AnnotationTypeWriterImpl.java
author duke
Sat, 01 Dec 2007 00:00:00 +0000
changeset 10 06bc494ca11e
child 1787 1aa079321cd2
permissions -rw-r--r--
Initial load
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
10
06bc494ca11e Initial load
duke
parents:
diff changeset
     1
/*
06bc494ca11e Initial load
duke
parents:
diff changeset
     2
 * Copyright 2003-2005 Sun Microsystems, Inc.  All Rights Reserved.
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
06bc494ca11e Initial load
duke
parents:
diff changeset
     7
 * published by the Free Software Foundation.  Sun designates this
06bc494ca11e Initial load
duke
parents:
diff changeset
     8
 * particular file as subject to the "Classpath" exception as provided
06bc494ca11e Initial load
duke
parents:
diff changeset
     9
 * by Sun in the LICENSE file that accompanied this code.
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
 *
06bc494ca11e Initial load
duke
parents:
diff changeset
    21
 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
06bc494ca11e Initial load
duke
parents:
diff changeset
    22
 * CA 95054 USA or visit www.sun.com if you need additional information or
06bc494ca11e Initial load
duke
parents:
diff changeset
    23
 * have any questions.
06bc494ca11e Initial load
duke
parents:
diff changeset
    24
 */
06bc494ca11e Initial load
duke
parents:
diff changeset
    25
06bc494ca11e Initial load
duke
parents:
diff changeset
    26
package com.sun.tools.doclets.formats.html;
06bc494ca11e Initial load
duke
parents:
diff changeset
    27
06bc494ca11e Initial load
duke
parents:
diff changeset
    28
import com.sun.tools.doclets.internal.toolkit.*;
06bc494ca11e Initial load
duke
parents:
diff changeset
    29
import com.sun.tools.doclets.internal.toolkit.util.*;
06bc494ca11e Initial load
duke
parents:
diff changeset
    30
import com.sun.tools.doclets.internal.toolkit.builders.*;
06bc494ca11e Initial load
duke
parents:
diff changeset
    31
import com.sun.javadoc.*;
06bc494ca11e Initial load
duke
parents:
diff changeset
    32
06bc494ca11e Initial load
duke
parents:
diff changeset
    33
/**
06bc494ca11e Initial load
duke
parents:
diff changeset
    34
 * Generate the Class Information Page.
06bc494ca11e Initial load
duke
parents:
diff changeset
    35
 * @see com.sun.javadoc.ClassDoc
06bc494ca11e Initial load
duke
parents:
diff changeset
    36
 * @see java.util.Collections
06bc494ca11e Initial load
duke
parents:
diff changeset
    37
 * @see java.util.List
06bc494ca11e Initial load
duke
parents:
diff changeset
    38
 * @see java.util.ArrayList
06bc494ca11e Initial load
duke
parents:
diff changeset
    39
 * @see java.util.HashMap
06bc494ca11e Initial load
duke
parents:
diff changeset
    40
 *
06bc494ca11e Initial load
duke
parents:
diff changeset
    41
 * @author Atul M Dambalkar
06bc494ca11e Initial load
duke
parents:
diff changeset
    42
 * @author Robert Field
06bc494ca11e Initial load
duke
parents:
diff changeset
    43
 */
06bc494ca11e Initial load
duke
parents:
diff changeset
    44
public class AnnotationTypeWriterImpl extends SubWriterHolderWriter
06bc494ca11e Initial load
duke
parents:
diff changeset
    45
        implements AnnotationTypeWriter {
06bc494ca11e Initial load
duke
parents:
diff changeset
    46
06bc494ca11e Initial load
duke
parents:
diff changeset
    47
    protected AnnotationTypeDoc annotationType;
06bc494ca11e Initial load
duke
parents:
diff changeset
    48
06bc494ca11e Initial load
duke
parents:
diff changeset
    49
    protected Type prev;
06bc494ca11e Initial load
duke
parents:
diff changeset
    50
06bc494ca11e Initial load
duke
parents:
diff changeset
    51
    protected Type next;
06bc494ca11e Initial load
duke
parents:
diff changeset
    52
06bc494ca11e Initial load
duke
parents:
diff changeset
    53
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
    54
     * @param annotationType the annotation type being documented.
06bc494ca11e Initial load
duke
parents:
diff changeset
    55
     * @param prevType the previous class that was documented.
06bc494ca11e Initial load
duke
parents:
diff changeset
    56
     * @param nextType the next class being documented.
06bc494ca11e Initial load
duke
parents:
diff changeset
    57
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
    58
    public AnnotationTypeWriterImpl (AnnotationTypeDoc annotationType,
06bc494ca11e Initial load
duke
parents:
diff changeset
    59
            Type prevType, Type nextType)
06bc494ca11e Initial load
duke
parents:
diff changeset
    60
    throws Exception {
06bc494ca11e Initial load
duke
parents:
diff changeset
    61
        super(ConfigurationImpl.getInstance(),
06bc494ca11e Initial load
duke
parents:
diff changeset
    62
              DirectoryManager.getDirectoryPath(annotationType.containingPackage()),
06bc494ca11e Initial load
duke
parents:
diff changeset
    63
              annotationType.name() + ".html",
06bc494ca11e Initial load
duke
parents:
diff changeset
    64
              DirectoryManager.getRelativePath(annotationType.containingPackage().name()));
06bc494ca11e Initial load
duke
parents:
diff changeset
    65
        this.annotationType = annotationType;
06bc494ca11e Initial load
duke
parents:
diff changeset
    66
        configuration.currentcd = annotationType.asClassDoc();
06bc494ca11e Initial load
duke
parents:
diff changeset
    67
        this.prev = prevType;
06bc494ca11e Initial load
duke
parents:
diff changeset
    68
        this.next = nextType;
06bc494ca11e Initial load
duke
parents:
diff changeset
    69
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
    70
06bc494ca11e Initial load
duke
parents:
diff changeset
    71
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
    72
     * Print this package link
06bc494ca11e Initial load
duke
parents:
diff changeset
    73
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
    74
    protected void navLinkPackage() {
06bc494ca11e Initial load
duke
parents:
diff changeset
    75
        navCellStart();
06bc494ca11e Initial load
duke
parents:
diff changeset
    76
        printHyperLink("package-summary.html", "",
06bc494ca11e Initial load
duke
parents:
diff changeset
    77
            configuration.getText("doclet.Package"), true, "NavBarFont1");
06bc494ca11e Initial load
duke
parents:
diff changeset
    78
        navCellEnd();
06bc494ca11e Initial load
duke
parents:
diff changeset
    79
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
    80
06bc494ca11e Initial load
duke
parents:
diff changeset
    81
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
    82
     * Print class page indicator
06bc494ca11e Initial load
duke
parents:
diff changeset
    83
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
    84
    protected void navLinkClass() {
06bc494ca11e Initial load
duke
parents:
diff changeset
    85
        navCellRevStart();
06bc494ca11e Initial load
duke
parents:
diff changeset
    86
        fontStyle("NavBarFont1Rev");
06bc494ca11e Initial load
duke
parents:
diff changeset
    87
        boldText("doclet.Class");
06bc494ca11e Initial load
duke
parents:
diff changeset
    88
        fontEnd();
06bc494ca11e Initial load
duke
parents:
diff changeset
    89
        navCellEnd();
06bc494ca11e Initial load
duke
parents:
diff changeset
    90
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
    91
06bc494ca11e Initial load
duke
parents:
diff changeset
    92
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
    93
     * Print class use link
06bc494ca11e Initial load
duke
parents:
diff changeset
    94
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
    95
    protected void navLinkClassUse() {
06bc494ca11e Initial load
duke
parents:
diff changeset
    96
        navCellStart();
06bc494ca11e Initial load
duke
parents:
diff changeset
    97
        printHyperLink("class-use/" + filename, "",
06bc494ca11e Initial load
duke
parents:
diff changeset
    98
                       configuration.getText("doclet.navClassUse"), true, "NavBarFont1");
06bc494ca11e Initial load
duke
parents:
diff changeset
    99
        navCellEnd();
06bc494ca11e Initial load
duke
parents:
diff changeset
   100
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   101
06bc494ca11e Initial load
duke
parents:
diff changeset
   102
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
   103
     * Print previous package link
06bc494ca11e Initial load
duke
parents:
diff changeset
   104
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   105
    protected void navLinkPrevious() {
06bc494ca11e Initial load
duke
parents:
diff changeset
   106
        if (prev == null) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   107
            printText("doclet.Prev_Class");
06bc494ca11e Initial load
duke
parents:
diff changeset
   108
        } else {
06bc494ca11e Initial load
duke
parents:
diff changeset
   109
            printLink(new LinkInfoImpl(LinkInfoImpl.CONTEXT_CLASS,
06bc494ca11e Initial load
duke
parents:
diff changeset
   110
                prev.asClassDoc(), "",
06bc494ca11e Initial load
duke
parents:
diff changeset
   111
                configuration.getText("doclet.Prev_Class"), true));
06bc494ca11e Initial load
duke
parents:
diff changeset
   112
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
   113
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   114
06bc494ca11e Initial load
duke
parents:
diff changeset
   115
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
   116
     * Print next package link
06bc494ca11e Initial load
duke
parents:
diff changeset
   117
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   118
    protected void navLinkNext() {
06bc494ca11e Initial load
duke
parents:
diff changeset
   119
        if (next == null) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   120
            printText("doclet.Next_Class");
06bc494ca11e Initial load
duke
parents:
diff changeset
   121
        } else {
06bc494ca11e Initial load
duke
parents:
diff changeset
   122
            printLink(new LinkInfoImpl(LinkInfoImpl.CONTEXT_CLASS,
06bc494ca11e Initial load
duke
parents:
diff changeset
   123
                next.asClassDoc(), "",
06bc494ca11e Initial load
duke
parents:
diff changeset
   124
                configuration.getText("doclet.Next_Class"), true));
06bc494ca11e Initial load
duke
parents:
diff changeset
   125
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
   126
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   127
06bc494ca11e Initial load
duke
parents:
diff changeset
   128
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
   129
     * {@inheritDoc}
06bc494ca11e Initial load
duke
parents:
diff changeset
   130
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   131
    public void writeHeader(String header) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   132
06bc494ca11e Initial load
duke
parents:
diff changeset
   133
        String pkgname = (annotationType.containingPackage() != null)?
06bc494ca11e Initial load
duke
parents:
diff changeset
   134
            annotationType.containingPackage().name(): "";
06bc494ca11e Initial load
duke
parents:
diff changeset
   135
        String clname = annotationType.name();
06bc494ca11e Initial load
duke
parents:
diff changeset
   136
06bc494ca11e Initial load
duke
parents:
diff changeset
   137
        printHtmlHeader(clname,
06bc494ca11e Initial load
duke
parents:
diff changeset
   138
            configuration.metakeywords.getMetaKeywords(annotationType), true);
06bc494ca11e Initial load
duke
parents:
diff changeset
   139
        printTop();
06bc494ca11e Initial load
duke
parents:
diff changeset
   140
        navLinks(true);
06bc494ca11e Initial load
duke
parents:
diff changeset
   141
        hr();
06bc494ca11e Initial load
duke
parents:
diff changeset
   142
        println("<!-- ======== START OF CLASS DATA ======== -->");
06bc494ca11e Initial load
duke
parents:
diff changeset
   143
        h2();
06bc494ca11e Initial load
duke
parents:
diff changeset
   144
        if (pkgname.length() > 0) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   145
            font("-1"); print(pkgname); fontEnd(); br();
06bc494ca11e Initial load
duke
parents:
diff changeset
   146
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
   147
        print(header + getTypeParameterLinks(new LinkInfoImpl(
06bc494ca11e Initial load
duke
parents:
diff changeset
   148
            LinkInfoImpl.CONTEXT_CLASS_HEADER,
06bc494ca11e Initial load
duke
parents:
diff changeset
   149
            annotationType, false)));
06bc494ca11e Initial load
duke
parents:
diff changeset
   150
        h2End();
06bc494ca11e Initial load
duke
parents:
diff changeset
   151
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   152
06bc494ca11e Initial load
duke
parents:
diff changeset
   153
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
   154
     * {@inheritDoc}
06bc494ca11e Initial load
duke
parents:
diff changeset
   155
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   156
    public void writeFooter() {
06bc494ca11e Initial load
duke
parents:
diff changeset
   157
        println("<!-- ========= END OF CLASS DATA ========= -->");
06bc494ca11e Initial load
duke
parents:
diff changeset
   158
        hr();
06bc494ca11e Initial load
duke
parents:
diff changeset
   159
        navLinks(false);
06bc494ca11e Initial load
duke
parents:
diff changeset
   160
        printBottom();
06bc494ca11e Initial load
duke
parents:
diff changeset
   161
        printBodyHtmlEnd();
06bc494ca11e Initial load
duke
parents:
diff changeset
   162
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   163
06bc494ca11e Initial load
duke
parents:
diff changeset
   164
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
   165
     * {@inheritDoc}
06bc494ca11e Initial load
duke
parents:
diff changeset
   166
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   167
    public void writeAnnotationTypeSignature(String modifiers) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   168
        dl();
06bc494ca11e Initial load
duke
parents:
diff changeset
   169
        dt();
06bc494ca11e Initial load
duke
parents:
diff changeset
   170
        preNoNewLine();
06bc494ca11e Initial load
duke
parents:
diff changeset
   171
        writeAnnotationInfo(annotationType);
06bc494ca11e Initial load
duke
parents:
diff changeset
   172
        print(modifiers);
06bc494ca11e Initial load
duke
parents:
diff changeset
   173
        String name = annotationType.name() +
06bc494ca11e Initial load
duke
parents:
diff changeset
   174
            getTypeParameterLinks(new LinkInfoImpl(
06bc494ca11e Initial load
duke
parents:
diff changeset
   175
                LinkInfoImpl.CONTEXT_CLASS_SIGNATURE, annotationType, false));
06bc494ca11e Initial load
duke
parents:
diff changeset
   176
        if (configuration().linksource) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   177
            printSrcLink(annotationType, name);
06bc494ca11e Initial load
duke
parents:
diff changeset
   178
        } else {
06bc494ca11e Initial load
duke
parents:
diff changeset
   179
            bold(name);
06bc494ca11e Initial load
duke
parents:
diff changeset
   180
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
   181
        dlEnd();
06bc494ca11e Initial load
duke
parents:
diff changeset
   182
        preEnd();
06bc494ca11e Initial load
duke
parents:
diff changeset
   183
        p();
06bc494ca11e Initial load
duke
parents:
diff changeset
   184
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   185
06bc494ca11e Initial load
duke
parents:
diff changeset
   186
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
   187
     * {@inheritDoc}
06bc494ca11e Initial load
duke
parents:
diff changeset
   188
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   189
    public void writeAnnotationTypeDescription() {
06bc494ca11e Initial load
duke
parents:
diff changeset
   190
        if(!configuration.nocomment) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   191
            // generate documentation for the class.
06bc494ca11e Initial load
duke
parents:
diff changeset
   192
            if (annotationType.inlineTags().length > 0) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   193
                printInlineComment(annotationType);
06bc494ca11e Initial load
duke
parents:
diff changeset
   194
                p();
06bc494ca11e Initial load
duke
parents:
diff changeset
   195
            }
06bc494ca11e Initial load
duke
parents:
diff changeset
   196
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
   197
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   198
06bc494ca11e Initial load
duke
parents:
diff changeset
   199
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
   200
     * {@inheritDoc}
06bc494ca11e Initial load
duke
parents:
diff changeset
   201
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   202
    public void writeAnnotationTypeTagInfo() {
06bc494ca11e Initial load
duke
parents:
diff changeset
   203
        boolean needHr = annotationType.elements().length > 0;
06bc494ca11e Initial load
duke
parents:
diff changeset
   204
        if(!configuration.nocomment) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   205
            // Print Information about all the tags here
06bc494ca11e Initial load
duke
parents:
diff changeset
   206
            printTags(annotationType);
06bc494ca11e Initial load
duke
parents:
diff changeset
   207
            if (needHr) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   208
                hr();
06bc494ca11e Initial load
duke
parents:
diff changeset
   209
            }
06bc494ca11e Initial load
duke
parents:
diff changeset
   210
            p();
06bc494ca11e Initial load
duke
parents:
diff changeset
   211
        } else if (needHr) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   212
            hr();
06bc494ca11e Initial load
duke
parents:
diff changeset
   213
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
   214
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   215
06bc494ca11e Initial load
duke
parents:
diff changeset
   216
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
   217
     * {@inheritDoc}
06bc494ca11e Initial load
duke
parents:
diff changeset
   218
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   219
    public void writeAnnotationTypeDeprecationInfo() {
06bc494ca11e Initial load
duke
parents:
diff changeset
   220
        hr();
06bc494ca11e Initial load
duke
parents:
diff changeset
   221
        Tag[] deprs = annotationType.tags("deprecated");
06bc494ca11e Initial load
duke
parents:
diff changeset
   222
        if (Util.isDeprecated(annotationType)) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   223
            boldText("doclet.Deprecated");
06bc494ca11e Initial load
duke
parents:
diff changeset
   224
            if (deprs.length > 0) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   225
                Tag[] commentTags = deprs[0].inlineTags();
06bc494ca11e Initial load
duke
parents:
diff changeset
   226
                if (commentTags.length > 0) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   227
06bc494ca11e Initial load
duke
parents:
diff changeset
   228
                    space();
06bc494ca11e Initial load
duke
parents:
diff changeset
   229
                    printInlineDeprecatedComment(annotationType, deprs[0]);
06bc494ca11e Initial load
duke
parents:
diff changeset
   230
                }
06bc494ca11e Initial load
duke
parents:
diff changeset
   231
            }
06bc494ca11e Initial load
duke
parents:
diff changeset
   232
            p();
06bc494ca11e Initial load
duke
parents:
diff changeset
   233
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
   234
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   235
06bc494ca11e Initial load
duke
parents:
diff changeset
   236
    protected void navLinkTree() {
06bc494ca11e Initial load
duke
parents:
diff changeset
   237
        navCellStart();
06bc494ca11e Initial load
duke
parents:
diff changeset
   238
        printHyperLink("package-tree.html", "",
06bc494ca11e Initial load
duke
parents:
diff changeset
   239
            configuration.getText("doclet.Tree"), true, "NavBarFont1");
06bc494ca11e Initial load
duke
parents:
diff changeset
   240
        navCellEnd();
06bc494ca11e Initial load
duke
parents:
diff changeset
   241
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   242
06bc494ca11e Initial load
duke
parents:
diff changeset
   243
    protected void printSummaryDetailLinks() {
06bc494ca11e Initial load
duke
parents:
diff changeset
   244
        try {
06bc494ca11e Initial load
duke
parents:
diff changeset
   245
            tr();
06bc494ca11e Initial load
duke
parents:
diff changeset
   246
            tdVAlignClass("top", "NavBarCell3");
06bc494ca11e Initial load
duke
parents:
diff changeset
   247
            font("-2");
06bc494ca11e Initial load
duke
parents:
diff changeset
   248
            print("  ");
06bc494ca11e Initial load
duke
parents:
diff changeset
   249
            navSummaryLinks();
06bc494ca11e Initial load
duke
parents:
diff changeset
   250
            fontEnd();
06bc494ca11e Initial load
duke
parents:
diff changeset
   251
            tdEnd();
06bc494ca11e Initial load
duke
parents:
diff changeset
   252
06bc494ca11e Initial load
duke
parents:
diff changeset
   253
            tdVAlignClass("top", "NavBarCell3");
06bc494ca11e Initial load
duke
parents:
diff changeset
   254
            font("-2");
06bc494ca11e Initial load
duke
parents:
diff changeset
   255
            navDetailLinks();
06bc494ca11e Initial load
duke
parents:
diff changeset
   256
            fontEnd();
06bc494ca11e Initial load
duke
parents:
diff changeset
   257
            tdEnd();
06bc494ca11e Initial load
duke
parents:
diff changeset
   258
            trEnd();
06bc494ca11e Initial load
duke
parents:
diff changeset
   259
        } catch (Exception e) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   260
            e.printStackTrace();
06bc494ca11e Initial load
duke
parents:
diff changeset
   261
            throw new DocletAbortException();
06bc494ca11e Initial load
duke
parents:
diff changeset
   262
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
   263
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   264
06bc494ca11e Initial load
duke
parents:
diff changeset
   265
    protected void navSummaryLinks() throws Exception {
06bc494ca11e Initial load
duke
parents:
diff changeset
   266
        printText("doclet.Summary");
06bc494ca11e Initial load
duke
parents:
diff changeset
   267
        space();
06bc494ca11e Initial load
duke
parents:
diff changeset
   268
        MemberSummaryBuilder memberSummaryBuilder = (MemberSummaryBuilder)
06bc494ca11e Initial load
duke
parents:
diff changeset
   269
            configuration.getBuilderFactory().getMemberSummaryBuilder(this);
06bc494ca11e Initial load
duke
parents:
diff changeset
   270
        writeNavSummaryLink(memberSummaryBuilder,
06bc494ca11e Initial load
duke
parents:
diff changeset
   271
            "doclet.navAnnotationTypeRequiredMember",
06bc494ca11e Initial load
duke
parents:
diff changeset
   272
            VisibleMemberMap.ANNOTATION_TYPE_MEMBER_REQUIRED);
06bc494ca11e Initial load
duke
parents:
diff changeset
   273
        navGap();
06bc494ca11e Initial load
duke
parents:
diff changeset
   274
        writeNavSummaryLink(memberSummaryBuilder,
06bc494ca11e Initial load
duke
parents:
diff changeset
   275
            "doclet.navAnnotationTypeOptionalMember",
06bc494ca11e Initial load
duke
parents:
diff changeset
   276
            VisibleMemberMap.ANNOTATION_TYPE_MEMBER_OPTIONAL);
06bc494ca11e Initial load
duke
parents:
diff changeset
   277
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   278
06bc494ca11e Initial load
duke
parents:
diff changeset
   279
    private void writeNavSummaryLink(MemberSummaryBuilder builder,
06bc494ca11e Initial load
duke
parents:
diff changeset
   280
            String label, int type) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   281
        AbstractMemberWriter writer = ((AbstractMemberWriter) builder.
06bc494ca11e Initial load
duke
parents:
diff changeset
   282
            getMemberSummaryWriter(type));
06bc494ca11e Initial load
duke
parents:
diff changeset
   283
        if (writer == null) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   284
              printText(label);
06bc494ca11e Initial load
duke
parents:
diff changeset
   285
        } else {
06bc494ca11e Initial load
duke
parents:
diff changeset
   286
            writer.printNavSummaryLink(null,
06bc494ca11e Initial load
duke
parents:
diff changeset
   287
                ! builder.getVisibleMemberMap(type).noVisibleMembers());
06bc494ca11e Initial load
duke
parents:
diff changeset
   288
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
   289
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   290
06bc494ca11e Initial load
duke
parents:
diff changeset
   291
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
   292
     * Method navDetailLinks
06bc494ca11e Initial load
duke
parents:
diff changeset
   293
     *
06bc494ca11e Initial load
duke
parents:
diff changeset
   294
     * @throws   Exception
06bc494ca11e Initial load
duke
parents:
diff changeset
   295
     *
06bc494ca11e Initial load
duke
parents:
diff changeset
   296
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   297
    protected void navDetailLinks() throws Exception {
06bc494ca11e Initial load
duke
parents:
diff changeset
   298
        printText("doclet.Detail");
06bc494ca11e Initial load
duke
parents:
diff changeset
   299
        space();
06bc494ca11e Initial load
duke
parents:
diff changeset
   300
        MemberSummaryBuilder memberSummaryBuilder = (MemberSummaryBuilder)
06bc494ca11e Initial load
duke
parents:
diff changeset
   301
            configuration.getBuilderFactory().getMemberSummaryBuilder(this);
06bc494ca11e Initial load
duke
parents:
diff changeset
   302
        AbstractMemberWriter writerOptional =
06bc494ca11e Initial load
duke
parents:
diff changeset
   303
            ((AbstractMemberWriter) memberSummaryBuilder.
06bc494ca11e Initial load
duke
parents:
diff changeset
   304
                getMemberSummaryWriter(VisibleMemberMap.ANNOTATION_TYPE_MEMBER_OPTIONAL));
06bc494ca11e Initial load
duke
parents:
diff changeset
   305
        AbstractMemberWriter writerRequired =
06bc494ca11e Initial load
duke
parents:
diff changeset
   306
            ((AbstractMemberWriter) memberSummaryBuilder.
06bc494ca11e Initial load
duke
parents:
diff changeset
   307
                getMemberSummaryWriter(VisibleMemberMap.ANNOTATION_TYPE_MEMBER_REQUIRED));
06bc494ca11e Initial load
duke
parents:
diff changeset
   308
        if (writerOptional != null){
06bc494ca11e Initial load
duke
parents:
diff changeset
   309
            writerOptional.printNavDetailLink(annotationType.elements().length > 0);
06bc494ca11e Initial load
duke
parents:
diff changeset
   310
        } else if (writerRequired != null){
06bc494ca11e Initial load
duke
parents:
diff changeset
   311
            writerRequired.printNavDetailLink(annotationType.elements().length > 0);
06bc494ca11e Initial load
duke
parents:
diff changeset
   312
        } else {
06bc494ca11e Initial load
duke
parents:
diff changeset
   313
            printText("doclet.navAnnotationTypeMember");
06bc494ca11e Initial load
duke
parents:
diff changeset
   314
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
   315
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   316
06bc494ca11e Initial load
duke
parents:
diff changeset
   317
    protected void navGap() {
06bc494ca11e Initial load
duke
parents:
diff changeset
   318
        space();
06bc494ca11e Initial load
duke
parents:
diff changeset
   319
        print('|');
06bc494ca11e Initial load
duke
parents:
diff changeset
   320
        space();
06bc494ca11e Initial load
duke
parents:
diff changeset
   321
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   322
06bc494ca11e Initial load
duke
parents:
diff changeset
   323
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
   324
     * If this is an inner class or interface, write the enclosing class or
06bc494ca11e Initial load
duke
parents:
diff changeset
   325
     * interface.
06bc494ca11e Initial load
duke
parents:
diff changeset
   326
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   327
    public void writeNestedClassInfo() {
06bc494ca11e Initial load
duke
parents:
diff changeset
   328
        ClassDoc outerClass = annotationType.containingClass();
06bc494ca11e Initial load
duke
parents:
diff changeset
   329
        if (outerClass != null) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   330
            dl();
06bc494ca11e Initial load
duke
parents:
diff changeset
   331
            dt();
06bc494ca11e Initial load
duke
parents:
diff changeset
   332
            if (annotationType.isInterface()) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   333
                boldText("doclet.Enclosing_Interface");
06bc494ca11e Initial load
duke
parents:
diff changeset
   334
            } else {
06bc494ca11e Initial load
duke
parents:
diff changeset
   335
                boldText("doclet.Enclosing_Class");
06bc494ca11e Initial load
duke
parents:
diff changeset
   336
            }
06bc494ca11e Initial load
duke
parents:
diff changeset
   337
            dd();
06bc494ca11e Initial load
duke
parents:
diff changeset
   338
            printLink(new LinkInfoImpl(LinkInfoImpl.CONTEXT_CLASS, outerClass,
06bc494ca11e Initial load
duke
parents:
diff changeset
   339
                false));
06bc494ca11e Initial load
duke
parents:
diff changeset
   340
            ddEnd();
06bc494ca11e Initial load
duke
parents:
diff changeset
   341
            dlEnd();
06bc494ca11e Initial load
duke
parents:
diff changeset
   342
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
   343
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   344
06bc494ca11e Initial load
duke
parents:
diff changeset
   345
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
   346
     * {@inheritDoc}
06bc494ca11e Initial load
duke
parents:
diff changeset
   347
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   348
    public AnnotationTypeDoc getAnnotationTypeDoc() {
06bc494ca11e Initial load
duke
parents:
diff changeset
   349
        return annotationType;
06bc494ca11e Initial load
duke
parents:
diff changeset
   350
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   351
06bc494ca11e Initial load
duke
parents:
diff changeset
   352
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
   353
     * {@inheritDoc}
06bc494ca11e Initial load
duke
parents:
diff changeset
   354
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   355
    public void completeMemberSummaryBuild() {
06bc494ca11e Initial load
duke
parents:
diff changeset
   356
        p();
06bc494ca11e Initial load
duke
parents:
diff changeset
   357
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   358
}