1 2 <style> 3 4 .package-label { 5 6 } 7 8 .class-label { 9 padding-left: 40px; 10 } 11 12 .method-label { 13 padding-left: 80px; 14 } 15 16 .package-entry { 17 background-color: #778899; 18 } 19 20 .class-entry { 21 background-color: #a9a9a9; 22 } 23 24 .method-entry { 25 background-color: #dcdcdc; 26 } 27 28 .collapsed { 29 30 } 31 32 .handle { 33 width: 25px; 34 background-repeat: no-repeat; 35 } 36 37 .handle-opened { 38 background-image: url("<?cs var:triangle.opened ?>"); 39 } 40 41 .handle-closed { 42 background-image: url("<?cs var:triangle.closed?>"); 43 } 44 45 .tbody { 46 padding: 0; 47 margin: 0; 48 } 49 50 #hierarchy { 51 border-collapse:collapse; 52 } 53 54 </style> 55 56 <script type="text/javascript" 57 src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script> 58 59 <script type="text/javascript"> 60 function collapsePackage(tr) { 61 var table = $("#hierarchy")[0]; 62 63 if (!$(tr).hasClass("collapsable")) { 64 return; 65 } 66 67 if ($(tr).hasClass("collapsed")) { 68 $(tr).removeClass("collapsed"); 69 $(tr).children(".handle").addClass("handle-opened"); 70 $(tr).children(".handle").removeClass("handle-closed"); 71 if (tr.rowIndex + 1 < table.rows.length) { 72 var tbody = table.rows[tr.rowIndex + 1].parentNode; 73 $(tbody).show(); 74 } 75 } else { 76 $(tr).addClass("collapsed"); 77 $(tr).children(".handle").removeClass("handle-opened"); 78 $(tr).children(".handle").addClass("handle-closed"); 79 if (tr.rowIndex + 1 < table.rows.length 80 && $(table.rows[tr.rowIndex + 1]).hasClass("class-entry")) { 81 var tbody = table.rows[tr.rowIndex + 1].parentNode; 82 $(tbody).hide(); 83 } 84 } 85 } 86 87 function collapseClass(tr) { 88 var table = $("#hierarchy")[0]; 89 90 if (!$(tr).hasClass("collapsable")) { 91 return; 92 } 93 94 if ($(tr).hasClass("collapsed")) { 95 $(tr).removeClass("collapsed"); 96 $(tr).children(".handle").addClass("handle-opened"); 97 $(tr).children(".handle").removeClass("handle-closed"); 98 var i = tr.rowIndex + 1; 99 while (i < table.rows.length && $(table.rows[i]).hasClass("method-entry")) { 100 $(table.rows[i++]).show(); 101 } 102 } else { 103 $(tr).addClass("collapsed"); 104 $(tr).children(".handle").removeClass("handle-opened"); 105 $(tr).children(".handle").addClass("handle-closed"); 106 var i = tr.rowIndex + 1; 107 while (i < table.rows.length && $(table.rows[i]).hasClass("method-entry")) { 108 $(table.rows[i++]).hide(); 109 } 110 } 111 } 112 113 $(function() { 114 $(".package-entry").click(function() { 115 collapsePackage(this); 116 }); 117 118 $(".class-entry").click(function() { 119 collapseClass(this); 120 }); 121 }); 122 </script> 123 124 <table border="0" id="hierarchy"> 125 <tr> 126 <th> </th> 127 <?cs each:site = sites ?> 128 <th><?cs var:site.name ?></th> 129 <?cs /each ?> 130 </tr> 131 <?cs each:package = packages ?> 132 <?cs if:subcount(package.classes) ?> 133 <tr class="package-entry collapsable"> 134 <td class="handle handle-opened"> </td> 135 <?cs else ?> 136 <tr class="package-entry"> 137 <td class="handle"> </td> 138 <?cs /if ?> 139 <td class="package-label"><?cs var:package.name ?></td> 140 <?cs each:site = package.sites ?> 141 <td> 142 <?cs if:site.hasPackage ?> 143 <a href="<?cs var:site.link ?>">Link</a> 144 <?cs else ?> 145 N/A 146 <?cs /if ?> 147 </td> 148 <?cs /each ?> 149 </tr> 150 <tbody class="package-contents"> 151 <?cs each:class = package.classes ?> 152 <?cs if:subcount(class.methods) ?> 153 <tr class="class-entry collapsable"> 154 <td class="handle handle-opened"> </td> 155 <?cs else ?> 156 <tr class="class-entry"> 157 <td class="handle"> </td> 158 <?cs /if ?> 159 <td class="class-label"><?cs var:class.qualifiedName ?></td> 160 <?cs each:site = class.sites ?> 161 <td> 162 <?cs if:site.hasClass ?> 163 <a href="<?cs var:site.link ?>">Link</a> 164 <?cs else ?> 165 N/A 166 <?cs /if ?> 167 </td> 168 <?cs /each ?> 169 </tr> 170 <?cs each:method = class.methods ?> 171 <tr class="method-entry"> 172 <td class="handle"> </td> 173 <td class="method-label"><?cs var:method.signature ?></td> 174 <?cs each:site = method.sites ?> 175 <td> 176 <?cs if:site.hasMethod ?> 177 <a href="<?cs var:site.link ?>">Link</a> 178 <?cs else ?> 179 N/A 180 <?cs /if ?> 181 </td> 182 <?cs /each ?> 183 </tr> 184 <?cs /each ?><?cs # methods ?> 185 <?cs /each ?><?cs # classes ?> 186 </tbody> 187 <?cs /each ?><?cs # packages ?> 188 </table>