src/share/classes/com/sun/tools/doclets/formats/html/AnnotationTypeOptionalMemberWriterImpl.java

Tue, 25 May 2010 15:54:51 -0700

author
ohair
date
Tue, 25 May 2010 15:54:51 -0700
changeset 554
9d9f26857129
parent 243
edd944553131
child 766
90af8d87741f
permissions
-rw-r--r--

6943119: Rebrand source copyright notices
Reviewed-by: darcy

     1 /*
     2  * Copyright (c) 2003, 2004, Oracle and/or its affiliates. All rights reserved.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     4  *
     5  * This code is free software; you can redistribute it and/or modify it
     6  * under the terms of the GNU General Public License version 2 only, as
     7  * published by the Free Software Foundation.  Oracle designates this
     8  * particular file as subject to the "Classpath" exception as provided
     9  * by Oracle in the LICENSE file that accompanied this code.
    10  *
    11  * This code is distributed in the hope that it will be useful, but WITHOUT
    12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
    13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
    14  * version 2 for more details (a copy is included in the LICENSE file that
    15  * accompanied this code).
    16  *
    17  * You should have received a copy of the GNU General Public License version
    18  * 2 along with this work; if not, write to the Free Software Foundation,
    19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
    20  *
    21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
    22  * or visit www.oracle.com if you need additional information or have any
    23  * questions.
    24  */
    26 package com.sun.tools.doclets.formats.html;
    28 import java.io.*;
    30 import com.sun.javadoc.*;
    31 import com.sun.tools.doclets.internal.toolkit.*;
    33 /**
    34  * Writes annotation type optional member documentation in HTML format.
    35  *
    36  * @author Jamie Ho
    37  * @author Bhavesh Patel (Modified)
    38  */
    39 public class AnnotationTypeOptionalMemberWriterImpl extends
    40         AnnotationTypeRequiredMemberWriterImpl
    41     implements AnnotationTypeOptionalMemberWriter, MemberSummaryWriter {
    43     /**
    44      * Construct a new AnnotationTypeOptionalMemberWriterImpl.
    45      *
    46      * @param writer         the writer that will write the output.
    47      * @param annotationType the AnnotationType that holds this member.
    48      */
    49     public AnnotationTypeOptionalMemberWriterImpl(SubWriterHolderWriter writer,
    50         AnnotationTypeDoc annotationType) {
    51         super(writer, annotationType);
    52     }
    54     /**
    55      * {@inheritDoc}
    56      */
    57     public void writeMemberSummaryHeader(ClassDoc classDoc) {
    58         writer.println("<!-- =========== ANNOTATION TYPE OPTIONAL MEMBER SUMMARY =========== -->");
    59         writer.println();
    60         writer.printSummaryHeader(this, classDoc);
    61     }
    63     /**
    64      * {@inheritDoc}
    65      */
    66     public void writeDefaultValueInfo(MemberDoc member) {
    67         if (((AnnotationTypeElementDoc) member).defaultValue() != null) {
    68             writer.printMemberDetailsListStartTag();
    69             writer.dd();
    70             writer.dl();
    71             writer.dt();
    72             writer.strong(ConfigurationImpl.getInstance().
    73                 getText("doclet.Default"));
    74             writer.dtEnd();
    75             writer.dd();
    76             writer.print(((AnnotationTypeElementDoc) member).defaultValue());
    77             writer.ddEnd();
    78             writer.dlEnd();
    79             writer.ddEnd();
    80         }
    81     }
    83     /**
    84      * {@inheritDoc}
    85      */
    86     public void close() throws IOException {
    87         writer.close();
    88     }
    90     /**
    91      * {@inheritDoc}
    92      */
    93     public void printSummaryLabel() {
    94         writer.printText("doclet.Annotation_Type_Optional_Member_Summary");
    95     }
    97     /**
    98      * {@inheritDoc}
    99      */
   100     public void printTableSummary() {
   101         writer.tableIndexSummary(configuration().getText("doclet.Member_Table_Summary",
   102                 configuration().getText("doclet.Annotation_Type_Optional_Member_Summary"),
   103                 configuration().getText("doclet.annotation_type_optional_members")));
   104     }
   106     public void printSummaryTableHeader(ProgramElementDoc member) {
   107         String[] header = new String[] {
   108             writer.getModifierTypeHeader(),
   109             configuration().getText("doclet.0_and_1",
   110                     configuration().getText("doclet.Annotation_Type_Optional_Member"),
   111                     configuration().getText("doclet.Description"))
   112         };
   113         writer.summaryTableHeader(header, "col");
   114     }
   116     /**
   117      * {@inheritDoc}
   118      */
   119     public void printSummaryAnchor(ClassDoc cd) {
   120         writer.anchor("annotation_type_optional_element_summary");
   121     }
   123     /**
   124      * {@inheritDoc}
   125      */
   126     protected void printNavSummaryLink(ClassDoc cd, boolean link) {
   127         if (link) {
   128             writer.printHyperLink("", "annotation_type_optional_element_summary",
   129                     configuration().getText("doclet.navAnnotationTypeOptionalMember"));
   130         } else {
   131             writer.printText("doclet.navAnnotationTypeOptionalMember");
   132         }
   133     }
   134 }

mercurial