Mercurial > dive4elements > river
annotate gwt-client/src/main/java/org/dive4elements/river/client/client/ui/uinfo/VegetationzonesTableEditPanel.java @ 9299:4a6cc7c6716a
uinfo.inundation_duration veg'zone select
author | gernotbelger |
---|---|
date | Wed, 25 Jul 2018 14:42:44 +0200 |
parents | 22a3999fd536 |
children | 6a7758923762 |
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; |
9261 | 13 import org.dive4elements.river.client.shared.model.VegetationZone; |
9064 | 14 |
9261 | 15 import com.google.gwt.event.dom.client.ClickEvent; |
16 import com.google.gwt.event.dom.client.ClickHandler; | |
17 import com.google.gwt.user.client.ui.Button; | |
9107 | 18 import com.smartgwt.client.util.SC; |
9299 | 19 import com.smartgwt.client.widgets.Canvas; |
9064 | 20 import com.smartgwt.client.widgets.form.DynamicForm; |
9261 | 21 import com.smartgwt.client.widgets.form.fields.ColorItem; |
9107 | 22 import com.smartgwt.client.widgets.form.fields.TextItem; |
23 import com.smartgwt.client.widgets.grid.ListGrid; | |
9064 | 24 import com.smartgwt.client.widgets.grid.ListGridRecord; |
9107 | 25 import com.smartgwt.client.widgets.layout.Layout; |
9108 | 26 import com.smartgwt.client.widgets.layout.VLayout; |
9064 | 27 |
9070
611a523fc42f
VegetationZoneAccessHelper, VegetationTablePanels verbessert
gernotbelger
parents:
9069
diff
changeset
|
28 public class VegetationzonesTableEditPanel extends AbstractVegZonesTablePanel { |
9064 | 29 private static final long serialVersionUID = 1L; |
30 | |
9107 | 31 private TextItem vegzone; |
32 | |
33 private TextItem start; | |
34 | |
35 private TextItem end; | |
36 | |
9068
a5cf8d7bff3c
access uinfo.salx; tablePanel edit/non-edit merge
gernotbelger
parents:
9066
diff
changeset
|
37 @Override |
9107 | 38 public void createWidget(final Layout root, final DataList data) { |
39 | |
9261 | 40 final ListGrid elements = super.createTable(root, data, "420", true); |
9107 | 41 |
9261 | 42 this.vegzone = PanelHelper.createItem("uinfo_vegetation_zone_label", this.MSG.uinfo_vegetation_zone_label(), "*"); |
9108 | 43 this.vegzone.setColSpan(4); |
9118
431f1c269be5
Veg-Zone Table improved, State change data recovery;
gernotbelger
parents:
9114
diff
changeset
|
44 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
|
45 this.end = PanelHelper.createIntegerItem("uinfo_vegetation_zones_to", this.MSG.uinfo_vegetation_zones_to(), "*"); |
9108 | 46 final VLayout fields = new VLayout(); |
9064 | 47 |
9261 | 48 final ColorItem colorPicker = new ColorItem(); |
49 colorPicker.setTitle(this.MSG.uinfo_vegetation_zone_color()); | |
50 | |
51 colorPicker.setShowTitle(true); | |
52 colorPicker.setShowValueIconOnly(false); | |
53 colorPicker.setShowPickerIcon(true); | |
54 colorPicker.setColSpan(2); | |
55 colorPicker.setWidth(110); | |
56 | |
9064 | 57 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
|
58 |
9064 | 59 final DynamicForm form1 = new DynamicForm(); |
9118
431f1c269be5
Veg-Zone Table improved, State change data recovery;
gernotbelger
parents:
9114
diff
changeset
|
60 |
9108 | 61 form1.setNumCols(4); // für Layout untereinander muss 2 eingestellt werden |
9261 | 62 if (VegetationZone.HAS_COLORS_EDITABLE) |
63 form1.setFields(this.vegzone, this.start, this.end, colorPicker); | |
64 else | |
65 form1.setFields(this.vegzone, this.start, this.end); | |
9064 | 66 |
67 add.addClickHandler(new ClickHandler() { | |
68 @Override | |
69 public void onClick(final ClickEvent ce) { | |
9066 | 70 final String v1 = VegetationzonesTableEditPanel.this.start.getValueAsString(); |
71 final String v2 = VegetationzonesTableEditPanel.this.end.getValueAsString(); | |
72 final String v3 = VegetationzonesTableEditPanel.this.vegzone.getValueAsString(); | |
9261 | 73 final String v4 = VegetationZone.HAS_COLORS_EDITABLE ? colorPicker.getValueAsString() : "#ffffff"; |
74 final String message = validate(v1, v2, v3, v4); | |
9107 | 75 if (message != null) { |
76 SC.warn(message); | |
9069
1ffd38826175
access uinfo.vegetationzones+inundation_duration
gernotbelger
parents:
9068
diff
changeset
|
77 return; |
1ffd38826175
access uinfo.vegetationzones+inundation_duration
gernotbelger
parents:
9068
diff
changeset
|
78 } |
9064 | 79 |
80 final ListGridRecord r = new ListGridRecord(); | |
81 r.setAttribute("vegzone", v3); | |
82 r.setAttribute("from", v1); | |
83 r.setAttribute("to", v2); | |
9261 | 84 r.setAttribute("color", v4); |
9107 | 85 elements.addData(r); |
9299 | 86 updateValidationMsgLabel(); |
9114 | 87 final String sortField = elements.getSortField(); |
88 if (sortField != null) { | |
89 elements.toggleSort(sortField); | |
90 elements.toggleSort(sortField); // HACK. has to be. otherwise normalizer won't be called :-( | |
91 } | |
9064 | 92 } |
93 }); | |
94 | |
95 fields.addMember(form1); | |
9107 | 96 root.addMember(fields); |
97 root.addMember(PanelHelper.getSpacer(10)); | |
98 root.addMember(add); | |
9299 | 99 } |
9261 | 100 |
9299 | 101 @Override |
102 protected Canvas createHelper(final DataList data) { | |
103 return null; | |
9064 | 104 } |
105 | |
9107 | 106 } |