Mercurial > dive4elements > river
changeset 8448:e98dbf72c9ec
(issue1733) Fix switch between location and distance
This changes the enable methods to state switchers. Combining
them avoids the problem that they could be out of sync.
author | Andre Heinecke <andre.heinecke@intevation.de> |
---|---|
date | Mon, 27 Oct 2014 12:52:00 +0100 |
parents | 4b315e5d2d4f |
children | f61e2791ccdf |
files | gwt-client/src/main/java/org/dive4elements/river/client/client/ui/LocationDistancePanel.java |
diffstat | 1 files changed, 14 insertions(+), 7 deletions(-) [+] |
line wrap: on
line diff
--- a/gwt-client/src/main/java/org/dive4elements/river/client/client/ui/LocationDistancePanel.java Mon Oct 27 12:38:22 2014 +0100 +++ b/gwt-client/src/main/java/org/dive4elements/river/client/client/ui/LocationDistancePanel.java Mon Oct 27 12:52:00 2014 +0100 @@ -692,7 +692,7 @@ } if (theMode.equals(FIELD_VALUE_DISTANCE)) { - enableDistancePanel(); + enableDistanceMode(); inputTables.selectTab(1); } currentFiltered = (ListGrid)inputTables.getSelectedTab().getPane(); @@ -734,6 +734,13 @@ filterRange.clear(); filterResultCount.setValue(""); + // The assumption is that location is tab 0 and distance tab 1 + if (inputTables.getSelectedTabNumber() == 0) { + enableLocationMode(); + } else { + enableDistanceMode(); + } + Canvas c = evt.getTabPane(); if(c instanceof ListGrid) { currentFiltered = (ListGrid)c; @@ -1157,7 +1164,8 @@ /** * Activates the location panel. */ - protected void enableLocationPanel() { + protected void enableLocationMode() { + mode.setValue(FIELD_MODE, FIELD_VALUE_LOCATION); container.hideMember(distancePanel); container.showMember(locationPanel); } @@ -1166,7 +1174,8 @@ /** * Activates the distance panel. */ - protected void enableDistancePanel() { + protected void enableDistanceMode() { + mode.setValue(FIELD_MODE, FIELD_VALUE_DISTANCE); container.hideMember(locationPanel); container.showMember(distancePanel); } @@ -1185,8 +1194,7 @@ return; } if (value.equals(FIELD_VALUE_LOCATION)) { - event.getItem().setValue(FIELD_VALUE_LOCATION); - enableLocationPanel(); + enableLocationMode(); filterDescription.clear(); filterRange.clear(); filterResultCount.setValue(""); @@ -1195,8 +1203,7 @@ inputTables.selectTab(0); } else { - event.getItem().setValue(FIELD_VALUE_DISTANCE); - enableDistancePanel(); + enableDistanceMode(); filterDescription.clear(); filterRange.clear(); filterResultCount.setValue("");