Mercurial > dive4elements > river
view flys-client/src/main/java/de/intevation/flys/client/client/ui/stationinfo/GaugeInfoPanel.java @ 5640:4bd444837cdd
Doc.
author | Felix Wolfsteller <felix.wolfsteller@intevation.de> |
---|---|
date | Wed, 10 Apr 2013 09:28:58 +0200 |
parents | 5ae8b8b46323 |
children |
line wrap: on
line source
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.smartgwt.client.widgets.layout.HLayout; 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; public class GaugeInfoPanel extends VLayout { /** The message class that provides i18n strings.*/ private FLYSConstants MSG = GWT.create(FLYSConstants.class); /** Application instance. */ private FLYS flys; public GaugeInfoPanel(GaugeInfo gauge, FLYS flys) { this.flys = flys; setStyleName("gaugeinfopanel"); NumberFormat nf = NumberFormat.getDecimalFormat(); VLayout grid = new VLayout(); HLayout line1 = new HLayout(); Double minw = gauge.getMinW(); Double maxw = gauge.getMaxW(); if (minw != null && maxw != null) { Label key = new Label(MSG.wq_value_q()); Label value = new Label(nf.format(minw) + " - " + nf.format(maxw)); key.setWidth(150); line1.addMember(key); line1.addMember(value); } HLayout line2 = new HLayout(); Double minq = gauge.getMinQ(); Double maxq = gauge.getMaxQ(); if (minq != null && maxq != null) { Label key = new Label(MSG.wq_value_w()); Label value = new Label( nf.format(minq) + " - " + nf.format(maxq)); key.setWidth(150); line2.addMember(key); line2.addMember(value); } HLayout line3 = new HLayout(); Double aeo = gauge.getAeo(); if (aeo != null) { Label key = new Label("AEO [kmĀ²]"); Label value = new Label(nf.format(aeo)); key.setWidth(150); line3.addMember(key); line3.addMember(value); } HLayout line4 = new HLayout(); Double datum = gauge.getDatum(); if (datum != null) { Label key = new Label(MSG.gauge_zero() + " [" + gauge.getWstUnit() + "]"); Label value = new Label(nf.format(datum)); key.setWidth(150); line4.addMember(key); line4.addMember(value); } HLayout line5 = new HLayout(); line5.addMember(new GaugeMainValueAnchor(flys, gauge)); grid.addMember(line1); grid.addMember(line2); grid.addMember(line3); grid.addMember(line4); grid.addMember(line5); addMember(grid); } /** * 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(MSG.show_mainvalues()); this.flys = flys; this.gauge = gauge; this.setHeight("5"); addClickHandler(this); } @Override public void onClick(ClickEvent ev) { GWT.log("GaugeMainValueAnchor - onClick " + gauge.getRiverName() + " " + gauge.getOfficialNumber()); flys.newGaugeMainValueTable(gauge); } } }