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 ?><?cs 141 /def ?> 142 143 <?cs # Show the red box with the deprecated warning ?><?cs 144 def:deprecated_warning(obj) ?><?cs 145 if:subcount(obj.deprecated) ?><p> 146 <p class="caution"><strong><?cs 147 if:obj.deprecatedsince ?> 148 This <?cs var:obj.kind ?> was deprecated 149 in API level <?cs var:obj.deprecatedsince ?>.<?cs 150 else ?> 151 This <?cs var:obj.kind ?> is deprecated.<?cs 152 /if ?></strong><br/> 153 <?cs call:tag_list(obj.deprecated) ?> 154 </p><?cs 155 /if ?><?cs 156 /def ?> 157 158 <?cs # print the See Also: section ?><?cs 159 def:see_also_tags(also) ?><?cs 160 if:subcount(also) ?> 161 <div class="jd-tagdata"> 162 <h5 class="jd-tagtitle">See Also</h5> 163 <ul class="nolist"><?cs 164 each:tag=also ?><li><?cs 165 if:tag.kind == "@see" ?><code><a href="<?cs var:toroot ?><?cs var:tag.href ?>"><?cs 166 var:tag.label ?></a></code><?cs 167 elif:tag.kind == "@seeHref" ?><a href="<?cs var:tag.href ?>"><?cs var:tag.label ?></a><?cs 168 elif:tag.kind == "@seeJustLabel" ?><?cs var:tag.label ?><?cs 169 else ?>[ERROR: Unknown @see kind]<?cs 170 /if ?></li><?cs 171 /each ?> 172 </ul> 173 </div><?cs 174 /if ?> 175 <?cs /def ?> 176 177 <?cs # print the API Level ?><?cs 178 def:since_tags(obj) ?><?cs 179 if:reference.apilevels && obj.since ?> 180 Added in <a href="<?cs var:toroot ?>guide/topics/manifest/uses-sdk-element.html#ApiLevels">API level <?cs var:obj.since ?></a><?cs 181 /if ?><?cs 182 /def ?> 183 <?cs def:federated_refs(obj) ?> 184 <?cs if:subcount(obj.federated) ?> 185 <div> 186 Also: 187 <?cs each:federated=obj.federated ?> 188 <a href="<?cs var:federated.url ?>"><?cs var:federated.name ?></a><?cs 189 if:!last(federated) ?>,<?cs /if ?> 190 <?cs /each ?> 191 </div> 192 <?cs /if ?> 193 <?cs /def ?> 194 <?cs # Print the long-form description for something. 195 Uses the following fields: deprecated descr seeAlso since ?><?cs 196 def:description(obj) ?><?cs 197 call:deprecated_warning(obj) ?> 198 <div class="jd-tagdata jd-tagdescr"><p><?cs call:tag_list(obj.descr) ?></p></div><?cs 199 if:subcount(obj.attrRefs) ?> 200 <div class="jd-tagdata"> 201 <h5 class="jd-tagtitle">Related XML Attributes</h5> 202 <ul class="nolist"><?cs 203 each:attr=obj.attrRefs ?> 204 <li><a href="<?cs var:toroot ?><?cs var:attr.href ?>"><?cs var:attr.name ?></a></li><?cs 205 /each ?> 206 </ul> 207 </div><?cs 208 /if ?><?cs 209 if:subcount(obj.paramTags) ?> 210 <div class="jd-tagdata"> 211 <h5 class="jd-tagtitle">Parameters</h5> 212 <table class="jd-tagtable"><?cs 213 each:tag=obj.paramTags ?> 214 <tr> 215 <th><?cs if:tag.isTypeParameter ?><<?cs /if ?><?cs var:tag.name 216 ?><?cs if:tag.isTypeParameter ?>><?cs /if ?></td> 217 <td><?cs call:tag_list(tag.comment) ?></td> 218 </tr><?cs 219 /each ?> 220 </table> 221 </div><?cs 222 /if ?><?cs 223 if:subcount(obj.returns) ?> 224 <div class="jd-tagdata"> 225 <h5 class="jd-tagtitle">Returns</h5> 226 <ul class="nolist"><li><?cs call:tag_list(obj.returns) ?></li></ul> 227 </div><?cs 228 /if ?><?cs 229 if:subcount(obj.throws) ?> 230 <div class="jd-tagdata"> 231 <h5 class="jd-tagtitle">Throws</h5> 232 <table class="jd-tagtable"><?cs 233 each:tag=obj.throws ?> 234 <tr> 235 <th><?cs call:type_link(tag.type) ?></td> 236 <td><?cs call:tag_list(tag.comment) ?></td> 237 </tr><?cs 238 /each ?> 239 </table> 240 </div><?cs 241 /if ?><?cs 242 call:see_also_tags(obj.seeAlso) ?><?cs 243 /def ?> 244 245 <?cs # A table of links to classes with descriptions, as in a package file or the nested classes ?><?cs 246 def:class_link_table(classes) ?><?cs 247 set:count = #1 ?> 248 <table class="jd-sumtable-expando"><?cs 249 each:cl=classes ?> 250 <tr class="<?cs if:count % #2 ?>alt-color<?cs /if ?> api apilevel-<?cs var:cl.type.since ?>" > 251 <td class="jd-linkcol"><?cs call:type_link(cl.type) ?></td> 252 <td class="jd-descrcol" width="100%"><?cs call:short_descr(cl) ?> </td> 253 </tr><?cs set:count = count + #1 ?><?cs 254 /each ?> 255 </table><?cs 256 /def ?> 257 258 <?cs # A list of links to classes, for use in the side navigation of classes when viewing a package (panel nav) ?><?cs 259 def:class_link_list(label, classes) ?><?cs 260 if:subcount(classes) ?> 261 <li><h2><?cs var:label ?></h2> 262 <ul><?cs 263 each:cl=classes ?> 264 <li class="api apilevel-<?cs var:cl.type.since ?>"><?cs call:type_link2(cl.type,"true") ?></li><?cs 265 /each ?> 266 </ul> 267 </li><?cs 268 /if ?><?cs 269 /def ?> 270 271 <?cs # A list of links to classes, for use in the side navigation of classes when viewing a class (panel nav) ?><?cs 272 def:list(label, classes) ?><?cs 273 if:subcount(classes) ?> 274 <li><h2><?cs var:label ?></h2> 275 <ul><?cs 276 each:cl=classes ?> 277 <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 278 /each ?> 279 </ul> 280 </li><?cs 281 /if ?><?cs 282 /def ?> 283 284 <?cs # A list of links to packages, for use in the side navigation of packages (panel nav) ?><?cs 285 def:package_link_list(packages) ?><?cs 286 each:pkg=packages ?> 287 <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 288 /each ?><?cs 289 /def ?> 290 291 <?cs # An expando trigger ?><?cs 292 def:expando_trigger(id, default) ?> 293 <a href="#" onclick="return toggleInherited(this, null)" id="<?cs var:id ?>" class="jd-expando-trigger closed" 294 ><img id="<?cs var:id ?>-trigger" 295 src="<?cs var:toroot ?>assets/images/triangle-<?cs var:default ?>.png" 296 class="jd-expando-trigger-img" /></a><?cs 297 /def ?> 298 299 <?cs # An expandable list of classes ?><?cs 300 def:expandable_class_list(id, classes, default) ?> 301 <div id="<?cs var:id ?>"> 302 <div id="<?cs var:id ?>-list" 303 class="jd-inheritedlinks" 304 <?cs if:default != "list" ?>style="display: none;"<?cs /if ?> 305 > 306 <?cs if:subcount(classes) <= #20 ?> 307 <?cs each:cl=classes ?> 308 <?cs call:type_link(cl.type) ?><?cs if:!last(cl) ?>,<?cs /if ?> 309 <?cs /each ?> 310 <?cs else ?> 311 <?cs set:leftovers = subcount(classes) - #15 ?> 312 <?cs loop:i = #0, #14, #1 ?> 313 <?cs with:cl=classes[i] ?> 314 <?cs call:type_link(cl.type) ?>, 315 <?cs /with ?> 316 <?cs if:(#i == #14) ?>and 317 <a href="#" onclick="return toggleInherited(document.getElementById('<?cs 318 var:id ?>', null))"><?cs var:leftovers ?> others.</a> 319 <?cs /if ?> 320 <?cs /loop ?> 321 <?cs /if ?> 322 </div> 323 <div id="<?cs var:id ?>-summary" 324 <?cs if:default != "summary" ?>style="display: none;"<?cs /if ?> 325 ><?cs 326 call:class_link_table(classes) ?> 327 </div> 328 </div><?cs 329 /def ?> 330 331 <?cs include:"components.cs" ?> 332 333