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