1 <?cs # A link to a package ?><?cs 2 3 def:package_link(pkg) ?> 4 <a href="<?cs var:toroot ?><?cs var:pkg.link ?>"><?cs var:pkg.name ?></a><?cs 5 /def ?><?cs 6 7 # A link to a type, or not if it is a primitive type 8 link: whether to create a link at the top level, always creates links in 9 recursive invocations. 10 Overloaded version to support use of 'nav' parameter, which when true, 11 will not include the generics in the class name (good for sidenav lists) 12 Expects the following fields: 13 .name 14 .link 15 .isPrimitive 16 .superBounds.N.(more links) (... super ... & ...) 17 .extendsBounds.N.(more links) (... extends ... & ...) 18 .typeArguments.N.(more links) (< ... >) ?><?cs 19 def:type_link_impl(type, link) ?><?cs call:type_link_impl2(type, link, "false") ?><?cs /def ?><?cs 20 21 def:type_link_impl2(type, link, nav) ?><?cs 22 if:type.link && link=="true" ?><?cs 23 if:type.federated ?><a href="<?cs var:type.link ?>"><?cs 24 var:type.label ?></a><?cs 25 else ?><a href="<?cs var:toroot ?><?cs var:type.link ?>"><?cs var:type.label ?></a><?cs 26 /if ?><?cs 27 else ?><?cs var:type.label ?><?cs 28 /if ?><?cs 29 if:subcount(type.extendsBounds) ?><?cs 30 each:t=type.extendsBounds ?><?cs 31 if:first(t) ?> extends <?cs else ?> & <?cs /if ?><?cs 32 call:type_link_impl(t, "true") ?><?cs 33 /each ?><?cs 34 /if ?><?cs 35 if:subcount(type.superBounds) ?><?cs 36 each:t=type.superBounds ?><?cs 37 if:first(t) ?> super <?cs else ?> & <?cs /if ?><?cs 38 call:type_link_impl(t, "true") ?><?cs 39 /each ?><?cs 40 /if ?><?cs 41 if:subcount(type.typeArguments) && nav=="false" 42 ?><<?cs each:t=type.typeArguments ?><?cs call:type_link_impl(t, "true") ?><?cs 43 if:!last(t) ?>, <?cs /if ?><?cs 44 /each ?>><?cs 45 /if ?><?cs 46 /def ?><?cs 47 48 def:simple_type_link(type)?><?cs 49 if:type.link?><?cs 50 if:type.federated ?><a href="<?cs var:type.link ?>"><?cs var:type.label ?></a><?cs 51 else ?><a href="<?cs var:toroot ?><?cs var:type.link ?>"><?cs var:type.label ?></a><?cs 52 /if?><?cs 53 else ?><?cs var:type.label ?><?cs 54 /if?><?cs 55 if:subcount(type.typeArguments)?><<?cs 56 each:t=type.typeArguments?><?cs 57 call:type_link_impl(t, "true")?><?cs 58 if:!last(t) ?>, <?cs 59 /if ?><?cs 60 /each ?>><?cs 61 /if ?><?cs 62 /def ?><?cs 63 64 def:class_name(type) ?><?cs call:type_link_impl(type, "false") ?><?cs 65 /def ?><?cs 66 def:type_link2(type,nav) ?><?cs call:type_link_impl2(type, "true", nav) ?><?cs 67 /def ?><?cs 68 def:type_link(type) ?><?cs call:type_link2(type, "false") ?><?cs 69 /def ?><?cs 70 71 # a conditional link. 72 if the "condition" parameter evals to true then the link is displayed 73 otherwise only the text is displayed ?><?cs 74 def:cond_link(text, root, path, condition) ?><?cs 75 if:condition ?><a href="<?cs var:root ?><?cs 76 var:path ?>"><?cs /if ?><?cs var:text ?><?cs 77 if:condition ?></a><?cs /if ?><?cs 78 /def ?><?cs 79 80 # A comma separated parameter list ?><?cs 81 def:parameter_list(params) ?><?cs 82 each:param = params ?><?cs 83 call:simple_type_link(param.type)?> <?cs 84 var:param.name ?><?cs 85 if: name(param)!=subcount(params)-1?>, <?cs /if ?><?cs 86 /each ?><?cs 87 /def ?><?cs 88 89 def:doc_root_override() 90 ?><?cs var:toroot ?><?cs 91 /def ?><?cs 92 # Print a list of tags (e.g. description text ?><?cs 93 def:tag_list(tags) ?><?cs 94 each:tag = tags ?><?cs 95 if:tag.name == "Text" ?><?cs var:tag.text?><?cs 96 elif:tag.kind == "@more" ?><p><?cs 97 elif:tag.kind == "@see" ?><code><a href="<?cs 98 if:!tag.federatedSite ?><?cs 99 var:toroot ?><?cs 100 /if ?><?cs var:tag.href ?>"><?cs var:tag.label ?></a></code><?cs 101 elif:tag.kind == "@linkplain" ?><a href="<?cs 102 if:!tag.federatedSite ?><?cs 103 var:toroot ?><?cs 104 /if ?><?cs var:tag.href ?>"><?cs var:tag.label ?></a></a><?cs 105 elif:tag.kind == "@seeHref" ?><a href="<?cs var:tag.href ?>"><?cs var:tag.label ?></a><?cs 106 elif:tag.kind == "@seeJustLabel" ?><?cs var:tag.label ?><?cs 107 elif:tag.kind == "@value" ?><code><a href="<?cs 108 if:!tag.federatedSite ?><?cs 109 var:toroot ?><?cs 110 /if ?><?cs var:tag.href ?>"><?cs var:tag.text ?></a></code><?cs 111 elif:tag.kind == "@code" ?><code><?cs var:tag.text ?></code><?cs 112 elif:tag.kind == "@samplecode" ?><pre><?cs var:tag.text ?></pre><?cs 113 elif:tag.name == "@sample" ?><pre><?cs var:tag.text ?></pre><?cs 114 elif:tag.name == "@include" ?><?cs var:tag.text ?><?cs 115 elif:tag.kind == "@docRoot" ?><?cs call:doc_root_override() ?><?cs 116 elif:tag.kind == "@sdkCurrent" ?><?cs var:sdk.current ?><?cs 117 elif:tag.kind == "@sdkCurrentVersion" ?><?cs var:sdk.version ?><?cs 118 elif:tag.kind == "@sdkCurrentRelId" ?><?cs var:sdk.rel.id ?><?cs 119 elif:tag.kind == "@sdkPlatformVersion" ?><?cs var:sdk.platform.version ?><?cs 120 elif:tag.kind == "@sdkPlatformApiLevel" ?><?cs var:sdk.platform.apiLevel ?><?cs 121 elif:tag.kind == "@sdkPlatformMajorMinor" ?><?cs var:sdk.platform.majorMinor ?><?cs 122 elif:tag.kind == "@sdkPlatformReleaseDate" ?><?cs var:sdk.platform.releaseDate ?><?cs 123 elif:tag.kind == "@sdkPlatformDeployableDate" ?><?cs var:sdk.platform.deployableDate ?><?cs 124 elif:tag.kind == "@adtZipVersion" ?><?cs var:adt.zip.version ?><?cs 125 elif:tag.kind == "@adtZipDownload" ?><?cs var:adt.zip.download ?><?cs 126 elif:tag.kind == "@adtZipBytes" ?><?cs var:adt.zip.bytes ?><?cs 127 elif:tag.kind == "@adtZipChecksum" ?><?cs var:adt.zip.checksum ?><?cs 128 elif:tag.kind == "@inheritDoc" ?><?cs # This is the case when @inheritDoc is in something 129 that does not inherit from anything?><?cs 130 elif:tag.kind == "@attr" ?><?cs 131 else ?>{<?cs var:tag.name?> <?cs var:tag.text ?>}<?cs 132 /if ?><?cs 133 /each ?><?cs 134 /def ?><?cs 135 136 # Print output for block tags that are not "standard" javadoc tags ?><?cs 137 def:block_tag_list(tags) ?><?cs 138 each:tag = tags ?><?cs 139 if:tag.kind == "@apiNote" ?> 140 <div class="jd-tagdata"> 141 <h5 class="jd-tagtitle">API Note:</h5> 142 <ul class="nolist"><li><?cs call:tag_list(tag.commentTags) ?></li></ul> 143 </div><?cs 144 /if ?><?cs 145 if:tag.kind == "@implSpec" ?> 146 <div class="jd-tagdata"> 147 <h5 class="jd-tagtitle">Implementation Requirements:</h5> 148 <ul class="nolist"><li><?cs call:tag_list(tag.commentTags) ?></li></ul> 149 </div><?cs 150 /if ?><?cs 151 if:tag.kind == "@implNote" ?> 152 <div class="jd-tagdata"> 153 <h5 class="jd-tagtitle">Implementation Note:</h5> 154 <ul class="nolist"><li><?cs call:tag_list(tag.commentTags) ?></li></ul> 155 </div><?cs 156 /if ?><?cs 157 /each ?><?cs 158 /def ?><?cs 159 160 # Show the short-form description of something. These come from shortDescr and deprecated ?><?cs 161 def:short_descr(obj) ?><?cs 162 if:subcount(obj.deprecated) ?><em><?cs 163 if:obj.deprecatedsince ?> 164 This <?cs var:obj.kind ?> was deprecated 165 in API level <?cs var:obj.deprecatedsince ?>.<?cs 166 else ?> 167 This <?cs var:obj.kind ?> is deprecated.<?cs 168 /if ?> 169 <?cs call:tag_list(obj.deprecated) ?></em><?cs 170 else ?><?cs call:tag_list(obj.shortDescr) ?><?cs 171 if:subcount(obj.annotationdocumentation)?><?cs 172 each:annodoc=obj.annotationdocumentation ?> 173 <div><?cs var:annodoc.text?></div><?cs 174 /each?><?cs /if?><?cs 175 /if ?><?cs 176 /def ?><?cs 177 178 # Show a list of annotations associated with obj 179 # 180 # pre is an HTML string to start the list. 181 # between is an HTML string to include between each successive element. 182 # post is an HTML string to end the list. 183 # for example, call:show_annotations_list(cl, "<p>Annotations: ", "<br />", "</p>") 184 # ?><?cs 185 def:show_annotations_list(obj, pre, between, post) ?><?cs 186 each:anno = obj.showAnnotations ?><?cs 187 if:first(anno) ?><?cs 188 var:pre ?><?cs 189 /if ?> 190 @<?cs var:anno.type.label ?>(<?cs 191 each:elem = anno.elementValues ?><?cs 192 var:elem.name ?> = <?cs 193 var:elem.value ?><?cs 194 if:last(elem) == 0 ?>, <?cs 195 /if ?><?cs 196 /each ?>)<?cs 197 if:last(anno) == 0 ?><?cs 198 var:between ?><?cs 199 /if ?><?cs 200 if:last(anno) ?><?cs 201 var:post ?><?cs 202 /if ?><?cs 203 /each ?><?cs 204 /def ?><?cs 205 206 # Show a comma-separated list of annotations associated with obj ?><?cs 207 def:show_simple_annotations_list(obj, pre, post) ?><?cs 208 call:show_annotations_list(obj, pre, ", ", post) ?><?cs 209 /def ?><?cs 210 211 # Show the red box with the deprecated warning ?><?cs 212 def:deprecated_warning(obj) ?><?cs 213 if:subcount(obj.deprecated) ?><p> 214 <p class="caution"><strong><?cs 215 if:obj.deprecatedsince ?> 216 This <?cs var:obj.kind ?> was deprecated 217 in API level <?cs var:obj.deprecatedsince ?>.<?cs 218 else ?> 219 This <?cs var:obj.kind ?> is deprecated.<?cs 220 /if ?></strong><br/> 221 <?cs call:tag_list(obj.deprecated) ?> 222 </p><?cs 223 /if ?><?cs 224 /def ?><?cs 225 226 # print the See Also: section ?><?cs 227 def:see_also_tags(also) ?><?cs 228 if:subcount(also) ?> 229 <div> 230 <p><b>See also:</b></p> 231 <ul class="nolist"><?cs 232 each:tag=also ?><li><?cs 233 if:tag.kind == "@see" ?><code><a href="<?cs var:toroot ?><?cs var:tag.href ?>"><?cs 234 var:tag.label ?></a></code><?cs 235 elif:tag.kind == "@seeHref" ?><a href="<?cs var:tag.href ?>"><?cs var:tag.label ?></a><?cs 236 elif:tag.kind == "@seeJustLabel" ?><?cs var:tag.label ?><?cs 237 else ?>[ERROR: Unknown @see kind]<?cs 238 /if ?></li><?cs 239 /each ?> 240 </ul> 241 </div><?cs 242 /if ?> 243 <?cs /def ?><?cs 244 245 # print the API Level ?><?cs 246 def:since_tags(obj) ?><?cs 247 if:reference.apilevels && obj.since ?> 248 Added in <a href="<?cs var:toroot ?>guide/topics/manifest/uses-sdk-element.html#ApiLevels">API level <?cs var:obj.since ?></a><?cs 249 /if ?><?cs 250 /def ?><?cs 251 252 def:federated_refs(obj) ?> 253 <?cs if:subcount(obj.federated) ?> 254 <div> 255 Also: 256 <?cs each:federated=obj.federated ?> 257 <a href="<?cs var:federated.url ?>"><?cs var:federated.name ?></a><?cs 258 if:!last(federated) ?>,<?cs /if ?> 259 <?cs /each ?> 260 </div> 261 <?cs /if ?> 262 <?cs /def ?><?cs 263 264 # 265 # Print the long-form description for something. 266 # Uses the following fields: deprecated descr seeAlso since 267 # 268 ?><?cs 269 def:description(obj) ?><?cs 270 call:deprecated_warning(obj) ?> 271 <p><?cs call:tag_list(obj.descr) ?></p><?cs 272 if:subcount(obj.annotationdocumentation)?><?cs 273 each:annodoc=obj.annotationdocumentation ?> 274 <div style="display:block"><?cs var:annodoc.text?></div><?cs 275 /each?><?cs /if?><?cs 276 if:subcount(obj.attrRefs) ?> 277 <p><b>Related XML Attributes:</b></p> 278 <ul class="nolist"><?cs 279 each:attr=obj.attrRefs ?> 280 <li><a href="<?cs var:toroot ?><?cs var:attr.href ?>"><?cs var:attr.name ?></a></li><?cs 281 /each ?> 282 </ul><?cs 283 /if ?><?cs 284 if:subcount(obj.blockTags) ?> 285 <?cs call:block_tag_list(obj.blockTags) ?><?cs 286 /if ?><?cs 287 # 288 # Print the @param tags 289 # 290 ?><?cs 291 if:subcount(obj.paramTags) ?> 292 <table class="responsive"> 293 <tr><th colspan=2>Parameters</th></tr><?cs 294 each:param=obj.paramTags ?> 295 <tr> 296 <td><code><?cs 297 if:param.isTypeParameter ?><<?cs 298 /if ?><?cs var:param.name ?><?cs 299 if:param.isTypeParameter ?>><?cs 300 /if ?></code></td> 301 <td width="100%"> 302 <code><?cs var:param.kind ?></code><?cs 303 if:string.find(param.comment.0.text, "<!--") != 0 304 ?>:<?cs # Do not print if param comment is an HTML comment ?><?cs 305 /if ?> 306 <?cs call:tag_list(param.comment) ?></td> 307 </tr><?cs 308 /each ?> 309 </table><?cs 310 /if ?><?cs 311 # 312 # Print the @return value 313 # 314 ?><?cs 315 if:subcount(obj.returns) ?> 316 <table class="responsive"> 317 <tr><th colspan=2>Returns</th></tr> 318 <tr> 319 <td><code><?cs call:type_link(method.returnType) ?></code></td> 320 <td width="100%"><?cs call:tag_list(obj.returns) ?></td> 321 </tr> 322 </table><?cs 323 # 324 # If no return tag found, but there is a return type not 'void', print it 325 # 326 ?><?cs 327 elif:subcount(method.returnType) && method.returnType.label != 'void' ?> 328 <table class="responsive"> 329 <tr><th colspan=2>Returns</th></tr> 330 <tr> 331 <td><code><?cs call:type_link(method.returnType) ?></code></td> 332 <td width="100%"><!-- no returns description in source --></td> 333 </tr> 334 </table><?cs 335 /if ?><?cs 336 # 337 # Print the throwables 338 # 339 ?><?cs 340 if:subcount(obj.throws) ?> 341 <table class="responsive"> 342 <tr><th colspan=2>Throws</th></tr><?cs 343 each:tag=obj.throws ?> 344 <tr> 345 <td><code><?cs call:type_link(tag.type) ?></code></td> 346 <td width="100%"><?cs call:tag_list(tag.comment) ?></td> 347 </tr><?cs 348 /each ?> 349 </table> 350 <?cs 351 /if ?><?cs 352 call:see_also_tags(obj.seeAlso) ?><?cs 353 /def ?><?cs 354 355 # A table of links to classes with descriptions, as in a package file or the nested classes ?><?cs 356 def:class_link_table(classes) ?><?cs 357 set:count = #1 ?> 358 <table class="jd-sumtable-expando"><?cs 359 each:cl=classes ?> 360 <tr class="<?cs if:count % #2 ?>alt-color<?cs /if ?> api apilevel-<?cs var:cl.type.since ?>" > 361 <td><?cs call:type_link(cl.type) ?></td> 362 <td width="100%"><?cs call:short_descr(cl) ?> </td> 363 </tr><?cs set:count = count + #1 ?><?cs 364 /each ?> 365 </table><?cs 366 /def ?><?cs 367 368 # A list of links to classes, for use in the side navigation of classes when viewing a package (panel nav) ?><?cs 369 def:class_link_list(label, classes) ?><?cs 370 if:subcount(classes) ?> 371 <li><h2><?cs var:label ?></h2> 372 <ul><?cs 373 each:cl=classes ?> 374 <li class="api apilevel-<?cs var:cl.type.since ?>"><?cs call:type_link2(cl.type,"true") ?></li><?cs 375 /each ?> 376 </ul> 377 </li><?cs 378 /if ?><?cs 379 /def ?><?cs 380 381 # A list of links to classes, for use in the side navigation of classes when viewing a class (panel nav) ?><?cs 382 def:list(label, classes) ?><?cs 383 if:subcount(classes) ?> 384 <li><h2><?cs var:label ?></h2> 385 <ul><?cs 386 each:cl=classes ?> 387 <li class="<?cs if:class.name == cl.label?>selected <?cs /if ?>api apilevel-<?cs var:cl.since ?>"><?cs call:type_link2(cl,"true") ?></li><?cs 388 /each ?> 389 </ul> 390 </li><?cs 391 /if ?><?cs 392 /def ?><?cs 393 394 # A list of links to packages, for use in the side navigation of packages (panel nav) ?><?cs 395 def:package_link_list(packages) ?><?cs 396 each:pkg=packages ?> 397 <li class="<?cs if:(class.package.name == pkg.name) || (package.name == pkg.name)?>selected <?cs /if ?>api apilevel-<?cs var:pkg.since ?>"><?cs call:package_link(pkg) ?></li><?cs 398 /each ?><?cs 399 /def ?><?cs 400 401 # An expando trigger ?><?cs 402 def:expando_trigger(id, default) ?> 403 <a href="#" onclick="return toggleInherited(this, null)" id="<?cs var:id ?>" class="jd-expando-trigger closed" 404 ><img height="34" id="<?cs var:id ?>-trigger" 405 src="<?cs var:toroot ?>assets/images/styles/disclosure_<?cs 406 if:default == 'closed' ?>down<?cs else ?>up<?cs /if ?>.png" 407 class="jd-expando-trigger-img" /></a><?cs 408 /def ?><?cs 409 410 # An expandable list of classes ?><?cs 411 def:expandable_class_list(id, classes, default) ?> 412 <div id="<?cs var:id ?>"> 413 <div id="<?cs var:id ?>-list" 414 class="jd-inheritedlinks" 415 <?cs if:default != "list" ?>style="display: none;"<?cs /if ?> 416 > 417 <?cs if:subcount(classes) <= #20 ?> 418 <?cs each:cl=classes ?> 419 <?cs call:type_link(cl.type) ?><?cs if:!last(cl) ?>,<?cs /if ?> 420 <?cs /each ?> 421 <?cs else ?> 422 <?cs set:leftovers = subcount(classes) - #15 ?> 423 <?cs loop:i = #0, #14, #1 ?> 424 <?cs with:cl=classes[i] ?> 425 <?cs call:type_link(cl.type) ?>, 426 <?cs /with ?> 427 <?cs if:(#i == #14) ?>and 428 <a href="#" onclick="return toggleInherited(document.getElementById('<?cs 429 var:id ?>', null))"><?cs var:leftovers ?> others.</a> 430 <?cs /if ?> 431 <?cs /loop ?> 432 <?cs /if ?> 433 </div> 434 <div id="<?cs var:id ?>-summary" 435 <?cs if:default != "summary" ?>style="display: none;"<?cs /if ?> 436 ><?cs 437 call:class_link_table(classes) ?> 438 </div> 439 </div><?cs 440 /def ?><?cs 441 include:"components.cs" ?>