Mercurial > dive4elements > river
comparison flys-client/src/main/java/de/intevation/flys/client/client/ui/LocationDistancePanel.java @ 55:4439f642f632
Read min/max values for the distance mode in the LocationDistancePanel.
flys-client/trunk@1511 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Ingo Weinzierl <ingo.weinzierl@intevation.de> |
---|---|
date | Fri, 18 Mar 2011 08:45:25 +0000 |
parents | 3d5d7788d471 |
children | 246af33f621c |
comparison
equal
deleted
inserted
replaced
54:0db278371632 | 55:4439f642f632 |
---|---|
62 protected DynamicForm mode; | 62 protected DynamicForm mode; |
63 | 63 |
64 /** A container that will contain the location or the distance panel.*/ | 64 /** A container that will contain the location or the distance panel.*/ |
65 protected HLayout container; | 65 protected HLayout container; |
66 | 66 |
67 /** The min value for a distance.*/ | |
68 protected double min; | |
69 | |
70 /** The max value for a distance.*/ | |
71 protected double max; | |
72 | |
67 /** The 'from' value entered in the distance mode.*/ | 73 /** The 'from' value entered in the distance mode.*/ |
68 protected double from; | 74 protected double from; |
69 | 75 |
70 /** The 'to' value entered in the distance mode.*/ | 76 /** The 'to' value entered in the distance mode.*/ |
71 protected double to; | 77 protected double to; |
93 * | 99 * |
94 * @return a panel. | 100 * @return a panel. |
95 */ | 101 */ |
96 public Canvas create(DataList data) { | 102 public Canvas create(DataList data) { |
97 VLayout layout = new VLayout(); | 103 VLayout layout = new VLayout(); |
104 | |
105 initDefaults(data); | |
98 | 106 |
99 Label label = new Label(MESSAGES.location_distance_state()); | 107 Label label = new Label(MESSAGES.location_distance_state()); |
100 Canvas widget = createWidget(data); | 108 Canvas widget = createWidget(data); |
101 IButton submit = new IButton(MESSAGES.next(), this); | 109 IButton submit = new IButton(MESSAGES.next(), this); |
102 | 110 |
140 return layout; | 148 return layout; |
141 } | 149 } |
142 | 150 |
143 | 151 |
144 /** | 152 /** |
153 * This method reads the default values defined in the DataItems of the Data | |
154 * objects in <i>list</i>. | |
155 * | |
156 * @param list The DataList container that stores the Data objects. | |
157 */ | |
158 protected void initDefaults(DataList list) { | |
159 Data f = getData(list.getAll(), "ld_from"); | |
160 Data t = getData(list.getAll(), "ld_to"); | |
161 Data s = getData(list.getAll(), "ld_step"); | |
162 | |
163 DataItem[] fItems = f.getItems(); | |
164 DataItem[] tItems = t.getItems(); | |
165 DataItem[] sItems = s.getItems(); | |
166 | |
167 min = Double.valueOf(fItems[0].getStringValue()); | |
168 max = Double.valueOf(tItems[0].getStringValue()); | |
169 step = Double.valueOf(sItems[0].getStringValue()); | |
170 | |
171 this.from = min; | |
172 this.to = max; | |
173 this.step = step; | |
174 } | |
175 | |
176 | |
177 /** | |
145 * This method greps the Data with name <i>name</i> from the list and | 178 * This method greps the Data with name <i>name</i> from the list and |
146 * returns it. | 179 * returns it. |
147 * | 180 * |
148 * @param items A list of Data. | 181 * @param items A list of Data. |
149 * @param name The name of the Data that we are searching for. | 182 * @param name The name of the Data that we are searching for. |