Tue, 14 May 2013 10:14:52 -0700
8011650: reduce use of RawHtml nodes in doclet
Reviewed-by: darcy
duke@1 | 1 | /* |
jjg@1521 | 2 | * Copyright (c) 2003, 2013, 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 | |
duke@1 | 27 | package com.sun.tools.doclets.formats.html; |
duke@1 | 28 | |
duke@1 | 29 | import com.sun.javadoc.*; |
jjg@1737 | 30 | import com.sun.tools.doclets.formats.html.markup.ContentBuilder; |
jjg@1737 | 31 | import com.sun.tools.doclets.formats.html.markup.StringContent; |
jjg@1737 | 32 | import com.sun.tools.doclets.internal.toolkit.Content; |
duke@1 | 33 | import com.sun.tools.doclets.internal.toolkit.util.*; |
duke@1 | 34 | import com.sun.tools.doclets.internal.toolkit.util.links.*; |
duke@1 | 35 | |
jjg@1359 | 36 | /** |
jjg@1359 | 37 | * <p><b>This is NOT part of any supported API. |
jjg@1359 | 38 | * If you write code that depends on this, you do so at your own risk. |
jjg@1359 | 39 | * This code and its internal interfaces are subject to change or |
jjg@1359 | 40 | * deletion without notice.</b> |
jjg@1359 | 41 | */ |
duke@1 | 42 | public class LinkInfoImpl extends LinkInfo { |
duke@1 | 43 | |
jjg@1735 | 44 | public enum Kind { |
jjg@1735 | 45 | DEFAULT, |
duke@1 | 46 | |
jjg@1735 | 47 | /** |
jjg@1735 | 48 | * Indicate that the link appears in a class list. |
jjg@1735 | 49 | */ |
jjg@1735 | 50 | ALL_CLASSES_FRAME, |
duke@1 | 51 | |
jjg@1735 | 52 | /** |
jjg@1735 | 53 | * Indicate that the link appears in a class documentation. |
jjg@1735 | 54 | */ |
jjg@1735 | 55 | CLASS, |
duke@1 | 56 | |
jjg@1735 | 57 | /** |
jjg@1735 | 58 | * Indicate that the link appears in member documentation. |
jjg@1735 | 59 | */ |
jjg@1735 | 60 | MEMBER, |
duke@1 | 61 | |
jjg@1735 | 62 | /** |
jjg@1735 | 63 | * Indicate that the link appears in class use documentation. |
jjg@1735 | 64 | */ |
jjg@1735 | 65 | CLASS_USE, |
duke@1 | 66 | |
jjg@1735 | 67 | /** |
jjg@1735 | 68 | * Indicate that the link appears in index documentation. |
jjg@1735 | 69 | */ |
jjg@1735 | 70 | INDEX, |
duke@1 | 71 | |
jjg@1735 | 72 | /** |
jjg@1735 | 73 | * Indicate that the link appears in constant value summary. |
jjg@1735 | 74 | */ |
jjg@1735 | 75 | CONSTANT_SUMMARY, |
duke@1 | 76 | |
jjg@1735 | 77 | /** |
jjg@1735 | 78 | * Indicate that the link appears in serialized form documentation. |
jjg@1735 | 79 | */ |
jjg@1735 | 80 | SERIALIZED_FORM, |
duke@1 | 81 | |
jjg@1735 | 82 | /** |
jjg@1735 | 83 | * Indicate that the link appears in serial member documentation. |
jjg@1735 | 84 | */ |
jjg@1735 | 85 | SERIAL_MEMBER, |
duke@1 | 86 | |
jjg@1735 | 87 | /** |
jjg@1735 | 88 | * Indicate that the link appears in package documentation. |
jjg@1735 | 89 | */ |
jjg@1735 | 90 | PACKAGE, |
duke@1 | 91 | |
jjg@1735 | 92 | /** |
jjg@1735 | 93 | * Indicate that the link appears in see tag documentation. |
jjg@1735 | 94 | */ |
jjg@1735 | 95 | SEE_TAG, |
duke@1 | 96 | |
jjg@1735 | 97 | /** |
jjg@1735 | 98 | * Indicate that the link appears in value tag documentation. |
jjg@1735 | 99 | */ |
jjg@1735 | 100 | VALUE_TAG, |
duke@1 | 101 | |
jjg@1735 | 102 | /** |
jjg@1735 | 103 | * Indicate that the link appears in tree documentation. |
jjg@1735 | 104 | */ |
jjg@1735 | 105 | TREE, |
duke@1 | 106 | |
jjg@1735 | 107 | /** |
jjg@1735 | 108 | * Indicate that the link appears in a class list. |
jjg@1735 | 109 | */ |
jjg@1735 | 110 | PACKAGE_FRAME, |
duke@1 | 111 | |
jjg@1735 | 112 | /** |
jjg@1735 | 113 | * The header in the class documentation. |
jjg@1735 | 114 | */ |
jjg@1735 | 115 | CLASS_HEADER, |
duke@1 | 116 | |
jjg@1735 | 117 | /** |
jjg@1735 | 118 | * The signature in the class documentation. |
jjg@1735 | 119 | */ |
jjg@1735 | 120 | CLASS_SIGNATURE, |
duke@1 | 121 | |
jjg@1735 | 122 | /** |
jjg@1735 | 123 | * The return type of a method. |
jjg@1735 | 124 | */ |
jjg@1735 | 125 | RETURN_TYPE, |
duke@1 | 126 | |
jjg@1735 | 127 | /** |
jjg@1735 | 128 | * The return type of a method in a member summary. |
jjg@1735 | 129 | */ |
jjg@1735 | 130 | SUMMARY_RETURN_TYPE, |
duke@1 | 131 | |
jjg@1735 | 132 | /** |
jjg@1735 | 133 | * The type of a method/constructor parameter. |
jjg@1735 | 134 | */ |
jjg@1735 | 135 | EXECUTABLE_MEMBER_PARAM, |
duke@1 | 136 | |
jjg@1735 | 137 | /** |
jjg@1735 | 138 | * Super interface links. |
jjg@1735 | 139 | */ |
jjg@1735 | 140 | SUPER_INTERFACES, |
duke@1 | 141 | |
jjg@1735 | 142 | /** |
jjg@1735 | 143 | * Implemented interface links. |
jjg@1735 | 144 | */ |
jjg@1735 | 145 | IMPLEMENTED_INTERFACES, |
duke@1 | 146 | |
jjg@1735 | 147 | /** |
jjg@1735 | 148 | * Implemented class links. |
jjg@1735 | 149 | */ |
jjg@1735 | 150 | IMPLEMENTED_CLASSES, |
duke@1 | 151 | |
jjg@1735 | 152 | /** |
jjg@1735 | 153 | * Subinterface links. |
jjg@1735 | 154 | */ |
jjg@1735 | 155 | SUBINTERFACES, |
duke@1 | 156 | |
jjg@1735 | 157 | /** |
jjg@1735 | 158 | * Subclasses links. |
jjg@1735 | 159 | */ |
jjg@1735 | 160 | SUBCLASSES, |
duke@1 | 161 | |
jjg@1735 | 162 | /** |
jjg@1735 | 163 | * The signature in the class documentation (implements/extends portion). |
jjg@1735 | 164 | */ |
jjg@1735 | 165 | CLASS_SIGNATURE_PARENT_NAME, |
duke@1 | 166 | |
jjg@1735 | 167 | /** |
jjg@1735 | 168 | * The header for method documentation copied from parent. |
jjg@1735 | 169 | */ |
jjg@1735 | 170 | METHOD_DOC_COPY, |
duke@1 | 171 | |
jjg@1735 | 172 | /** |
jjg@1735 | 173 | * Method "specified by" link. |
jjg@1735 | 174 | */ |
jjg@1735 | 175 | METHOD_SPECIFIED_BY, |
duke@1 | 176 | |
jjg@1735 | 177 | /** |
jjg@1735 | 178 | * Method "overrides" link. |
jjg@1735 | 179 | */ |
jjg@1735 | 180 | METHOD_OVERRIDES, |
duke@1 | 181 | |
jjg@1735 | 182 | /** |
jjg@1735 | 183 | * Annotation link. |
jjg@1735 | 184 | */ |
jjg@1735 | 185 | ANNOTATION, |
duke@1 | 186 | |
jjg@1735 | 187 | /** |
jjg@1735 | 188 | * The header for field documentation copied from parent. |
jjg@1735 | 189 | */ |
jjg@1735 | 190 | FIELD_DOC_COPY, |
duke@1 | 191 | |
jjg@1735 | 192 | /** |
jjg@1735 | 193 | * The parent nodes in the class tree. |
jjg@1735 | 194 | */ |
jjg@1735 | 195 | CLASS_TREE_PARENT, |
duke@1 | 196 | |
jjg@1735 | 197 | /** |
jjg@1735 | 198 | * The type parameters of a method or constructor. |
jjg@1735 | 199 | */ |
jjg@1735 | 200 | MEMBER_TYPE_PARAMS, |
duke@1 | 201 | |
jjg@1735 | 202 | /** |
jjg@1735 | 203 | * Indicate that the link appears in class use documentation. |
jjg@1735 | 204 | */ |
jjg@1735 | 205 | CLASS_USE_HEADER, |
jjg@1735 | 206 | |
jjg@1735 | 207 | /** |
jjg@1735 | 208 | * The header for property documentation copied from parent. |
jjg@1735 | 209 | */ |
jjg@1735 | 210 | PROPERTY_DOC_COPY |
jjg@1735 | 211 | } |
jjg@1606 | 212 | |
jjg@1410 | 213 | public final ConfigurationImpl configuration; |
jjg@1410 | 214 | |
duke@1 | 215 | /** |
jjg@1735 | 216 | * The location of the link. |
duke@1 | 217 | */ |
jjg@1735 | 218 | public Kind context = Kind.DEFAULT; |
duke@1 | 219 | |
duke@1 | 220 | /** |
duke@1 | 221 | * The value of the marker #. |
duke@1 | 222 | */ |
duke@1 | 223 | public String where = ""; |
duke@1 | 224 | |
duke@1 | 225 | /** |
duke@1 | 226 | * String style of text defined in style sheet. |
duke@1 | 227 | */ |
jjg@1737 | 228 | public String styleName = ""; |
duke@1 | 229 | |
duke@1 | 230 | /** |
jjg@1410 | 231 | * The value of the target. |
duke@1 | 232 | */ |
duke@1 | 233 | public String target = ""; |
duke@1 | 234 | |
duke@1 | 235 | /** |
duke@1 | 236 | * Construct a LinkInfo object. |
duke@1 | 237 | * |
jjg@1410 | 238 | * @param configuration the configuration data for the doclet |
duke@1 | 239 | * @param context the context of the link. |
duke@1 | 240 | * @param classDoc the class to link to. |
duke@1 | 241 | * @param label the label for the link. |
duke@1 | 242 | * @param target the value of the target attribute. |
duke@1 | 243 | */ |
jjg@1410 | 244 | public LinkInfoImpl(ConfigurationImpl configuration, |
jjg@1737 | 245 | Kind context, ClassDoc classDoc, Content label, String target) { |
jjg@1410 | 246 | this.configuration = configuration; |
duke@1 | 247 | this.classDoc = classDoc; |
duke@1 | 248 | this.label = label; |
duke@1 | 249 | this.target = target; |
duke@1 | 250 | setContext(context); |
duke@1 | 251 | } |
duke@1 | 252 | |
duke@1 | 253 | /** |
jjg@1737 | 254 | * {@inherotDoc} |
jjg@1737 | 255 | */ |
jjg@1737 | 256 | protected Content newContent() { |
jjg@1737 | 257 | return new ContentBuilder(); |
jjg@1737 | 258 | } |
jjg@1737 | 259 | |
jjg@1737 | 260 | /** |
duke@1 | 261 | * Construct a LinkInfo object. |
duke@1 | 262 | * |
jjg@1410 | 263 | * @param configuration the configuration data for the doclet |
duke@1 | 264 | * @param context the context of the link. |
duke@1 | 265 | * @param classDoc the class to link to. |
duke@1 | 266 | * @param where the value of the marker #. |
duke@1 | 267 | * @param label the label for the link. |
bpatel@182 | 268 | * @param isStrong true if the link should be strong. |
duke@1 | 269 | * @param styleName String style of text defined in style sheet. |
duke@1 | 270 | */ |
jjg@1410 | 271 | public LinkInfoImpl(ConfigurationImpl configuration, |
jjg@1737 | 272 | Kind context, ClassDoc classDoc, String where, Content label, |
jjg@1410 | 273 | boolean isStrong, String styleName) { |
jjg@1410 | 274 | this.configuration = configuration; |
duke@1 | 275 | this.classDoc = classDoc; |
duke@1 | 276 | this.where = where; |
duke@1 | 277 | this.label = label; |
bpatel@182 | 278 | this.isStrong = isStrong; |
duke@1 | 279 | this.styleName = styleName; |
duke@1 | 280 | setContext(context); |
duke@1 | 281 | } |
duke@1 | 282 | |
duke@1 | 283 | /** |
duke@1 | 284 | * Construct a LinkInfo object. |
duke@1 | 285 | * |
jjg@1410 | 286 | * @param configuration the configuration data for the doclet |
duke@1 | 287 | * @param context the context of the link. |
duke@1 | 288 | * @param classDoc the class to link to. |
duke@1 | 289 | * @param where the value of the marker #. |
jjg@1737 | 290 | * @param label the plain-text label for the link. |
bpatel@182 | 291 | * @param isStrong true if the link should be strong. |
duke@1 | 292 | */ |
jjg@1410 | 293 | public LinkInfoImpl(ConfigurationImpl configuration, |
jjg@1735 | 294 | Kind context, ClassDoc classDoc, String where, String label, |
jjg@1410 | 295 | boolean isStrong) { |
jjg@1737 | 296 | this(configuration, context, classDoc, where, new StringContent(label), |
jjg@1737 | 297 | isStrong, ""); |
jjg@1737 | 298 | } |
jjg@1737 | 299 | |
jjg@1737 | 300 | /** |
jjg@1737 | 301 | * Construct a LinkInfo object. |
jjg@1737 | 302 | * |
jjg@1737 | 303 | * @param configuration the configuration data for the doclet |
jjg@1737 | 304 | * @param context the context of the link. |
jjg@1737 | 305 | * @param classDoc the class to link to. |
jjg@1737 | 306 | * @param where the value of the marker #. |
jjg@1737 | 307 | * @param label the label for the link. |
jjg@1737 | 308 | * @param isStrong true if the link should be strong. |
jjg@1737 | 309 | */ |
jjg@1737 | 310 | public LinkInfoImpl(ConfigurationImpl configuration, |
jjg@1737 | 311 | Kind context, ClassDoc classDoc, String where, Content label, |
jjg@1737 | 312 | boolean isStrong) { |
jjg@1737 | 313 | this(configuration, context, classDoc, where, label, |
jjg@1737 | 314 | isStrong, ""); |
jjg@1737 | 315 | } |
jjg@1737 | 316 | |
jjg@1737 | 317 | /** |
jjg@1737 | 318 | * Construct a LinkInfo object. |
jjg@1737 | 319 | * |
jjg@1737 | 320 | * @param configuration the configuration data for the doclet |
jjg@1737 | 321 | * @param classDoc the class to link to. |
jjg@1737 | 322 | * @param label the label for the link. |
jjg@1737 | 323 | */ |
jjg@1737 | 324 | public LinkInfoImpl(ConfigurationImpl configuration, |
jjg@1737 | 325 | ClassDoc classDoc, Content label) { |
jjg@1410 | 326 | this.configuration = configuration; |
duke@1 | 327 | this.classDoc = classDoc; |
duke@1 | 328 | this.label = label; |
duke@1 | 329 | setContext(context); |
duke@1 | 330 | } |
duke@1 | 331 | |
duke@1 | 332 | /** |
duke@1 | 333 | * Construct a LinkInfo object. |
duke@1 | 334 | * |
jjg@1410 | 335 | * @param configuration the configuration data for the doclet |
duke@1 | 336 | * @param classDoc the class to link to. |
duke@1 | 337 | * @param label the label for the link. |
duke@1 | 338 | */ |
jjg@1410 | 339 | public LinkInfoImpl(ConfigurationImpl configuration, |
jjg@1410 | 340 | ClassDoc classDoc, String label) { |
jjg@1410 | 341 | this.configuration = configuration; |
duke@1 | 342 | this.classDoc = classDoc; |
jjg@1737 | 343 | this.label = new StringContent(label); |
duke@1 | 344 | setContext(context); |
duke@1 | 345 | } |
duke@1 | 346 | |
duke@1 | 347 | /** |
duke@1 | 348 | * Construct a LinkInfo object. |
duke@1 | 349 | * |
jjg@1410 | 350 | * @param configuration the configuration data for the doclet |
duke@1 | 351 | * @param context the context of the link. |
duke@1 | 352 | * @param executableMemberDoc the member to link to. |
bpatel@182 | 353 | * @param isStrong true if the link should be strong. |
duke@1 | 354 | */ |
jjg@1410 | 355 | public LinkInfoImpl(ConfigurationImpl configuration, |
jjg@1735 | 356 | Kind context, ExecutableMemberDoc executableMemberDoc, |
jjg@1410 | 357 | boolean isStrong) { |
jjg@1410 | 358 | this.configuration = configuration; |
duke@1 | 359 | this.executableMemberDoc = executableMemberDoc; |
bpatel@182 | 360 | this.isStrong = isStrong; |
duke@1 | 361 | setContext(context); |
duke@1 | 362 | } |
duke@1 | 363 | |
duke@1 | 364 | /** |
duke@1 | 365 | * Construct a LinkInfo object. |
duke@1 | 366 | * |
jjg@1410 | 367 | * @param configuration the configuration data for the doclet |
duke@1 | 368 | * @param context the context of the link. |
duke@1 | 369 | * @param classDoc the class to link to. |
bpatel@182 | 370 | * @param isStrong true if the link should be strong. |
duke@1 | 371 | */ |
jjg@1410 | 372 | public LinkInfoImpl(ConfigurationImpl configuration, |
jjg@1735 | 373 | Kind context, ClassDoc classDoc, boolean isStrong) { |
jjg@1410 | 374 | this.configuration = configuration; |
duke@1 | 375 | this.classDoc = classDoc; |
bpatel@182 | 376 | this.isStrong = isStrong; |
duke@1 | 377 | setContext(context); |
duke@1 | 378 | } |
duke@1 | 379 | |
duke@1 | 380 | /** |
duke@1 | 381 | * Construct a LinkInfo object. |
duke@1 | 382 | * |
jjg@1410 | 383 | * @param configuration the configuration data for the doclet |
duke@1 | 384 | * @param context the context of the link. |
duke@1 | 385 | * @param type the class to link to. |
duke@1 | 386 | */ |
jjg@1410 | 387 | public LinkInfoImpl(ConfigurationImpl configuration, |
jjg@1735 | 388 | Kind context, Type type) { |
jjg@1410 | 389 | this.configuration = configuration; |
duke@1 | 390 | this.type = type; |
duke@1 | 391 | setContext(context); |
duke@1 | 392 | } |
duke@1 | 393 | |
duke@1 | 394 | /** |
duke@1 | 395 | * Construct a LinkInfo object. |
duke@1 | 396 | * |
jjg@1410 | 397 | * @param configuration the configuration data for the doclet |
duke@1 | 398 | * @param context the context of the link. |
duke@1 | 399 | * @param type the class to link to. |
duke@1 | 400 | * @param isVarArg true if this is a link to a var arg. |
duke@1 | 401 | */ |
jjg@1410 | 402 | public LinkInfoImpl(ConfigurationImpl configuration, |
jjg@1735 | 403 | Kind context, Type type, boolean isVarArg) { |
jjg@1410 | 404 | this.configuration = configuration; |
duke@1 | 405 | this.type = type; |
duke@1 | 406 | this.isVarArg = isVarArg; |
duke@1 | 407 | setContext(context); |
duke@1 | 408 | } |
duke@1 | 409 | |
duke@1 | 410 | /** |
duke@1 | 411 | * Construct a LinkInfo object. |
duke@1 | 412 | * |
jjg@1410 | 413 | * @param configuration the configuration data for the doclet |
duke@1 | 414 | * @param context the context of the link. |
duke@1 | 415 | * @param type the class to link to. |
jjg@1737 | 416 | * @param label plain-text label for the link. |
jjg@1737 | 417 | * @param isStrong true if the link should be strong. |
jjg@1737 | 418 | */ |
jjg@1737 | 419 | public LinkInfoImpl(ConfigurationImpl configuration, |
jjg@1737 | 420 | Kind context, Type type, String label, |
jjg@1737 | 421 | boolean isStrong) { |
jjg@1737 | 422 | this(configuration, context, type, new StringContent(label), isStrong); |
jjg@1737 | 423 | } |
jjg@1737 | 424 | |
jjg@1737 | 425 | /** |
jjg@1737 | 426 | * Construct a LinkInfo object. |
jjg@1737 | 427 | * |
jjg@1737 | 428 | * @param configuration the configuration data for the doclet |
jjg@1737 | 429 | * @param context the context of the link. |
jjg@1737 | 430 | * @param type the class to link to. |
duke@1 | 431 | * @param label the label for the link. |
bpatel@182 | 432 | * @param isStrong true if the link should be strong. |
duke@1 | 433 | */ |
jjg@1410 | 434 | public LinkInfoImpl(ConfigurationImpl configuration, |
jjg@1737 | 435 | Kind context, Type type, Content label, |
jjg@1410 | 436 | boolean isStrong) { |
jjg@1410 | 437 | this.configuration = configuration; |
duke@1 | 438 | this.type = type; |
duke@1 | 439 | this.label = label; |
bpatel@182 | 440 | this.isStrong = isStrong; |
duke@1 | 441 | setContext(context); |
duke@1 | 442 | } |
duke@1 | 443 | |
duke@1 | 444 | /** |
duke@1 | 445 | * Construct a LinkInfo object. |
duke@1 | 446 | * |
jjg@1410 | 447 | * @param configuration the configuration data for the doclet |
duke@1 | 448 | * @param context the context of the link. |
duke@1 | 449 | * @param classDoc the class to link to. |
jjg@1737 | 450 | * @param label plain-text label for the link. |
jjg@1737 | 451 | * @param isStrong true if the link should be strong. |
jjg@1737 | 452 | */ |
jjg@1737 | 453 | public LinkInfoImpl(ConfigurationImpl configuration, |
jjg@1737 | 454 | Kind context, ClassDoc classDoc, String label, |
jjg@1737 | 455 | boolean isStrong) { |
jjg@1737 | 456 | this(configuration, context, classDoc, new StringContent(label), isStrong); |
jjg@1737 | 457 | } |
jjg@1737 | 458 | |
jjg@1737 | 459 | /** |
jjg@1737 | 460 | * Construct a LinkInfo object. |
jjg@1737 | 461 | * |
jjg@1737 | 462 | * @param configuration the configuration data for the doclet |
jjg@1737 | 463 | * @param context the context of the link. |
jjg@1737 | 464 | * @param classDoc the class to link to. |
duke@1 | 465 | * @param label the label for the link. |
bpatel@182 | 466 | * @param isStrong true if the link should be strong. |
duke@1 | 467 | */ |
jjg@1410 | 468 | public LinkInfoImpl(ConfigurationImpl configuration, |
jjg@1737 | 469 | Kind context, ClassDoc classDoc, Content label, |
jjg@1410 | 470 | boolean isStrong) { |
jjg@1410 | 471 | this.configuration = configuration; |
duke@1 | 472 | this.classDoc = classDoc; |
duke@1 | 473 | this.label = label; |
bpatel@182 | 474 | this.isStrong = isStrong; |
duke@1 | 475 | setContext(context); |
duke@1 | 476 | } |
duke@1 | 477 | |
duke@1 | 478 | /** |
duke@1 | 479 | * {@inheritDoc} |
duke@1 | 480 | */ |
jjg@1735 | 481 | public Kind getContext() { |
duke@1 | 482 | return context; |
duke@1 | 483 | } |
duke@1 | 484 | |
duke@1 | 485 | /** |
duke@1 | 486 | * {@inheritDoc} |
duke@1 | 487 | * |
duke@1 | 488 | * This method sets the link attributes to the appropriate values |
duke@1 | 489 | * based on the context. |
duke@1 | 490 | * |
duke@1 | 491 | * @param c the context id to set. |
duke@1 | 492 | */ |
jjg@1735 | 493 | public final void setContext(Kind c) { |
duke@1 | 494 | //NOTE: Put context specific link code here. |
duke@1 | 495 | switch (c) { |
duke@1 | 496 | case ALL_CLASSES_FRAME: |
duke@1 | 497 | case PACKAGE_FRAME: |
jjg@1735 | 498 | case IMPLEMENTED_CLASSES: |
jjg@1735 | 499 | case SUBCLASSES: |
jjg@1735 | 500 | case METHOD_DOC_COPY: |
jjg@1735 | 501 | case FIELD_DOC_COPY: |
jjg@1735 | 502 | case PROPERTY_DOC_COPY: |
jjg@1735 | 503 | case CLASS_USE_HEADER: |
duke@1 | 504 | includeTypeInClassLinkLabel = false; |
duke@1 | 505 | break; |
duke@1 | 506 | |
jjg@1735 | 507 | case ANNOTATION: |
duke@1 | 508 | excludeTypeParameterLinks = true; |
duke@1 | 509 | excludeTypeBounds = true; |
duke@1 | 510 | break; |
duke@1 | 511 | |
jjg@1735 | 512 | case IMPLEMENTED_INTERFACES: |
jjg@1735 | 513 | case SUPER_INTERFACES: |
jjg@1735 | 514 | case SUBINTERFACES: |
jjg@1735 | 515 | case CLASS_TREE_PARENT: |
jjg@1735 | 516 | case TREE: |
jjg@1735 | 517 | case CLASS_SIGNATURE_PARENT_NAME: |
duke@1 | 518 | excludeTypeParameterLinks = true; |
duke@1 | 519 | excludeTypeBounds = true; |
duke@1 | 520 | includeTypeInClassLinkLabel = false; |
duke@1 | 521 | includeTypeAsSepLink = true; |
duke@1 | 522 | break; |
duke@1 | 523 | |
jjg@1735 | 524 | case PACKAGE: |
jjg@1735 | 525 | case CLASS_USE: |
jjg@1735 | 526 | case CLASS_HEADER: |
jjg@1735 | 527 | case CLASS_SIGNATURE: |
duke@1 | 528 | excludeTypeParameterLinks = true; |
duke@1 | 529 | includeTypeAsSepLink = true; |
duke@1 | 530 | includeTypeInClassLinkLabel = false; |
duke@1 | 531 | break; |
duke@1 | 532 | |
jjg@1735 | 533 | case MEMBER_TYPE_PARAMS: |
duke@1 | 534 | includeTypeAsSepLink = true; |
duke@1 | 535 | includeTypeInClassLinkLabel = false; |
duke@1 | 536 | break; |
duke@1 | 537 | |
jjg@1735 | 538 | case RETURN_TYPE: |
jjg@1735 | 539 | case SUMMARY_RETURN_TYPE: |
jjg@1521 | 540 | excludeTypeBounds = true; |
jjg@1521 | 541 | break; |
jjg@1735 | 542 | case EXECUTABLE_MEMBER_PARAM: |
duke@1 | 543 | excludeTypeBounds = true; |
duke@1 | 544 | break; |
duke@1 | 545 | } |
duke@1 | 546 | context = c; |
duke@1 | 547 | if (type != null && |
duke@1 | 548 | type.asTypeVariable()!= null && |
duke@1 | 549 | type.asTypeVariable().owner() instanceof ExecutableMemberDoc){ |
duke@1 | 550 | excludeTypeParameterLinks = true; |
duke@1 | 551 | } |
duke@1 | 552 | } |
duke@1 | 553 | |
duke@1 | 554 | /** |
duke@1 | 555 | * Return true if this link is linkable and false if we can't link to the |
duke@1 | 556 | * desired place. |
duke@1 | 557 | * |
duke@1 | 558 | * @return true if this link is linkable and false if we can't link to the |
duke@1 | 559 | * desired place. |
duke@1 | 560 | */ |
duke@1 | 561 | public boolean isLinkable() { |
jjg@1410 | 562 | return Util.isLinkable(classDoc, configuration); |
duke@1 | 563 | } |
duke@1 | 564 | } |