comparison gwt-client/src/main/java/org/dive4elements/river/client/client/ui/uinfo/SuperVegZonesTablePanel.java @ 9069:1ffd38826175

access uinfo.vegetationzones+inundation_duration
author gernotbelger
date Tue, 15 May 2018 12:00:26 +0200
parents a5cf8d7bff3c
children
comparison
equal deleted inserted replaced
9068:a5cf8d7bff3c 9069:1ffd38826175
32 * @author Domenico Nardi Tironi 32 * @author Domenico Nardi Tironi
33 * 33 *
34 */ 34 */
35 public abstract class SuperVegZonesTablePanel extends AbstractUIProvider { 35 public abstract class SuperVegZonesTablePanel extends AbstractUIProvider {
36 private static final long serialVersionUID = 1L; 36 private static final long serialVersionUID = 1L;
37 public static final String tableCellSeparator = "tableCellSeparator"; 37 public static final String TABLE_CELL_SEPARATOR = "TABLE_CELL_SEPARATOR";
38 public static final String tableRowSeparator = "tableRowSeparator"; 38 public static final String TABLE_ROW_SEPARATOR = "TABLE_ROW_SEPARATOR";
39 39
40 protected static final String datakey = "vegzones"; 40 protected static final String datakey = "vegzones";
41 41
42 protected final ListGrid elements = new ListGrid(); 42 protected final ListGrid elements = new ListGrid();
43 protected TextItem vegzone; 43 protected TextItem vegzone;
115 115
116 protected final void addDataInit(final DataList data) { 116 protected final void addDataInit(final DataList data) {
117 for (final Data dataItemContainer : data.getAll()) { 117 for (final Data dataItemContainer : data.getAll()) {
118 if (dataItemContainer.getItems() != null) { 118 if (dataItemContainer.getItems() != null) {
119 for (final DataItem dataItem : dataItemContainer.getItems()) { 119 for (final DataItem dataItem : dataItemContainer.getItems()) {
120 if (dataItem.getStringValue() != null && dataItem.getStringValue().contains(tableRowSeparator)) { 120 if (dataItem.getStringValue() != null && dataItem.getStringValue().contains(TABLE_ROW_SEPARATOR)) {
121 121
122 final String[] rows = dataItem.getStringValue().split(tableRowSeparator); 122 final String[] rows = dataItem.getStringValue().split(TABLE_ROW_SEPARATOR);
123 for (final String row : rows) { 123 for (final String row : rows) {
124 this.elements.addData(createEntry(row)); 124 this.elements.addData(createEntry(row));
125 } 125 }
126 } 126 }
127 } 127 }
158 158
159 final List<Data> items = dataList.getAll(); 159 final List<Data> items = dataList.getAll();
160 final Data str = getData(items, datakey); 160 final Data str = getData(items, datakey);
161 final DataItem[] strItems = str.getItems(); 161 final DataItem[] strItems = str.getItems();
162 162
163 final String[] entries = strItems[0].getLabel().split(VegetationzonesTablePanel.tableRowSeparator); 163 final String[] entries = strItems[0].getLabel().split(VegetationzonesTablePanel.TABLE_ROW_SEPARATOR);
164 for (final String entry : entries) { 164 for (final String entry : entries) {
165 final String[] vals = entry.split(VegetationzonesTablePanel.tableCellSeparator); 165 final String[] vals = entry.split(VegetationzonesTablePanel.TABLE_CELL_SEPARATOR);
166 final Label dateLabel = new Label(vals[0] + " (" + vals[1] + "-" + vals[2] + ")"); 166 final Label dateLabel = new Label(vals[0] + " (" + vals[1] + "-" + vals[2] + ")");
167 dateLabel.setHeight(20); 167 dateLabel.setHeight(20);
168 vLayout.addMember(dateLabel); 168 vLayout.addMember(dateLabel);
169 } 169 }
170 final Canvas back = getBackButton(dataList.getState()); 170 final Canvas back = getBackButton(dataList.getState());
176 } 176 }
177 177
178 protected static final Data[] getDummyData() { 178 protected static final Data[] getDummyData() {
179 final List<Data> data = new ArrayList<Data>(); 179 final List<Data> data = new ArrayList<Data>();
180 String d = ""; 180 String d = "";
181 d = d + "Zonaler Wald" + tableCellSeparator + "0" + tableCellSeparator + "5" + tableRowSeparator; 181 // TODO: move to messages
182 d = d + "Hartholzaue, trocken" + tableCellSeparator + "5" + tableCellSeparator + "40" + tableRowSeparator; 182 d = d + "Zonaler Wald" + TABLE_CELL_SEPARATOR + "0" + TABLE_CELL_SEPARATOR + "5" + TABLE_ROW_SEPARATOR;
183 d = d + "Hartholzaue, feucht" + tableCellSeparator + "40" + tableCellSeparator + "80" + tableRowSeparator; 183 d = d + "Hartholzaue, trocken" + TABLE_CELL_SEPARATOR + "5" + TABLE_CELL_SEPARATOR + "40" + TABLE_ROW_SEPARATOR;
184 d = d + "Silberweidenwald" + tableCellSeparator + "80" + tableCellSeparator + "140" + tableRowSeparator; 184 d = d + "Hartholzaue, feucht" + TABLE_CELL_SEPARATOR + "40" + TABLE_CELL_SEPARATOR + "80" + TABLE_ROW_SEPARATOR;
185 d = d + "Weidengebüsch" + tableCellSeparator + "140" + tableCellSeparator + "200" + tableRowSeparator; 185 d = d + "Silberweidenwald" + TABLE_CELL_SEPARATOR + "80" + TABLE_CELL_SEPARATOR + "140" + TABLE_ROW_SEPARATOR;
186 d = d + "Uferröhricht" + tableCellSeparator + "200" + tableCellSeparator + "260" + tableRowSeparator; 186 d = d + "Weidengebüsch" + TABLE_CELL_SEPARATOR + "140" + TABLE_CELL_SEPARATOR + "200" + TABLE_ROW_SEPARATOR;
187 d = d + "Uferpioniere" + tableCellSeparator + "260" + tableCellSeparator + "320" + tableRowSeparator; 187 d = d + "Uferröhricht" + TABLE_CELL_SEPARATOR + "200" + TABLE_CELL_SEPARATOR + "260" + TABLE_ROW_SEPARATOR;
188 d = d + "Vegetationslos" + tableCellSeparator + "320" + tableCellSeparator + "365" + tableRowSeparator; 188 d = d + "Uferpioniere" + TABLE_CELL_SEPARATOR + "260" + TABLE_CELL_SEPARATOR + "320" + TABLE_ROW_SEPARATOR;
189 d = d + "Wasserfläche" + tableCellSeparator + "365" + tableCellSeparator + "365" + tableRowSeparator; 189 d = d + "Vegetationslos" + TABLE_CELL_SEPARATOR + "320" + TABLE_CELL_SEPARATOR + "365" + TABLE_ROW_SEPARATOR;
190 d = d + "Wasserfläche" + TABLE_CELL_SEPARATOR + "365" + TABLE_CELL_SEPARATOR + "365" + TABLE_ROW_SEPARATOR;
190 191
191 final DataItem item = new DefaultDataItem(datakey, "entryDescription", d); // DATA-key 192 final DataItem item = new DefaultDataItem(datakey, "entryDescription", d); // DATA-key
192 data.add(new DefaultData(datakey, null, null, new DataItem[] { item })); 193 data.add(new DefaultData(datakey, null, null, new DataItem[] { item }));
193 return data.toArray(new Data[data.size()]); 194 return data.toArray(new Data[data.size()]);
194 } 195 }
202 return getDummyData();// new Data[0]; // return getDummyData(); 203 return getDummyData();// new Data[0]; // return getDummyData();
203 } 204 }
204 String d = ""; 205 String d = "";
205 for (final ListGridRecord element : lgr) { 206 for (final ListGridRecord element : lgr) {
206 final Record r = element; 207 final Record r = element;
207 d += r.getAttribute("vegzone") + VegetationzonesTablePanel.tableCellSeparator + r.getAttribute("from") 208 d += r.getAttribute("vegzone") + VegetationzonesTablePanel.TABLE_CELL_SEPARATOR + r.getAttribute("from")
208 + VegetationzonesTablePanel.tableCellSeparator + r.getAttribute("to"); 209 + VegetationzonesTablePanel.TABLE_CELL_SEPARATOR + r.getAttribute("to");
209 d += VegetationzonesTablePanel.tableRowSeparator; 210 d += VegetationzonesTablePanel.TABLE_ROW_SEPARATOR;
210 } 211 }
211 212
212 final DataItem item = new DefaultDataItem(datakey, null, d); // DATA-key 213 final DataItem item = new DefaultDataItem(datakey, null, d); // DATA-key
213 data.add(new DefaultData(datakey, null, null, new DataItem[] { item })); 214 data.add(new DefaultData(datakey, null, null, new DataItem[] { item }));
214 return data.toArray(new Data[data.size()]); 215 return data.toArray(new Data[data.size()]);
215 } 216 }
216 217
217 public final ListGridRecord createEntry(final String row) { 218 public final ListGridRecord createEntry(final String row) {
218 219
219 if (row.contains(tableCellSeparator)) { 220 if (row.contains(TABLE_CELL_SEPARATOR)) {
220 221
221 final String[] vals = row.split(tableCellSeparator); 222 final String[] vals = row.split(TABLE_CELL_SEPARATOR);
222 if (vals.length == 3) { 223 if (vals.length == 3) {
223 final String vegzone = vals[0]; 224 final String vegzone = vals[0];
224 final String from = vals[1]; 225 final String from = vals[1];
225 final String to = vals[2]; 226 final String to = vals[2];
226 227

http://dive4elements.wald.intevation.org