Mercurial > dive4elements > river
changeset 783:8ebaad41285b
#159 Added listeners to the locations and distances tables of the kilometer range panel to set the from/to fields.
flys-client/trunk@2274 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Ingo Weinzierl <ingo.weinzierl@intevation.de> |
---|---|
date | Fri, 01 Jul 2011 09:11:39 +0000 |
parents | 4a7ece57f44c |
children | 3fa64c796ffc |
files | flys-client/ChangeLog flys-client/src/main/java/de/intevation/flys/client/client/ui/DistancePanel.java |
diffstat | 2 files changed, 54 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/flys-client/ChangeLog Fri Jul 01 08:44:24 2011 +0000 +++ b/flys-client/ChangeLog Fri Jul 01 09:11:39 2011 +0000 @@ -1,3 +1,13 @@ +2011-07-01 Ingo Weinzierl <ingo@intevation.de> + + flys/issue159 (WINFO: Radiobutton - Ortsauswahl bei "W für ungleichwertigen Abflusslängsschnitt" entfernen) + + * src/main/java/de/intevation/flys/client/client/ui/DistancePanel.java: + Connected columns of the locations and distances tables with the + panels from/to fields. The first two columns of the locations and the + first column of the distances table might be used to set from/to values + in the panel. + 2011-07-01 Ingo Weinzierl <ingo@intevation.de> * src/main/java/de/intevation/flys/client/server/DistanceInfoXML.java:
--- a/flys-client/src/main/java/de/intevation/flys/client/client/ui/DistancePanel.java Fri Jul 01 08:44:24 2011 +0000 +++ b/flys-client/src/main/java/de/intevation/flys/client/client/ui/DistancePanel.java Fri Jul 01 09:11:39 2011 +0000 @@ -6,10 +6,14 @@ import com.google.gwt.core.client.GWT; import com.google.gwt.i18n.client.NumberFormat; +import com.smartgwt.client.data.Record; +import com.smartgwt.client.util.SC; import com.smartgwt.client.widgets.Canvas; import com.smartgwt.client.widgets.Label; import com.smartgwt.client.widgets.form.fields.events.BlurHandler; import com.smartgwt.client.widgets.form.fields.events.BlurEvent; +import com.smartgwt.client.widgets.grid.events.RecordClickHandler; +import com.smartgwt.client.widgets.grid.events.RecordClickEvent; import com.smartgwt.client.widgets.layout.HLayout; import com.smartgwt.client.widgets.layout.VLayout; import com.smartgwt.client.widgets.tab.TabSet; @@ -310,6 +314,46 @@ locationsTable.setDataSource(new DistanceInfoDataSource( url, river, "locations")); + distancesTable.addRecordClickHandler(new RecordClickHandler() { + public void onRecordClick(RecordClickEvent e) { + Record r = e.getRecord(); + + String from = r.getAttribute("from"); + String to = r.getAttribute("to"); + + try { + distancePanel.setFrom(Double.valueOf(from)); + distancePanel.setTo(Double.valueOf(to)); + } + catch (NumberFormatException nfe) { + SC.warn(MSG.wrongFormat()); + } + } + }); + + locationsTable.addRecordClickHandler(new RecordClickHandler() { + public void onRecordClick(RecordClickEvent e) { + Record r = e.getRecord(); + int field = e.getFieldNum(); + + try { + String value = r.getAttribute("from"); + + switch (field) { + case 0: + distancePanel.setFrom(Double.valueOf(value)); + break; + case 1: + distancePanel.setTo(Double.valueOf(value)); + break; + } + } + catch (NumberFormatException nfe) { + SC.warn(MSG.wrongFormat()); + } + } + }); + tabs = new TabSet(); tabs.setWidth100(); tabs.setHeight100();