Mercurial > dive4elements > river
comparison flys-client/src/main/java/de/intevation/flys/client/client/ui/AbstractUIProvider.java @ 562:9f16ac843dda
Introduced a client side validation before new user data are sent to the server - the range/location panel already implements this validation.
flys-client/trunk@2097 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Ingo Weinzierl <ingo.weinzierl@intevation.de> |
---|---|
date | Thu, 09 Jun 2011 14:06:10 +0000 |
parents | 4a684d29404f |
children | dfbc6693247e |
comparison
equal
deleted
inserted
replaced
561:460b8e0f0563 | 562:9f16ac843dda |
---|---|
3 import java.util.ArrayList; | 3 import java.util.ArrayList; |
4 import java.util.List; | 4 import java.util.List; |
5 | 5 |
6 import com.google.gwt.core.client.GWT; | 6 import com.google.gwt.core.client.GWT; |
7 | 7 |
8 import com.smartgwt.client.util.SC; | |
8 import com.smartgwt.client.widgets.Canvas; | 9 import com.smartgwt.client.widgets.Canvas; |
9 import com.smartgwt.client.widgets.Img; | 10 import com.smartgwt.client.widgets.Img; |
10 import com.smartgwt.client.widgets.events.ClickEvent; | 11 import com.smartgwt.client.widgets.events.ClickEvent; |
11 import com.smartgwt.client.widgets.events.ClickHandler; | 12 import com.smartgwt.client.widgets.events.ClickHandler; |
12 import com.smartgwt.client.widgets.Button; | 13 import com.smartgwt.client.widgets.Button; |
114 * fireStepForwardEvent() method is called here. | 115 * fireStepForwardEvent() method is called here. |
115 * | 116 * |
116 * @param e The click event. | 117 * @param e The click event. |
117 */ | 118 */ |
118 public void onClick(ClickEvent e) { | 119 public void onClick(ClickEvent e) { |
119 Data[] data = getData(); | 120 List<String> errors = validate(); |
120 | 121 if (errors == null || errors.isEmpty()) { |
121 fireStepForwardEvent(new StepForwardEvent(data)); | 122 Data[] data = getData(); |
123 fireStepForwardEvent(new StepForwardEvent(data)); | |
124 } | |
125 else { | |
126 StringBuilder sb = new StringBuilder(); | |
127 | |
128 for (String error: errors) { | |
129 sb.append(error); | |
130 sb.append("<br>"); | |
131 } | |
132 | |
133 SC.warn(sb.toString()); | |
134 } | |
122 } | 135 } |
123 | 136 |
124 | 137 |
125 /** | 138 /** |
126 * Creates the 'next' button to step forward to the next state. | 139 * Creates the 'next' button to step forward to the next state. |
214 | 227 |
215 return null; | 228 return null; |
216 } | 229 } |
217 | 230 |
218 | 231 |
232 public List<String> validate() { | |
233 return new ArrayList<String>(); | |
234 } | |
235 | |
236 | |
219 /** | 237 /** |
220 * This method needs to be implemented by concrete subclasses. It should | 238 * This method needs to be implemented by concrete subclasses. It should |
221 * create a new Canvas object with a representation of <i>data</i>. | 239 * create a new Canvas object with a representation of <i>data</i>. |
222 * | 240 * |
223 * @param data The data that should be displayed. | 241 * @param data The data that should be displayed. |