##### Coverage Report - org.melati.util.JSStaticTree

Classes in this File | Line Coverage | Branch Coverage | Complexity
JSStaticTree |
59% | 43/72
N/A | N/A
| 1.0;1

1 |  |
     /*
2 |  |
      * $Source: /usr/cvsroot/melati/melati/src/site/resources/withWebmacro/org.melati.util.JSStaticTree.html,v $
3 |  |
      * $Revision: 1.1 $
4 |  |
      *
5 |  |
      * Copyright (C) 2001 Myles Chippendale
6 |  |
      *
7 |  |
      * Part of Melati (http://melati.org), a framework for the rapid
8 |  |
      * development of clean, maintainable web applications.
9 |  |
      *
10 |  |
      * Melati is free software; Permission is granted to copy, distribute
11 |  |
      * and/or modify this software under the terms either:
12 |  |
      *
13 |  |
      * a) the GNU General Public License as published by the Free Software
14 |  |
      *    Foundation; either version 2 of the License, or (at your option)
15 |  |
      *    any later version,
16 |  |
      *
17 |  |
      *    or
18 |  |
      *
19 |  |
      * b) any version of the Melati Software License, as published
20 |  |
      *    at http://melati.org
21 |  |
      *
22 |  |
      * You should have received a copy of the GNU General Public License and
23 |  |
      * the Melati Software License along with this program;
24 |  |
      * if not, write to the Free Software Foundation, Inc.,
25 |  |
      * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA to obtain the
26 |  |
      * GNU General Public License and visit http://melati.org to obtain the
27 |  |
      * Melati Software License.
28 |  |
      *
29 |  |
      * Feel free to contact the Developers of Melati (http://melati.org),
30 |  |
      * if you would like to work out a different arrangement than the options
31 |  |
      * outlined here.  It is our intention to allow Melati to be used by as
32 |  |
      * wide an audience as possible.
33 |  |
      *
34 |  |
      * This program is distributed in the hope that it will be useful,
35 |  |
      * but WITHOUT ANY WARRANTY; without even the implied warranty of
36 |  |
      * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
37 |  |
      * GNU General Public License for more details.
38 |  |
      *
39 |  |
      * Contact details for copyright holder:
40 |  |
      *
41 |  |
      *     Myles Chippendale <mylesc At paneris.org>
42 |  |
      */
43 |  |
     package org.melati.util;
44 |  |
45 |  |
     import org.melati.poem.Treeable;
46 |  |
47 |  |
     /**
48 |  |
      * A JavaScript tree which can be rendered as ordinary HTML.
49 |  |
      */
50 |  |
     public class JSStaticTree extends Tree {
51 |  |
52 | 16 |
       private String backgroundColour = "FFFFFF";
53 | 16 |
       private Integer depthPerDownload = new Integer(-1);
54 |  |
       private String verticalLinkImage;
55 |  |
       private String spacerImage;
56 |  |
       private String openedFolderImage;
57 |  |
       private String closedFolderImage;
58 |  |
       private String openedTImage;
59 |  |
       private String closedTImage;
60 |  |
       private String openedLImage;
61 |  |
       private String closedLImage;
62 |  |
       private String leafTImage;
63 |  |
       private String leafLImage;
64 |  |
       private String leafImage;
65 |  |
       private String imageBaseRef;
66 |  |
67 |  |
       /**
68 |  |
        * Constructor.
69 |  |
        *
70 |  |
        * @param tree
71 |  |
        *        the Tree to render
72 |  |
        * @param staticURL
73 |  |
        *        images base url
74 |  |
        */
75 |  |
       public JSStaticTree(Tree tree, String staticURL) {
76 | 14 |
         super(tree.getTreeableRoots(), tree.getDepth());
77 | 14 |
         verticalLinkImage = staticURL + "/vertline.gif";
78 | 14 |
         spacerImage = staticURL + "/spacer.gif";
79 | 14 |
         openedFolderImage = staticURL + "/openfolder.gif";
80 | 14 |
         closedFolderImage = staticURL + "/closedfolder.gif";
81 | 14 |
         openedTImage = staticURL + "/node_minus.gif";
82 | 14 |
         closedTImage = staticURL + "/node_plus.gif";
83 | 14 |
         openedLImage = staticURL + "/lastnode_minus.gif";
84 | 14 |
         closedLImage = staticURL + "/lastnode_plus.gif";
85 | 14 |
         leafTImage = staticURL + "/node.gif";
86 | 14 |
         leafLImage = staticURL + "/last_node.gif";
87 | 14 |
         leafImage = staticURL + "/file.gif";
88 | 14 |
         imageBaseRef = staticURL;
89 | 14 |
       }
90 |  |
91 |  |
       /**
92 |  |
        * Constructor for an array.
93 |  |
        *
94 |  |
        * @param nodes
95 |  |
        * @param staticURL
96 |  |
        */
97 |  |
       public JSStaticTree(Treeable[] nodes, String staticURL) {
98 | 2 |
         super(nodes);
99 | 2 |
         verticalLinkImage = staticURL + "/vertline.gif";
100 | 2 |
         spacerImage = staticURL + "/spacer.gif";
101 | 2 |
         openedFolderImage = staticURL + "/openfolder.gif";
102 | 2 |
         closedFolderImage = staticURL + "/closedfolder.gif";
103 | 2 |
         openedTImage = staticURL + "/node_minus.gif";
104 | 2 |
         closedTImage = staticURL + "/node_plus.gif";
105 | 2 |
         openedLImage = staticURL + "/lastnode_minus.gif";
106 | 2 |
         closedLImage = staticURL + "/lastnode_plus.gif";
107 | 2 |
         leafTImage = staticURL + "/node.gif";
108 | 2 |
         leafLImage = staticURL + "/last_node.gif";
109 | 2 |
         leafImage = staticURL + "/file.gif";
110 | 2 |
         imageBaseRef = staticURL;
111 | 2 |
       }
112 |  |
113 |  |
       /**
114 |  |
        * @return the background colour hex string (without a hash)
115 |  |
        */
116 |  |
       public String getBackgroundColour() {
117 | 10 |
         return backgroundColour;
118 |  |
       }
119 |  |
120 |  |
       /**
121 |  |
        * Set the background colour.
122 |  |
        *
123 |  |
        * @param bg the background colour hex string (without a hash)
124 |  |
        */
125 |  |
       public void setBackgroundColour(String bg) {
126 | 0 |
         backgroundColour = bg;
127 | 0 |
       }
128 |  |
129 |  |
       /**
130 |  |
        * @return the vertical link image
131 |  |
        */
132 |  |
       public String getVerticalLinkImage() {
133 | 20 |
         return verticalLinkImage;
134 |  |
       }
135 |  |
136 |  |
       /**
137 |  |
        * Set the vertical link image.
138 |  |
        * @param vli the vertical link image
139 |  |
        */
140 |  |
       public void setVerticalLinkImage(String vli) {
141 | 0 |
         verticalLinkImage = vli;
142 | 0 |
       }
143 |  |
144 |  |
       /**
145 |  |
        * @return the spacer image name
146 |  |
        */
147 |  |
       public String getSpacerImage() {
148 | 20 |
         return spacerImage;
149 |  |
       }
150 |  |
151 |  |
       /**
152 |  |
        * Set the spacer image name.
153 |  |
        * @param si the spacer image name to set
154 |  |
        */
155 |  |
       public void setSpacerImage(String si) {
156 | 0 |
         spacerImage = si;
157 | 0 |
       }
158 |  |
159 |  |
       /**
160 |  |
        * @return the opened folder image name
161 |  |
        */
162 |  |
       public String getOpenedFolderImage() {
163 | 20 |
         return openedFolderImage;
164 |  |
       }
165 |  |
166 |  |
       /**
167 |  |
        * Set the opened folder image name.
168 |  |
        * @param ofi the opened folder image name to set
169 |  |
        */
170 |  |
       public void setOpenedFolderImage(String ofi) {
171 | 0 |
         openedFolderImage = ofi;
172 | 0 |
       }
173 |  |
174 |  |
       /**
175 |  |
        * @return the closed folder image name
176 |  |
        */
177 |  |
       public String getClosedFolderImage() {
178 | 20 |
         return closedFolderImage;
179 |  |
       }
180 |  |
181 |  |
       /**
182 |  |
        * Set the closed folder image name.
183 |  |
        * @param cfi the closed folder image name to set
184 |  |
        */
185 |  |
       public void setClosedFolderImage(String cfi) {
186 | 0 |
         closedFolderImage = cfi;
187 | 0 |
       }
188 |  |
189 |  |
       /**
190 |  |
        * @return the opened Tee image
191 |  |
        */
192 |  |
       public String getOpenedTImage() {
193 | 20 |
         return openedTImage;
194 |  |
       }
195 |  |
196 |  |
       /**
197 |  |
        * Set the opened Tee image.
198 |  |
        * @param oti the opened Tee image to set
199 |  |
        */
200 |  |
       public void setOpenedTImage(String oti) {
201 | 0 |
         openedTImage = oti;
202 | 0 |
       }
203 |  |
204 |  |
       /**
205 |  |
        * @return the opened L image
206 |  |
        */
207 |  |
       public String getOpenedLImage() {
208 | 20 |
         return openedLImage;
209 |  |
       }
210 |  |
211 |  |
       /**
212 |  |
        * Set the opened L image.
213 |  |
        * @param oli the opened L image to set
214 |  |
        */
215 |  |
       public void setOpenedLImage(String oli) {
216 | 0 |
         openedLImage = oli;
217 | 0 |
       }
218 |  |
219 |  |
       /**
220 |  |
        * @return the closed Tee image
221 |  |
        */
222 |  |
       public String getClosedTImage() {
223 | 20 |
         return closedTImage;
224 |  |
       }
225 |  |
226 |  |
       /**
227 |  |
        * Set the closed Tee image.
228 |  |
        * @param cti the closed Tee image
229 |  |
        */
230 |  |
       public void setClosedTImage(String cti) {
231 | 0 |
         closedTImage = cti;
232 | 0 |
       }
233 |  |
234 |  |
       /**
235 |  |
        * @return the closed L image
236 |  |
        */
237 |  |
       public String getClosedLImage() {
238 | 20 |
         return closedLImage;
239 |  |
       }
240 |  |
241 |  |
       /**
242 |  |
        * Set the closed L image.
243 |  |
        * @param cli the closed L image
244 |  |
        */
245 |  |
       public void setClosedLImage(String cli) {
246 | 0 |
         closedLImage = cli;
247 | 0 |
       }
248 |  |
249 |  |
       /**
250 |  |
        * @return the Leaf Tee image
251 |  |
        */
252 |  |
       public String getLeafTImage() {
253 | 20 |
         return leafTImage;
254 |  |
       }
255 |  |
256 |  |
       /**
257 |  |
        * Set the Leaf Tee image.
258 |  |
        * @param lti the Leaf Tee image to set
259 |  |
        */
260 |  |
       public void setLeafTImage(String lti) {
261 | 0 |
         leafTImage = lti;
262 | 0 |
       }
263 |  |
264 |  |
       /**
265 |  |
        * @return the leaf L image
266 |  |
        */
267 |  |
       public String getLeafLImage() {
268 | 20 |
         return leafLImage;
269 |  |
       }
270 |  |
271 |  |
       /**
272 |  |
        * Set the leaf L image.
273 |  |
        * @param lli the leaf L image to set
274 |  |
        */
275 |  |
       public void setLeafLImage(String lli) {
276 | 0 |
         leafLImage = lli;
277 | 0 |
       }
278 |  |
279 |  |
       /**
280 |  |
        * @return the leaf image
281 |  |
        */
282 |  |
       public String getLeafImage() {
283 | 20 |
         return leafImage;
284 |  |
       }
285 |  |
286 |  |
       /**
287 |  |
        * Set the leaf image.
288 |  |
        * @param li the leaf image to set
289 |  |
        */
290 |  |
       public void setLeafImage(String li) {
291 | 0 |
         leafImage = li;
292 | 0 |
       }
293 |  |
294 |  |
       /**
295 |  |
        * @return the image base href
296 |  |
        */
297 |  |
       public String getImageBaseRef() {
298 | 0 |
         return imageBaseRef;
299 |  |
       }
300 |  |
301 |  |
       /**
302 |  |
        * Set the image base href.
303 |  |
        * @param ibr the image base href to set
304 |  |
        */
305 |  |
       public void setImageBaseRef(String ibr) {
306 | 0 |
         imageBaseRef = ibr;
307 | 0 |
       }
308 |  |
309 |  |
       /**
310 |  |
        * @return the depth per download
311 |  |
        */
312 |  |
       public Integer getDepthPerDownload() {
313 | 10 |
         return depthPerDownload;
314 |  |
       }
315 |  |
316 |  |
       /**
317 |  |
        * Set the depth per download.
318 |  |
        * @param dpd the depth per download to set
319 |  |
        */
320 |  |
       public void setDepthPerDownload(Integer dpd) {
321 | 0 |
         depthPerDownload = dpd;
322 | 0 |
       }
323 |  |
324 |  |
     }