Mercurial > dive4elements > river
comparison flys-client/src/main/java/de/intevation/flys/client/client/ui/WQInputPanel.java @ 56:c9c19761a449
Read min/max values for the distance modes in WQInputPanel.
flys-client/trunk@1513 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Ingo Weinzierl <ingo.weinzierl@intevation.de> |
---|---|
date | Fri, 18 Mar 2011 09:36:28 +0000 |
parents | 3d5d7788d471 |
children | 246af33f621c |
comparison
equal
deleted
inserted
replaced
55:4439f642f632 | 56:c9c19761a449 |
---|---|
65 protected VLayout container; | 65 protected VLayout container; |
66 | 66 |
67 /** The RadioGroupItem that determines the w/q input mode.*/ | 67 /** The RadioGroupItem that determines the w/q input mode.*/ |
68 protected DynamicForm modes; | 68 protected DynamicForm modes; |
69 | 69 |
70 /** The min values for the 'from' property in the W-Range input mode.*/ | |
71 protected double minW; | |
72 | |
73 /** The min values for the 'from' property in the Q-Range input mode.*/ | |
74 protected double minQ; | |
75 | |
76 /** The max values for the 'from' property in the W-Range input mode.*/ | |
77 protected double maxW; | |
78 | |
79 /** The max values for the 'from' property in the Q-Range input mode.*/ | |
80 protected double maxQ; | |
81 | |
70 /** The 'from' value entered in the range W mode.*/ | 82 /** The 'from' value entered in the range W mode.*/ |
71 protected double fromW; | 83 protected double fromW; |
72 | 84 |
73 /** The 'to' value entered in the range W mode.*/ | 85 /** The 'to' value entered in the range W mode.*/ |
74 protected double toW; | 86 protected double toW; |
105 * @param data The data that is displayed. | 117 * @param data The data that is displayed. |
106 * | 118 * |
107 * @return the widget. | 119 * @return the widget. |
108 */ | 120 */ |
109 public Canvas create(DataList data) { | 121 public Canvas create(DataList data) { |
122 initDefaults(data); | |
123 | |
110 Canvas widget = createWidget(data); | 124 Canvas widget = createWidget(data); |
111 IButton submit = new IButton(MSG.next(), this); | 125 IButton submit = new IButton(MSG.next(), this); |
112 Label label = new Label(MSG.wqTitle()); | 126 Label label = new Label(MSG.wqTitle()); |
113 | 127 |
114 label.setHeight(25); | 128 label.setHeight(25); |
146 | 160 |
147 layout.addMember(label); | 161 layout.addMember(label); |
148 layout.addMember(new Label(text)); | 162 layout.addMember(new Label(text)); |
149 | 163 |
150 return layout; | 164 return layout; |
165 } | |
166 | |
167 | |
168 /** | |
169 * This method reads the default values defined in the DataItems of the Data | |
170 * objects in <i>list</i>. | |
171 * | |
172 * @param list The DataList container that stores the Data objects. | |
173 */ | |
174 protected void initDefaults(DataList list) { | |
175 Data f = getData(list.getAll(), "wq_from"); | |
176 Data t = getData(list.getAll(), "wq_to"); | |
177 Data s = getData(list.getAll(), "wq_step"); | |
178 | |
179 DataItem fQItem = getDataItem(f.getItems(), "minQ"); | |
180 DataItem fWItem = getDataItem(f.getItems(), "minW"); | |
181 DataItem tQItem = getDataItem(t.getItems(), "maxQ"); | |
182 DataItem tWItem = getDataItem(t.getItems(), "maxW"); | |
183 DataItem sQItem = getDataItem(s.getItems(), "stepQ"); | |
184 DataItem sWItem = getDataItem(s.getItems(), "stepW"); | |
185 | |
186 minW = Double.valueOf(fWItem.getStringValue()); | |
187 maxW = Double.valueOf(tWItem.getStringValue()); | |
188 stepW = Double.valueOf(sWItem.getStringValue()); | |
189 | |
190 minQ = Double.valueOf(fQItem.getStringValue()); | |
191 maxQ = Double.valueOf(tQItem.getStringValue()); | |
192 stepQ = Double.valueOf(sQItem.getStringValue()); | |
193 | |
194 this.fromW = minW; | |
195 this.toW = maxW; | |
196 this.stepW = stepW; | |
197 | |
198 this.fromQ = minQ; | |
199 this.toQ = maxQ; | |
200 this.stepQ = stepQ; | |
151 } | 201 } |
152 | 202 |
153 | 203 |
154 protected String createWString(DataItem from, DataItem to, DataItem step) { | 204 protected String createWString(DataItem from, DataItem to, DataItem step) { |
155 StringBuilder sb = new StringBuilder(); | 205 StringBuilder sb = new StringBuilder(); |
194 } | 244 } |
195 | 245 |
196 return null; | 246 return null; |
197 } | 247 } |
198 | 248 |
249 /** | |
250 * This method greps the DataItem with name <i>name</i> from the list and | |
251 * returns it. | |
252 * | |
253 * @param items A list of DataItems. | |
254 * @param name The name of the DataItem that we are searching for. | |
255 * | |
256 * @return the DataItem with the name <i>name</i>. | |
257 */ | |
258 protected DataItem getDataItem(DataItem[] items, String name) { | |
259 for (DataItem item: items) { | |
260 if (name.equals(item.getLabel())) { | |
261 return item; | |
262 } | |
263 } | |
264 | |
265 return null; | |
266 } | |
267 | |
199 | 268 |
200 /** | 269 /** |
201 * This method creates the whole widget. There is a panel on the left, that | 270 * This method creates the whole widget. There is a panel on the left, that |
202 * allows the user to enter values manually by keyboard. On the right, there | 271 * allows the user to enter values manually by keyboard. On the right, there |
203 * is a table that allows the user to enter values by mouse click. | 272 * is a table that allows the user to enter values by mouse click. |