diff gwt-client/src/main/java/org/dive4elements/river/client/client/ui/uinfo/AbstractVegZonesTablePanel.java @ 9552:7f3444cbba5f

vegZone -1 to 366
author gernotbelger
date Mon, 22 Oct 2018 16:26:12 +0200
parents d421c2bf0195
children 8cf2968dd4f9
line wrap: on
line diff
--- a/gwt-client/src/main/java/org/dive4elements/river/client/client/ui/uinfo/AbstractVegZonesTablePanel.java	Mon Oct 22 13:17:27 2018 +0200
+++ b/gwt-client/src/main/java/org/dive4elements/river/client/client/ui/uinfo/AbstractVegZonesTablePanel.java	Mon Oct 22 16:26:12 2018 +0200
@@ -50,6 +50,9 @@
 public abstract class AbstractVegZonesTablePanel extends AbstractUIProvider {
     private static final long serialVersionUID = 1L;
 
+    private static final int LOWER = -1;
+    private static final int UPPER = 366;
+
     private static final String datakey = "vegzones";
     final protected List<ListGridRecord> records = new ArrayList<ListGridRecord>();
     private final Label validationLabel = PanelHelper.getValidationLabel();
@@ -214,8 +217,8 @@
 
     private IntegerRangeValidator getValidator() {
         final IntegerRangeValidator validator = new IntegerRangeValidator();
-        validator.setMin(0);
-        validator.setMax(365);
+        validator.setMin(LOWER);
+        validator.setMax(UPPER);
         validator.setErrorMessage(this.MSG.uinfo_vegetation_zones_validation_range());
         return validator;
     }
@@ -327,8 +330,8 @@
         final List<VegetationZoneServerClientXChange> zoneList = new ArrayList<VegetationZoneServerClientXChange>();
         for (final ListGridRecord element : lgr) {
             final Record r = element;
-            final VegetationZoneServerClientXChange zone = VegetationZoneServerClientXChange.createFromTableEntry(r.getAttribute("vegzone"), r.getAttribute("from"), r.getAttribute("to"),
-                    r.getAttribute("color"));
+            final VegetationZoneServerClientXChange zone = VegetationZoneServerClientXChange.createFromTableEntry(r.getAttribute("vegzone"),
+                    r.getAttribute("from"), r.getAttribute("to"), r.getAttribute("color"));
             zoneList.add(zone);
         }
         return zoneList;
@@ -365,10 +368,10 @@
             final Integer from = Integer.valueOf(fromInput);
             final Integer to = Integer.valueOf(toInput);
 
-            if (from < 0 || from > 365)
+            if (from < LOWER || from > UPPER)
                 return this.MSG.uinfo_vegetation_zones_validation_range();
 
-            if (to < 0 || to > 365)
+            if (to < LOWER || to > UPPER)
                 return this.MSG.uinfo_vegetation_zones_validation_range();
 
             if (from > to)
@@ -387,7 +390,7 @@
 
         if (VegetationZoneServerClientXChange.zonesAreOverlapping(this.getZones(this.elements.getRecords())))
             errors.add(this.MSG.uinfo_vegetation_zone_overlap());
-        if (VegetationZoneServerClientXChange.hasGaps(this.getZones(this.elements.getRecords()), 0, 365))
+        if (VegetationZoneServerClientXChange.hasGaps(this.getZones(this.elements.getRecords()), LOWER, UPPER))
             errors.add(this.MSG.uinfo_vegetation_zone_has_gaps());
         return errors;
     }

http://dive4elements.wald.intevation.org