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