Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||
JSDynamicTree |
|
| 1.0;1 |
1 | /* | |
2 | * $Source$ | |
3 | * $Revision$ | |
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 | /** | |
46 | * A JavaScript tree which can be rendered as Dynamic HTML. | |
47 | */ | |
48 | public class JSDynamicTree extends Tree { | |
49 | ||
50 | 0 | private Integer x = new Integer(10); |
51 | 0 | private Integer y = new Integer(10); |
52 | 0 | private Integer nodeHeight = new Integer(19); |
53 | 0 | private Integer nodeWidth = new Integer(400); |
54 | 0 | private String nodeColour = "#ffffff"; |
55 | 0 | private Integer indent = new Integer(20); |
56 | 0 | private String nodeLabelTemplet = ""; |
57 | 0 | private String openedImage = ""; |
58 | 0 | private String closedImage = ""; |
59 | 0 | private String leafImage = ""; |
60 | 0 | private Integer depthPerDownload = new Integer(-1); |
61 | ||
62 | /** | |
63 | * Constructor. | |
64 | * | |
65 | * @param tree | |
66 | * the Tree to render | |
67 | */ | |
68 | public JSDynamicTree(Tree tree) { | |
69 | 0 | super(tree.getTreeableRoots(), tree.getDepth()); |
70 | 0 | } |
71 | ||
72 | /** | |
73 | * @return the starting X co-ordinate | |
74 | */ | |
75 | public Integer getX() { | |
76 | 0 | return x; |
77 | } | |
78 | ||
79 | /** | |
80 | * Set the starting X co-ordinate. | |
81 | * @param x the starting X co-ordinate to set | |
82 | */ | |
83 | public void setX(Integer x) { | |
84 | 0 | this.x = x; |
85 | 0 | } |
86 | ||
87 | /** | |
88 | * @return the starting Y co-ordinate | |
89 | */ | |
90 | public Integer getY() { | |
91 | 0 | return y; |
92 | } | |
93 | ||
94 | /** | |
95 | * Set the starting Y co-ordinate. | |
96 | * @param y the starting Y co-ordinate to set | |
97 | */ | |
98 | public void setY(Integer y) { | |
99 | 0 | this.y = y; |
100 | 0 | } |
101 | ||
102 | /** | |
103 | * @return the node height | |
104 | */ | |
105 | public Integer getNodeHeight() { | |
106 | 0 | return nodeHeight; |
107 | } | |
108 | ||
109 | /** | |
110 | * Set the node height. | |
111 | * @param nh the node height to set | |
112 | */ | |
113 | public void setNodeHeight(Integer nh) { | |
114 | 0 | nodeHeight = nh; |
115 | 0 | } |
116 | ||
117 | /** | |
118 | * @return the node width | |
119 | */ | |
120 | public Integer getNodeWidth() { | |
121 | 0 | return nodeWidth; |
122 | } | |
123 | ||
124 | /** | |
125 | * Set the node width. | |
126 | * @param nw the node width to set | |
127 | */ | |
128 | public void setNodeWidth(Integer nw) { | |
129 | 0 | nodeWidth = nw; |
130 | 0 | } |
131 | ||
132 | /** | |
133 | * @return the node colour | |
134 | */ | |
135 | public String getNodeColour() { | |
136 | 0 | return nodeColour; |
137 | } | |
138 | ||
139 | /** | |
140 | * Set the node colour. | |
141 | * @param nc the node colour to set | |
142 | */ | |
143 | public void setNodeColour(String nc) { | |
144 | 0 | nodeColour = nc; |
145 | 0 | } |
146 | ||
147 | /** | |
148 | * @return the indent | |
149 | */ | |
150 | public Integer getIndent() { | |
151 | 0 | return indent; |
152 | } | |
153 | ||
154 | /** | |
155 | * Set the indent. | |
156 | * @param i the indent to set | |
157 | */ | |
158 | public void setIndent(Integer i) { | |
159 | 0 | indent = i; |
160 | 0 | } |
161 | ||
162 | /** | |
163 | * @return the node label templet | |
164 | */ | |
165 | public String getNodeLabelTemplet() { | |
166 | 0 | return nodeLabelTemplet; |
167 | } | |
168 | ||
169 | /** | |
170 | * Set the node label templet. | |
171 | * @param nlt the node label templet to set | |
172 | */ | |
173 | public void setNodeLabelTemplet(String nlt) { | |
174 | 0 | nodeLabelTemplet = nlt; |
175 | 0 | } |
176 | ||
177 | /** | |
178 | * @return the opened image | |
179 | */ | |
180 | public String getOpenedImage() { | |
181 | 0 | return openedImage; |
182 | } | |
183 | ||
184 | /** | |
185 | * Set the opened image. | |
186 | * @param oi the opened image to set | |
187 | */ | |
188 | public void setOpenedImage(String oi) { | |
189 | 0 | openedImage = oi; |
190 | 0 | } |
191 | ||
192 | /** | |
193 | * @return the closed image | |
194 | */ | |
195 | public String getClosedImage() { | |
196 | 0 | return closedImage; |
197 | } | |
198 | ||
199 | /** | |
200 | * Set the closed image. | |
201 | * @param ci the closed image to set | |
202 | */ | |
203 | public void setClosedImage(String ci) { | |
204 | 0 | closedImage = ci; |
205 | 0 | } |
206 | ||
207 | /** | |
208 | * @return the leaf image | |
209 | */ | |
210 | public String getLeafImage() { | |
211 | 0 | return leafImage; |
212 | } | |
213 | ||
214 | /** | |
215 | * Set the leaf image. | |
216 | * | |
217 | * @param li | |
218 | * the leaf image to set | |
219 | */ | |
220 | public void setLeafImage(String li) { | |
221 | 0 | leafImage = li; |
222 | 0 | } |
223 | ||
224 | /** | |
225 | * @return the depth per download | |
226 | */ | |
227 | public Integer getDepthPerDownload() { | |
228 | 0 | return depthPerDownload; |
229 | } | |
230 | ||
231 | /** | |
232 | * Set the depth per download. | |
233 | * | |
234 | * @param dpd | |
235 | * the depth per download to set | |
236 | */ | |
237 | public void setDepthPerDownload(Integer dpd) { | |
238 | 0 | depthPerDownload = dpd; |
239 | 0 | } |
240 | ||
241 | } |