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

Sat, 13 Apr 2013 18:48:29 -0700

author
bpatel
date
Sat, 13 Apr 2013 18:48:29 -0700
changeset 1691
f10cffab99b4
parent 1410
bfec2a1cc869
child 1735
8ea30d59ac41
permissions
-rw-r--r--

8009686: Generated javadoc documentation should be able to display type annotation on an array
Reviewed-by: jjg

duke@1 1 /*
jjg@1359 2 * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
duke@1 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
duke@1 4 *
duke@1 5 * This code is free software; you can redistribute it and/or modify it
duke@1 6 * under the terms of the GNU General Public License version 2 only, as
ohair@554 7 * published by the Free Software Foundation. Oracle designates this
duke@1 8 * particular file as subject to the "Classpath" exception as provided
ohair@554 9 * by Oracle in the LICENSE file that accompanied this code.
duke@1 10 *
duke@1 11 * This code is distributed in the hope that it will be useful, but WITHOUT
duke@1 12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
duke@1 13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
duke@1 14 * version 2 for more details (a copy is included in the LICENSE file that
duke@1 15 * accompanied this code).
duke@1 16 *
duke@1 17 * You should have received a copy of the GNU General Public License version
duke@1 18 * 2 along with this work; if not, write to the Free Software Foundation,
duke@1 19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
duke@1 20 *
ohair@554 21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
ohair@554 22 * or visit www.oracle.com if you need additional information or have any
ohair@554 23 * questions.
duke@1 24 */
duke@1 25
duke@1 26 package com.sun.tools.doclets.formats.html;
duke@1 27
bpatel@233 28 import java.io.*;
bpatel@766 29 import java.util.*;
bpatel@233 30
bpatel@233 31 import com.sun.javadoc.*;
bpatel@766 32 import com.sun.tools.doclets.formats.html.markup.*;
duke@1 33 import com.sun.tools.doclets.internal.toolkit.*;
duke@1 34 import com.sun.tools.doclets.internal.toolkit.util.*;
duke@1 35
duke@1 36 /**
duke@1 37 * Writes nested class documentation in HTML format.
duke@1 38 *
jjg@1359 39 * <p><b>This is NOT part of any supported API.
jjg@1359 40 * If you write code that depends on this, you do so at your own risk.
jjg@1359 41 * This code and its internal interfaces are subject to change or
jjg@1359 42 * deletion without notice.</b>
jjg@1359 43 *
duke@1 44 * @author Robert Field
duke@1 45 * @author Atul M Dambalkar
duke@1 46 * @author Jamie Ho (rewrite)
bpatel@243 47 * @author Bhavesh Patel (Modified)
duke@1 48 */
duke@1 49 public class NestedClassWriterImpl extends AbstractMemberWriter
duke@1 50 implements MemberSummaryWriter {
duke@1 51
duke@1 52 public NestedClassWriterImpl(SubWriterHolderWriter writer,
duke@1 53 ClassDoc classdoc) {
duke@1 54 super(writer, classdoc);
duke@1 55 }
duke@1 56
duke@1 57 public NestedClassWriterImpl(SubWriterHolderWriter writer) {
duke@1 58 super(writer);
duke@1 59 }
duke@1 60
duke@1 61 /**
duke@1 62 * {@inheritDoc}
duke@1 63 */
bpatel@766 64 public Content getMemberSummaryHeader(ClassDoc classDoc,
bpatel@766 65 Content memberSummaryTree) {
bpatel@766 66 memberSummaryTree.addContent(HtmlConstants.START_OF_NESTED_CLASS_SUMMARY);
bpatel@766 67 Content memberTree = writer.getMemberTreeHeader();
bpatel@766 68 writer.addSummaryHeader(this, classDoc, memberTree);
bpatel@766 69 return memberTree;
duke@1 70 }
duke@1 71
duke@1 72 /**
duke@1 73 * Close the writer.
duke@1 74 */
duke@1 75 public void close() throws IOException {
duke@1 76 writer.close();
duke@1 77 }
duke@1 78
duke@1 79 public int getMemberKind() {
duke@1 80 return VisibleMemberMap.INNERCLASSES;
duke@1 81 }
duke@1 82
bpatel@766 83 /**
bpatel@766 84 * {@inheritDoc}
bpatel@766 85 */
bpatel@766 86 public void addSummaryLabel(Content memberTree) {
bpatel@766 87 Content label = HtmlTree.HEADING(HtmlConstants.SUMMARY_HEADING,
bpatel@766 88 writer.getResource("doclet.Nested_Class_Summary"));
bpatel@766 89 memberTree.addContent(label);
bpatel@243 90 }
bpatel@243 91
bpatel@766 92 /**
bpatel@766 93 * {@inheritDoc}
bpatel@766 94 */
bpatel@766 95 public String getTableSummary() {
jjg@1410 96 return configuration.getText("doclet.Member_Table_Summary",
jjg@1410 97 configuration.getText("doclet.Nested_Class_Summary"),
jjg@1410 98 configuration.getText("doclet.nested_classes"));
bpatel@243 99 }
bpatel@243 100
bpatel@766 101 /**
bpatel@766 102 * {@inheritDoc}
bpatel@766 103 */
bpatel@766 104 public String getCaption() {
jjg@1410 105 return configuration.getText("doclet.Nested_Classes");
bpatel@766 106 }
bpatel@766 107
bpatel@766 108 /**
bpatel@766 109 * {@inheritDoc}
bpatel@766 110 */
bpatel@766 111 public String[] getSummaryTableHeader(ProgramElementDoc member) {
bpatel@243 112 String[] header;
bpatel@243 113 if (member.isInterface()) {
bpatel@243 114 header = new String[] {
bpatel@243 115 writer.getModifierTypeHeader(),
jjg@1410 116 configuration.getText("doclet.0_and_1",
jjg@1410 117 configuration.getText("doclet.Interface"),
jjg@1410 118 configuration.getText("doclet.Description"))
bpatel@243 119 };
bpatel@243 120 }
bpatel@243 121 else {
bpatel@243 122 header = new String[] {
bpatel@243 123 writer.getModifierTypeHeader(),
jjg@1410 124 configuration.getText("doclet.0_and_1",
jjg@1410 125 configuration.getText("doclet.Class"),
jjg@1410 126 configuration.getText("doclet.Description"))
bpatel@243 127 };
bpatel@243 128 }
bpatel@766 129 return header;
duke@1 130 }
duke@1 131
bpatel@766 132 /**
bpatel@766 133 * {@inheritDoc}
bpatel@766 134 */
bpatel@766 135 public void addSummaryAnchor(ClassDoc cd, Content memberTree) {
bpatel@766 136 memberTree.addContent(writer.getMarkerAnchor("nested_class_summary"));
duke@1 137 }
duke@1 138
bpatel@766 139 /**
bpatel@766 140 * {@inheritDoc}
bpatel@766 141 */
bpatel@766 142 public void addInheritedSummaryAnchor(ClassDoc cd, Content inheritedTree) {
bpatel@766 143 inheritedTree.addContent(writer.getMarkerAnchor(
bpatel@766 144 "nested_classes_inherited_from_class_" + cd.qualifiedName()));
duke@1 145 }
duke@1 146
bpatel@766 147 /**
bpatel@766 148 * {@inheritDoc}
bpatel@766 149 */
bpatel@766 150 public void addInheritedSummaryLabel(ClassDoc cd, Content inheritedTree) {
bpatel@766 151 Content classLink = new RawHtml(writer.getPreQualifiedClassLink(
bpatel@766 152 LinkInfoImpl.CONTEXT_MEMBER, cd, false));
bpatel@766 153 Content label = new StringContent(cd.isInterface() ?
jjg@1410 154 configuration.getText("doclet.Nested_Classes_Interface_Inherited_From_Interface") :
jjg@1410 155 configuration.getText("doclet.Nested_Classes_Interfaces_Inherited_From_Class"));
bpatel@766 156 Content labelHeading = HtmlTree.HEADING(HtmlConstants.INHERITED_SUMMARY_HEADING,
bpatel@766 157 label);
bpatel@766 158 labelHeading.addContent(writer.getSpace());
bpatel@766 159 labelHeading.addContent(classLink);
bpatel@766 160 inheritedTree.addContent(labelHeading);
duke@1 161 }
duke@1 162
bpatel@766 163 /**
bpatel@766 164 * {@inheritDoc}
bpatel@766 165 */
bpatel@766 166 protected void addSummaryLink(int context, ClassDoc cd, ProgramElementDoc member,
bpatel@766 167 Content tdSummary) {
bpatel@766 168 Content strong = HtmlTree.STRONG(new RawHtml(
jjg@1410 169 writer.getLink(new LinkInfoImpl(configuration, context, (ClassDoc)member, false))));
bpatel@766 170 Content code = HtmlTree.CODE(strong);
bpatel@766 171 tdSummary.addContent(code);
duke@1 172 }
duke@1 173
bpatel@766 174 /**
bpatel@766 175 * {@inheritDoc}
bpatel@766 176 */
bpatel@766 177 protected void addInheritedSummaryLink(ClassDoc cd,
bpatel@766 178 ProgramElementDoc member, Content linksTree) {
bpatel@766 179 linksTree.addContent(new RawHtml(
jjg@1410 180 writer.getLink(new LinkInfoImpl(configuration, LinkInfoImpl.CONTEXT_MEMBER,
bpatel@766 181 (ClassDoc)member, false))));
duke@1 182 }
duke@1 183
bpatel@766 184 /**
bpatel@766 185 * {@inheritDoc}
bpatel@766 186 */
bpatel@766 187 protected void addSummaryType(ProgramElementDoc member,
bpatel@766 188 Content tdSummaryType) {
duke@1 189 ClassDoc cd = (ClassDoc)member;
bpatel@766 190 addModifierAndType(cd, null, tdSummaryType);
duke@1 191 }
duke@1 192
bpatel@766 193 /**
bpatel@766 194 * {@inheritDoc}
bpatel@766 195 */
bpatel@766 196 protected Content getDeprecatedLink(ProgramElementDoc member) {
bpatel@766 197 return writer.getQualifiedClassLink(LinkInfoImpl.CONTEXT_MEMBER,
bpatel@766 198 (ClassDoc)member);
duke@1 199 }
duke@1 200
bpatel@766 201 /**
bpatel@766 202 * {@inheritDoc}
bpatel@766 203 */
bpatel@766 204 protected Content getNavSummaryLink(ClassDoc cd, boolean link) {
duke@1 205 if (link) {
jjg@1372 206 return writer.getHyperLink((cd == null) ? "nested_class_summary":
jjg@1372 207 "nested_classes_inherited_from_class_" + cd.qualifiedName(),
bpatel@766 208 writer.getResource("doclet.navNested"));
duke@1 209 } else {
bpatel@766 210 return writer.getResource("doclet.navNested");
duke@1 211 }
duke@1 212 }
duke@1 213
bpatel@766 214 /**
bpatel@766 215 * {@inheritDoc}
bpatel@766 216 */
bpatel@766 217 protected void addNavDetailLink(boolean link, Content liNav) {
duke@1 218 }
duke@1 219 }

mercurial