Mercurial > dive4elements > river
comparison gwt-client/src/main/java/org/dive4elements/river/client/client/ui/wq/WTable.java @ 6666:3c4c0ea52bbb
issue1259: in WQAdaptedInputPanel (vollmer w/q-input) allow
click selection of W values, analogously to Q values.
author | Felix Wolfsteller <felix.wolfsteller@intevation.de> |
---|---|
date | Fri, 26 Jul 2013 08:59:55 +0200 |
parents | ea9eef426962 |
children | 2ca1f3991e17 |
comparison
equal
deleted
inserted
replaced
6665:b7945db8a43b | 6666:3c4c0ea52bbb |
---|---|
19 import com.smartgwt.client.widgets.grid.ListGridRecord; | 19 import com.smartgwt.client.widgets.grid.ListGridRecord; |
20 | 20 |
21 import org.dive4elements.river.client.client.FLYSConstants; | 21 import org.dive4elements.river.client.client.FLYSConstants; |
22 | 22 |
23 /** | 23 /** |
24 * Table showing W main values. | |
25 * TODO becomes very similiar to QDTable. Probably mergeable. | |
24 * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a> | 26 * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a> |
25 */ | 27 */ |
26 public class WTable extends ListGrid { | 28 public class WTable extends ListGrid { |
27 | 29 |
28 /** The message class that provides i18n strings.*/ | 30 /** The message class that provides i18n strings.*/ |
29 protected FLYSConstants MESSAGE = GWT.create(FLYSConstants.class); | 31 protected FLYSConstants MESSAGE = GWT.create(FLYSConstants.class); |
30 | 32 |
31 | 33 |
32 public WTable() { | 34 public WTable() { |
35 String baseUrl = GWT.getHostPageBaseURL(); | |
36 | |
33 setWidth100(); | 37 setWidth100(); |
34 setHeight100(); | 38 setHeight100(); |
35 setSelectionType(SelectionStyle.NONE); | 39 setSelectionType(SelectionStyle.NONE); |
36 setSelectionType(SelectionStyle.NONE); | 40 setSelectionType(SelectionStyle.NONE); |
37 setShowHeaderContextMenu(false); | 41 setShowHeaderContextMenu(false); |
66 return v.toString(); | 70 return v.toString(); |
67 } | 71 } |
68 } | 72 } |
69 }); | 73 }); |
70 | 74 |
71 setFields(name, type, value); | 75 ListGridField select = new ListGridField("select", MESSAGE.selection()); |
76 select.setType(ListGridFieldType.ICON); | |
77 select.setWidth(70); | |
78 select.setCellIcon(baseUrl + MESSAGE.markerGreen()); | |
79 | |
80 setFields(select, name, type, value); | |
81 hideField("select"); | |
82 } | |
83 | |
84 public void showSelect() { | |
85 showField("select"); | |
86 } | |
87 | |
88 | |
89 /** | |
90 * Search all records for one with attribute name equals to given name. | |
91 * @return null if none found. | |
92 * */ | |
93 public Double findRecordValue(String name) { | |
94 for (ListGridRecord record : getRecords()) { | |
95 if (record.getAttribute("name").equals(name)) { | |
96 return record.getAttributeAsDouble("value"); | |
97 } | |
98 } | |
99 return null; | |
72 } | 100 } |
73 } | 101 } |
74 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : | 102 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : |