author | bpatel |
Fri, 18 Oct 2013 16:34:42 -0700 | |
changeset 21478 | fa4c7cda1b41 |
parent 21008 | af0b915df7cc |
child 22159 | 682da512ec17 |
permissions | -rw-r--r-- |
10 | 1 |
/* |
17558
eee4ccf66cfd
8010440: Replace int constants in LinkInfoImpl with enum
jjg
parents:
14542
diff
changeset
|
2 |
* Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved. |
10 | 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 |
|
5520 | 7 |
* published by the Free Software Foundation. Oracle designates this |
10 | 8 |
* particular file as subject to the "Classpath" exception as provided |
5520 | 9 |
* by Oracle in the LICENSE file that accompanied this code. |
10 | 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 |
* |
|
5520 | 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. |
|
10 | 24 |
*/ |
25 |
||
26 |
package com.sun.tools.doclets.formats.html; |
|
27 |
||
2216
b124d5c924eb
6786690: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - DL tag and nesting issue
bpatel
parents:
1789
diff
changeset
|
28 |
import java.io.*; |
b124d5c924eb
6786690: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - DL tag and nesting issue
bpatel
parents:
1789
diff
changeset
|
29 |
import java.util.*; |
10 | 30 |
|
31 |
import com.sun.javadoc.*; |
|
7614
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
32 |
import com.sun.tools.doclets.formats.html.markup.*; |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
33 |
import com.sun.tools.doclets.internal.toolkit.*; |
14258 | 34 |
import com.sun.tools.doclets.internal.toolkit.util.*; |
10 | 35 |
|
36 |
/** |
|
37 |
* Generate Index for all the Member Names with Indexing in |
|
38 |
* Unicode Order. This class is a base class for {@link SingleIndexWriter} and |
|
39 |
* {@link SplitIndexWriter}. It uses the functionality from |
|
40 |
* {@link HtmlDocletWriter} to generate the Index Contents. |
|
41 |
* |
|
14260
727a84636f12
8000665: fix "internal API" comments on javadoc files
jjg
parents:
14258
diff
changeset
|
42 |
* <p><b>This is NOT part of any supported API. |
727a84636f12
8000665: fix "internal API" comments on javadoc files
jjg
parents:
14258
diff
changeset
|
43 |
* If you write code that depends on this, you do so at your own risk. |
727a84636f12
8000665: fix "internal API" comments on javadoc files
jjg
parents:
14258
diff
changeset
|
44 |
* This code and its internal interfaces are subject to change or |
727a84636f12
8000665: fix "internal API" comments on javadoc files
jjg
parents:
14258
diff
changeset
|
45 |
* deletion without notice.</b> |
727a84636f12
8000665: fix "internal API" comments on javadoc files
jjg
parents:
14258
diff
changeset
|
46 |
* |
10 | 47 |
* @see IndexBuilder |
48 |
* @author Atul M Dambalkar |
|
7614
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
49 |
* @author Bhavesh Patel (Modified) |
10 | 50 |
*/ |
51 |
public class AbstractIndexWriter extends HtmlDocletWriter { |
|
52 |
||
53 |
/** |
|
54 |
* The index of all the members with unicode character. |
|
55 |
*/ |
|
56 |
protected IndexBuilder indexbuilder; |
|
57 |
||
58 |
/** |
|
14357
faf9cde2817b
8000741: refactor javadoc to use abstraction to handle relative paths
jjg
parents:
14260
diff
changeset
|
59 |
* This constructor will be used by {@link SplitIndexWriter}. Initializes |
10 | 60 |
* path to this file and relative path from this file. |
61 |
* |
|
14357
faf9cde2817b
8000741: refactor javadoc to use abstraction to handle relative paths
jjg
parents:
14260
diff
changeset
|
62 |
* @param configuration The current configuration |
10 | 63 |
* @param path Path to the file which is getting generated. |
64 |
* @param indexbuilder Unicode based Index from {@link IndexBuilder} |
|
65 |
*/ |
|
66 |
protected AbstractIndexWriter(ConfigurationImpl configuration, |
|
14357
faf9cde2817b
8000741: refactor javadoc to use abstraction to handle relative paths
jjg
parents:
14260
diff
changeset
|
67 |
DocPath path, |
faf9cde2817b
8000741: refactor javadoc to use abstraction to handle relative paths
jjg
parents:
14260
diff
changeset
|
68 |
IndexBuilder indexbuilder) |
10 | 69 |
throws IOException { |
14357
faf9cde2817b
8000741: refactor javadoc to use abstraction to handle relative paths
jjg
parents:
14260
diff
changeset
|
70 |
super(configuration, path); |
10 | 71 |
this.indexbuilder = indexbuilder; |
72 |
} |
|
73 |
||
74 |
/** |
|
7614
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
75 |
* Get the index label for navigation bar. |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
76 |
* |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
77 |
* @return a content tree for the tree label |
10 | 78 |
*/ |
7614
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
79 |
protected Content getNavLinkIndex() { |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
80 |
Content li = HtmlTree.LI(HtmlStyle.navBarCell1Rev, indexLabel); |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
81 |
return li; |
10 | 82 |
} |
83 |
||
84 |
/** |
|
7614
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
85 |
* Add the member information for the unicode character along with the |
10 | 86 |
* list of the members. |
87 |
* |
|
7614
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
88 |
* @param unicode Unicode for which member list information to be generated |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
89 |
* @param memberlist List of members for the unicode character |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
90 |
* @param contentTree the content tree to which the information will be added |
10 | 91 |
*/ |
21008
af0b915df7cc
8025633: Fix javadoc to generate valid anchor names
bpatel
parents:
17563
diff
changeset
|
92 |
protected void addContents(Character uc, List<? extends Doc> memberlist, |
7614
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
93 |
Content contentTree) { |
21008
af0b915df7cc
8025633: Fix javadoc to generate valid anchor names
bpatel
parents:
17563
diff
changeset
|
94 |
String unicode = uc.toString(); |
af0b915df7cc
8025633: Fix javadoc to generate valid anchor names
bpatel
parents:
17563
diff
changeset
|
95 |
contentTree.addContent(getMarkerAnchorForIndex(unicode)); |
af0b915df7cc
8025633: Fix javadoc to generate valid anchor names
bpatel
parents:
17563
diff
changeset
|
96 |
Content headContent = new StringContent(unicode); |
7614
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
97 |
Content heading = HtmlTree.HEADING(HtmlConstants.CONTENT_HEADING, false, |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
98 |
HtmlStyle.title, headContent); |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
99 |
contentTree.addContent(heading); |
2216
b124d5c924eb
6786690: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - DL tag and nesting issue
bpatel
parents:
1789
diff
changeset
|
100 |
int memberListSize = memberlist.size(); |
b124d5c924eb
6786690: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - DL tag and nesting issue
bpatel
parents:
1789
diff
changeset
|
101 |
// Display the list only if there are elements to be displayed. |
b124d5c924eb
6786690: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - DL tag and nesting issue
bpatel
parents:
1789
diff
changeset
|
102 |
if (memberListSize > 0) { |
7614
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
103 |
Content dl = new HtmlTree(HtmlTag.DL); |
2216
b124d5c924eb
6786690: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - DL tag and nesting issue
bpatel
parents:
1789
diff
changeset
|
104 |
for (int i = 0; i < memberListSize; i++) { |
b124d5c924eb
6786690: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - DL tag and nesting issue
bpatel
parents:
1789
diff
changeset
|
105 |
Doc element = memberlist.get(i); |
b124d5c924eb
6786690: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - DL tag and nesting issue
bpatel
parents:
1789
diff
changeset
|
106 |
if (element instanceof MemberDoc) { |
7614
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
107 |
addDescription((MemberDoc)element, dl); |
2216
b124d5c924eb
6786690: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - DL tag and nesting issue
bpatel
parents:
1789
diff
changeset
|
108 |
} else if (element instanceof ClassDoc) { |
7614
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
109 |
addDescription((ClassDoc)element, dl); |
2216
b124d5c924eb
6786690: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - DL tag and nesting issue
bpatel
parents:
1789
diff
changeset
|
110 |
} else if (element instanceof PackageDoc) { |
7614
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
111 |
addDescription((PackageDoc)element, dl); |
2216
b124d5c924eb
6786690: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - DL tag and nesting issue
bpatel
parents:
1789
diff
changeset
|
112 |
} |
10 | 113 |
} |
7614
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
114 |
contentTree.addContent(dl); |
10 | 115 |
} |
116 |
} |
|
117 |
||
118 |
/** |
|
7614
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
119 |
* Add one line summary comment for the package. |
10 | 120 |
* |
7614
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
121 |
* @param pkg the package to be documented |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
122 |
* @param dlTree the content tree to which the description will be added |
10 | 123 |
*/ |
7614
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
124 |
protected void addDescription(PackageDoc pkg, Content dlTree) { |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
125 |
Content link = getPackageLink(pkg, new StringContent(Util.getPackageName(pkg))); |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
126 |
Content dt = HtmlTree.DT(link); |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
127 |
dt.addContent(" - "); |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
128 |
dt.addContent(getResource("doclet.package")); |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
129 |
dt.addContent(" " + pkg.name()); |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
130 |
dlTree.addContent(dt); |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
131 |
Content dd = new HtmlTree(HtmlTag.DD); |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
132 |
addSummaryComment(pkg, dd); |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
133 |
dlTree.addContent(dd); |
10 | 134 |
} |
135 |
||
136 |
/** |
|
7614
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
137 |
* Add one line summary comment for the class. |
10 | 138 |
* |
7614
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
139 |
* @param cd the class being documented |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
140 |
* @param dlTree the content tree to which the description will be added |
10 | 141 |
*/ |
7614
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
142 |
protected void addDescription(ClassDoc cd, Content dlTree) { |
17559
87c28ee29329
8011642: Remove LinkOutput in favor of direct use of Content
jjg
parents:
17558
diff
changeset
|
143 |
Content link = getLink(new LinkInfoImpl(configuration, |
17561 | 144 |
LinkInfoImpl.Kind.INDEX, cd).strong(true)); |
7614
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
145 |
Content dt = HtmlTree.DT(link); |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
146 |
dt.addContent(" - "); |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
147 |
addClassInfo(cd, dt); |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
148 |
dlTree.addContent(dt); |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
149 |
Content dd = new HtmlTree(HtmlTag.DD); |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
150 |
addComment(cd, dd); |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
151 |
dlTree.addContent(dd); |
10 | 152 |
} |
153 |
||
154 |
/** |
|
17558
eee4ccf66cfd
8010440: Replace int constants in LinkInfoImpl with enum
jjg
parents:
14542
diff
changeset
|
155 |
* Add the classkind (class, interface, exception), error of the class |
10 | 156 |
* passed. |
157 |
* |
|
7614
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
158 |
* @param cd the class being documented |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
159 |
* @param contentTree the content tree to which the class info will be added |
10 | 160 |
*/ |
7614
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
161 |
protected void addClassInfo(ClassDoc cd, Content contentTree) { |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
162 |
contentTree.addContent(getResource("doclet.in", |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
163 |
Util.getTypeName(configuration, cd, false), |
17563
e8ddeb9bd17c
8011668: Allow HTMLWriter.getResource to take Content args
jjg
parents:
17561
diff
changeset
|
164 |
getPackageLink(cd.containingPackage(), |
e8ddeb9bd17c
8011668: Allow HTMLWriter.getResource to take Content args
jjg
parents:
17561
diff
changeset
|
165 |
Util.getPackageName(cd.containingPackage())) |
e8ddeb9bd17c
8011668: Allow HTMLWriter.getResource to take Content args
jjg
parents:
17561
diff
changeset
|
166 |
)); |
10 | 167 |
} |
168 |
||
169 |
/** |
|
7614
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
170 |
* Add description for Class, Field, Method or Constructor. |
10 | 171 |
* |
7614
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
172 |
* @param member MemberDoc for the member of the Class Kind |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
173 |
* @param dlTree the content tree to which the description will be added |
10 | 174 |
*/ |
7614
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
175 |
protected void addDescription(MemberDoc member, Content dlTree) { |
10 | 176 |
String name = (member instanceof ExecutableMemberDoc)? |
177 |
member.name() + ((ExecutableMemberDoc)member).flatSignature() : |
|
178 |
member.name(); |
|
21478
fa4c7cda1b41
8026567: Use meaningful style names for strong and italic styles.
bpatel
parents:
21008
diff
changeset
|
179 |
Content span = HtmlTree.SPAN(HtmlStyle.memberNameLink, |
17558
eee4ccf66cfd
8010440: Replace int constants in LinkInfoImpl with enum
jjg
parents:
14542
diff
changeset
|
180 |
getDocLink(LinkInfoImpl.Kind.INDEX, member, name)); |
7614
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
181 |
Content dt = HtmlTree.DT(span); |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
182 |
dt.addContent(" - "); |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
183 |
addMemberDesc(member, dt); |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
184 |
dlTree.addContent(dt); |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
185 |
Content dd = new HtmlTree(HtmlTag.DD); |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
186 |
addComment(member, dd); |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
187 |
dlTree.addContent(dd); |
10 | 188 |
} |
189 |
||
190 |
/** |
|
7614
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
191 |
* Add comment for each element in the index. If the element is deprecated |
10 | 192 |
* and it has a @deprecated tag, use that comment. Else if the containing |
193 |
* class for this element is deprecated, then add the word "Deprecated." at |
|
194 |
* the start and then print the normal comment. |
|
195 |
* |
|
7614
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
196 |
* @param element Index element |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
197 |
* @param contentTree the content tree to which the comment will be added |
10 | 198 |
*/ |
7614
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
199 |
protected void addComment(ProgramElementDoc element, Content contentTree) { |
10 | 200 |
Tag[] tags; |
21478
fa4c7cda1b41
8026567: Use meaningful style names for strong and italic styles.
bpatel
parents:
21008
diff
changeset
|
201 |
Content span = HtmlTree.SPAN(HtmlStyle.deprecatedLabel, deprecatedPhrase); |
7614
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
202 |
HtmlTree div = new HtmlTree(HtmlTag.DIV); |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
203 |
div.addStyle(HtmlStyle.block); |
10 | 204 |
if (Util.isDeprecated(element)) { |
7614
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
205 |
div.addContent(span); |
10 | 206 |
if ((tags = element.tags("deprecated")).length > 0) |
7614
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
207 |
addInlineDeprecatedComment(element, tags[0], div); |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
208 |
contentTree.addContent(div); |
10 | 209 |
} else { |
210 |
ClassDoc cont = element.containingClass(); |
|
211 |
while (cont != null) { |
|
212 |
if (Util.isDeprecated(cont)) { |
|
7614
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
213 |
div.addContent(span); |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
214 |
contentTree.addContent(div); |
10 | 215 |
break; |
216 |
} |
|
217 |
cont = cont.containingClass(); |
|
218 |
} |
|
7614
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
219 |
addSummaryComment(element, contentTree); |
10 | 220 |
} |
221 |
} |
|
222 |
||
223 |
/** |
|
7614
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
224 |
* Add description about the Static Varible/Method/Constructor for a |
10 | 225 |
* member. |
226 |
* |
|
7614
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
227 |
* @param member MemberDoc for the member within the Class Kind |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
228 |
* @param contentTree the content tree to which the member description will be added |
10 | 229 |
*/ |
7614
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
230 |
protected void addMemberDesc(MemberDoc member, Content contentTree) { |
10 | 231 |
ClassDoc containing = member.containingClass(); |
7614
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
232 |
String classdesc = Util.getTypeName( |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
233 |
configuration, containing, true) + " "; |
10 | 234 |
if (member.isField()) { |
235 |
if (member.isStatic()) { |
|
7614
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
236 |
contentTree.addContent( |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
237 |
getResource("doclet.Static_variable_in", classdesc)); |
10 | 238 |
} else { |
7614
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
239 |
contentTree.addContent( |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
240 |
getResource("doclet.Variable_in", classdesc)); |
10 | 241 |
} |
242 |
} else if (member.isConstructor()) { |
|
7614
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
243 |
contentTree.addContent( |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
244 |
getResource("doclet.Constructor_for", classdesc)); |
10 | 245 |
} else if (member.isMethod()) { |
246 |
if (member.isStatic()) { |
|
7614
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
247 |
contentTree.addContent( |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
248 |
getResource("doclet.Static_method_in", classdesc)); |
10 | 249 |
} else { |
7614
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
250 |
contentTree.addContent( |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
251 |
getResource("doclet.Method_in", classdesc)); |
10 | 252 |
} |
253 |
} |
|
17558
eee4ccf66cfd
8010440: Replace int constants in LinkInfoImpl with enum
jjg
parents:
14542
diff
changeset
|
254 |
addPreQualifiedClassLink(LinkInfoImpl.Kind.INDEX, containing, |
7614
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
255 |
false, contentTree); |
10 | 256 |
} |
21008
af0b915df7cc
8025633: Fix javadoc to generate valid anchor names
bpatel
parents:
17563
diff
changeset
|
257 |
|
af0b915df7cc
8025633: Fix javadoc to generate valid anchor names
bpatel
parents:
17563
diff
changeset
|
258 |
/** |
af0b915df7cc
8025633: Fix javadoc to generate valid anchor names
bpatel
parents:
17563
diff
changeset
|
259 |
* Get the marker anchor which will be added to the index documentation tree. |
af0b915df7cc
8025633: Fix javadoc to generate valid anchor names
bpatel
parents:
17563
diff
changeset
|
260 |
* |
af0b915df7cc
8025633: Fix javadoc to generate valid anchor names
bpatel
parents:
17563
diff
changeset
|
261 |
* @param anchorNameForIndex the anchor name attribute for index page |
af0b915df7cc
8025633: Fix javadoc to generate valid anchor names
bpatel
parents:
17563
diff
changeset
|
262 |
* @return a content tree for the marker anchor |
af0b915df7cc
8025633: Fix javadoc to generate valid anchor names
bpatel
parents:
17563
diff
changeset
|
263 |
*/ |
af0b915df7cc
8025633: Fix javadoc to generate valid anchor names
bpatel
parents:
17563
diff
changeset
|
264 |
public Content getMarkerAnchorForIndex(String anchorNameForIndex) { |
af0b915df7cc
8025633: Fix javadoc to generate valid anchor names
bpatel
parents:
17563
diff
changeset
|
265 |
return getMarkerAnchor(getNameForIndex(anchorNameForIndex), null); |
af0b915df7cc
8025633: Fix javadoc to generate valid anchor names
bpatel
parents:
17563
diff
changeset
|
266 |
} |
af0b915df7cc
8025633: Fix javadoc to generate valid anchor names
bpatel
parents:
17563
diff
changeset
|
267 |
|
af0b915df7cc
8025633: Fix javadoc to generate valid anchor names
bpatel
parents:
17563
diff
changeset
|
268 |
/** |
af0b915df7cc
8025633: Fix javadoc to generate valid anchor names
bpatel
parents:
17563
diff
changeset
|
269 |
* Generate a valid HTML name for member index page. |
af0b915df7cc
8025633: Fix javadoc to generate valid anchor names
bpatel
parents:
17563
diff
changeset
|
270 |
* |
af0b915df7cc
8025633: Fix javadoc to generate valid anchor names
bpatel
parents:
17563
diff
changeset
|
271 |
* @param unicode the string that needs to be converted to valid HTML name. |
af0b915df7cc
8025633: Fix javadoc to generate valid anchor names
bpatel
parents:
17563
diff
changeset
|
272 |
* @return a valid HTML name string. |
af0b915df7cc
8025633: Fix javadoc to generate valid anchor names
bpatel
parents:
17563
diff
changeset
|
273 |
*/ |
af0b915df7cc
8025633: Fix javadoc to generate valid anchor names
bpatel
parents:
17563
diff
changeset
|
274 |
public String getNameForIndex(String unicode) { |
af0b915df7cc
8025633: Fix javadoc to generate valid anchor names
bpatel
parents:
17563
diff
changeset
|
275 |
return "I:" + getName(unicode); |
af0b915df7cc
8025633: Fix javadoc to generate valid anchor names
bpatel
parents:
17563
diff
changeset
|
276 |
} |
10 | 277 |
} |