Mercurial > dive4elements > river
comparison flys-client/src/main/java/de/intevation/flys/client/client/ui/SelectProvider.java @ 49:d573ae975330
Some refactoring (imports, etc).
flys-client/trunk@1497 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Ingo Weinzierl <ingo.weinzierl@intevation.de> |
---|---|
date | Thu, 17 Mar 2011 11:39:27 +0000 |
parents | 7142386e86c2 |
children | a2923d63f530 |
comparison
equal
deleted
inserted
replaced
48:6e191588a295 | 49:d573ae975330 |
---|---|
1 package de.intevation.flys.client.client.ui; | 1 package de.intevation.flys.client.client.ui; |
2 | 2 |
3 import java.util.ArrayList; | |
4 import java.util.LinkedHashMap; | 3 import java.util.LinkedHashMap; |
5 import java.util.List; | |
6 | 4 |
7 import com.google.gwt.core.client.GWT; | 5 import com.google.gwt.core.client.GWT; |
8 | 6 |
9 import com.smartgwt.client.types.VerticalAlignment; | 7 import com.smartgwt.client.types.VerticalAlignment; |
10 import com.smartgwt.client.widgets.Canvas; | 8 import com.smartgwt.client.widgets.Canvas; |
11 import com.smartgwt.client.widgets.IButton; | 9 import com.smartgwt.client.widgets.IButton; |
12 import com.smartgwt.client.widgets.Label; | 10 import com.smartgwt.client.widgets.Label; |
13 import com.smartgwt.client.widgets.events.ClickEvent; | |
14 import com.smartgwt.client.widgets.events.ClickHandler; | |
15 import com.smartgwt.client.widgets.form.DynamicForm; | 11 import com.smartgwt.client.widgets.form.DynamicForm; |
16 import com.smartgwt.client.widgets.form.fields.ComboBoxItem; | 12 import com.smartgwt.client.widgets.form.fields.ComboBoxItem; |
17 import com.smartgwt.client.widgets.layout.HLayout; | 13 import com.smartgwt.client.widgets.layout.HLayout; |
18 import com.smartgwt.client.widgets.layout.VLayout; | 14 import com.smartgwt.client.widgets.layout.VLayout; |
19 | 15 |
21 import de.intevation.flys.client.shared.model.DataItem; | 17 import de.intevation.flys.client.shared.model.DataItem; |
22 import de.intevation.flys.client.shared.model.DefaultData; | 18 import de.intevation.flys.client.shared.model.DefaultData; |
23 import de.intevation.flys.client.shared.model.DefaultDataItem; | 19 import de.intevation.flys.client.shared.model.DefaultDataItem; |
24 | 20 |
25 import de.intevation.flys.client.client.FLYSMessages; | 21 import de.intevation.flys.client.client.FLYSMessages; |
26 import de.intevation.flys.client.client.event.HasStepForwardHandlers; | |
27 import de.intevation.flys.client.client.event.StepForwardEvent; | |
28 import de.intevation.flys.client.client.event.StepForwardHandler; | |
29 | 22 |
30 | 23 |
31 /** | 24 /** |
32 * This UIProvider displays the DataItems of the Data object in a combo box. | 25 * This UIProvider displays the DataItems of the Data object in a combo box. |
33 * | 26 * |
34 * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a> | 27 * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a> |
35 */ | 28 */ |
36 public class SelectProvider implements UIProvider, HasStepForwardHandlers, | 29 public class SelectProvider |
37 ClickHandler | 30 extends AbstractUIProvider |
38 { | 31 { |
39 /** The message class that provides i18n strings.*/ | 32 /** The message class that provides i18n strings.*/ |
40 protected FLYSMessages messages = GWT.create(FLYSMessages.class); | 33 protected FLYSMessages messages = GWT.create(FLYSMessages.class); |
41 | |
42 /** The StepForwardHandlers.*/ | |
43 protected List<StepForwardHandler> forwardHandlers; | |
44 | 34 |
45 /** The combobox.*/ | 35 /** The combobox.*/ |
46 protected ComboBoxItem combobox; | 36 protected ComboBoxItem combobox; |
47 | 37 |
48 /** The name of the data object.*/ | 38 /** The name of the data object.*/ |
49 protected String dataName; | 39 protected String dataName; |
50 | 40 |
51 | |
52 /** | |
53 * Creates a new UIProvider instance of this class. | |
54 */ | |
55 public SelectProvider() { | |
56 forwardHandlers = new ArrayList<StepForwardHandler>(); | |
57 } | |
58 | |
59 | |
60 public void addStepForwardHandler(StepForwardHandler handler) { | |
61 if (handler != null) { | |
62 forwardHandlers.add(handler); | |
63 } | |
64 } | |
65 | |
66 | |
67 /** | |
68 * This method is called after the user has clicked on the 'next' button to | |
69 * step to the next state. | |
70 * | |
71 * @param e The StepForwardEvent. | |
72 */ | |
73 protected void fireStepForwardEvent(StepForwardEvent e) { | |
74 GWT.log("SelectProvider - fireStepForwardEvent() handlers: " + forwardHandlers.size()); | |
75 for (StepForwardHandler handler: forwardHandlers) { | |
76 handler.onStepForward(e); | |
77 } | |
78 } | |
79 | |
80 public void onClick(ClickEvent e) { | |
81 Data[] data = getData(); | |
82 | |
83 SelectProvider.this.fireStepForwardEvent(new StepForwardEvent(data)); | |
84 } | |
85 | 41 |
86 /** | 42 /** |
87 * This method currently returns a | 43 * This method currently returns a |
88 * {@link com.smartgwt.client.widgets.form.DynamicForm} that contains all | 44 * {@link com.smartgwt.client.widgets.form.DynamicForm} that contains all |
89 * data items in a combobox stored in <i>data</i>. | 45 * data items in a combobox stored in <i>data</i>. |