comparison flys-client/src/main/java/de/intevation/flys/client/client/ui/DoubleArrayPanel.java @ 573:756bd8f0b97c

The DoubleArrayPanel is more tolerant towards entered whitespaces. flys-client/trunk@2123 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Ingo Weinzierl <ingo.weinzierl@intevation.de>
date Wed, 15 Jun 2011 09:03:27 +0000
parents 6ebe845a9d37
children 42512fce9b1b
comparison
equal deleted inserted replaced
572:830e4720caad 573:756bd8f0b97c
141 141
142 if (value == null) { 142 if (value == null) {
143 return valid; 143 return valid;
144 } 144 }
145 145
146 String[] parts = value.split(" "); 146 String[] parts = value.split("\\s+");
147 147
148 if (parts == null) { 148 if (parts == null) {
149 return valid; 149 return valid;
150 } 150 }
151 151
152 NumberFormat f = NumberFormat.getDecimalFormat(); 152 NumberFormat f = NumberFormat.getDecimalFormat();
153 Map errors = getErrors(); 153 Map errors = getErrors();
154 154
155 try { 155 try {
156 for (String part: parts) { 156 for (String part: parts) {
157
158 if (part.length() == 0) {
159 continue;
160 }
161
157 double location = f.parse(part); 162 double location = f.parse(part);
158 } 163 }
159 164
160 errors.remove(item.getFieldName()); 165 errors.remove(item.getFieldName());
161 } 166 }
184 189
185 if (value == null) { 190 if (value == null) {
186 return null; 191 return null;
187 } 192 }
188 193
189 String[] parts = value.split(" "); 194 String[] parts = value.split("\\s+");
190 195
191 if (parts == null) { 196 if (parts == null) {
192 return null; 197 return null;
193 } 198 }
194 199
196 201
197 double[] values = new double[parts.length]; 202 double[] values = new double[parts.length];
198 203
199 int i = 0; 204 int i = 0;
200 OUTER: for (String part: parts) { 205 OUTER: for (String part: parts) {
206 if (part.length() == 0) {
207 continue;
208 }
209
201 try { 210 try {
202 double x = f.parse(part); 211 double x = f.parse(part);
203 for (int j = 0; j < i; ++j) { 212 for (int j = 0; j < i; ++j) {
204 if (values[j] == x) { 213 if (values[j] == x) {
205 continue OUTER; 214 continue OUTER;

http://dive4elements.wald.intevation.org