Mercurial > dive4elements > river
comparison flys-client/src/main/java/de/intevation/flys/client/client/ui/fixation/FixMultiPeriodPanel.java @ 3835:11d74b9d428a
i18n (#872)
flys-client/trunk@5541 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Christian Lins <christian.lins@intevation.de> |
---|---|
date | Thu, 20 Sep 2012 14:17:21 +0000 |
parents | 0de61fc9d281 |
children |
comparison
equal
deleted
inserted
replaced
3834:52109c4bc5de | 3835:11d74b9d428a |
---|---|
1 package de.intevation.flys.client.client.ui.fixation; | 1 package de.intevation.flys.client.client.ui.fixation; |
2 | |
3 import java.util.List; | |
4 import java.util.ArrayList; | |
5 import java.util.Date; | |
6 | 2 |
7 import com.google.gwt.core.client.GWT; | 3 import com.google.gwt.core.client.GWT; |
8 import com.google.gwt.i18n.client.DateTimeFormat; | 4 import com.google.gwt.i18n.client.DateTimeFormat; |
9 | 5 |
10 import com.smartgwt.client.data.Record; | 6 import com.smartgwt.client.types.ListGridFieldType; |
11 | 7 import com.smartgwt.client.widgets.Button; |
12 import com.smartgwt.client.widgets.Canvas; | 8 import com.smartgwt.client.widgets.Canvas; |
13 import com.smartgwt.client.widgets.Label; | 9 import com.smartgwt.client.widgets.Label; |
14 import com.smartgwt.client.widgets.Button; | |
15 import com.smartgwt.client.widgets.events.ClickEvent; | 10 import com.smartgwt.client.widgets.events.ClickEvent; |
16 import com.smartgwt.client.widgets.events.ClickHandler; | 11 import com.smartgwt.client.widgets.events.ClickHandler; |
17 | |
18 import com.smartgwt.client.widgets.grid.ListGrid; | 12 import com.smartgwt.client.widgets.grid.ListGrid; |
19 import com.smartgwt.client.widgets.grid.ListGridField; | 13 import com.smartgwt.client.widgets.grid.ListGridField; |
20 import com.smartgwt.client.widgets.grid.ListGridRecord; | 14 import com.smartgwt.client.widgets.grid.ListGridRecord; |
21 | 15 import com.smartgwt.client.widgets.grid.events.RecordClickEvent; |
16 import com.smartgwt.client.widgets.grid.events.RecordClickHandler; | |
22 import com.smartgwt.client.widgets.layout.HLayout; | 17 import com.smartgwt.client.widgets.layout.HLayout; |
23 import com.smartgwt.client.widgets.layout.VLayout; | 18 import com.smartgwt.client.widgets.layout.VLayout; |
24 | 19 |
25 import com.smartgwt.client.types.ListGridFieldType; | 20 import de.intevation.flys.client.client.FLYSConstants; |
26 | |
27 import com.smartgwt.client.widgets.grid.events.RecordClickEvent; | |
28 import com.smartgwt.client.widgets.grid.events.RecordClickHandler; | |
29 | |
30 import de.intevation.flys.client.shared.model.Data; | 21 import de.intevation.flys.client.shared.model.Data; |
31 import de.intevation.flys.client.shared.model.DataItem; | 22 import de.intevation.flys.client.shared.model.DataItem; |
32 import de.intevation.flys.client.shared.model.DataList; | 23 import de.intevation.flys.client.shared.model.DataList; |
33 import de.intevation.flys.client.shared.model.DefaultData; | 24 import de.intevation.flys.client.shared.model.DefaultData; |
34 import de.intevation.flys.client.shared.model.DefaultDataItem; | 25 import de.intevation.flys.client.shared.model.DefaultDataItem; |
26 | |
27 import java.util.ArrayList; | |
28 import java.util.Date; | |
29 import java.util.List; | |
35 | 30 |
36 /** | 31 /** |
37 * This UIProvider creates a panel for location or distance input. | 32 * This UIProvider creates a panel for location or distance input. |
38 * | 33 * |
39 * @author <a href="mailto:raimund.renkert@intevation.de">Raimund Renkert</a> | 34 * @author <a href="mailto:raimund.renkert@intevation.de">Raimund Renkert</a> |
40 */ | 35 */ |
41 public class FixMultiPeriodPanel | 36 public class FixMultiPeriodPanel |
42 extends FixPeriodPanel | 37 extends FixPeriodPanel |
43 { | 38 { |
39 /** The message class that provides i18n strings. */ | |
40 protected FLYSConstants MESSAGES = GWT.create(FLYSConstants.class); | |
44 | 41 |
45 protected ListGrid elements; | 42 protected ListGrid elements; |
46 | 43 |
47 protected String values; | 44 protected String values; |
48 | 45 |
52 | 49 |
53 public FixMultiPeriodPanel(String startName, String endName) { | 50 public FixMultiPeriodPanel(String startName, String endName) { |
54 super(startName, endName); | 51 super(startName, endName); |
55 } | 52 } |
56 | 53 |
54 @Override | |
57 public Canvas createWidget(DataList data) { | 55 public Canvas createWidget(DataList data) { |
58 HLayout input = new HLayout(); | 56 HLayout input = new HLayout(); |
59 VLayout root = new VLayout(); | 57 VLayout root = new VLayout(); |
60 VLayout grid = new VLayout(); | 58 VLayout grid = new VLayout(); |
61 VLayout layout = (VLayout) super.createWidget(data); | 59 VLayout layout = (VLayout) super.createWidget(data); |
62 Button add = new Button("Add"); | 60 Button add = new Button(MESSAGES.add()); |
63 elements = new ListGrid(); | 61 elements = new ListGrid(); |
64 | 62 |
65 add.addClickHandler(new ClickHandler() { | 63 add.addClickHandler(new ClickHandler() { |
66 public void onClick(ClickEvent ce) { | 64 public void onClick(ClickEvent ce) { |
67 Date f = inputPanel.getFromDate(); | 65 Date f = inputPanel.getFromDate(); |
167 /** | 165 /** |
168 * This method returns the selected data. | 166 * This method returns the selected data. |
169 * | 167 * |
170 * @return the selected/inserted data. | 168 * @return the selected/inserted data. |
171 */ | 169 */ |
170 @Override | |
172 public Data[] getData() { | 171 public Data[] getData() { |
173 List<Data> data = new ArrayList<Data>(); | 172 List<Data> data = new ArrayList<Data>(); |
174 | 173 |
175 boolean valid = saveDateValues(); | 174 boolean valid = saveDateValues(); |
176 if(valid) { | 175 if(valid) { |
183 } | 182 } |
184 return data.toArray(new Data[data.size()]); | 183 return data.toArray(new Data[data.size()]); |
185 } | 184 } |
186 | 185 |
187 | 186 |
187 @Override | |
188 protected boolean saveDateValues() { | 188 protected boolean saveDateValues() { |
189 ListGridRecord[] lgr = elements.getRecords(); | 189 ListGridRecord[] lgr = elements.getRecords(); |
190 if (lgr.length == 0) { | 190 if (lgr.length == 0) { |
191 return false; | 191 return false; |
192 } | 192 } |