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