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 ?> 278 <b><a href="<?cs var:toroot ?>preview/">Android <?cs var:obj.since ?> Developer Preview</a></b><?cs 279 /if?><?cs 280 /if ?><?cs 281 /def ?><?cs 282 283 # print the artifact ?><?cs 284 def:artifact_tags(obj) ?><?cs 285 if:reference.artifacts && obj.artifact ?> 286 belongs to Maven artifact <?cs var:obj.artifact ?></a><?cs 287 /if ?><?cs 288 /def ?><?cs 289 290 def:federated_refs(obj) ?> 291 <?cs if:subcount(obj.federated) ?> 292 <div> 293 Also: 294 <?cs each:federated=obj.federated ?> 295 <a href="<?cs var:federated.url ?>"><?cs var:federated.name ?></a><?cs 296 if:!last(federated) ?>,<?cs /if ?> 297 <?cs /each ?> 298 </div> 299 <?cs /if ?> 300 <?cs /def ?><?cs 301 302 # 303 # Print the long-form description for something. 304 # Uses the following fields: deprecated descr seeAlso since 305 # 306 ?><?cs 307 def:description(obj) ?><?cs 308 call:deprecated_warning(obj) ?> 309 <p><?cs call:tag_list(obj.descr) ?></p><?cs 310 call:aux_tag_list(obj.descrAux) ?><?cs 311 if:subcount(obj.annotationdocumentation)?><?cs 312 each:annodoc=obj.annotationdocumentation ?> 313 <div><?cs var:annodoc.text?></div><?cs 314 /each?><?cs /if?><?cs 315 if:subcount(obj.attrRefs) ?> 316 <p><b>Related XML Attributes:</b></p> 317 <ul class="nolist"><?cs 318 each:attr=obj.attrRefs ?> 319 <li><a href="<?cs 320 if:!attr.federatedSite ?><?cs 321 var:toroot ?><?cs 322 /if ?><?cs var:attr.href ?>"><?cs var:attr.name ?></a></li><?cs 323 /each ?> 324 </ul><?cs 325 /if ?><?cs 326 if:subcount(obj.blockTags) ?> 327 <?cs call:block_tag_list(obj.blockTags) ?><?cs 328 /if ?><?cs 329 # 330 # Print the @param tags 331 # 332 ?><?cs 333 if:subcount(obj.paramTags) ?> 334 <table class="responsive"> 335 <tr><th colspan=2>Parameters</th></tr><?cs 336 each:param=obj.paramTags ?> 337 <tr> 338 <td><code><?cs 339 if:param.isTypeParameter ?><<?cs 340 /if ?><?cs var:param.name ?><?cs 341 if:param.isTypeParameter ?>><?cs 342 /if ?></code></td> 343 <td width="100%"> 344 <code><?cs var:param.kind ?></code><?cs 345 if:string.find(param.comment.0.text, "<!--") != 0 346 ?>:<?cs # Do not print if param comment is an HTML comment ?><?cs 347 /if ?> <?cs 348 call:tag_list(param.comment) ?><?cs 349 call:aux_tag_list(param.commentAux) ?></td> 350 </tr><?cs 351 /each ?> 352 </table><?cs 353 /if ?><?cs 354 # 355 # Print the @return value 356 # 357 ?><?cs 358 if:subcount(obj.returns) || (subcount(method.returnType) && method.returnType.label != 'void') ?> 359 <table class="responsive"> 360 <tr><th colspan=2>Returns</th></tr> 361 <tr> 362 <td><code><?cs call:type_link(method.returnType) ?></code></td> 363 <td width="100%"><?cs 364 if:subcount(obj.returns) ?><?cs 365 call:tag_list(obj.returns) ?><?cs 366 else ?><!-- no returns description in source --><?cs 367 /if ?><?cs 368 call:aux_tag_list(obj.returnsAux) ?></td> 369 </tr> 370 </table><?cs 371 /if ?><?cs 372 # 373 # Print the throwables 374 # 375 ?><?cs 376 if:subcount(obj.throws) ?> 377 <table class="responsive"> 378 <tr><th colspan=2>Throws</th></tr><?cs 379 each:tag=obj.throws ?> 380 <tr> 381 <td><code><?cs call:type_link(tag.type) ?></code></td> 382 <td width="100%"><?cs call:tag_list(tag.comment) ?></td> 383 </tr><?cs 384 /each ?> 385 </table> 386 <?cs 387 /if ?><?cs 388 call:see_also_tags(obj.seeAlso) ?><?cs 389 /def ?><?cs 390 391 # A table of links to classes with descriptions, as in a package file or the nested classes ?><?cs 392 def:class_link_table(classes) ?><?cs 393 set:count = #1 ?> 394 <table class="jd-sumtable-expando"><?cs 395 each:cl=classes ?> 396 <tr class="<?cs if:count % #2 ?>alt-color<?cs /if ?> api apilevel-<?cs var:cl.type.since ?>" > 397 <td><?cs call:type_link(cl.type) ?></td> 398 <td width="100%"><?cs call:short_descr(cl) ?> </td> 399 </tr><?cs set:count = count + #1 ?><?cs 400 /each ?> 401 </table><?cs 402 /def ?><?cs 403 404 # A list of links to classes, for use in the side navigation of classes when viewing a package (panel nav) ?><?cs 405 def:class_link_list(label, classes) ?><?cs 406 if:subcount(classes) ?> 407 <li><h2 class="hide-from-toc"><?cs var:label ?></h2> 408 <ul><?cs 409 each:cl=classes ?> 410 <li class="api apilevel-<?cs var:cl.type.since ?>"><?cs call:type_link2(cl.type,"true") ?></li><?cs 411 /each ?> 412 </ul> 413 </li><?cs 414 /if ?><?cs 415 /def ?><?cs 416 417 # A list of links to classes, for use in the side navigation of classes when viewing a class (panel nav) ?><?cs 418 def: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 class="<?cs if:class.name == cl.label?>selected <?cs /if ?>api apilevel-<?cs var:cl.since ?>"><?cs call:type_link2(cl,"true") ?></li><?cs 424 /each ?> 425 </ul> 426 </li><?cs 427 /if ?><?cs 428 /def ?><?cs 429 430 # A list of links to packages, for use in the side navigation of packages (panel nav) ?><?cs 431 def:package_link_list(packages) ?><?cs 432 each:pkg=packages ?> 433 <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 434 /each ?><?cs 435 /def ?> 436 437 <?cs 438 # An expando trigger 439 ?><?cs 440 def:expando_trigger(id, default) ?> 441 <a href="#" id="<?cs var:id ?>" class="jd-expando-trigger closed"<?cs 442 if:enable_javascript ?> 443 onclick="return toggleInherited(this, null)"<?cs 444 /if ?> > 445 <img id="<?cs var:id ?>-trigger" class="jd-expando-trigger-img" 446 height="34" 447 src="<?cs var:toroot ?>assets/images/styles/disclosure_<?cs 448 if:default == 'closed' ?>down<?cs else ?>up<?cs /if ?>.png" /> 449 </a><?cs 450 /def ?> 451 452 <?cs 453 # An expandable list of classes 454 ?><?cs 455 def:expandable_class_list(id, classes, default) ?> 456 <div id="<?cs var:id ?>" class="showalways" > <?cs 457 if:subcount(classes) <= #20 ?><?cs 458 each:cl=classes ?><?cs 459 call:type_link(cl.type) ?><?cs 460 if:!last(cl) 461 ?>, <?cs 462 /if ?><?cs 463 /each ?><?cs 464 else ?><?cs 465 set:leftovers = subcount(classes) - #15 ?><?cs 466 loop:i = #0, #14, #1 ?><?cs 467 with:cl=classes[i] ?><?cs 468 call:type_link(cl.type) ?>, <?cs 469 /with ?><?cs 470 if:(#i == #14) ?> and <?cs var:leftovers ?> others.<?cs 471 /if ?><?cs 472 /loop ?><?cs 473 /if ?> 474 </div> 475 <div id="<?cs var:id ?>-summary"<?cs 476 if:default == "summary" ?> 477 class="showalways"<?cs 478 /if ?> > 479 <?cs call:class_link_table(classes) ?> 480 </div><?cs 481 /def ?> 482 483 <?cs include:"components.cs" ?> 484