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

Wed, 10 Oct 2012 16:48:21 -0700

author
jjg
date
Wed, 10 Oct 2012 16:48:21 -0700
changeset 1359
25e14ad23cef
parent 798
4868a36f6fd8
child 1372
78962d89f283
permissions
-rw-r--r--

8000665: fix "internal API" comments on javadoc files
Reviewed-by: darcy

     1 /*
     2  * Copyright (c) 1997, 2012, 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.*;
    29 import java.util.*;
    31 import com.sun.javadoc.*;
    32 import com.sun.tools.doclets.formats.html.markup.*;
    33 import com.sun.tools.doclets.internal.toolkit.*;
    34 import com.sun.tools.doclets.internal.toolkit.util.*;
    36 /**
    37  * Writes nested class documentation in HTML format.
    38  *
    39  *  <p><b>This is NOT part of any supported API.
    40  *  If you write code that depends on this, you do so at your own risk.
    41  *  This code and its internal interfaces are subject to change or
    42  *  deletion without notice.</b>
    43  *
    44  * @author Robert Field
    45  * @author Atul M Dambalkar
    46  * @author Jamie Ho (rewrite)
    47  * @author Bhavesh Patel (Modified)
    48  */
    49 public class NestedClassWriterImpl extends AbstractMemberWriter
    50     implements MemberSummaryWriter {
    52     public NestedClassWriterImpl(SubWriterHolderWriter writer,
    53             ClassDoc classdoc) {
    54         super(writer, classdoc);
    55     }
    57     public NestedClassWriterImpl(SubWriterHolderWriter writer) {
    58         super(writer);
    59     }
    61     /**
    62      * {@inheritDoc}
    63      */
    64     public Content getMemberSummaryHeader(ClassDoc classDoc,
    65             Content memberSummaryTree) {
    66         memberSummaryTree.addContent(HtmlConstants.START_OF_NESTED_CLASS_SUMMARY);
    67         Content memberTree = writer.getMemberTreeHeader();
    68         writer.addSummaryHeader(this, classDoc, memberTree);
    69         return memberTree;
    70     }
    72     /**
    73      * Close the writer.
    74      */
    75     public void close() throws IOException {
    76         writer.close();
    77     }
    79     public int getMemberKind() {
    80         return VisibleMemberMap.INNERCLASSES;
    81     }
    83     /**
    84      * {@inheritDoc}
    85      */
    86     public void addSummaryLabel(Content memberTree) {
    87         Content label = HtmlTree.HEADING(HtmlConstants.SUMMARY_HEADING,
    88                 writer.getResource("doclet.Nested_Class_Summary"));
    89         memberTree.addContent(label);
    90     }
    92     /**
    93      * {@inheritDoc}
    94      */
    95     public String getTableSummary() {
    96         return configuration().getText("doclet.Member_Table_Summary",
    97                 configuration().getText("doclet.Nested_Class_Summary"),
    98                 configuration().getText("doclet.nested_classes"));
    99     }
   101     /**
   102      * {@inheritDoc}
   103      */
   104     public String getCaption() {
   105         return configuration().getText("doclet.Nested_Classes");
   106     }
   108     /**
   109      * {@inheritDoc}
   110      */
   111     public String[] getSummaryTableHeader(ProgramElementDoc member) {
   112         String[] header;
   113         if (member.isInterface()) {
   114             header = new String[] {
   115                 writer.getModifierTypeHeader(),
   116                 configuration().getText("doclet.0_and_1",
   117                         configuration().getText("doclet.Interface"),
   118                         configuration().getText("doclet.Description"))
   119             };
   120         }
   121         else {
   122             header = new String[] {
   123                 writer.getModifierTypeHeader(),
   124                 configuration().getText("doclet.0_and_1",
   125                         configuration().getText("doclet.Class"),
   126                         configuration().getText("doclet.Description"))
   127             };
   128         }
   129         return header;
   130     }
   132     /**
   133      * {@inheritDoc}
   134      */
   135     public void addSummaryAnchor(ClassDoc cd, Content memberTree) {
   136         memberTree.addContent(writer.getMarkerAnchor("nested_class_summary"));
   137     }
   139     /**
   140      * {@inheritDoc}
   141      */
   142     public void addInheritedSummaryAnchor(ClassDoc cd, Content inheritedTree) {
   143         inheritedTree.addContent(writer.getMarkerAnchor(
   144                 "nested_classes_inherited_from_class_" + cd.qualifiedName()));
   145     }
   147     /**
   148      * {@inheritDoc}
   149      */
   150     public void addInheritedSummaryLabel(ClassDoc cd, Content inheritedTree) {
   151         Content classLink = new RawHtml(writer.getPreQualifiedClassLink(
   152                 LinkInfoImpl.CONTEXT_MEMBER, cd, false));
   153         Content label = new StringContent(cd.isInterface() ?
   154             configuration().getText("doclet.Nested_Classes_Interface_Inherited_From_Interface") :
   155             configuration().getText("doclet.Nested_Classes_Interfaces_Inherited_From_Class"));
   156         Content labelHeading = HtmlTree.HEADING(HtmlConstants.INHERITED_SUMMARY_HEADING,
   157                 label);
   158         labelHeading.addContent(writer.getSpace());
   159         labelHeading.addContent(classLink);
   160         inheritedTree.addContent(labelHeading);
   161     }
   163     /**
   164      * {@inheritDoc}
   165      */
   166     protected void addSummaryLink(int context, ClassDoc cd, ProgramElementDoc member,
   167             Content tdSummary) {
   168         Content strong = HtmlTree.STRONG(new RawHtml(
   169                 writer.getLink(new LinkInfoImpl(context, (ClassDoc)member, false))));
   170         Content code = HtmlTree.CODE(strong);
   171         tdSummary.addContent(code);
   172     }
   174     /**
   175      * {@inheritDoc}
   176      */
   177     protected void addInheritedSummaryLink(ClassDoc cd,
   178             ProgramElementDoc member, Content linksTree) {
   179         linksTree.addContent(new RawHtml(
   180                 writer.getLink(new LinkInfoImpl(LinkInfoImpl.CONTEXT_MEMBER,
   181                 (ClassDoc)member, false))));
   182     }
   184     /**
   185      * {@inheritDoc}
   186      */
   187     protected void addSummaryType(ProgramElementDoc member,
   188             Content tdSummaryType) {
   189         ClassDoc cd = (ClassDoc)member;
   190         addModifierAndType(cd, null, tdSummaryType);
   191     }
   193     /**
   194      * {@inheritDoc}
   195      */
   196     protected Content getDeprecatedLink(ProgramElementDoc member) {
   197         return writer.getQualifiedClassLink(LinkInfoImpl.CONTEXT_MEMBER,
   198                 (ClassDoc)member);
   199     }
   201     /**
   202      * {@inheritDoc}
   203      */
   204     protected Content getNavSummaryLink(ClassDoc cd, boolean link) {
   205         if (link) {
   206             return writer.getHyperLink("", (cd == null) ? "nested_class_summary":
   207                 "nested_classes_inherited_from_class_" +
   208                 cd.qualifiedName(),
   209                 writer.getResource("doclet.navNested"));
   210         } else {
   211             return writer.getResource("doclet.navNested");
   212         }
   213     }
   215     /**
   216      * {@inheritDoc}
   217      */
   218     protected void addNavDetailLink(boolean link, Content liNav) {
   219     }
   220 }

mercurial