author | mcimadamore |
Tue, 13 Jan 2009 13:27:14 +0000 | |
changeset 1789 | 7ac8c0815000 |
parent 1787 | 1aa079321cd2 |
child 5520 | 86e4b9a9da40 |
permissions | -rw-r--r-- |
10 | 1 |
/* |
2 |
* Copyright 2003-2004 Sun Microsystems, Inc. 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. Sun designates this |
|
8 |
* particular file as subject to the "Classpath" exception as provided |
|
9 |
* by Sun 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, |
|
22 |
* CA 95054 USA or visit www.sun.com if you need additional information or |
|
23 |
* have any questions. |
|
24 |
*/ |
|
25 |
||
26 |
||
27 |
package com.sun.tools.doclets.formats.html; |
|
28 |
||
29 |
import com.sun.javadoc.*; |
|
30 |
import com.sun.tools.doclets.internal.toolkit.util.*; |
|
31 |
import com.sun.tools.doclets.internal.toolkit.util.links.*; |
|
32 |
||
33 |
public class LinkInfoImpl extends LinkInfo { |
|
34 |
||
35 |
/** |
|
36 |
* Indicate that the link appears in a class list. |
|
37 |
*/ |
|
38 |
public static final int ALL_CLASSES_FRAME = 1; |
|
39 |
||
40 |
/** |
|
41 |
* Indicate that the link appears in a class documentation. |
|
42 |
*/ |
|
43 |
public static final int CONTEXT_CLASS = 2; |
|
44 |
||
45 |
/** |
|
46 |
* Indicate that the link appears in member documentation. |
|
47 |
*/ |
|
48 |
public static final int CONTEXT_MEMBER = 3; |
|
49 |
||
50 |
/** |
|
51 |
* Indicate that the link appears in class use documentation. |
|
52 |
*/ |
|
53 |
public static final int CONTEXT_CLASS_USE = 4; |
|
54 |
||
55 |
/** |
|
56 |
* Indicate that the link appears in index documentation. |
|
57 |
*/ |
|
58 |
public static final int CONTEXT_INDEX = 5; |
|
59 |
||
60 |
/** |
|
61 |
* Indicate that the link appears in constant value summary. |
|
62 |
*/ |
|
63 |
public static final int CONTEXT_CONSTANT_SUMMARY = 6; |
|
64 |
||
65 |
/** |
|
66 |
* Indicate that the link appears in serialized form documentation. |
|
67 |
*/ |
|
68 |
public static final int CONTEXT_SERIALIZED_FORM = 7; |
|
69 |
||
70 |
/** |
|
71 |
* Indicate that the link appears in serial member documentation. |
|
72 |
*/ |
|
73 |
public static final int CONTEXT_SERIAL_MEMBER = 8; |
|
74 |
||
75 |
/** |
|
76 |
* Indicate that the link appears in package documentation. |
|
77 |
*/ |
|
78 |
public static final int CONTEXT_PACKAGE = 9; |
|
79 |
||
80 |
/** |
|
81 |
* Indicate that the link appears in see tag documentation. |
|
82 |
*/ |
|
83 |
public static final int CONTEXT_SEE_TAG = 10; |
|
84 |
||
85 |
/** |
|
86 |
* Indicate that the link appears in value tag documentation. |
|
87 |
*/ |
|
88 |
public static final int CONTEXT_VALUE_TAG = 11; |
|
89 |
||
90 |
/** |
|
91 |
* Indicate that the link appears in tree documentation. |
|
92 |
*/ |
|
93 |
public static final int CONTEXT_TREE = 12; |
|
94 |
||
95 |
/** |
|
96 |
* Indicate that the link appears in a class list. |
|
97 |
*/ |
|
98 |
public static final int PACKAGE_FRAME = 13; |
|
99 |
||
100 |
/** |
|
101 |
* The header in the class documentation. |
|
102 |
*/ |
|
103 |
public static final int CONTEXT_CLASS_HEADER = 14; |
|
104 |
||
105 |
/** |
|
106 |
* The signature in the class documentation. |
|
107 |
*/ |
|
108 |
public static final int CONTEXT_CLASS_SIGNATURE = 15; |
|
109 |
||
110 |
/** |
|
111 |
* The return type of a method. |
|
112 |
*/ |
|
113 |
public static final int CONTEXT_RETURN_TYPE = 16; |
|
114 |
||
115 |
/** |
|
116 |
* The return type of a method in a member summary. |
|
117 |
*/ |
|
118 |
public static final int CONTEXT_SUMMARY_RETURN_TYPE = 17; |
|
119 |
||
120 |
/** |
|
121 |
* The type of a method/constructor parameter. |
|
122 |
*/ |
|
123 |
public static final int CONTEXT_EXECUTABLE_MEMBER_PARAM = 18; |
|
124 |
||
125 |
/** |
|
126 |
* Super interface links. |
|
127 |
*/ |
|
128 |
public static final int CONTEXT_SUPER_INTERFACES = 19; |
|
129 |
||
130 |
/** |
|
131 |
* Implemented interface links. |
|
132 |
*/ |
|
133 |
public static final int CONTEXT_IMPLEMENTED_INTERFACES = 20; |
|
134 |
||
135 |
/** |
|
136 |
* Implemented class links. |
|
137 |
*/ |
|
138 |
public static final int CONTEXT_IMPLEMENTED_CLASSES = 21; |
|
139 |
||
140 |
/** |
|
141 |
* Subinterface links. |
|
142 |
*/ |
|
143 |
public static final int CONTEXT_SUBINTERFACES = 22; |
|
144 |
||
145 |
/** |
|
146 |
* Subclasses links. |
|
147 |
*/ |
|
148 |
public static final int CONTEXT_SUBCLASSES = 23; |
|
149 |
||
150 |
/** |
|
151 |
* The signature in the class documentation (implements/extends portion). |
|
152 |
*/ |
|
153 |
public static final int CONTEXT_CLASS_SIGNATURE_PARENT_NAME = 24; |
|
154 |
||
155 |
/** |
|
156 |
* The header for method documentation copied from parent. |
|
157 |
*/ |
|
158 |
public static final int CONTEXT_METHOD_DOC_COPY = 26; |
|
159 |
||
160 |
/** |
|
161 |
* Method "specified by" link. |
|
162 |
*/ |
|
163 |
public static final int CONTEXT_METHOD_SPECIFIED_BY = 27; |
|
164 |
||
165 |
/** |
|
166 |
* Method "overrides" link. |
|
167 |
*/ |
|
168 |
public static final int CONTEXT_METHOD_OVERRIDES = 28; |
|
169 |
||
170 |
/** |
|
171 |
* Annotation link. |
|
172 |
*/ |
|
173 |
public static final int CONTEXT_ANNOTATION = 29; |
|
174 |
||
175 |
/** |
|
176 |
* The header for field documentation copied from parent. |
|
177 |
*/ |
|
178 |
public static final int CONTEXT_FIELD_DOC_COPY = 30; |
|
179 |
||
180 |
/** |
|
181 |
* The parent nodes int the class tree. |
|
182 |
*/ |
|
183 |
public static final int CONTEXT_CLASS_TREE_PARENT = 31; |
|
184 |
||
185 |
/** |
|
186 |
* The type parameters of a method or constructor. |
|
187 |
*/ |
|
188 |
public static final int CONTEXT_MEMBER_TYPE_PARAMS = 32; |
|
189 |
||
190 |
/** |
|
191 |
* Indicate that the link appears in class use documentation. |
|
192 |
*/ |
|
193 |
public static final int CONTEXT_CLASS_USE_HEADER = 33; |
|
194 |
||
195 |
/** |
|
196 |
* The integer indicating the location of the link. |
|
197 |
*/ |
|
198 |
public int context; |
|
199 |
||
200 |
/** |
|
201 |
* The value of the marker #. |
|
202 |
*/ |
|
203 |
public String where = ""; |
|
204 |
||
205 |
/** |
|
206 |
* String style of text defined in style sheet. |
|
207 |
*/ |
|
208 |
public String styleName =""; |
|
209 |
||
210 |
/** |
|
211 |
* The valueof the target. |
|
212 |
*/ |
|
213 |
public String target = ""; |
|
214 |
||
215 |
/** |
|
216 |
* Construct a LinkInfo object. |
|
217 |
* |
|
218 |
* @param context the context of the link. |
|
219 |
* @param classDoc the class to link to. |
|
220 |
* @param label the label for the link. |
|
221 |
* @param target the value of the target attribute. |
|
222 |
*/ |
|
223 |
public LinkInfoImpl (int context, ClassDoc classDoc, String label, |
|
224 |
String target){ |
|
225 |
this.classDoc = classDoc; |
|
226 |
this.label = label; |
|
227 |
this.target = target; |
|
228 |
setContext(context); |
|
229 |
} |
|
230 |
||
231 |
/** |
|
232 |
* Construct a LinkInfo object. |
|
233 |
* |
|
234 |
* @param context the context of the link. |
|
235 |
* @param classDoc the class to link to. |
|
236 |
* @param where the value of the marker #. |
|
237 |
* @param label the label for the link. |
|
1787
1aa079321cd2
6786028: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - Bold tags should be strong
bpatel
parents:
10
diff
changeset
|
238 |
* @param isStrong true if the link should be strong. |
10 | 239 |
* @param styleName String style of text defined in style sheet. |
240 |
*/ |
|
241 |
public LinkInfoImpl (int context, ClassDoc classDoc, String where, String label, |
|
1787
1aa079321cd2
6786028: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - Bold tags should be strong
bpatel
parents:
10
diff
changeset
|
242 |
boolean isStrong, String styleName){ |
10 | 243 |
this.classDoc = classDoc; |
244 |
this.where = where; |
|
245 |
this.label = label; |
|
1787
1aa079321cd2
6786028: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - Bold tags should be strong
bpatel
parents:
10
diff
changeset
|
246 |
this.isStrong = isStrong; |
10 | 247 |
this.styleName = styleName; |
248 |
setContext(context); |
|
249 |
} |
|
250 |
||
251 |
/** |
|
252 |
* Construct a LinkInfo object. |
|
253 |
* |
|
254 |
* @param context the context of the link. |
|
255 |
* @param classDoc the class to link to. |
|
256 |
* @param where the value of the marker #. |
|
257 |
* @param label the label for the link. |
|
1787
1aa079321cd2
6786028: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - Bold tags should be strong
bpatel
parents:
10
diff
changeset
|
258 |
* @param isStrong true if the link should be strong. |
10 | 259 |
*/ |
260 |
public LinkInfoImpl (int context, ClassDoc classDoc, String where, String label, |
|
1787
1aa079321cd2
6786028: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - Bold tags should be strong
bpatel
parents:
10
diff
changeset
|
261 |
boolean isStrong){ |
10 | 262 |
this.classDoc = classDoc; |
263 |
this.where = where; |
|
264 |
this.label = label; |
|
1787
1aa079321cd2
6786028: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - Bold tags should be strong
bpatel
parents:
10
diff
changeset
|
265 |
this.isStrong = isStrong; |
10 | 266 |
setContext(context); |
267 |
} |
|
268 |
||
269 |
/** |
|
270 |
* Construct a LinkInfo object. |
|
271 |
* |
|
272 |
* @param classDoc the class to link to. |
|
273 |
* @param label the label for the link. |
|
274 |
*/ |
|
275 |
public LinkInfoImpl (ClassDoc classDoc, String label){ |
|
276 |
this.classDoc = classDoc; |
|
277 |
this.label = label; |
|
278 |
setContext(context); |
|
279 |
} |
|
280 |
||
281 |
/** |
|
282 |
* Construct a LinkInfo object. |
|
283 |
* |
|
284 |
* @param context the context of the link. |
|
285 |
* @param executableMemberDoc the member to link to. |
|
1787
1aa079321cd2
6786028: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - Bold tags should be strong
bpatel
parents:
10
diff
changeset
|
286 |
* @param isStrong true if the link should be strong. |
10 | 287 |
*/ |
288 |
public LinkInfoImpl (int context, ExecutableMemberDoc executableMemberDoc, |
|
1787
1aa079321cd2
6786028: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - Bold tags should be strong
bpatel
parents:
10
diff
changeset
|
289 |
boolean isStrong){ |
10 | 290 |
this.executableMemberDoc = executableMemberDoc; |
1787
1aa079321cd2
6786028: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - Bold tags should be strong
bpatel
parents:
10
diff
changeset
|
291 |
this.isStrong = isStrong; |
10 | 292 |
setContext(context); |
293 |
} |
|
294 |
||
295 |
/** |
|
296 |
* Construct a LinkInfo object. |
|
297 |
* |
|
298 |
* @param context the context of the link. |
|
299 |
* @param classDoc the class to link to. |
|
1787
1aa079321cd2
6786028: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - Bold tags should be strong
bpatel
parents:
10
diff
changeset
|
300 |
* @param isStrong true if the link should be strong. |
10 | 301 |
*/ |
1787
1aa079321cd2
6786028: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - Bold tags should be strong
bpatel
parents:
10
diff
changeset
|
302 |
public LinkInfoImpl (int context, ClassDoc classDoc, boolean isStrong){ |
10 | 303 |
this.classDoc = classDoc; |
1787
1aa079321cd2
6786028: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - Bold tags should be strong
bpatel
parents:
10
diff
changeset
|
304 |
this.isStrong = isStrong; |
10 | 305 |
setContext(context); |
306 |
} |
|
307 |
||
308 |
/** |
|
309 |
* Construct a LinkInfo object. |
|
310 |
* |
|
311 |
* @param context the context of the link. |
|
312 |
* @param type the class to link to. |
|
313 |
*/ |
|
314 |
public LinkInfoImpl (int context, Type type){ |
|
315 |
this.type = type; |
|
316 |
setContext(context); |
|
317 |
} |
|
318 |
||
319 |
/** |
|
320 |
* Construct a LinkInfo object. |
|
321 |
* |
|
322 |
* @param context the context of the link. |
|
323 |
* @param type the class to link to. |
|
324 |
* @param isVarArg true if this is a link to a var arg. |
|
325 |
*/ |
|
326 |
public LinkInfoImpl (int context, Type type, boolean isVarArg){ |
|
327 |
this.type = type; |
|
328 |
this.isVarArg = isVarArg; |
|
329 |
setContext(context); |
|
330 |
} |
|
331 |
||
332 |
/** |
|
333 |
* Construct a LinkInfo object. |
|
334 |
* |
|
335 |
* @param context the context of the link. |
|
336 |
* @param type the class to link to. |
|
337 |
* @param label the label for the link. |
|
1787
1aa079321cd2
6786028: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - Bold tags should be strong
bpatel
parents:
10
diff
changeset
|
338 |
* @param isStrong true if the link should be strong. |
10 | 339 |
*/ |
340 |
public LinkInfoImpl (int context, Type type, String label, |
|
1787
1aa079321cd2
6786028: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - Bold tags should be strong
bpatel
parents:
10
diff
changeset
|
341 |
boolean isStrong){ |
10 | 342 |
this.type = type; |
343 |
this.label = label; |
|
1787
1aa079321cd2
6786028: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - Bold tags should be strong
bpatel
parents:
10
diff
changeset
|
344 |
this.isStrong = isStrong; |
10 | 345 |
setContext(context); |
346 |
} |
|
347 |
||
348 |
/** |
|
349 |
* Construct a LinkInfo object. |
|
350 |
* |
|
351 |
* @param context the context of the link. |
|
352 |
* @param classDoc the class to link to. |
|
353 |
* @param label the label for the link. |
|
1787
1aa079321cd2
6786028: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - Bold tags should be strong
bpatel
parents:
10
diff
changeset
|
354 |
* @param isStrong true if the link should be strong. |
10 | 355 |
*/ |
356 |
public LinkInfoImpl (int context, ClassDoc classDoc, String label, |
|
1787
1aa079321cd2
6786028: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - Bold tags should be strong
bpatel
parents:
10
diff
changeset
|
357 |
boolean isStrong){ |
10 | 358 |
this.classDoc = classDoc; |
359 |
this.label = label; |
|
1787
1aa079321cd2
6786028: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - Bold tags should be strong
bpatel
parents:
10
diff
changeset
|
360 |
this.isStrong = isStrong; |
10 | 361 |
setContext(context); |
362 |
} |
|
363 |
||
364 |
/** |
|
365 |
* {@inheritDoc} |
|
366 |
*/ |
|
367 |
public int getContext() { |
|
368 |
return context; |
|
369 |
} |
|
370 |
||
371 |
/** |
|
372 |
* {@inheritDoc} |
|
373 |
* |
|
374 |
* This method sets the link attributes to the appropriate values |
|
375 |
* based on the context. |
|
376 |
* |
|
377 |
* @param c the context id to set. |
|
378 |
*/ |
|
379 |
public void setContext(int c) { |
|
380 |
//NOTE: Put context specific link code here. |
|
381 |
switch (c) { |
|
382 |
case ALL_CLASSES_FRAME: |
|
383 |
case PACKAGE_FRAME: |
|
384 |
case CONTEXT_IMPLEMENTED_CLASSES: |
|
385 |
case CONTEXT_SUBCLASSES: |
|
386 |
case CONTEXT_METHOD_DOC_COPY: |
|
387 |
case CONTEXT_FIELD_DOC_COPY: |
|
388 |
case CONTEXT_CLASS_USE_HEADER: |
|
389 |
includeTypeInClassLinkLabel = false; |
|
390 |
break; |
|
391 |
||
392 |
case CONTEXT_ANNOTATION: |
|
393 |
excludeTypeParameterLinks = true; |
|
394 |
excludeTypeBounds = true; |
|
395 |
break; |
|
396 |
||
397 |
case CONTEXT_IMPLEMENTED_INTERFACES: |
|
398 |
case CONTEXT_SUPER_INTERFACES: |
|
399 |
case CONTEXT_SUBINTERFACES: |
|
400 |
case CONTEXT_CLASS_TREE_PARENT: |
|
401 |
case CONTEXT_TREE: |
|
402 |
case CONTEXT_CLASS_SIGNATURE_PARENT_NAME: |
|
403 |
excludeTypeParameterLinks = true; |
|
404 |
excludeTypeBounds = true; |
|
405 |
includeTypeInClassLinkLabel = false; |
|
406 |
includeTypeAsSepLink = true; |
|
407 |
break; |
|
408 |
||
409 |
case CONTEXT_PACKAGE: |
|
410 |
case CONTEXT_CLASS_USE: |
|
411 |
excludeTypeBoundsLinks = true; |
|
412 |
excludeTypeParameterLinks = true; |
|
413 |
break; |
|
414 |
||
415 |
case CONTEXT_CLASS_HEADER: |
|
416 |
case CONTEXT_CLASS_SIGNATURE: |
|
417 |
excludeTypeParameterLinks = true; |
|
418 |
includeTypeAsSepLink = true; |
|
419 |
includeTypeInClassLinkLabel = false; |
|
420 |
break; |
|
421 |
||
422 |
case CONTEXT_MEMBER_TYPE_PARAMS: |
|
423 |
includeTypeAsSepLink = true; |
|
424 |
includeTypeInClassLinkLabel = false; |
|
425 |
break; |
|
426 |
||
427 |
case CONTEXT_RETURN_TYPE: |
|
428 |
case CONTEXT_SUMMARY_RETURN_TYPE: |
|
429 |
case CONTEXT_EXECUTABLE_MEMBER_PARAM: |
|
430 |
excludeTypeBounds = true; |
|
431 |
break; |
|
432 |
} |
|
433 |
context = c; |
|
434 |
if (type != null && |
|
435 |
type.asTypeVariable()!= null && |
|
436 |
type.asTypeVariable().owner() instanceof ExecutableMemberDoc){ |
|
437 |
excludeTypeParameterLinks = true; |
|
438 |
} |
|
439 |
} |
|
440 |
||
441 |
/** |
|
442 |
* Return true if this link is linkable and false if we can't link to the |
|
443 |
* desired place. |
|
444 |
* |
|
445 |
* @return true if this link is linkable and false if we can't link to the |
|
446 |
* desired place. |
|
447 |
*/ |
|
448 |
public boolean isLinkable() { |
|
449 |
return Util.isLinkable(classDoc, ConfigurationImpl.getInstance()); |
|
450 |
} |
|
451 |
} |