Mercurial > dive4elements > river
comparison gwt-client/src/main/java/org/dive4elements/river/client/client/ui/range/LocationsTable.java @ 5838:5aa05a7a34b7
Rename modules to more fitting names.
author | Sascha L. Teichmann <teichmann@intevation.de> |
---|---|
date | Thu, 25 Apr 2013 15:23:37 +0200 |
parents | flys-client/src/main/java/org/dive4elements/river/client/client/ui/range/LocationsTable.java@821a02bbfb4e |
children | 172338b1407f |
comparison
equal
deleted
inserted
replaced
5837:d9901a08d0a6 | 5838:5aa05a7a34b7 |
---|---|
1 package org.dive4elements.river.client.client.ui.range; | |
2 | |
3 import com.google.gwt.core.client.GWT; | |
4 import com.google.gwt.i18n.client.NumberFormat; | |
5 | |
6 import com.smartgwt.client.types.ListGridFieldType; | |
7 import com.smartgwt.client.types.SelectionStyle; | |
8 import com.smartgwt.client.widgets.grid.ListGrid; | |
9 import com.smartgwt.client.widgets.grid.ListGridField; | |
10 import com.smartgwt.client.widgets.grid.ListGridRecord; | |
11 | |
12 import com.smartgwt.client.widgets.grid.CellFormatter; | |
13 | |
14 import org.dive4elements.river.client.client.FLYSConstants; | |
15 | |
16 | |
17 /** | |
18 * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a> | |
19 */ | |
20 public class LocationsTable extends ListGrid { | |
21 | |
22 /** The message class that provides i18n strings.*/ | |
23 protected FLYSConstants MSG = GWT.create(FLYSConstants.class); | |
24 | |
25 | |
26 public LocationsTable() { | |
27 String baseUrl = GWT.getHostPageBaseURL(); | |
28 | |
29 setWidth100(); | |
30 setHeight100(); | |
31 setSelectionType(SelectionStyle.SINGLE); | |
32 setSelectionType(SelectionStyle.SINGLE); | |
33 setShowHeaderContextMenu(false); | |
34 setShowRecordComponents(true); | |
35 setShowRecordComponentsByCell(true); | |
36 setEmptyMessage(MSG.empty_filter()); | |
37 setCanReorderFields(false); | |
38 | |
39 ListGridField addfrom = new ListGridField ("from", MSG.from()); | |
40 addfrom.setType(ListGridFieldType.ICON); | |
41 addfrom.setWidth(30); | |
42 addfrom.setCellIcon(baseUrl + MSG.markerGreen()); | |
43 | |
44 ListGridField addto = new ListGridField("to", MSG.to()); | |
45 addto.setType(ListGridFieldType.ICON); | |
46 addto.setWidth(30); | |
47 addto.setCellIcon(baseUrl + MSG.markerRed()); | |
48 | |
49 ListGridField ldescr = new ListGridField( | |
50 "description", MSG.description()); | |
51 ldescr.setType(ListGridFieldType.TEXT); | |
52 ldescr.setWidth("*"); | |
53 | |
54 ListGridField lside = new ListGridField("riverside", MSG.riverside()); | |
55 lside.setType(ListGridFieldType.TEXT); | |
56 lside.setWidth("12%"); | |
57 | |
58 ListGridField loc = new ListGridField("from", MSG.locations()); | |
59 loc.setType(ListGridFieldType.FLOAT); | |
60 loc.setCellFormatter(new CellFormatter() { | |
61 public String format( | |
62 Object value, | |
63 ListGridRecord record, | |
64 int rowNum, int colNum) { | |
65 if (value == null) return null; | |
66 try { | |
67 NumberFormat nf; | |
68 double v = Double.parseDouble((String)value); | |
69 nf = NumberFormat.getFormat("###0.00##"); | |
70 return nf.format(v); | |
71 } | |
72 catch (Exception e) { | |
73 return value.toString(); | |
74 } | |
75 } | |
76 } | |
77 ); | |
78 | |
79 loc.setWidth("12%"); | |
80 | |
81 ListGridField bottom = new ListGridField("bottom", MSG.bottom_edge()); | |
82 bottom.setType(ListGridFieldType.TEXT); | |
83 bottom.setWidth("10%"); | |
84 | |
85 ListGridField top = new ListGridField("top", MSG.top_edge()); | |
86 top.setType(ListGridFieldType.TEXT); | |
87 top.setWidth("10%"); | |
88 | |
89 setFields(addfrom, addto, ldescr, loc, lside, bottom, top); | |
90 } | |
91 } | |
92 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : |