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