duke@1: /* ohair@554: * Copyright (c) 1997, 2004, Oracle and/or its affiliates. All rights reserved. duke@1: * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. duke@1: * duke@1: * This code is free software; you can redistribute it and/or modify it duke@1: * under the terms of the GNU General Public License version 2 only, as ohair@554: * published by the Free Software Foundation. Oracle designates this duke@1: * particular file as subject to the "Classpath" exception as provided ohair@554: * by Oracle in the LICENSE file that accompanied this code. duke@1: * duke@1: * This code is distributed in the hope that it will be useful, but WITHOUT duke@1: * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or duke@1: * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License duke@1: * version 2 for more details (a copy is included in the LICENSE file that duke@1: * accompanied this code). duke@1: * duke@1: * You should have received a copy of the GNU General Public License version duke@1: * 2 along with this work; if not, write to the Free Software Foundation, duke@1: * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. duke@1: * ohair@554: * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA ohair@554: * or visit www.oracle.com if you need additional information or have any ohair@554: * questions. duke@1: */ duke@1: duke@1: package com.sun.tools.doclets.formats.html; duke@1: bpatel@233: import java.io.*; bpatel@766: import java.util.*; bpatel@233: bpatel@233: import com.sun.javadoc.*; bpatel@766: import com.sun.tools.doclets.formats.html.markup.*; duke@1: import com.sun.tools.doclets.internal.toolkit.*; duke@1: import com.sun.tools.doclets.internal.toolkit.util.*; duke@1: duke@1: /** duke@1: * Writes nested class documentation in HTML format. duke@1: * duke@1: * @author Robert Field duke@1: * @author Atul M Dambalkar duke@1: * @author Jamie Ho (rewrite) bpatel@243: * @author Bhavesh Patel (Modified) duke@1: */ duke@1: public class NestedClassWriterImpl extends AbstractMemberWriter duke@1: implements MemberSummaryWriter { duke@1: duke@1: public NestedClassWriterImpl(SubWriterHolderWriter writer, duke@1: ClassDoc classdoc) { duke@1: super(writer, classdoc); duke@1: } duke@1: duke@1: public NestedClassWriterImpl(SubWriterHolderWriter writer) { duke@1: super(writer); duke@1: } duke@1: duke@1: /** duke@1: * {@inheritDoc} duke@1: */ bpatel@766: public Content getMemberSummaryHeader(ClassDoc classDoc, bpatel@766: Content memberSummaryTree) { bpatel@766: memberSummaryTree.addContent(HtmlConstants.START_OF_NESTED_CLASS_SUMMARY); bpatel@766: Content memberTree = writer.getMemberTreeHeader(); bpatel@766: writer.addSummaryHeader(this, classDoc, memberTree); bpatel@766: return memberTree; duke@1: } duke@1: duke@1: /** duke@1: * Close the writer. duke@1: */ duke@1: public void close() throws IOException { duke@1: writer.close(); duke@1: } duke@1: duke@1: public int getMemberKind() { duke@1: return VisibleMemberMap.INNERCLASSES; duke@1: } duke@1: bpatel@766: /** bpatel@766: * {@inheritDoc} bpatel@766: */ bpatel@766: public void addSummaryLabel(Content memberTree) { bpatel@766: Content label = HtmlTree.HEADING(HtmlConstants.SUMMARY_HEADING, bpatel@766: writer.getResource("doclet.Nested_Class_Summary")); bpatel@766: memberTree.addContent(label); bpatel@243: } bpatel@243: bpatel@766: /** bpatel@766: * {@inheritDoc} bpatel@766: */ bpatel@766: public String getTableSummary() { bpatel@766: return configuration().getText("doclet.Member_Table_Summary", bpatel@243: configuration().getText("doclet.Nested_Class_Summary"), bpatel@766: configuration().getText("doclet.nested_classes")); bpatel@243: } bpatel@243: bpatel@766: /** bpatel@766: * {@inheritDoc} bpatel@766: */ bpatel@766: public String getCaption() { bpatel@766: return configuration().getText("doclet.Nested_Classes"); bpatel@766: } bpatel@766: bpatel@766: /** bpatel@766: * {@inheritDoc} bpatel@766: */ bpatel@766: public String[] getSummaryTableHeader(ProgramElementDoc member) { bpatel@243: String[] header; bpatel@243: if (member.isInterface()) { bpatel@243: header = new String[] { bpatel@243: writer.getModifierTypeHeader(), bpatel@243: configuration().getText("doclet.0_and_1", bpatel@243: configuration().getText("doclet.Interface"), bpatel@243: configuration().getText("doclet.Description")) bpatel@243: }; bpatel@243: } bpatel@243: else { bpatel@243: header = new String[] { bpatel@243: writer.getModifierTypeHeader(), bpatel@243: configuration().getText("doclet.0_and_1", bpatel@243: configuration().getText("doclet.Class"), bpatel@243: configuration().getText("doclet.Description")) bpatel@243: }; bpatel@243: } bpatel@766: return header; duke@1: } duke@1: bpatel@766: /** bpatel@766: * {@inheritDoc} bpatel@766: */ bpatel@766: public void addSummaryAnchor(ClassDoc cd, Content memberTree) { bpatel@766: memberTree.addContent(writer.getMarkerAnchor("nested_class_summary")); duke@1: } duke@1: bpatel@766: /** bpatel@766: * {@inheritDoc} bpatel@766: */ bpatel@766: public void addInheritedSummaryAnchor(ClassDoc cd, Content inheritedTree) { bpatel@766: inheritedTree.addContent(writer.getMarkerAnchor( bpatel@766: "nested_classes_inherited_from_class_" + cd.qualifiedName())); duke@1: } duke@1: bpatel@766: /** bpatel@766: * {@inheritDoc} bpatel@766: */ bpatel@766: public void addInheritedSummaryLabel(ClassDoc cd, Content inheritedTree) { bpatel@766: Content classLink = new RawHtml(writer.getPreQualifiedClassLink( bpatel@766: LinkInfoImpl.CONTEXT_MEMBER, cd, false)); bpatel@766: Content label = new StringContent(cd.isInterface() ? bpatel@766: configuration().getText("doclet.Nested_Classes_Interface_Inherited_From_Interface") : bpatel@766: configuration().getText("doclet.Nested_Classes_Interfaces_Inherited_From_Class")); bpatel@766: Content labelHeading = HtmlTree.HEADING(HtmlConstants.INHERITED_SUMMARY_HEADING, bpatel@766: label); bpatel@766: labelHeading.addContent(writer.getSpace()); bpatel@766: labelHeading.addContent(classLink); bpatel@766: inheritedTree.addContent(labelHeading); duke@1: } duke@1: bpatel@766: /** bpatel@766: * {@inheritDoc} bpatel@766: */ bpatel@766: protected void addSummaryLink(int context, ClassDoc cd, ProgramElementDoc member, bpatel@766: Content tdSummary) { bpatel@766: Content strong = HtmlTree.STRONG(new RawHtml( bpatel@766: writer.getLink(new LinkInfoImpl(context, (ClassDoc)member, false)))); bpatel@766: Content code = HtmlTree.CODE(strong); bpatel@766: tdSummary.addContent(code); duke@1: } duke@1: bpatel@766: /** bpatel@766: * {@inheritDoc} bpatel@766: */ bpatel@766: protected void addInheritedSummaryLink(ClassDoc cd, bpatel@766: ProgramElementDoc member, Content linksTree) { bpatel@766: linksTree.addContent(new RawHtml( bpatel@766: writer.getLink(new LinkInfoImpl(LinkInfoImpl.CONTEXT_MEMBER, bpatel@766: (ClassDoc)member, false)))); duke@1: } duke@1: bpatel@766: /** bpatel@766: * {@inheritDoc} bpatel@766: */ bpatel@766: protected void addSummaryType(ProgramElementDoc member, bpatel@766: Content tdSummaryType) { duke@1: ClassDoc cd = (ClassDoc)member; bpatel@766: addModifierAndType(cd, null, tdSummaryType); duke@1: } duke@1: bpatel@766: /** bpatel@766: * {@inheritDoc} bpatel@766: */ bpatel@766: protected Content getDeprecatedLink(ProgramElementDoc member) { bpatel@766: return writer.getQualifiedClassLink(LinkInfoImpl.CONTEXT_MEMBER, bpatel@766: (ClassDoc)member); duke@1: } duke@1: bpatel@766: /** bpatel@766: * {@inheritDoc} bpatel@766: */ bpatel@766: protected Content getNavSummaryLink(ClassDoc cd, boolean link) { duke@1: if (link) { bpatel@766: return writer.getHyperLink("", (cd == null) ? "nested_class_summary": bpatel@766: "nested_classes_inherited_from_class_" + duke@1: cd.qualifiedName(), bpatel@766: writer.getResource("doclet.navNested")); duke@1: } else { bpatel@766: return writer.getResource("doclet.navNested"); duke@1: } duke@1: } duke@1: bpatel@766: /** bpatel@766: * {@inheritDoc} bpatel@766: */ bpatel@766: protected void addNavDetailLink(boolean link, Content liNav) { duke@1: } duke@1: }