Mercurial > dive4elements > river
view gwt-client/src/main/java/org/dive4elements/river/client/client/ui/stationinfo/MeasurementStationListGrid.java @ 6189:4365320750bb
Add helpers for links into the Flys wiki with optional SSO support.
If a SAML ticket is known for the current user, a HTML form is generated
so tha the Ticket is used to authenticate the Wiki access, otherwise a
plain Link is generated similar to what the UI used before the SSO
links.
Part of flys/issue1265
author | Bernhard Herzog <bh@intevation.de> |
---|---|
date | Tue, 04 Jun 2013 17:33:55 +0200 |
parents | ea9eef426962 |
children | 5319ecd0619c |
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 com.google.gwt.core.client.GWT; import com.smartgwt.client.types.ListGridFieldType; import com.smartgwt.client.widgets.Canvas; import com.smartgwt.client.widgets.WidgetCanvas; import com.smartgwt.client.widgets.grid.ListGridField; import com.smartgwt.client.widgets.grid.ListGridRecord; import com.smartgwt.client.widgets.grid.events.RecordClickEvent; import com.smartgwt.client.widgets.grid.events.RecordClickHandler; import org.dive4elements.river.client.client.FLYS; import org.dive4elements.river.client.shared.model.MeasurementStation; import org.dive4elements.river.client.shared.model.RiverInfo; import java.util.ArrayList; import java.util.List; /** * @author <a href="mailto:bjoern.ricks@intevation.de">Björn Ricks</a> */ public class MeasurementStationListGrid extends InfoListGrid implements RecordClickHandler { public MeasurementStationListGrid(FLYS flys) { super(flys); ListGridField nfield = new ListGridField("name", "Messtelle"); ListGridField sfield = new ListGridField("kmstart", "Start [km]", 60); ListGridField efield = new ListGridField("kmend", "Ende [km]", 60); ListGridField stfield = new ListGridField("station", "Station [km]"); ListGridField lfield = new ListGridField("link", "Link"); lfield.setType(ListGridFieldType.LINK); ListGridField cfield = new ListGridField("curvelink", "SQ"); cfield.addRecordClickHandler(this); this.setFields(nfield, sfield, efield, stfield, lfield, cfield); } /** * Resets the items of the tree. * If the list of gauges is empty or null the tree will be empty. */ @Override public void setRiverInfo(RiverInfo riverinfo) { List<MeasurementStation> stations = riverinfo.getMeasurementStations(); GWT.log("MeasurmentStationListGrid - setRiverInfo " + stations); if (stations != null && !stations.isEmpty()) { ArrayList<MeasurementStation> emptystations = new ArrayList<MeasurementStation>(); if (!riverinfo.isKmUp()) { for (MeasurementStation station : stations) { addStation(station, emptystations); } } else { for (int i = stations.size()-1; i >= 0; i--) { MeasurementStation station = stations.get(i); addStation(station, emptystations); } } // put empty stations to the end for (MeasurementStation station : emptystations) { addStation(station); } } } private void addStation(MeasurementStation station, List<MeasurementStation> empty) { if (station.getKmStart() != null && station.getKmEnd() != null) { addStation(station); } else { empty.add(station); } } private void addStation(MeasurementStation station) { ListGridRecord record = new MeasurementStationRecord(station); this.addData(record); } @Override public void open() { } @Override protected Canvas getExpandPanel(ListGridRecord record) { MeasurementStationRecord station = (MeasurementStationRecord)record; return new WidgetCanvas(new MeasurementStationInfoPanel(station)); } @Override public void onRecordClick(RecordClickEvent event) { MeasurementStationRecord station = (MeasurementStationRecord)event.getRecord(); flys.newSQRelation(station.getRiverName(), station.getID()); } }