Mercurial > dive4elements > river
comparison flys-client/src/main/java/de/intevation/flys/client/client/ui/stationinfo/InfoListGrid.java @ 4956:f46a07c11324
Refactor Pegel- and Messtelleninfo in client ui
Use SmartGWT ListGrid instead of GWT Tree to display the station entires.
author | Björn Ricks <bjoern.ricks@intevation.de> |
---|---|
date | Fri, 01 Feb 2013 16:32:48 +0100 |
parents | |
children | 6f6461e07854 |
comparison
equal
deleted
inserted
replaced
4950:4c7acc3a4ae1 | 4956:f46a07c11324 |
---|---|
1 package de.intevation.flys.client.client.ui.stationinfo; | |
2 | |
3 import com.google.gwt.core.client.GWT; | |
4 import com.smartgwt.client.widgets.Canvas; | |
5 import com.smartgwt.client.widgets.grid.ListGrid; | |
6 import com.smartgwt.client.widgets.grid.ListGridRecord; | |
7 import com.smartgwt.client.widgets.layout.VLayout; | |
8 | |
9 import de.intevation.flys.client.client.FLYS; | |
10 import de.intevation.flys.client.client.FLYSConstants; | |
11 import de.intevation.flys.client.shared.model.Data; | |
12 import de.intevation.flys.client.shared.model.DataList; | |
13 import de.intevation.flys.client.shared.model.RiverInfo; | |
14 | |
15 /** | |
16 * @author <a href="mailto:bjoern.ricks@intevation.de">Björn Ricks</a> | |
17 */ | |
18 public abstract class InfoListGrid extends ListGrid { | |
19 | |
20 protected FLYS flys; | |
21 protected DataList[] data; | |
22 | |
23 public InfoListGrid(FLYS flys) { | |
24 super(); | |
25 this.flys = flys; | |
26 this.setCanExpandRecords(true); | |
27 this.setCanExpandMultipleRecords(true); | |
28 } | |
29 | |
30 /** The message class that provides i18n strings.*/ | |
31 protected FLYSConstants MSG = GWT.create(FLYSConstants.class); | |
32 | |
33 public void openAll() { | |
34 GWT.log("InfoListGrid - openAll"); | |
35 for (ListGridRecord record: this.getRecords()) { | |
36 expandRecord(record); | |
37 } | |
38 } | |
39 | |
40 public void setData(DataList[] data) { | |
41 GWT.log("InfoListGrid - setData"); | |
42 this.data = data; | |
43 this.open(); | |
44 } | |
45 | |
46 protected Double getDoubleValue(Data d) { | |
47 String tmp = d.getStringValue(); | |
48 if (tmp != null) { | |
49 return Double.valueOf(tmp); | |
50 } | |
51 return null; | |
52 } | |
53 | |
54 @Override | |
55 protected Canvas getExpansionComponent(ListGridRecord record) { | |
56 VLayout layout = new VLayout(); | |
57 layout.setPadding(5); | |
58 layout.addMember(this.getExpandPanel(record)); | |
59 return layout; | |
60 } | |
61 | |
62 public abstract void open(); | |
63 | |
64 public abstract void setRiverInfo(RiverInfo riverinfo); | |
65 | |
66 protected abstract Canvas getExpandPanel(ListGridRecord record); | |
67 } |