• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 <?cs # Create a comma separated list of annotations on obj that were in showAnnotations in Doclava ?>
2 <?cs # pre is an HTML string to start the list, post is an HTML string to close the list ?>
3 <?cs # for example call:show_annotations_list(cl, "<td>Annotations: ", "</td>") ?>
4 <?cs # if obj has nothing on obj.showAnnotations, nothing will be output ?>
5 <?cs def:show_annotations_list(obj) ?>
6     <?cs each:anno = obj.showAnnotations ?>
7       <?cs if:first(anno) ?>
8         <span class='annotation-message'>
9           Included in documentation by the annotations:
10       <?cs /if ?>
11       @<?cs var:anno.type.label ?>
12       <?cs if:last(anno) == 0 ?>
13         , &nbsp;
14       <?cs /if ?>
15       <?cs if:last(anno)?>
16         </span>
17       <?cs /if ?>
18     <?cs /each ?>
19 <?cs /def ?>
20 
21 <?cs # Override default class_link_table to display annotations ?>
22 <?cs def:class_link_table(classes) ?>
23   <?cs set:count = #1 ?>
24   <table class="jd-sumtable-expando">
25     <?cs each:cl=classes ?>
26       <tr class="<?cs if:count % #2 ?>alt-color<?cs /if ?> api apilevel-<?cs var:cl.type.since ?>" >
27         <td class="jd-linkcol"><?cs call:type_link(cl.type) ?></td>
28         <td class="jd-descrcol" width="100%">
29           <?cs call:short_descr(cl) ?>&nbsp;
30           <?cs call:show_annotations_list(cl) ?>
31         </td>
32       </tr>
33       <?cs set:count = count + #1 ?>
34     <?cs /each ?>
35   </table>
36 <?cs /def ?>
37 
38 <?cs
39 # Prints a comma separated list of parameters with optional line breaks
40 ?><?cs
41 def:parameter_list(params, linebreaks) ?><?cs
42   each:param = params ?><?cs
43       call:simple_type_link(param.type)?> <?cs
44       var:param.name ?><?cs
45       if: name(param)!=subcount(params)-1
46         ?>, <?cs if:linebreaks
47 ?>
48                 <?cs /if ?><?cs
49       /if ?><?cs
50   /each ?><?cs
51 /def ?><?cs
52 
53 # Print output for aux tags that are not "standard" javadoc tags ?><?cs
54 def:aux_tag_list(tags) ?><?cs
55   each:tag = tags ?><p><?cs
56       if:tag.kind == "@memberDoc" ?><?cs call:tag_list(tag.commentTags) ?><?cs
57       elif:tag.kind == "@paramDoc" ?><?cs call:tag_list(tag.commentTags) ?><?cs
58       elif:tag.kind == "@returnDoc" ?><?cs call:tag_list(tag.commentTags) ?><?cs
59       elif:tag.kind == "@range" ?><?cs call:dump_range(tag) ?><?cs
60       elif:tag.kind == "@intDef" ?><?cs call:dump_int_def(tag) ?><?cs
61       elif:tag.kind == "@permission" ?><?cs call:dump_permission(tag) ?><?cs
62       elif:tag.kind == "@service" ?><?cs call:dump_service(tag) ?><?cs
63       /if ?><?cs
64   /each ?></p><?cs
65 /def ?><?cs
66 
67 # Print output for @range tags ?><?cs
68 def:dump_range(tag) ?><?cs
69   if:tag.from && tag.to ?>Value is between <?cs var:tag.from ?> and <?cs var:tag.to ?> inclusive.<?cs
70   elif:tag.from ?>Value is <?cs var:tag.from ?> or greater.<?cs
71   elif:tag.to ?>Value is <?cs var:tag.to ?> or less.<?cs
72   /if ?><?cs
73 /def ?><?cs
74 
75 # Print output for @intDef tags ?><?cs
76 def:dump_int_def(tag) ?><?cs
77   if:tag.flag ?><?cs
78     if:subcount(tag.values) > 1 ?>Value is either <code>0</code> or combination of <?cs
79     else ?>Value is either <code>0</code> or <?cs
80     /if ?><?cs
81   else ?>Value is <?cs
82   /if ?><?cs
83   loop:i = #0, subcount(tag.values), #1 ?><?cs
84     with:val = tag.values[i] ?><?cs
85       call:tag_list(val.commentTags) ?><?cs
86       if i == subcount(tag.values) - 2 ?> or <?cs
87       elif:i < subcount(tag.values) - 2 ?>, <?cs
88       /if ?><?cs
89     /with ?><?cs
90   /loop ?>.<?cs
91 /def ?><?cs
92 
93 # Print output for @permission tags ?><?cs
94 def:dump_permission(tag) ?>Requires the <?cs
95   loop:i = #0, subcount(tag.values), #1 ?><?cs
96     with:val = tag.values[i] ?><?cs
97       call:tag_list(val.commentTags) ?><?cs
98       if i == subcount(tag.values) - 2 ?><?cs
99         if tag.any ?> or <?cs
100         else ?> and <?cs
101         /if ?><?cs
102       elif:i < subcount(tag.values) - 2 ?>, <?cs
103       /if ?><?cs
104     /with ?><?cs
105   /loop ?><?cs
106   if subcount(tag.values) > 1 ?> permissions.<?cs
107   else ?> permission.<?cs
108   /if ?><?cs
109 /def ?><?cs
110 
111 # Print output for @service tags ?><?cs
112 def:dump_service(tag) ?>Instances of this class must be obtained using <?cs
113   loop:i = #0, subcount(tag.values) - 1, #2 ?><?cs
114     call:tag_list(tag.values[i].commentTags) ?> with the argument <?cs
115     call:tag_list(tag.values[i+1].commentTags) ?><?cs
116     if i < subcount(tag.values) - 2 ?> or <?cs
117     /if ?><?cs
118   /loop ?>.<?cs
119 /def ?>
120