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

Tue, 14 May 2013 10:14:52 -0700

author
jjg
date
Tue, 14 May 2013 10:14:52 -0700
changeset 1736
74cd21f2c2fe
parent 1735
8ea30d59ac41
child 1737
7a9ef837e57f
permissions
-rw-r--r--

8011642: Remove LinkOutput in favor of direct use of Content
Reviewed-by: bpatel, darcy

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

mercurial