Mercurial > dive4elements > river
comparison flys-client/src/main/java/de/intevation/flys/client/client/ui/LocationDistancePanel.java @ 1536:4f4d29404dba
Filter the helper input tables using the range filter.
flys-client/trunk@3754 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Raimund Renkert <raimund.renkert@intevation.de> |
---|---|
date | Tue, 24 Jan 2012 08:46:33 +0000 |
parents | 98123d34529b |
children | 2b104fa094e2 |
comparison
equal
deleted
inserted
replaced
1535:03e82be2aabc | 1536:4f4d29404dba |
---|---|
6 | 6 |
7 import com.google.gwt.core.client.GWT; | 7 import com.google.gwt.core.client.GWT; |
8 import com.google.gwt.i18n.client.NumberFormat; | 8 import com.google.gwt.i18n.client.NumberFormat; |
9 | 9 |
10 import com.smartgwt.client.data.Criteria; | 10 import com.smartgwt.client.data.Criteria; |
11 import com.smartgwt.client.data.Criterion; | |
12 import com.smartgwt.client.data.AdvancedCriteria; | |
13 import com.smartgwt.client.types.OperatorId; | |
14 | |
11 import com.smartgwt.client.widgets.Canvas; | 15 import com.smartgwt.client.widgets.Canvas; |
12 import com.smartgwt.client.widgets.Label; | 16 import com.smartgwt.client.widgets.Label; |
13 import com.smartgwt.client.widgets.form.DynamicForm; | 17 import com.smartgwt.client.widgets.form.DynamicForm; |
14 import com.smartgwt.client.widgets.form.fields.events.BlurHandler; | 18 import com.smartgwt.client.widgets.form.fields.events.BlurHandler; |
15 import com.smartgwt.client.widgets.form.fields.events.BlurEvent; | 19 import com.smartgwt.client.widgets.form.fields.events.BlurEvent; |
780 } | 784 } |
781 } | 785 } |
782 | 786 |
783 | 787 |
784 public void onFilterCriteriaChanged(RangeFilterEvent event) { | 788 public void onFilterCriteriaChanged(RangeFilterEvent event) { |
785 GWT.log("filtering range"); | 789 Float from = event.getFrom() - 0.001f; |
790 Float to = event.getTo() + 0.001f; | |
791 GWT.log("filtering range: " + from + " to " + to); | |
792 | |
793 | |
794 Criterion combinedFilter = null; | |
795 Criterion locationFilter = null; | |
796 if (from.equals(Float.NaN) && to.equals(Float.NaN)) { | |
797 locationsTable.clearCriteria(); | |
798 distanceTable.clearCriteria(); | |
799 locationDistanceTable.clearCriteria(); | |
800 } | |
801 else if (from.equals(Float.NaN)) { | |
802 combinedFilter = new Criterion("to", OperatorId.LESS_OR_EQUAL, to); | |
803 locationFilter = | |
804 new Criterion("from", OperatorId.LESS_OR_EQUAL, to); | |
805 locationsTable.filterData(locationFilter); | |
806 distanceTable.filterData(combinedFilter); | |
807 locationDistanceTable.filterData(combinedFilter); | |
808 return; | |
809 } | |
810 else if (to.equals(Float.NaN)) { | |
811 combinedFilter = | |
812 new Criterion("from", OperatorId.GREATER_OR_EQUAL, from); | |
813 locationsTable.filterData(combinedFilter); | |
814 distanceTable.filterData(combinedFilter); | |
815 locationDistanceTable.filterData(combinedFilter); | |
816 } | |
817 else { | |
818 AdvancedCriteria c1 = | |
819 new AdvancedCriteria(OperatorId.AND, new Criterion[] { | |
820 new Criterion("from", OperatorId.GREATER_OR_EQUAL, from), | |
821 new Criterion("from", OperatorId.LESS_OR_EQUAL, to) | |
822 }); | |
823 | |
824 AdvancedCriteria c2 = | |
825 new AdvancedCriteria(OperatorId.AND, new Criterion[] { | |
826 new Criterion("to", OperatorId.GREATER_OR_EQUAL, from), | |
827 new Criterion("to", OperatorId.LESS_OR_EQUAL, to) | |
828 }); | |
829 | |
830 combinedFilter = | |
831 new AdvancedCriteria(OperatorId.OR, new Criterion[] { | |
832 c1, c2 | |
833 }); | |
834 } | |
835 locationsTable.filterData(combinedFilter); | |
836 distanceTable.filterData(combinedFilter); | |
837 locationDistanceTable.filterData(combinedFilter); | |
786 } | 838 } |
787 | 839 |
788 | 840 |
789 @Override | 841 @Override |
790 public List<String> validate() { | 842 public List<String> validate() { |