Mercurial > dive4elements > river
comparison gwt-client/src/main/java/org/dive4elements/river/client/client/ui/ModuleSelection.java @ 5928:34392dc16546
Implemented interaction design in project startup page.
author | Raimund Renkert <rrenkert@intevation.de> |
---|---|
date | Wed, 08 May 2013 16:34:45 +0200 |
parents | 172338b1407f |
children | 59afa245549b |
comparison
equal
deleted
inserted
replaced
5927:d53e39372a25 | 5928:34392dc16546 |
---|---|
14 import com.smartgwt.client.types.VerticalAlignment; | 14 import com.smartgwt.client.types.VerticalAlignment; |
15 import com.smartgwt.client.util.SC; | 15 import com.smartgwt.client.util.SC; |
16 import com.smartgwt.client.widgets.Canvas; | 16 import com.smartgwt.client.widgets.Canvas; |
17 import com.smartgwt.client.widgets.Label; | 17 import com.smartgwt.client.widgets.Label; |
18 import com.smartgwt.client.widgets.form.DynamicForm; | 18 import com.smartgwt.client.widgets.form.DynamicForm; |
19 import com.smartgwt.client.widgets.form.fields.LinkItem; | |
19 import com.smartgwt.client.widgets.form.fields.RadioGroupItem; | 20 import com.smartgwt.client.widgets.form.fields.RadioGroupItem; |
21 import com.smartgwt.client.widgets.form.fields.events.ChangeEvent; | |
22 import com.smartgwt.client.widgets.form.fields.events.ChangeHandler; | |
20 import com.smartgwt.client.widgets.layout.HLayout; | 23 import com.smartgwt.client.widgets.layout.HLayout; |
21 import com.smartgwt.client.widgets.layout.VLayout; | 24 import com.smartgwt.client.widgets.layout.VLayout; |
22 | 25 |
23 import org.dive4elements.river.client.client.Config; | 26 import org.dive4elements.river.client.client.Config; |
24 import org.dive4elements.river.client.client.FLYSConstants; | 27 import org.dive4elements.river.client.client.FLYSConstants; |
29 import org.dive4elements.river.client.shared.model.DataList; | 32 import org.dive4elements.river.client.shared.model.DataList; |
30 import org.dive4elements.river.client.shared.model.DefaultData; | 33 import org.dive4elements.river.client.shared.model.DefaultData; |
31 import org.dive4elements.river.client.shared.model.DefaultDataItem; | 34 import org.dive4elements.river.client.shared.model.DefaultDataItem; |
32 import org.dive4elements.river.client.shared.model.Module; | 35 import org.dive4elements.river.client.shared.model.Module; |
33 | 36 |
37 import java.util.ArrayList; | |
34 import java.util.LinkedHashMap; | 38 import java.util.LinkedHashMap; |
39 import java.util.List; | |
40 import java.util.Map; | |
35 | 41 |
36 /** | 42 /** |
37 * The ModuleSelection combines the river selection and the module selection in | 43 * The ModuleSelection combines the river selection and the module selection in |
38 * one widget. It will display a vertical splitted widget - the upper part will | 44 * one widget. It will display a vertical splitted widget - the upper part will |
39 * render checkboxes for each module, the lower one will display a combobox at | 45 * render checkboxes for each module, the lower one will display a combobox at |
55 protected Module[] modules; | 61 protected Module[] modules; |
56 | 62 |
57 /** The ModuleService used to retrieve the available modules of a user.*/ | 63 /** The ModuleService used to retrieve the available modules of a user.*/ |
58 protected ModuleServiceAsync moduleService = GWT.create(ModuleService.class); | 64 protected ModuleServiceAsync moduleService = GWT.create(ModuleService.class); |
59 | 65 |
66 private List<String> fixRivers; | |
67 private List<String> minfoRivers; | |
68 protected Map<String, LinkItem> rivers; | |
60 | 69 |
61 /** | 70 /** |
62 * The default constructor. | 71 * The default constructor. |
63 */ | 72 */ |
64 public ModuleSelection() { | 73 public ModuleSelection() { |
74 rivers = null; | |
75 //TODO: put all the rivers into a config file, or something. | |
76 fixRivers = new ArrayList<String>(); | |
77 fixRivers.add("Rhein"); | |
78 fixRivers.add("Elbe"); | |
79 fixRivers.add("Donau"); | |
80 | |
81 minfoRivers = new ArrayList<String>(); | |
82 minfoRivers.add("Elbe"); | |
83 minfoRivers.add("Rhein"); | |
84 minfoRivers.add("Oder"); | |
85 | |
65 readModules(); | 86 readModules(); |
66 } | 87 } |
67 | 88 |
68 | 89 |
69 /** | 90 /** |
139 | 160 |
140 Label label = new Label(MESSAGES.module_selection()); | 161 Label label = new Label(MESSAGES.module_selection()); |
141 DynamicForm form = new DynamicForm(); | 162 DynamicForm form = new DynamicForm(); |
142 | 163 |
143 radio = new RadioGroupItem("plugin"); | 164 radio = new RadioGroupItem("plugin"); |
165 radio.addChangeHandler(new ChangeHandler() { | |
166 @Override | |
167 public void onChange(ChangeEvent event) { | |
168 String selected = (String)event.getValue(); | |
169 if (!rivers.isEmpty()) { | |
170 for (Map.Entry<String, LinkItem> s: rivers.entrySet()) { | |
171 if (selected.equals("minfo") && !minfoRivers.contains(s.getKey())) { | |
172 s.getValue().hide(); | |
173 } | |
174 else if (selected.equals("fixanalysis") && !fixRivers.contains(s.getKey())) { | |
175 s.getValue().hide(); | |
176 } | |
177 else { | |
178 s.getValue().show(); | |
179 s.getValue().setCellStyle("formCell"); | |
180 } | |
181 callUnHighlightRiver(s.getKey()); | |
182 } | |
183 } | |
184 } | |
185 }); | |
144 | 186 |
145 label.setWidth(50); | 187 label.setWidth(50); |
146 label.setHeight(25); | 188 label.setHeight(25); |
147 | 189 |
148 | 190 |
178 | 220 |
179 Data data = new DefaultData("module", null, null, items); | 221 Data data = new DefaultData("module", null, null, items); |
180 | 222 |
181 return new Data[] {data}; | 223 return new Data[] {data}; |
182 } | 224 } |
225 | |
226 public void setRivers(Map<String, LinkItem> rivers) { | |
227 this.rivers = rivers; | |
228 } | |
229 | |
230 private native void callUnHighlightRiver(String name) /*-{ | |
231 $wnd.unHighlight(name); | |
232 }-*/; | |
183 } | 233 } |
184 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : | 234 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : |