Mercurial > dive4elements > river
changeset 4981:0e6e44e6725f
flys-client: (first draft) In GaugeInfo show link to show main values.
author | Felix Wolfsteller <felix.wolfsteller@intevation.de> |
---|---|
date | Thu, 14 Feb 2013 09:32:29 +0100 |
parents | e70ff0a600a3 |
children | cbe89b2ce3cd |
files | flys-client/src/main/java/de/intevation/flys/client/client/FLYS.java flys-client/src/main/java/de/intevation/flys/client/client/ui/stationinfo/GaugeInfoPanel.java flys-client/src/main/java/de/intevation/flys/client/client/ui/stationinfo/GaugeListGrid.java flys-client/src/main/java/de/intevation/flys/client/client/ui/stationinfo/GaugePanel.java flys-client/src/main/java/de/intevation/flys/client/client/ui/wq/WAutoTable.java |
diffstat | 5 files changed, 138 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/flys-client/src/main/java/de/intevation/flys/client/client/FLYS.java Thu Feb 14 09:29:51 2013 +0100 +++ b/flys-client/src/main/java/de/intevation/flys/client/client/FLYS.java Thu Feb 14 09:32:29 2013 +0100 @@ -35,9 +35,12 @@ import de.intevation.flys.client.shared.model.Artifact; import de.intevation.flys.client.shared.model.Collection; import de.intevation.flys.client.shared.model.CollectionItem; +import de.intevation.flys.client.shared.model.GaugeInfo; import de.intevation.flys.client.shared.model.River; import de.intevation.flys.client.shared.model.User; +import de.intevation.flys.client.client.ui.wq.WAutoTable; + import java.util.ArrayList; import java.util.List; import java.util.MissingResourceException; @@ -434,6 +437,27 @@ }); } + + /** Opens a window with Main Values from gauge. */ + public void newGaugeMainValueTable(GaugeInfo gauge) { + Window mainValueView = new Window(); + mainValueView.addItem(new WAutoTable(gauge.getRiverName(), + new double[] {gauge.getKmStart(), gauge.getKmEnd()})); + mainValueView.setWidth(1010); + mainValueView.setHeight(700); + + mainValueView.setMaximized(true); + + mainValueView.setCanDragReposition(true); + mainValueView.setCanDragResize(true); + mainValueView.setShowMaximizeButton(true); + mainValueView.setKeepInParentRect(true); + + // TODO i18n + mainValueView.setTitle("Stammdaten " + gauge.getName() + " (" + gauge.getRiverName() + ")" ); + workspace.addChild(mainValueView); + } + public void newGaugeDischargeCurve(String river, Long gaugeref) { Config config = Config.getInstance();
--- a/flys-client/src/main/java/de/intevation/flys/client/client/ui/stationinfo/GaugeInfoPanel.java Thu Feb 14 09:29:51 2013 +0100 +++ b/flys-client/src/main/java/de/intevation/flys/client/client/ui/stationinfo/GaugeInfoPanel.java Thu Feb 14 09:32:29 2013 +0100 @@ -1,10 +1,15 @@ package de.intevation.flys.client.client.ui.stationinfo; import com.google.gwt.core.client.GWT; +import com.google.gwt.event.dom.client.ClickEvent; +import com.google.gwt.event.dom.client.ClickHandler; import com.google.gwt.i18n.client.NumberFormat; +import com.google.gwt.user.client.ui.Anchor; import com.google.gwt.user.client.ui.Grid; import com.smartgwt.client.widgets.layout.VLayout; +import com.smartgwt.client.widgets.Label; +import de.intevation.flys.client.client.FLYS; import de.intevation.flys.client.client.FLYSConstants; import de.intevation.flys.client.shared.model.GaugeInfo; @@ -13,7 +18,11 @@ /** The message class that provides i18n strings.*/ private FLYSConstants MSG = GWT.create(FLYSConstants.class); - public GaugeInfoPanel(GaugeInfo gauge) { + /** Application instance. */ + private FLYS flys; + + public GaugeInfoPanel(GaugeInfo gauge, FLYS flys) { + this.flys = flys; setStyleName("gaugeinfopanel"); setWidth100(); @@ -51,5 +60,33 @@ } addMember(grid); + addMember(new GaugeMainValueAnchor(flys, gauge)); + } + + + /** + * Clickable anchor that asks application to show window with + * main values for gauge. + */ + class GaugeMainValueAnchor extends Anchor implements ClickHandler { + + private FLYS flys; + private GaugeInfo gauge; + + public GaugeMainValueAnchor(FLYS flys, GaugeInfo gauge) { + super("TODO:i18n MainVALUES"); + // TODO i18n mainvalues + this.flys = flys; + this.gauge = gauge; + + addClickHandler(this); + } + + @Override + public void onClick(ClickEvent ev) { + GWT.log("GaugeMainValueAnchor - onClick " + gauge.getRiverName() + + " " + gauge.getOfficialNumber()); + flys.newGaugeMainValueTable(gauge); + } } }
--- a/flys-client/src/main/java/de/intevation/flys/client/client/ui/stationinfo/GaugeListGrid.java Thu Feb 14 09:29:51 2013 +0100 +++ b/flys-client/src/main/java/de/intevation/flys/client/client/ui/stationinfo/GaugeListGrid.java Thu Feb 14 09:32:29 2013 +0100 @@ -295,7 +295,7 @@ @Override protected Canvas getExpandPanel(ListGridRecord record) { GaugeRecord item = (GaugeRecord)record; - return new WidgetCanvas(new GaugeInfoPanel(item)); + return new WidgetCanvas(new GaugeInfoPanel(item, flys)); } @Override
--- a/flys-client/src/main/java/de/intevation/flys/client/client/ui/stationinfo/GaugePanel.java Thu Feb 14 09:29:51 2013 +0100 +++ b/flys-client/src/main/java/de/intevation/flys/client/client/ui/stationinfo/GaugePanel.java Thu Feb 14 09:32:29 2013 +0100 @@ -1,10 +1,15 @@ package de.intevation.flys.client.client.ui.stationinfo; +import com.smartgwt.client.util.SC; +import com.smartgwt.client.widgets.Label; + import com.google.gwt.core.client.GWT; import com.google.gwt.user.client.rpc.AsyncCallback; + import de.intevation.flys.client.client.FLYS; import de.intevation.flys.client.shared.model.RiverInfo; + /** * The GaugePanel is intended to be used within a SectionStackSection *
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/flys-client/src/main/java/de/intevation/flys/client/client/ui/wq/WAutoTable.java Thu Feb 14 09:32:29 2013 +0100 @@ -0,0 +1,70 @@ +package de.intevation.flys.client.client.ui.wq; + +import com.google.gwt.core.client.GWT; +import com.google.gwt.i18n.client.NumberFormat; + +import com.smartgwt.client.util.SC; + +import com.google.gwt.user.client.rpc.AsyncCallback; + +import de.intevation.flys.client.client.services.WQInfoService; +import de.intevation.flys.client.client.services.WQInfoServiceAsync; + +import de.intevation.flys.client.shared.model.WQInfoObject; +import de.intevation.flys.client.shared.model.WQInfoRecord; + +import de.intevation.flys.client.client.FLYSConstants; + +import de.intevation.flys.client.client.Config; + +public class WAutoTable extends WTable { + + WQInfoServiceAsync wqInfoService = + GWT.create(WQInfoService.class); + + public WAutoTable(String riverName, double[] dist) { + super(); + Config config = Config.getInstance(); + String locale = config.getLocale(); + wqInfoService.getWQInfo(locale, riverName, dist[0], dist[1], + new AsyncCallback<WQInfoObject[]>() { + @Override + public void onFailure(Throwable caught) { + GWT.log("Could not recieve wq informations."); + SC.warn(caught.getMessage()); + } + + @Override + public void onSuccess(WQInfoObject[] wqi) { + int num = wqi != null ? wqi.length :0; + GWT.log("Recieved " + num + " wq informations."); + + if (num == 0) { + return; + } + + addWQInfo(wqi); + + boolean isQ = false; + boolean isFree = false; + boolean isRange = true; + } + } + ); + } + + + protected void addWQInfo (WQInfoObject[] wqi) { + for(WQInfoObject wi: wqi) { + WQInfoRecord rec = new WQInfoRecord(wi); + + if (wi.getType().equals("W")) { + this.addData(rec); + } + else { + this.addData(rec); + } + } + } +} +// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :