# HG changeset patch # User Ingo Weinzierl # Date 1309511499 0 # Node ID 8ebaad41285b5c7526b752b9e86695d79658995d # Parent 4a7ece57f44c2c6494726e156a88b5dc25c9285d #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 diff -r 4a7ece57f44c -r 8ebaad41285b flys-client/ChangeLog --- 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 + + 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 * src/main/java/de/intevation/flys/client/server/DistanceInfoXML.java: diff -r 4a7ece57f44c -r 8ebaad41285b flys-client/src/main/java/de/intevation/flys/client/client/ui/DistancePanel.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();