aoqi@0: /* aoqi@0: * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. aoqi@0: * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. aoqi@0: * aoqi@0: * This code is free software; you can redistribute it and/or modify it aoqi@0: * under the terms of the GNU General Public License version 2 only, as aoqi@0: * published by the Free Software Foundation. Oracle designates this aoqi@0: * particular file as subject to the "Classpath" exception as provided aoqi@0: * by Oracle in the LICENSE file that accompanied this code. aoqi@0: * aoqi@0: * This code is distributed in the hope that it will be useful, but WITHOUT aoqi@0: * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or aoqi@0: * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License aoqi@0: * version 2 for more details (a copy is included in the LICENSE file that aoqi@0: * accompanied this code). aoqi@0: * aoqi@0: * You should have received a copy of the GNU General Public License version aoqi@0: * 2 along with this work; if not, write to the Free Software Foundation, aoqi@0: * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. aoqi@0: * aoqi@0: * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA aoqi@0: * or visit www.oracle.com if you need additional information or have any aoqi@0: * questions. aoqi@0: */ aoqi@0: aoqi@0: package com.sun.tools.doclets.formats.html; aoqi@0: aoqi@0: import java.io.*; aoqi@0: aoqi@0: import com.sun.javadoc.*; aoqi@0: import com.sun.tools.doclets.formats.html.markup.*; aoqi@0: import com.sun.tools.doclets.internal.toolkit.*; aoqi@0: import com.sun.tools.doclets.internal.toolkit.util.*; aoqi@0: aoqi@0: /** aoqi@0: * Writes nested class documentation in HTML format. aoqi@0: * aoqi@0: *

This is NOT part of any supported API. aoqi@0: * If you write code that depends on this, you do so at your own risk. aoqi@0: * This code and its internal interfaces are subject to change or aoqi@0: * deletion without notice. aoqi@0: * aoqi@0: * @author Robert Field aoqi@0: * @author Atul M Dambalkar aoqi@0: * @author Jamie Ho (rewrite) aoqi@0: * @author Bhavesh Patel (Modified) aoqi@0: */ aoqi@0: public class NestedClassWriterImpl extends AbstractMemberWriter aoqi@0: implements MemberSummaryWriter { aoqi@0: aoqi@0: public NestedClassWriterImpl(SubWriterHolderWriter writer, aoqi@0: ClassDoc classdoc) { aoqi@0: super(writer, classdoc); aoqi@0: } aoqi@0: aoqi@0: public NestedClassWriterImpl(SubWriterHolderWriter writer) { aoqi@0: super(writer); aoqi@0: } aoqi@0: aoqi@0: /** aoqi@0: * {@inheritDoc} aoqi@0: */ aoqi@0: public Content getMemberSummaryHeader(ClassDoc classDoc, aoqi@0: Content memberSummaryTree) { aoqi@0: memberSummaryTree.addContent(HtmlConstants.START_OF_NESTED_CLASS_SUMMARY); aoqi@0: Content memberTree = writer.getMemberTreeHeader(); aoqi@0: writer.addSummaryHeader(this, classDoc, memberTree); aoqi@0: return memberTree; aoqi@0: } aoqi@0: aoqi@0: /** aoqi@0: * Close the writer. aoqi@0: */ aoqi@0: public void close() throws IOException { aoqi@0: writer.close(); aoqi@0: } aoqi@0: aoqi@0: public int getMemberKind() { aoqi@0: return VisibleMemberMap.INNERCLASSES; aoqi@0: } aoqi@0: aoqi@0: /** aoqi@0: * {@inheritDoc} aoqi@0: */ aoqi@0: public void addSummaryLabel(Content memberTree) { aoqi@0: Content label = HtmlTree.HEADING(HtmlConstants.SUMMARY_HEADING, aoqi@0: writer.getResource("doclet.Nested_Class_Summary")); aoqi@0: memberTree.addContent(label); aoqi@0: } aoqi@0: aoqi@0: /** aoqi@0: * {@inheritDoc} aoqi@0: */ aoqi@0: public String getTableSummary() { aoqi@0: return configuration.getText("doclet.Member_Table_Summary", aoqi@0: configuration.getText("doclet.Nested_Class_Summary"), aoqi@0: configuration.getText("doclet.nested_classes")); aoqi@0: } aoqi@0: aoqi@0: /** aoqi@0: * {@inheritDoc} aoqi@0: */ aoqi@0: public Content getCaption() { aoqi@0: return configuration.getResource("doclet.Nested_Classes"); aoqi@0: } aoqi@0: aoqi@0: /** aoqi@0: * {@inheritDoc} aoqi@0: */ aoqi@0: public String[] getSummaryTableHeader(ProgramElementDoc member) { aoqi@0: String[] header; aoqi@0: if (member.isInterface()) { aoqi@0: header = new String[] { aoqi@0: writer.getModifierTypeHeader(), aoqi@0: configuration.getText("doclet.0_and_1", aoqi@0: configuration.getText("doclet.Interface"), aoqi@0: configuration.getText("doclet.Description")) aoqi@0: }; aoqi@0: } aoqi@0: else { aoqi@0: header = new String[] { aoqi@0: writer.getModifierTypeHeader(), aoqi@0: configuration.getText("doclet.0_and_1", aoqi@0: configuration.getText("doclet.Class"), aoqi@0: configuration.getText("doclet.Description")) aoqi@0: }; aoqi@0: } aoqi@0: return header; aoqi@0: } aoqi@0: aoqi@0: /** aoqi@0: * {@inheritDoc} aoqi@0: */ aoqi@0: public void addSummaryAnchor(ClassDoc cd, Content memberTree) { aoqi@0: memberTree.addContent(writer.getMarkerAnchor( aoqi@0: SectionName.NESTED_CLASS_SUMMARY)); aoqi@0: } aoqi@0: aoqi@0: /** aoqi@0: * {@inheritDoc} aoqi@0: */ aoqi@0: public void addInheritedSummaryAnchor(ClassDoc cd, Content inheritedTree) { aoqi@0: inheritedTree.addContent(writer.getMarkerAnchor( aoqi@0: SectionName.NESTED_CLASSES_INHERITANCE, aoqi@0: cd.qualifiedName())); aoqi@0: } aoqi@0: aoqi@0: /** aoqi@0: * {@inheritDoc} aoqi@0: */ aoqi@0: public void addInheritedSummaryLabel(ClassDoc cd, Content inheritedTree) { aoqi@0: Content classLink = writer.getPreQualifiedClassLink( aoqi@0: LinkInfoImpl.Kind.MEMBER, cd, false); aoqi@0: Content label = new StringContent(cd.isInterface() ? aoqi@0: configuration.getText("doclet.Nested_Classes_Interface_Inherited_From_Interface") : aoqi@0: configuration.getText("doclet.Nested_Classes_Interfaces_Inherited_From_Class")); aoqi@0: Content labelHeading = HtmlTree.HEADING(HtmlConstants.INHERITED_SUMMARY_HEADING, aoqi@0: label); aoqi@0: labelHeading.addContent(writer.getSpace()); aoqi@0: labelHeading.addContent(classLink); aoqi@0: inheritedTree.addContent(labelHeading); aoqi@0: } aoqi@0: aoqi@0: /** aoqi@0: * {@inheritDoc} aoqi@0: */ aoqi@0: protected void addSummaryLink(LinkInfoImpl.Kind context, ClassDoc cd, ProgramElementDoc member, aoqi@0: Content tdSummary) { aoqi@0: Content memberLink = HtmlTree.SPAN(HtmlStyle.memberNameLink, aoqi@0: writer.getLink(new LinkInfoImpl(configuration, context, (ClassDoc)member))); aoqi@0: Content code = HtmlTree.CODE(memberLink); aoqi@0: tdSummary.addContent(code); aoqi@0: } aoqi@0: aoqi@0: /** aoqi@0: * {@inheritDoc} aoqi@0: */ aoqi@0: protected void addInheritedSummaryLink(ClassDoc cd, aoqi@0: ProgramElementDoc member, Content linksTree) { aoqi@0: linksTree.addContent( aoqi@0: writer.getLink(new LinkInfoImpl(configuration, LinkInfoImpl.Kind.MEMBER, aoqi@0: (ClassDoc)member))); aoqi@0: } aoqi@0: aoqi@0: /** aoqi@0: * {@inheritDoc} aoqi@0: */ aoqi@0: protected void addSummaryType(ProgramElementDoc member, aoqi@0: Content tdSummaryType) { aoqi@0: ClassDoc cd = (ClassDoc)member; aoqi@0: addModifierAndType(cd, null, tdSummaryType); aoqi@0: } aoqi@0: aoqi@0: /** aoqi@0: * {@inheritDoc} aoqi@0: */ aoqi@0: protected Content getDeprecatedLink(ProgramElementDoc member) { aoqi@0: return writer.getQualifiedClassLink(LinkInfoImpl.Kind.MEMBER, aoqi@0: (ClassDoc)member); aoqi@0: } aoqi@0: aoqi@0: /** aoqi@0: * {@inheritDoc} aoqi@0: */ aoqi@0: protected Content getNavSummaryLink(ClassDoc cd, boolean link) { aoqi@0: if (link) { aoqi@0: if (cd == null) { aoqi@0: return writer.getHyperLink( aoqi@0: SectionName.NESTED_CLASS_SUMMARY, aoqi@0: writer.getResource("doclet.navNested")); aoqi@0: } else { aoqi@0: return writer.getHyperLink( aoqi@0: SectionName.NESTED_CLASSES_INHERITANCE, aoqi@0: cd.qualifiedName(), writer.getResource("doclet.navNested")); aoqi@0: } aoqi@0: } else { aoqi@0: return writer.getResource("doclet.navNested"); aoqi@0: } aoqi@0: } aoqi@0: aoqi@0: /** aoqi@0: * {@inheritDoc} aoqi@0: */ aoqi@0: protected void addNavDetailLink(boolean link, Content liNav) { aoqi@0: } aoqi@0: }