annotate gwt-client/src/main/java/org/dive4elements/river/client/client/ui/uinfo/UinfoInundationSingleYearEpochBehaviour.java @ 9481:787fc085459b

TSV introduced; uinfo.inundationWMS-Config
author gernotbelger
date Wed, 12 Sep 2018 10:55:09 +0200
parents
children ba0561906f81
rev   line source
9481
787fc085459b TSV introduced; uinfo.inundationWMS-Config
gernotbelger
parents:
diff changeset
1 /** Copyright (C) 2017 by Bundesanstalt für Gewässerkunde
787fc085459b TSV introduced; uinfo.inundationWMS-Config
gernotbelger
parents:
diff changeset
2 * Software engineering by
787fc085459b TSV introduced; uinfo.inundationWMS-Config
gernotbelger
parents:
diff changeset
3 * Björnsen Beratende Ingenieure GmbH
787fc085459b TSV introduced; uinfo.inundationWMS-Config
gernotbelger
parents:
diff changeset
4 * Dr. Schumacher Ingenieurbüro für Wasser und Umwelt
787fc085459b TSV introduced; uinfo.inundationWMS-Config
gernotbelger
parents:
diff changeset
5 *
787fc085459b TSV introduced; uinfo.inundationWMS-Config
gernotbelger
parents:
diff changeset
6 * This file is Free Software under the GNU AGPL (>=v3)
787fc085459b TSV introduced; uinfo.inundationWMS-Config
gernotbelger
parents:
diff changeset
7 * and comes with ABSOLUTELY NO WARRANTY! Check out the
787fc085459b TSV introduced; uinfo.inundationWMS-Config
gernotbelger
parents:
diff changeset
8 * documentation coming with Dive4Elements River for details.
787fc085459b TSV introduced; uinfo.inundationWMS-Config
gernotbelger
parents:
diff changeset
9 */
787fc085459b TSV introduced; uinfo.inundationWMS-Config
gernotbelger
parents:
diff changeset
10 package org.dive4elements.river.client.client.ui.uinfo;
787fc085459b TSV introduced; uinfo.inundationWMS-Config
gernotbelger
parents:
diff changeset
11
787fc085459b TSV introduced; uinfo.inundationWMS-Config
gernotbelger
parents:
diff changeset
12 import java.util.List;
787fc085459b TSV introduced; uinfo.inundationWMS-Config
gernotbelger
parents:
diff changeset
13
787fc085459b TSV introduced; uinfo.inundationWMS-Config
gernotbelger
parents:
diff changeset
14 import org.dive4elements.river.client.client.FLYSConstants;
787fc085459b TSV introduced; uinfo.inundationWMS-Config
gernotbelger
parents:
diff changeset
15
787fc085459b TSV introduced; uinfo.inundationWMS-Config
gernotbelger
parents:
diff changeset
16 import com.smartgwt.client.widgets.form.fields.TextItem;
787fc085459b TSV introduced; uinfo.inundationWMS-Config
gernotbelger
parents:
diff changeset
17
787fc085459b TSV introduced; uinfo.inundationWMS-Config
gernotbelger
parents:
diff changeset
18 /**
787fc085459b TSV introduced; uinfo.inundationWMS-Config
gernotbelger
parents:
diff changeset
19 * @author Domenico Nardi Tironi
787fc085459b TSV introduced; uinfo.inundationWMS-Config
gernotbelger
parents:
diff changeset
20 *
787fc085459b TSV introduced; uinfo.inundationWMS-Config
gernotbelger
parents:
diff changeset
21 */
787fc085459b TSV introduced; uinfo.inundationWMS-Config
gernotbelger
parents:
diff changeset
22 public class UinfoInundationSingleYearEpochBehaviour extends ValidationBehaviourSingleMultiInputItem {
787fc085459b TSV introduced; uinfo.inundationWMS-Config
gernotbelger
parents:
diff changeset
23
787fc085459b TSV introduced; uinfo.inundationWMS-Config
gernotbelger
parents:
diff changeset
24 private final String titleForCreateOld;
787fc085459b TSV introduced; uinfo.inundationWMS-Config
gernotbelger
parents:
diff changeset
25
787fc085459b TSV introduced; uinfo.inundationWMS-Config
gernotbelger
parents:
diff changeset
26 public UinfoInundationSingleYearEpochBehaviour(final FLYSConstants msg, final String titleForCreateOld) {
787fc085459b TSV introduced; uinfo.inundationWMS-Config
gernotbelger
parents:
diff changeset
27 super(msg);
787fc085459b TSV introduced; uinfo.inundationWMS-Config
gernotbelger
parents:
diff changeset
28 this.titleForCreateOld = titleForCreateOld;
787fc085459b TSV introduced; uinfo.inundationWMS-Config
gernotbelger
parents:
diff changeset
29 }
787fc085459b TSV introduced; uinfo.inundationWMS-Config
gernotbelger
parents:
diff changeset
30
787fc085459b TSV introduced; uinfo.inundationWMS-Config
gernotbelger
parents:
diff changeset
31 @Override
787fc085459b TSV introduced; uinfo.inundationWMS-Config
gernotbelger
parents:
diff changeset
32 public void appendValue(final TextItem inputItem, final String value) {
787fc085459b TSV introduced; uinfo.inundationWMS-Config
gernotbelger
parents:
diff changeset
33 inputItem.setValue(value);
787fc085459b TSV introduced; uinfo.inundationWMS-Config
gernotbelger
parents:
diff changeset
34 }
787fc085459b TSV introduced; uinfo.inundationWMS-Config
gernotbelger
parents:
diff changeset
35
787fc085459b TSV introduced; uinfo.inundationWMS-Config
gernotbelger
parents:
diff changeset
36 @Override
787fc085459b TSV introduced; uinfo.inundationWMS-Config
gernotbelger
parents:
diff changeset
37 public List<String> validate(final List<String> errors, final String inputValueString) {
787fc085459b TSV introduced; uinfo.inundationWMS-Config
gernotbelger
parents:
diff changeset
38 boolean isGood = false;
787fc085459b TSV introduced; uinfo.inundationWMS-Config
gernotbelger
parents:
diff changeset
39 for (final String validYear : this.getValidInputs()) { // no numeric check
787fc085459b TSV introduced; uinfo.inundationWMS-Config
gernotbelger
parents:
diff changeset
40 /* No list contains for strings? */
787fc085459b TSV introduced; uinfo.inundationWMS-Config
gernotbelger
parents:
diff changeset
41 if (inputValueString.equals(validYear)) {
787fc085459b TSV introduced; uinfo.inundationWMS-Config
gernotbelger
parents:
diff changeset
42 isGood = true;
787fc085459b TSV introduced; uinfo.inundationWMS-Config
gernotbelger
parents:
diff changeset
43 break;
787fc085459b TSV introduced; uinfo.inundationWMS-Config
gernotbelger
parents:
diff changeset
44 }
787fc085459b TSV introduced; uinfo.inundationWMS-Config
gernotbelger
parents:
diff changeset
45 }
787fc085459b TSV introduced; uinfo.inundationWMS-Config
gernotbelger
parents:
diff changeset
46 if (!isGood) {
787fc085459b TSV introduced; uinfo.inundationWMS-Config
gernotbelger
parents:
diff changeset
47 String tmp = this.errorForItemMsg;
787fc085459b TSV introduced; uinfo.inundationWMS-Config
gernotbelger
parents:
diff changeset
48 tmp = tmp.replace("$1", inputValueString);
787fc085459b TSV introduced; uinfo.inundationWMS-Config
gernotbelger
parents:
diff changeset
49 errors.add(tmp);
787fc085459b TSV introduced; uinfo.inundationWMS-Config
gernotbelger
parents:
diff changeset
50 }
787fc085459b TSV introduced; uinfo.inundationWMS-Config
gernotbelger
parents:
diff changeset
51
787fc085459b TSV introduced; uinfo.inundationWMS-Config
gernotbelger
parents:
diff changeset
52 return errors;
787fc085459b TSV introduced; uinfo.inundationWMS-Config
gernotbelger
parents:
diff changeset
53
787fc085459b TSV introduced; uinfo.inundationWMS-Config
gernotbelger
parents:
diff changeset
54 }
787fc085459b TSV introduced; uinfo.inundationWMS-Config
gernotbelger
parents:
diff changeset
55
787fc085459b TSV introduced; uinfo.inundationWMS-Config
gernotbelger
parents:
diff changeset
56 @Override
787fc085459b TSV introduced; uinfo.inundationWMS-Config
gernotbelger
parents:
diff changeset
57 public boolean isMultipleInputsAllowed() {
787fc085459b TSV introduced; uinfo.inundationWMS-Config
gernotbelger
parents:
diff changeset
58 return false;
787fc085459b TSV introduced; uinfo.inundationWMS-Config
gernotbelger
parents:
diff changeset
59 }
787fc085459b TSV introduced; uinfo.inundationWMS-Config
gernotbelger
parents:
diff changeset
60
787fc085459b TSV introduced; uinfo.inundationWMS-Config
gernotbelger
parents:
diff changeset
61 @Override
787fc085459b TSV introduced; uinfo.inundationWMS-Config
gernotbelger
parents:
diff changeset
62 public String titleForCreateOld() {
787fc085459b TSV introduced; uinfo.inundationWMS-Config
gernotbelger
parents:
diff changeset
63 return this.titleForCreateOld;
787fc085459b TSV introduced; uinfo.inundationWMS-Config
gernotbelger
parents:
diff changeset
64 }
787fc085459b TSV introduced; uinfo.inundationWMS-Config
gernotbelger
parents:
diff changeset
65 }

http://dive4elements.wald.intevation.org