Mercurial > dive4elements > river
annotate gwt-client/src/main/java/org/dive4elements/river/client/client/ui/uinfo/VegetationzonesTableEditPanel.java @ 9559:ba0561906f81
Uinfo inundation duration workflow (vegetation zones, scenario), wms-config changed
author | gernotbelger |
---|---|
date | Wed, 24 Oct 2018 18:40:38 +0200 |
parents | d421c2bf0195 |
children | 8cf2968dd4f9 |
rev | line source |
---|---|
9064 | 1 /* Copyright (C) 2011, 2012, 2013 by Bundesanstalt für Gewässerkunde |
2 * Software engineering by Intevation GmbH | |
3 * | |
4 * This file is Free Software under the GNU AGPL (>=v3) | |
5 * and comes with ABSOLUTELY NO WARRANTY! Check out the | |
6 * documentation coming with Dive4Elements River for details. | |
7 */ | |
8 | |
9 package org.dive4elements.river.client.client.ui.uinfo; | |
10 | |
9066 | 11 import org.dive4elements.river.client.client.ui.PanelHelper; |
9064 | 12 import org.dive4elements.river.client.shared.model.DataList; |
13 | |
9261 | 14 import com.google.gwt.event.dom.client.ClickEvent; |
15 import com.google.gwt.event.dom.client.ClickHandler; | |
16 import com.google.gwt.user.client.ui.Button; | |
9107 | 17 import com.smartgwt.client.util.SC; |
9299 | 18 import com.smartgwt.client.widgets.Canvas; |
9064 | 19 import com.smartgwt.client.widgets.form.DynamicForm; |
9261 | 20 import com.smartgwt.client.widgets.form.fields.ColorItem; |
9107 | 21 import com.smartgwt.client.widgets.form.fields.TextItem; |
22 import com.smartgwt.client.widgets.grid.ListGrid; | |
9064 | 23 import com.smartgwt.client.widgets.grid.ListGridRecord; |
9107 | 24 import com.smartgwt.client.widgets.layout.Layout; |
9108 | 25 import com.smartgwt.client.widgets.layout.VLayout; |
9064 | 26 |
9070
611a523fc42f
VegetationZoneAccessHelper, VegetationTablePanels verbessert
gernotbelger
parents:
9069
diff
changeset
|
27 public class VegetationzonesTableEditPanel extends AbstractVegZonesTablePanel { |
9064 | 28 private static final long serialVersionUID = 1L; |
29 | |
9107 | 30 private TextItem vegzone; |
31 | |
32 private TextItem start; | |
33 | |
34 private TextItem end; | |
35 | |
9068
a5cf8d7bff3c
access uinfo.salx; tablePanel edit/non-edit merge
gernotbelger
parents:
9066
diff
changeset
|
36 @Override |
9107 | 37 public void createWidget(final Layout root, final DataList data) { |
38 | |
9261 | 39 final ListGrid elements = super.createTable(root, data, "420", true); |
9107 | 40 |
9261 | 41 this.vegzone = PanelHelper.createItem("uinfo_vegetation_zone_label", this.MSG.uinfo_vegetation_zone_label(), "*"); |
9108 | 42 this.vegzone.setColSpan(4); |
9118
431f1c269be5
Veg-Zone Table improved, State change data recovery;
gernotbelger
parents:
9114
diff
changeset
|
43 this.start = PanelHelper.createIntegerItem("uinfo_vegetation_zones_from", this.MSG.uinfo_vegetation_zones_from(), "*"); |
431f1c269be5
Veg-Zone Table improved, State change data recovery;
gernotbelger
parents:
9114
diff
changeset
|
44 this.end = PanelHelper.createIntegerItem("uinfo_vegetation_zones_to", this.MSG.uinfo_vegetation_zones_to(), "*"); |
9108 | 45 final VLayout fields = new VLayout(); |
9064 | 46 |
9261 | 47 final ColorItem colorPicker = new ColorItem(); |
48 colorPicker.setTitle(this.MSG.uinfo_vegetation_zone_color()); | |
49 | |
50 colorPicker.setShowTitle(true); | |
51 colorPicker.setShowValueIconOnly(false); | |
52 colorPicker.setShowPickerIcon(true); | |
53 colorPicker.setColSpan(2); | |
54 colorPicker.setWidth(110); | |
55 | |
9064 | 56 final Button add = new Button(this.MSG.add_date()); // TODO: make key more generic or change to more specific |
9068
a5cf8d7bff3c
access uinfo.salx; tablePanel edit/non-edit merge
gernotbelger
parents:
9066
diff
changeset
|
57 |
9064 | 58 final DynamicForm form1 = new DynamicForm(); |
9118
431f1c269be5
Veg-Zone Table improved, State change data recovery;
gernotbelger
parents:
9114
diff
changeset
|
59 |
9108 | 60 form1.setNumCols(4); // für Layout untereinander muss 2 eingestellt werden |
9523 | 61 form1.setFields(this.vegzone, this.start, this.end, colorPicker); |
9064 | 62 |
63 add.addClickHandler(new ClickHandler() { | |
64 @Override | |
65 public void onClick(final ClickEvent ce) { | |
66 | |
9523 | 67 handleAddClicked(elements, colorPicker); |
9064 | 68 } |
69 }); | |
70 | |
71 fields.addMember(form1); | |
9107 | 72 root.addMember(fields); |
73 root.addMember(PanelHelper.getSpacer(10)); | |
74 root.addMember(add); | |
9299 | 75 } |
9261 | 76 |
9523 | 77 protected void handleAddClicked(final ListGrid elements, final ColorItem colorPicker) { |
78 final String v1 = VegetationzonesTableEditPanel.this.start.getValueAsString(); | |
79 final String v2 = VegetationzonesTableEditPanel.this.end.getValueAsString(); | |
80 final String v3 = VegetationzonesTableEditPanel.this.vegzone.getValueAsString(); | |
81 final String v4 = colorPicker.getValueAsString(); | |
82 | |
83 final String message = validate(v1, v2, v3, v4); | |
84 if (message != null) { | |
85 SC.warn(message); | |
86 return; | |
87 } | |
88 | |
89 final ListGridRecord r = new ListGridRecord(); | |
90 r.setAttribute("vegzone", v3); | |
91 r.setAttribute("from", v1); | |
92 r.setAttribute("to", v2); | |
93 r.setAttribute("color", v4); | |
94 elements.addData(r); | |
95 updateValidationMsgLabel(); | |
96 final String sortField = elements.getSortField(); | |
97 if (sortField != null) { | |
98 elements.toggleSort(sortField); | |
99 elements.toggleSort(sortField); // HACK. has to be. otherwise normalizer won't be called :-( | |
100 } | |
101 } | |
102 | |
9299 | 103 @Override |
104 protected Canvas createHelper(final DataList data) { | |
105 return null; | |
9064 | 106 } |
9107 | 107 } |