teichmann@5861: /* Copyright (C) 2011, 2012, 2013 by Bundesanstalt für Gewässerkunde
teichmann@5861: * Software engineering by Intevation GmbH
teichmann@5861: *
teichmann@5993: * This file is Free Software under the GNU AGPL (>=v3)
teichmann@5861: * and comes with ABSOLUTELY NO WARRANTY! Check out the
teichmann@5993: * documentation coming with Dive4Elements River for details.
teichmann@5861: */
teichmann@5861:
teichmann@5835: package org.dive4elements.river.client.client.ui.stationinfo;
bjoern@4956:
bjoern@4956: import com.google.gwt.core.client.GWT;
bjoern@4956: import com.google.gwt.user.client.rpc.AsyncCallback;
felix@4981:
teichmann@5835: import org.dive4elements.river.client.client.FLYS;
teichmann@5835: import org.dive4elements.river.client.shared.model.RiverInfo;
bjoern@4956:
felix@4981:
bjoern@4956: /**
bjoern@4956: * The GaugePanel is intended to be used within a SectionStackSection
bjoern@4956: *
bjoern@4956: * @author Björn Ricks
bjoern@4956: */
bjoern@4956: public class GaugePanel extends InfoPanel {
bjoern@4956:
bjoern@4956: /**
bjoern@4956: * GaugePanel loads the GaugeInfo from the RiverInfoService and
bjoern@4956: * displays them in a tree underneath a RiverInfoPanel
bjoern@4956: *
bjoern@4956: * @param flys The FLYS object
bjoern@4956: */
bjoern@4956: public GaugePanel(FLYS flys) {
bh@6191: super(flys, new GaugeListGrid(flys));
bjoern@4956: }
bjoern@4956:
bjoern@4956:
bjoern@4956: @Override
bjoern@4956: public String getSectionTitle() {
bjoern@4956: return MSG.gaugePanelTitle();
bjoern@4956: }
bjoern@4956:
bjoern@4956: /**
felix@4980: * Loads the river info and renders it afterwards.
bjoern@4956: */
bjoern@4956: public void refresh() {
bjoern@4956: contract();
bjoern@4956:
bjoern@4956: riverInfoService.getGauges(this.river, new AsyncCallback() {
bjoern@4956: @Override
bjoern@4956: public void onFailure(Throwable e) {
bjoern@4956: GWT.log("Could not load the river info." + e);
bjoern@4956: }
bjoern@4956:
bjoern@4956: @Override
bjoern@4956: public void onSuccess(RiverInfo riverinfo) {
bjoern@4956: GWT.log("Loaded river info");
bjoern@4956: render(riverinfo);
bjoern@4956: expand();
bjoern@4956: }
bjoern@4956: });
bjoern@4956: }
bjoern@4956: }