comparison flys-client/src/main/java/de/intevation/flys/client/client/ui/ParameterMatrixPanel.java @ 3994:cc0b31dc2789

fix issue898 (crash when no param selected for parametermatrix).
author Felix Wolfsteller <felix.wolfsteller@intevation.de>
date Mon, 01 Oct 2012 09:39:26 +0200
parents 87e7571970e6
children 4d74a579c5c5
comparison
equal deleted inserted replaced
3993:7d056b7a50d8 3994:cc0b31dc2789
1 package de.intevation.flys.client.client.ui; 1 package de.intevation.flys.client.client.ui;
2 2
3 import java.util.ArrayList;
3 import java.util.List; 4 import java.util.List;
4 import java.util.Map; 5 import java.util.Map;
5 import java.util.Set; 6 import java.util.Set;
7
8 import com.google.gwt.core.client.GWT;
6 9
7 import com.google.gwt.user.client.ui.HTML; 10 import com.google.gwt.user.client.ui.HTML;
8 11
9 import com.smartgwt.client.widgets.Canvas; 12 import com.smartgwt.client.widgets.Canvas;
10 import com.smartgwt.client.widgets.Label; 13 import com.smartgwt.client.widgets.Label;
21 24
22 /** 25 /**
23 * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a> 26 * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a>
24 */ 27 */
25 public class ParameterMatrixPanel extends AbstractUIProvider { 28 public class ParameterMatrixPanel extends AbstractUIProvider {
29
30 /** The message class that provides i18n strings. */
31 protected FLYSConstants MESSAGES = GWT.create(FLYSConstants.class);
26 32
27 private ParameterMatrix matrix; 33 private ParameterMatrix matrix;
28 34
29 @Override 35 @Override
30 protected Data[] getData() { 36 protected Data[] getData() {
158 Label label = new Label(data.getDescription()); 164 Label label = new Label(data.getDescription());
159 label.setHeight(35); 165 label.setHeight(35);
160 166
161 return label; 167 return label;
162 } 168 }
169
170
171 /** Selection shall not be empty. */
172 @Override
173 public List<String> validate() {
174 GWT.log ("validation. validation. validation. ");
175 List<String> errors = new ArrayList<String>();
176 // Early stop on one (only) error.
177 for (Map.Entry<String, List<String>> entry : matrix.getSelection().entrySet()) {
178 if (entry.getValue() == null || entry.getValue().size() == 0) {
179 errors.add(MESSAGES.error_values_needed());
180 return errors;
181 }
182 }
183 return errors;
184 }
163 } 185 }
164 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : 186 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :

http://dive4elements.wald.intevation.org