Mercurial > dive4elements > river
comparison flys-client/src/main/java/de/intevation/flys/client/client/ui/DistancePanel.java @ 1538:92f81eac034a
Added filter implementation for input helper tables in single location and
distance panel.
flys-client/trunk@3756 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Raimund Renkert <raimund.renkert@intevation.de> |
---|---|
date | Tue, 24 Jan 2012 12:43:06 +0000 |
parents | 98123d34529b |
children | 7e738bc8ed75 |
comparison
equal
deleted
inserted
replaced
1537:2b104fa094e2 | 1538:92f81eac034a |
---|---|
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.data.Record; | 15 import com.smartgwt.client.data.Record; |
12 import com.smartgwt.client.util.SC; | 16 import com.smartgwt.client.util.SC; |
13 import com.smartgwt.client.widgets.Canvas; | 17 import com.smartgwt.client.widgets.Canvas; |
14 import com.smartgwt.client.widgets.Label; | 18 import com.smartgwt.client.widgets.Label; |
15 import com.smartgwt.client.widgets.form.DynamicForm; | 19 import com.smartgwt.client.widgets.form.DynamicForm; |
529 | 533 |
530 | 534 |
531 tabs.addTabSelectedHandler(new TabSelectedHandler() { | 535 tabs.addTabSelectedHandler(new TabSelectedHandler() { |
532 public void onTabSelected(TabSelectedEvent evt) { | 536 public void onTabSelected(TabSelectedEvent evt) { |
533 filterDescription.clear(); | 537 filterDescription.clear(); |
538 filterRange.clear(); | |
534 } | 539 } |
535 }); | 540 }); |
536 | 541 |
537 helperContainer.addMember(tabs); | 542 helperContainer.addMember(tabs); |
538 helperContainer.addMember(filterLayout); | 543 helperContainer.addMember(filterLayout); |
553 } | 558 } |
554 } | 559 } |
555 | 560 |
556 | 561 |
557 public void onFilterCriteriaChanged(RangeFilterEvent event) { | 562 public void onFilterCriteriaChanged(RangeFilterEvent event) { |
558 GWT.log("filter range"); | 563 Float from = event.getFrom() - 0.001f; |
564 Float to = event.getTo() + 0.001f; | |
565 | |
566 Criterion combinedFilter = null; | |
567 Criterion locationFilter = null; | |
568 if (from.equals(Float.NaN) && to.equals(Float.NaN)) { | |
569 locationsTable.clearCriteria(); | |
570 distancesTable.clearCriteria(); | |
571 } | |
572 else if (from.equals(Float.NaN)) { | |
573 combinedFilter = new Criterion("to", OperatorId.LESS_OR_EQUAL, to); | |
574 locationFilter = | |
575 new Criterion("from", OperatorId.LESS_OR_EQUAL, to); | |
576 locationsTable.filterData(locationFilter); | |
577 distancesTable.filterData(combinedFilter); | |
578 return; | |
579 } | |
580 else if (to.equals(Float.NaN)) { | |
581 combinedFilter = | |
582 new Criterion("from", OperatorId.GREATER_OR_EQUAL, from); | |
583 } | |
584 else { | |
585 AdvancedCriteria c1 = | |
586 new AdvancedCriteria(OperatorId.AND, new Criterion[] { | |
587 new Criterion("from", OperatorId.GREATER_OR_EQUAL, from), | |
588 new Criterion("from", OperatorId.LESS_OR_EQUAL, to) | |
589 }); | |
590 | |
591 AdvancedCriteria c2 = | |
592 new AdvancedCriteria(OperatorId.AND, new Criterion[] { | |
593 new Criterion("to", OperatorId.GREATER_OR_EQUAL, from), | |
594 new Criterion("to", OperatorId.LESS_OR_EQUAL, to) | |
595 }); | |
596 | |
597 AdvancedCriteria c3 = | |
598 new AdvancedCriteria(OperatorId.AND, new Criterion[] { | |
599 new Criterion("from", OperatorId.LESS_OR_EQUAL, to), | |
600 new Criterion("to", OperatorId.GREATER_OR_EQUAL, from) | |
601 }); | |
602 | |
603 combinedFilter = | |
604 new AdvancedCriteria(OperatorId.OR, new Criterion[] { | |
605 c1, c2, c3 | |
606 }); | |
607 } | |
608 locationsTable.filterData(combinedFilter); | |
609 distancesTable.filterData(combinedFilter); | |
559 } | 610 } |
560 | 611 |
561 | 612 |
562 protected String getRiverName() { | 613 protected String getRiverName() { |
563 ArtifactDescription adescr = artifact.getArtifactDescription(); | 614 ArtifactDescription adescr = artifact.getArtifactDescription(); |