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

Tue, 09 Oct 2012 19:10:00 -0700

author
jjg
date
Tue, 09 Oct 2012 19:10:00 -0700
changeset 1357
c75be5bc5283
parent 798
4868a36f6fd8
child 1359
25e14ad23cef
permissions
-rw-r--r--

8000663: clean up langtools imports
Reviewed-by: darcy

     1 /*
     2  * Copyright (c) 1997, 2010, 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  * @author Robert Field
    40  * @author Atul M Dambalkar
    41  * @author Jamie Ho (rewrite)
    42  * @author Bhavesh Patel (Modified)
    43  */
    44 public class NestedClassWriterImpl extends AbstractMemberWriter
    45     implements MemberSummaryWriter {
    47     public NestedClassWriterImpl(SubWriterHolderWriter writer,
    48             ClassDoc classdoc) {
    49         super(writer, classdoc);
    50     }
    52     public NestedClassWriterImpl(SubWriterHolderWriter writer) {
    53         super(writer);
    54     }
    56     /**
    57      * {@inheritDoc}
    58      */
    59     public Content getMemberSummaryHeader(ClassDoc classDoc,
    60             Content memberSummaryTree) {
    61         memberSummaryTree.addContent(HtmlConstants.START_OF_NESTED_CLASS_SUMMARY);
    62         Content memberTree = writer.getMemberTreeHeader();
    63         writer.addSummaryHeader(this, classDoc, memberTree);
    64         return memberTree;
    65     }
    67     /**
    68      * Close the writer.
    69      */
    70     public void close() throws IOException {
    71         writer.close();
    72     }
    74     public int getMemberKind() {
    75         return VisibleMemberMap.INNERCLASSES;
    76     }
    78     /**
    79      * {@inheritDoc}
    80      */
    81     public void addSummaryLabel(Content memberTree) {
    82         Content label = HtmlTree.HEADING(HtmlConstants.SUMMARY_HEADING,
    83                 writer.getResource("doclet.Nested_Class_Summary"));
    84         memberTree.addContent(label);
    85     }
    87     /**
    88      * {@inheritDoc}
    89      */
    90     public String getTableSummary() {
    91         return configuration().getText("doclet.Member_Table_Summary",
    92                 configuration().getText("doclet.Nested_Class_Summary"),
    93                 configuration().getText("doclet.nested_classes"));
    94     }
    96     /**
    97      * {@inheritDoc}
    98      */
    99     public String getCaption() {
   100         return configuration().getText("doclet.Nested_Classes");
   101     }
   103     /**
   104      * {@inheritDoc}
   105      */
   106     public String[] getSummaryTableHeader(ProgramElementDoc member) {
   107         String[] header;
   108         if (member.isInterface()) {
   109             header = new String[] {
   110                 writer.getModifierTypeHeader(),
   111                 configuration().getText("doclet.0_and_1",
   112                         configuration().getText("doclet.Interface"),
   113                         configuration().getText("doclet.Description"))
   114             };
   115         }
   116         else {
   117             header = new String[] {
   118                 writer.getModifierTypeHeader(),
   119                 configuration().getText("doclet.0_and_1",
   120                         configuration().getText("doclet.Class"),
   121                         configuration().getText("doclet.Description"))
   122             };
   123         }
   124         return header;
   125     }
   127     /**
   128      * {@inheritDoc}
   129      */
   130     public void addSummaryAnchor(ClassDoc cd, Content memberTree) {
   131         memberTree.addContent(writer.getMarkerAnchor("nested_class_summary"));
   132     }
   134     /**
   135      * {@inheritDoc}
   136      */
   137     public void addInheritedSummaryAnchor(ClassDoc cd, Content inheritedTree) {
   138         inheritedTree.addContent(writer.getMarkerAnchor(
   139                 "nested_classes_inherited_from_class_" + cd.qualifiedName()));
   140     }
   142     /**
   143      * {@inheritDoc}
   144      */
   145     public void addInheritedSummaryLabel(ClassDoc cd, Content inheritedTree) {
   146         Content classLink = new RawHtml(writer.getPreQualifiedClassLink(
   147                 LinkInfoImpl.CONTEXT_MEMBER, cd, false));
   148         Content label = new StringContent(cd.isInterface() ?
   149             configuration().getText("doclet.Nested_Classes_Interface_Inherited_From_Interface") :
   150             configuration().getText("doclet.Nested_Classes_Interfaces_Inherited_From_Class"));
   151         Content labelHeading = HtmlTree.HEADING(HtmlConstants.INHERITED_SUMMARY_HEADING,
   152                 label);
   153         labelHeading.addContent(writer.getSpace());
   154         labelHeading.addContent(classLink);
   155         inheritedTree.addContent(labelHeading);
   156     }
   158     /**
   159      * {@inheritDoc}
   160      */
   161     protected void addSummaryLink(int context, ClassDoc cd, ProgramElementDoc member,
   162             Content tdSummary) {
   163         Content strong = HtmlTree.STRONG(new RawHtml(
   164                 writer.getLink(new LinkInfoImpl(context, (ClassDoc)member, false))));
   165         Content code = HtmlTree.CODE(strong);
   166         tdSummary.addContent(code);
   167     }
   169     /**
   170      * {@inheritDoc}
   171      */
   172     protected void addInheritedSummaryLink(ClassDoc cd,
   173             ProgramElementDoc member, Content linksTree) {
   174         linksTree.addContent(new RawHtml(
   175                 writer.getLink(new LinkInfoImpl(LinkInfoImpl.CONTEXT_MEMBER,
   176                 (ClassDoc)member, false))));
   177     }
   179     /**
   180      * {@inheritDoc}
   181      */
   182     protected void addSummaryType(ProgramElementDoc member,
   183             Content tdSummaryType) {
   184         ClassDoc cd = (ClassDoc)member;
   185         addModifierAndType(cd, null, tdSummaryType);
   186     }
   188     /**
   189      * {@inheritDoc}
   190      */
   191     protected Content getDeprecatedLink(ProgramElementDoc member) {
   192         return writer.getQualifiedClassLink(LinkInfoImpl.CONTEXT_MEMBER,
   193                 (ClassDoc)member);
   194     }
   196     /**
   197      * {@inheritDoc}
   198      */
   199     protected Content getNavSummaryLink(ClassDoc cd, boolean link) {
   200         if (link) {
   201             return writer.getHyperLink("", (cd == null) ? "nested_class_summary":
   202                 "nested_classes_inherited_from_class_" +
   203                 cd.qualifiedName(),
   204                 writer.getResource("doclet.navNested"));
   205         } else {
   206             return writer.getResource("doclet.navNested");
   207         }
   208     }
   210     /**
   211      * {@inheritDoc}
   212      */
   213     protected void addNavDetailLink(boolean link, Content liNav) {
   214     }
   215 }

mercurial