view gwt-client/src/main/java/org/dive4elements/river/client/client/ui/stationinfo/MeasurementStationInfoPanel.java @ 7933:900299ab8e6e

Replaced plain gwt with smartgwt components in info panels.
author Raimund Renkert <rrenkert@intevation.de>
date Tue, 17 Jun 2014 09:45:48 +0200
parents ea9eef426962
children 71144e25a6c9
line wrap: on
line source
/* Copyright (C) 2011, 2012, 2013 by Bundesanstalt für Gewässerkunde
 * Software engineering by Intevation GmbH
 *
 * This file is Free Software under the GNU AGPL (>=v3)
 * and comes with ABSOLUTELY NO WARRANTY! Check out the
 * documentation coming with Dive4Elements River for details.
 */

package org.dive4elements.river.client.client.ui.stationinfo;

import java.util.Date;

import com.google.gwt.core.client.GWT;
import com.google.gwt.i18n.client.DateTimeFormat;
import com.google.gwt.i18n.client.DateTimeFormat.PredefinedFormat;
import com.smartgwt.client.widgets.Label;
import com.smartgwt.client.widgets.layout.HLayout;
import com.smartgwt.client.widgets.layout.VLayout;

import org.dive4elements.river.client.client.FLYSConstants;
import org.dive4elements.river.client.shared.model.MeasurementStation;

public class MeasurementStationInfoPanel extends VLayout {

    /** The message class that provides i18n strings.*/
    private FLYSConstants MSG = GWT.create(FLYSConstants.class);

    public MeasurementStationInfoPanel(MeasurementStation station) {
        setStyleName("infopanel");
        setWidth100();

        VLayout grid = new VLayout();

        HLayout line1 = new HLayout();
        String type = station.getMeasurementType();
        if (type != null) {
            Label key = new Label(MSG.measurement_station_type());
            Label value = new Label(type);
            key.setWidth(150);
            line1.addMember(key);
            line1.addMember(value);
            grid.addMember(line1);
        }

        HLayout line2 = new HLayout();
        String riverside = station.getRiverSide();
        if (riverside != null) {
            Label key = new Label(MSG.riverside());
            Label value = new Label(riverside);
            key.setWidth(150);
            line2.addMember(key);
            line2.addMember(value);
            grid.addMember(line2);
        }

        HLayout line3 = new HLayout();
        String gaugename = station.getGaugeName();
        if (gaugename != null) {
            Label key = new Label(MSG.measurement_station_gauge_name());
            Label value = new Label(gaugename);
            key.setWidth(150);
            line3.addMember(key);
            line3.addMember(value);
            grid.addMember(line3);
        }

        HLayout line4 = new HLayout();
        DateTimeFormat df = DateTimeFormat.getFormat(
            PredefinedFormat.DATE_MEDIUM);

        Date starttime = station.getStartTime();
        if (starttime != null) {
            Label key = new Label(MSG.measurement_station_start_time());
            Label value = new Label(df.format(starttime));
            key.setWidth(150);
            line4.addMember(key);
            line4.addMember(value);
            grid.addMember(line4);
        }

        HLayout line5 = new HLayout();
        String moperator = station.getOperator();
        if (moperator != null) {
            Label key = new Label(MSG.measurement_station_operator());
            Label value = new Label(moperator);
            key.setWidth(150);
            line5.addMember(key);
            line5.addMember(value);
            grid.addMember(line5);
        }

        addMember(grid);
    }
}

http://dive4elements.wald.intevation.org