changeset 9279:83ef08b5e1ac

Waterlevel/Sounding TwinPanel wil hide all soundings/waterlevels that have no year information.
author gernotbelger
date Fri, 20 Jul 2018 14:56:27 +0200
parents 717c9dc1859f
children d1ce60b760bd
files gwt-client/src/main/java/org/dive4elements/river/client/client/ui/sinfo/WaterlevelSoundingSelectionController.java gwt-client/src/main/java/org/dive4elements/river/client/client/ui/sinfo/WaterlevelSoundingYearFilter.java
diffstat 2 files changed, 11 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/gwt-client/src/main/java/org/dive4elements/river/client/client/ui/sinfo/WaterlevelSoundingSelectionController.java	Fri Jul 20 11:19:07 2018 +0200
+++ b/gwt-client/src/main/java/org/dive4elements/river/client/client/ui/sinfo/WaterlevelSoundingSelectionController.java	Fri Jul 20 14:56:27 2018 +0200
@@ -67,7 +67,7 @@
 
                 final Integer waterlevelYear = WaterlevelSoundingYearFilter.parseYear(year);
                 if (waterlevelYear == null) {
-                    // should never happen, we should only show waterlevels that have a year
+                    // should never happen, we should only show soundings that have a year
                     return false;
                 }
 
@@ -129,7 +129,8 @@
     protected final void handleSoundingChanged(final DatacageWidget waterlevelWidget, final List<TreeNode> selection) {
 
         if (this.turnFilterOff) {
-            waterlevelWidget.setFilter(DatacageWidget.ACCEPT_ALL_FILTER);
+            // still filter waterlevels without year
+            waterlevelWidget.setFilter(new WaterlevelSoundingYearFilter(null));
             waterlevelWidget.getTreeGrid().setEmptyMessage(this.msg.databasket_empty());
             return;
         }
--- a/gwt-client/src/main/java/org/dive4elements/river/client/client/ui/sinfo/WaterlevelSoundingYearFilter.java	Fri Jul 20 11:19:07 2018 +0200
+++ b/gwt-client/src/main/java/org/dive4elements/river/client/client/ui/sinfo/WaterlevelSoundingYearFilter.java	Fri Jul 20 14:56:27 2018 +0200
@@ -18,9 +18,12 @@
  */
 final class WaterlevelSoundingYearFilter implements DatacageFilter {
 
-    private final int soundingYear;
+    private final Integer soundingYear;
 
-    public WaterlevelSoundingYearFilter(final int soundingYear) {
+    /**
+     * @param soundingYear If <code>null</code>, we do not check the distance to the waterlevel year, but still hide waterlevels without year
+     */
+    public WaterlevelSoundingYearFilter(final Integer soundingYear) {
         this.soundingYear = soundingYear;
     }
 
@@ -38,6 +41,9 @@
             // should never happen, we should only show waterlevels that have a year
             return false;
         }
+        
+        if( this.soundingYear == null )
+            return true;
 
         final int diff = Math.abs(this.soundingYear - waterlevelYear);
 

http://dive4elements.wald.intevation.org