Mercurial > dive4elements > river
view gwt-client/src/main/java/org/dive4elements/river/client/client/ui/stationinfo/InfoListGrid.java @ 6579:b2534dfa2ac8
Doc.
author | Felix Wolfsteller <felix.wolfsteller@intevation.de> |
---|---|
date | Wed, 17 Jul 2013 10:02:58 +0200 |
parents | 7106f9b75004 |
children | 6f8f13d829e5 |
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.widgets.Canvas; import com.smartgwt.client.widgets.grid.ListGrid; import com.smartgwt.client.widgets.grid.ListGridRecord; import com.smartgwt.client.widgets.layout.VLayout; import org.dive4elements.river.client.client.FLYS; import org.dive4elements.river.client.client.FLYSConstants; import org.dive4elements.river.client.client.ui.WikiLinks; import org.dive4elements.river.client.shared.model.Data; import org.dive4elements.river.client.shared.model.DataList; import org.dive4elements.river.client.shared.model.RiverInfo; /** * @author <a href="mailto:bjoern.ricks@intevation.de">Björn Ricks</a> */ public abstract class InfoListGrid extends ListGrid { protected FLYS flys; protected DataList[] data; /** The message class that provides i18n strings.*/ protected FLYSConstants MSG = GWT.create(FLYSConstants.class); public InfoListGrid(FLYS flys) { super(); this.flys = flys; this.setCanExpandRecords(true); this.setCanExpandMultipleRecords(true); } @Override protected Canvas createRecordComponent( final ListGridRecord record, Integer colNum ) { String name = this.getFieldName(colNum); if (name.equals("infolink")) { return WikiLinks.linkDynamicForm( flys, record.getAttribute("link"), record.getLinkText()); } else { return null; } } public void openAll() { GWT.log("InfoListGrid - openAll"); for (ListGridRecord record: this.getRecords()) { expandRecord(record); } } public void setData(DataList[] data) { GWT.log("InfoListGrid - setData"); this.data = data; this.open(); } protected Double getDoubleValue(Data d) { String tmp = d.getStringValue(); if (tmp != null) { return Double.valueOf(tmp); } return null; } @Override protected Canvas getExpansionComponent(ListGridRecord record) { VLayout layout = new VLayout(); layout.setPadding(5); layout.addMember(this.getExpandPanel(record)); return layout; } public abstract void open(); public abstract void setRiverInfo(RiverInfo riverinfo); protected abstract Canvas getExpandPanel(ListGridRecord record); }