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 def:class_name(type) ?><?cs call:type_link_impl(type, "false") ?><?cs /def ?> 48 <?cs def:type_link2(type,nav) ?><?cs call:type_link_impl2(type, "true", nav) ?><?cs /def ?> 49 <?cs def:type_link(type) ?><?cs call:type_link2(type, "false") ?><?cs /def ?> 50 51 <?cs # a conditional link. 52 if the "condition" parameter evals to true then the link is displayed 53 otherwise only the text is displayed 54 ?><?cs 55 def:cond_link(text, root, path, condition) ?><?cs 56 if:condition ?><a href="<?cs var:root ?><?cs var:path ?>"><?cs /if ?><?cs var:text ?><?cs if:condition ?></a><?cs /if ?><?cs 57 /def ?> 58 59 <?cs # A comma separated parameter list ?><?cs 60 def:parameter_list(params) ?><?cs 61 each:param = params ?><?cs 62 call:type_link(param.type)?> <?cs 63 var:param.name ?><?cs 64 if: name(param)!=subcount(params)-1?>, <?cs /if ?><?cs 65 /each ?><?cs 66 /def ?> 67 68 <?cs # Print a list of tags (e.g. description text ?><?cs 69 def:tag_list(tags) ?><?cs 70 each:tag = tags ?><?cs 71 if:tag.name == "Text" ?><?cs var:tag.text?><?cs 72 elif:tag.kind == "@more" ?><p><?cs 73 elif:tag.kind == "@see" ?><code><a href="<?cs var:toroot ?><?cs var:tag.href ?>"><?cs var:tag.label ?></a></code><?cs 74 elif:tag.kind == "@seeHref" ?><a href="<?cs var:tag.href ?>"><?cs var:tag.label ?></a><?cs 75 elif:tag.kind == "@seeJustLabel" ?><?cs var:tag.label ?><?cs 76 elif:tag.kind == "@value" ?><code><a href="<?cs var:toroot ?><?cs var:tag.href ?>"><?cs var:tag.text ?></a></code><?cs 77 elif:tag.kind == "@code" ?><code><?cs var:tag.text ?></code><?cs 78 elif:tag.kind == "@samplecode" ?><pre><?cs var:tag.text ?></pre><?cs 79 elif:tag.name == "@sample" ?><pre><?cs var:tag.text ?></pre><?cs 80 elif:tag.name == "@include" ?><?cs var:tag.text ?><?cs 81 elif:tag.kind == "@docRoot" ?><?cs var:toroot ?><?cs 82 elif:tag.kind == "@sdkCurrent" ?><?cs var:sdk.current ?><?cs 83 elif:tag.kind == "@sdkCurrentVersion" ?><?cs var:sdk.version ?><?cs 84 elif:tag.kind == "@sdkCurrentRelId" ?><?cs var:sdk.rel.id ?><?cs 85 elif:tag.kind == "@sdkPlatformVersion" ?><?cs var:sdk.platform.version ?><?cs 86 elif:tag.kind == "@sdkPlatformApiLevel" ?><?cs var:sdk.platform.apiLevel ?><?cs 87 elif:tag.kind == "@sdkPlatformMajorMinor" ?><?cs var:sdk.platform.majorMinor ?><?cs 88 elif:tag.kind == "@sdkPlatformReleaseDate" ?><?cs var:sdk.platform.releaseDate ?><?cs 89 elif:tag.kind == "@sdkPlatformDeployableDate" ?><?cs var:sdk.platform.deployableDate ?><?cs 90 elif:tag.kind == "@adtZipVersion" ?><?cs var:adt.zip.version ?><?cs 91 elif:tag.kind == "@adtZipDownload" ?><?cs var:adt.zip.download ?><?cs 92 elif:tag.kind == "@adtZipBytes" ?><?cs var:adt.zip.bytes ?><?cs 93 elif:tag.kind == "@adtZipChecksum" ?><?cs var:adt.zip.checksum ?><?cs 94 elif:tag.kind == "@inheritDoc" ?><?cs # This is the case when @inheritDoc is in something 95 that doesn't inherit from anything?><?cs 96 elif:tag.kind == "@attr" ?><?cs 97 else ?>{<?cs var:tag.name?> <?cs var:tag.text ?>}<?cs 98 /if ?><?cs 99 /each ?><?cs 100 /def ?> 101 102 <?cs # Show the short-form description of something. These come from shortDescr and deprecated ?><?cs 103 def:short_descr(obj) ?><?cs 104 if:subcount(obj.deprecated) ?><em><?cs 105 if:obj.deprecatedsince ?> 106 This <?cs var:obj.kind ?> was deprecated 107 in API level <?cs var:obj.deprecatedsince ?>.<?cs 108 else ?> 109 This <?cs var:obj.kind ?> is deprecated.<?cs 110 /if ?> 111 <?cs call:tag_list(obj.deprecated) ?></em><?cs 112 else ?><?cs call:tag_list(obj.shortDescr) ?><?cs 113 /if ?><?cs 114 /def ?> 115 116 <?cs # Show the red box with the deprecated warning ?><?cs 117 def:deprecated_warning(obj) ?><?cs 118 if:subcount(obj.deprecated) ?><p> 119 <p class="caution"><strong><?cs 120 if:obj.deprecatedsince ?> 121 This <?cs var:obj.kind ?> was deprecated 122 in API level <?cs var:obj.deprecatedsince ?>.<?cs 123 else ?> 124 This <?cs var:obj.kind ?> is deprecated.<?cs 125 /if ?></strong><br/> 126 <?cs call:tag_list(obj.deprecated) ?> 127 </p><?cs 128 /if ?><?cs 129 /def ?> 130 131 <?cs # print the See Also: section ?><?cs 132 def:see_also_tags(also) ?><?cs 133 if:subcount(also) ?> 134 <div class="jd-tagdata"> 135 <h5 class="jd-tagtitle">See Also</h5> 136 <ul class="nolist"><?cs 137 each:tag=also ?><li><?cs 138 if:tag.kind == "@see" ?><code><a href="<?cs var:toroot ?><?cs var:tag.href ?>"><?cs 139 var:tag.label ?></a></code><?cs 140 elif:tag.kind == "@seeHref" ?><a href="<?cs var:tag.href ?>"><?cs var:tag.label ?></a><?cs 141 elif:tag.kind == "@seeJustLabel" ?><?cs var:tag.label ?><?cs 142 else ?>[ERROR: Unknown @see kind]<?cs 143 /if ?></li><?cs 144 /each ?> 145 </ul> 146 </div><?cs 147 /if ?> 148 <?cs /def ?> 149 150 <?cs # print the API Level ?><?cs 151 def:since_tags(obj) ?><?cs 152 if:reference.apilevels && obj.since ?> 153 Added in <a href="<?cs var:toroot ?>guide/topics/manifest/uses-sdk-element.html#ApiLevels">API level <?cs var:obj.since ?></a><?cs 154 /if ?><?cs 155 /def ?> 156 <?cs def:federated_refs(obj) ?> 157 <?cs if:subcount(obj.federated) ?> 158 <div> 159 Also: 160 <?cs each:federated=obj.federated ?> 161 <a href="<?cs var:federated.url ?>"><?cs var:federated.name ?></a><?cs 162 if:!last(federated) ?>,<?cs /if ?> 163 <?cs /each ?> 164 </div> 165 <?cs /if ?> 166 <?cs /def ?> 167 <?cs # Print the long-form description for something. 168 Uses the following fields: deprecated descr seeAlso since ?><?cs 169 def:description(obj) ?><?cs 170 call:deprecated_warning(obj) ?> 171 <div class="jd-tagdata jd-tagdescr"><p><?cs call:tag_list(obj.descr) ?></p></div><?cs 172 if:subcount(obj.attrRefs) ?> 173 <div class="jd-tagdata"> 174 <h5 class="jd-tagtitle">Related XML Attributes</h5> 175 <ul class="nolist"><?cs 176 each:attr=obj.attrRefs ?> 177 <li><a href="<?cs var:toroot ?><?cs var:attr.href ?>"><?cs var:attr.name ?></a></li><?cs 178 /each ?> 179 </ul> 180 </div><?cs 181 /if ?><?cs 182 if:subcount(obj.paramTags) ?> 183 <div class="jd-tagdata"> 184 <h5 class="jd-tagtitle">Parameters</h5> 185 <table class="jd-tagtable"><?cs 186 each:tag=obj.paramTags ?> 187 <tr> 188 <th><?cs if:tag.isTypeParameter ?><<?cs /if ?><?cs var:tag.name 189 ?><?cs if:tag.isTypeParameter ?>><?cs /if ?></td> 190 <td><?cs call:tag_list(tag.comment) ?></td> 191 </tr><?cs 192 /each ?> 193 </table> 194 </div><?cs 195 /if ?><?cs 196 if:subcount(obj.returns) ?> 197 <div class="jd-tagdata"> 198 <h5 class="jd-tagtitle">Returns</h5> 199 <ul class="nolist"><li><?cs call:tag_list(obj.returns) ?></li></ul> 200 </div><?cs 201 /if ?><?cs 202 if:subcount(obj.throws) ?> 203 <div class="jd-tagdata"> 204 <h5 class="jd-tagtitle">Throws</h5> 205 <table class="jd-tagtable"><?cs 206 each:tag=obj.throws ?> 207 <tr> 208 <th><?cs call:type_link(tag.type) ?></td> 209 <td><?cs call:tag_list(tag.comment) ?></td> 210 </tr><?cs 211 /each ?> 212 </table> 213 </div><?cs 214 /if ?><?cs 215 call:see_also_tags(obj.seeAlso) ?><?cs 216 /def ?> 217 218 <?cs # A table of links to classes with descriptions, as in a package file or the nested classes ?><?cs 219 def:class_link_table(classes) ?><?cs 220 set:count = #1 ?> 221 <table class="jd-sumtable-expando"><?cs 222 each:cl=classes ?> 223 <tr class="<?cs if:count % #2 ?>alt-color<?cs /if ?> api apilevel-<?cs var:cl.type.since ?>" > 224 <td class="jd-linkcol"><?cs call:type_link(cl.type) ?></td> 225 <td class="jd-descrcol" width="100%"><?cs call:short_descr(cl) ?> </td> 226 </tr><?cs set:count = count + #1 ?><?cs 227 /each ?> 228 </table><?cs 229 /def ?> 230 231 <?cs # A list of links to classes, for use in the side navigation of classes when viewing a package (panel nav) ?><?cs 232 def:class_link_list(label, classes) ?><?cs 233 if:subcount(classes) ?> 234 <li><h2><?cs var:label ?></h2> 235 <ul><?cs 236 each:cl=classes ?> 237 <li class="api apilevel-<?cs var:cl.type.since ?>"><?cs call:type_link2(cl.type,"true") ?></li><?cs 238 /each ?> 239 </ul> 240 </li><?cs 241 /if ?><?cs 242 /def ?> 243 244 <?cs # A list of links to classes, for use in the side navigation of classes when viewing a class (panel nav) ?><?cs 245 def:list(label, classes) ?><?cs 246 if:subcount(classes) ?> 247 <li><h2><?cs var:label ?></h2> 248 <ul><?cs 249 each:cl=classes ?> 250 <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 251 /each ?> 252 </ul> 253 </li><?cs 254 /if ?><?cs 255 /def ?> 256 257 <?cs # A list of links to packages, for use in the side navigation of packages (panel nav) ?><?cs 258 def:package_link_list(packages) ?><?cs 259 each:pkg=packages ?> 260 <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 261 /each ?><?cs 262 /def ?> 263 264 <?cs # An expando trigger ?><?cs 265 def:expando_trigger(id, default) ?> 266 <a href="#" onclick="return toggleInherited(this, null)" id="<?cs var:id ?>" class="jd-expando-trigger closed" 267 ><img id="<?cs var:id ?>-trigger" 268 src="<?cs var:toroot ?>assets/images/triangle-<?cs var:default ?>.png" 269 class="jd-expando-trigger-img" /></a><?cs 270 /def ?> 271 272 <?cs # An expandable list of classes ?><?cs 273 def:expandable_class_list(id, classes, default) ?> 274 <div id="<?cs var:id ?>"> 275 <div id="<?cs var:id ?>-list" 276 class="jd-inheritedlinks" 277 <?cs if:default != "list" ?>style="display: none;"<?cs /if ?> 278 > 279 <?cs if:subcount(classes) <= #20 ?> 280 <?cs each:cl=classes ?> 281 <?cs call:type_link(cl.type) ?><?cs if:!last(cl) ?>,<?cs /if ?> 282 <?cs /each ?> 283 <?cs else ?> 284 <?cs set:leftovers = subcount(classes) - #15 ?> 285 <?cs loop:i = #0, #14, #1 ?> 286 <?cs with:cl=classes[i] ?> 287 <?cs call:type_link(cl.type) ?>, 288 <?cs /with ?> 289 <?cs if:(#i == #14) ?>and 290 <a href="#" onclick="return toggleInherited(document.getElementById('<?cs 291 var:id ?>', null))"><?cs var:leftovers ?> others.</a> 292 <?cs /if ?> 293 <?cs /loop ?> 294 <?cs /if ?> 295 </div> 296 <div id="<?cs var:id ?>-summary" 297 <?cs if:default != "summary" ?>style="display: none;"<?cs /if ?> 298 ><?cs 299 call:class_link_table(classes) ?> 300 </div> 301 </div><?cs 302 /def ?> 303 304 <?cs include:"components.cs" ?> 305 306