annotate flys-client/src/main/java/de/intevation/flys/client/client/ui/ModuleSelection.java @ 5815:2aabd9752d5e interaktive-karte

Initial interaction model for riverselection on image map.
author Raimund Renkert <rrenkert@intevation.de>
date Wed, 24 Apr 2013 15:14:56 +0200
parents 360e22afb98b
children
rev   line source
30
5709bd8f4d7c Added a new widget that combines the module and the river selection. Users can now choose the desired plugin and river in one step.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
1 package de.intevation.flys.client.client.ui;
5709bd8f4d7c Added a new widget that combines the module and the river selection. Users can now choose the desired plugin and river in one step.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
2
5709bd8f4d7c Added a new widget that combines the module and the river selection. Users can now choose the desired plugin and river in one step.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
3 import com.google.gwt.core.client.GWT;
3518
33ed40aa1201 User ModuleService to get all modules for a user
Bjoern Ricks <bjoern.ricks@intevation.de>
parents: 2522
diff changeset
4 import com.google.gwt.user.client.rpc.AsyncCallback;
30
5709bd8f4d7c Added a new widget that combines the module and the river selection. Users can now choose the desired plugin and river in one step.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
5
83
4784ca718476 Improved the positioning of helper widgets and some layout specific stuff.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 57
diff changeset
6 import com.smartgwt.client.types.VerticalAlignment;
3518
33ed40aa1201 User ModuleService to get all modules for a user
Bjoern Ricks <bjoern.ricks@intevation.de>
parents: 2522
diff changeset
7 import com.smartgwt.client.util.SC;
30
5709bd8f4d7c Added a new widget that combines the module and the river selection. Users can now choose the desired plugin and river in one step.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
8 import com.smartgwt.client.widgets.Canvas;
5709bd8f4d7c Added a new widget that combines the module and the river selection. Users can now choose the desired plugin and river in one step.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
9 import com.smartgwt.client.widgets.Label;
5709bd8f4d7c Added a new widget that combines the module and the river selection. Users can now choose the desired plugin and river in one step.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
10 import com.smartgwt.client.widgets.form.DynamicForm;
5815
2aabd9752d5e Initial interaction model for riverselection on image map.
Raimund Renkert <rrenkert@intevation.de>
parents: 4131
diff changeset
11 import com.smartgwt.client.widgets.form.fields.LinkItem;
30
5709bd8f4d7c Added a new widget that combines the module and the river selection. Users can now choose the desired plugin and river in one step.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
12 import com.smartgwt.client.widgets.form.fields.RadioGroupItem;
5815
2aabd9752d5e Initial interaction model for riverselection on image map.
Raimund Renkert <rrenkert@intevation.de>
parents: 4131
diff changeset
13 import com.smartgwt.client.widgets.form.fields.events.ChangeEvent;
2aabd9752d5e Initial interaction model for riverselection on image map.
Raimund Renkert <rrenkert@intevation.de>
parents: 4131
diff changeset
14 import com.smartgwt.client.widgets.form.fields.events.ChangeHandler;
30
5709bd8f4d7c Added a new widget that combines the module and the river selection. Users can now choose the desired plugin and river in one step.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
15 import com.smartgwt.client.widgets.layout.HLayout;
5709bd8f4d7c Added a new widget that combines the module and the river selection. Users can now choose the desired plugin and river in one step.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
16 import com.smartgwt.client.widgets.layout.VLayout;
5709bd8f4d7c Added a new widget that combines the module and the river selection. Users can now choose the desired plugin and river in one step.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
17
4131
360e22afb98b Cosmetics, warnings and minor TODOs.
Christian Lins <christian.lins@intevation.de>
parents: 3530
diff changeset
18 import de.intevation.flys.client.client.Config;
360e22afb98b Cosmetics, warnings and minor TODOs.
Christian Lins <christian.lins@intevation.de>
parents: 3530
diff changeset
19 import de.intevation.flys.client.client.FLYSConstants;
3518
33ed40aa1201 User ModuleService to get all modules for a user
Bjoern Ricks <bjoern.ricks@intevation.de>
parents: 2522
diff changeset
20 import de.intevation.flys.client.client.services.ModuleService;
33ed40aa1201 User ModuleService to get all modules for a user
Bjoern Ricks <bjoern.ricks@intevation.de>
parents: 2522
diff changeset
21 import de.intevation.flys.client.client.services.ModuleServiceAsync;
30
5709bd8f4d7c Added a new widget that combines the module and the river selection. Users can now choose the desired plugin and river in one step.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
22 import de.intevation.flys.client.shared.model.Data;
5709bd8f4d7c Added a new widget that combines the module and the river selection. Users can now choose the desired plugin and river in one step.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
23 import de.intevation.flys.client.shared.model.DataItem;
51
a2923d63f530 Introduced a data structure DataList to manage to list of Data objects of a single state.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 45
diff changeset
24 import de.intevation.flys.client.shared.model.DataList;
30
5709bd8f4d7c Added a new widget that combines the module and the river selection. Users can now choose the desired plugin and river in one step.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
25 import de.intevation.flys.client.shared.model.DefaultData;
5709bd8f4d7c Added a new widget that combines the module and the river selection. Users can now choose the desired plugin and river in one step.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
26 import de.intevation.flys.client.shared.model.DefaultDataItem;
3518
33ed40aa1201 User ModuleService to get all modules for a user
Bjoern Ricks <bjoern.ricks@intevation.de>
parents: 2522
diff changeset
27 import de.intevation.flys.client.shared.model.Module;
30
5709bd8f4d7c Added a new widget that combines the module and the river selection. Users can now choose the desired plugin and river in one step.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
28
5815
2aabd9752d5e Initial interaction model for riverselection on image map.
Raimund Renkert <rrenkert@intevation.de>
parents: 4131
diff changeset
29 import java.util.ArrayList;
4131
360e22afb98b Cosmetics, warnings and minor TODOs.
Christian Lins <christian.lins@intevation.de>
parents: 3530
diff changeset
30 import java.util.LinkedHashMap;
5815
2aabd9752d5e Initial interaction model for riverselection on image map.
Raimund Renkert <rrenkert@intevation.de>
parents: 4131
diff changeset
31 import java.util.List;
2aabd9752d5e Initial interaction model for riverselection on image map.
Raimund Renkert <rrenkert@intevation.de>
parents: 4131
diff changeset
32 import java.util.Map;
30
5709bd8f4d7c Added a new widget that combines the module and the river selection. Users can now choose the desired plugin and river in one step.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
33
5709bd8f4d7c Added a new widget that combines the module and the river selection. Users can now choose the desired plugin and river in one step.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
34 /**
5709bd8f4d7c Added a new widget that combines the module and the river selection. Users can now choose the desired plugin and river in one step.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
35 * The ModuleSelection combines the river selection and the module selection in
5709bd8f4d7c Added a new widget that combines the module and the river selection. Users can now choose the desired plugin and river in one step.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
36 * one widget. It will display a vertical splitted widget - the upper part will
5709bd8f4d7c Added a new widget that combines the module and the river selection. Users can now choose the desired plugin and river in one step.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
37 * render checkboxes for each module, the lower one will display a combobox at
5709bd8f4d7c Added a new widget that combines the module and the river selection. Users can now choose the desired plugin and river in one step.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
38 * the left and a map panel on the right to choose the river.
5709bd8f4d7c Added a new widget that combines the module and the river selection. Users can now choose the desired plugin and river in one step.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
39 *
5709bd8f4d7c Added a new widget that combines the module and the river selection. Users can now choose the desired plugin and river in one step.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
40 * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a>
5709bd8f4d7c Added a new widget that combines the module and the river selection. Users can now choose the desired plugin and river in one step.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
41 */
5709bd8f4d7c Added a new widget that combines the module and the river selection. Users can now choose the desired plugin and river in one step.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
42 public class ModuleSelection extends MapSelection {
5709bd8f4d7c Added a new widget that combines the module and the river selection. Users can now choose the desired plugin and river in one step.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
43
4131
360e22afb98b Cosmetics, warnings and minor TODOs.
Christian Lins <christian.lins@intevation.de>
parents: 3530
diff changeset
44 private static final long serialVersionUID = -5634831815175543328L;
360e22afb98b Cosmetics, warnings and minor TODOs.
Christian Lins <christian.lins@intevation.de>
parents: 3530
diff changeset
45
5815
2aabd9752d5e Initial interaction model for riverselection on image map.
Raimund Renkert <rrenkert@intevation.de>
parents: 4131
diff changeset
46 private List<String> fixRivers;
2aabd9752d5e Initial interaction model for riverselection on image map.
Raimund Renkert <rrenkert@intevation.de>
parents: 4131
diff changeset
47 private List<String> minfoRivers;
2aabd9752d5e Initial interaction model for riverselection on image map.
Raimund Renkert <rrenkert@intevation.de>
parents: 4131
diff changeset
48
30
5709bd8f4d7c Added a new widget that combines the module and the river selection. Users can now choose the desired plugin and river in one step.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
49 /** The message class that provides i18n strings.*/
211
b92281182c6b Removed the FLYSMessages interface and replaced it with a FLYSConstants interface - this interface has the ability to lookup i18n strings with given keys.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 86
diff changeset
50 protected FLYSConstants MESSAGES = GWT.create(FLYSConstants.class);
30
5709bd8f4d7c Added a new widget that combines the module and the river selection. Users can now choose the desired plugin and river in one step.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
51
5709bd8f4d7c Added a new widget that combines the module and the river selection. Users can now choose the desired plugin and river in one step.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
52 /** The module checkboxes.*/
5709bd8f4d7c Added a new widget that combines the module and the river selection. Users can now choose the desired plugin and river in one step.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
53 protected RadioGroupItem radio;
5709bd8f4d7c Added a new widget that combines the module and the river selection. Users can now choose the desired plugin and river in one step.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
54
3518
33ed40aa1201 User ModuleService to get all modules for a user
Bjoern Ricks <bjoern.ricks@intevation.de>
parents: 2522
diff changeset
55 /** */
33ed40aa1201 User ModuleService to get all modules for a user
Bjoern Ricks <bjoern.ricks@intevation.de>
parents: 2522
diff changeset
56 protected Module[] modules;
33ed40aa1201 User ModuleService to get all modules for a user
Bjoern Ricks <bjoern.ricks@intevation.de>
parents: 2522
diff changeset
57
5815
2aabd9752d5e Initial interaction model for riverselection on image map.
Raimund Renkert <rrenkert@intevation.de>
parents: 4131
diff changeset
58 /** */
2aabd9752d5e Initial interaction model for riverselection on image map.
Raimund Renkert <rrenkert@intevation.de>
parents: 4131
diff changeset
59 protected Map<String, LinkItem> rivers;
2aabd9752d5e Initial interaction model for riverselection on image map.
Raimund Renkert <rrenkert@intevation.de>
parents: 4131
diff changeset
60
3518
33ed40aa1201 User ModuleService to get all modules for a user
Bjoern Ricks <bjoern.ricks@intevation.de>
parents: 2522
diff changeset
61 /** The ModuleService used to retrieve the available modules of a user.*/
33ed40aa1201 User ModuleService to get all modules for a user
Bjoern Ricks <bjoern.ricks@intevation.de>
parents: 2522
diff changeset
62 protected ModuleServiceAsync moduleService = GWT.create(ModuleService.class);
33ed40aa1201 User ModuleService to get all modules for a user
Bjoern Ricks <bjoern.ricks@intevation.de>
parents: 2522
diff changeset
63
30
5709bd8f4d7c Added a new widget that combines the module and the river selection. Users can now choose the desired plugin and river in one step.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
64
5709bd8f4d7c Added a new widget that combines the module and the river selection. Users can now choose the desired plugin and river in one step.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
65 /**
5709bd8f4d7c Added a new widget that combines the module and the river selection. Users can now choose the desired plugin and river in one step.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
66 * The default constructor.
5709bd8f4d7c Added a new widget that combines the module and the river selection. Users can now choose the desired plugin and river in one step.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
67 */
5709bd8f4d7c Added a new widget that combines the module and the river selection. Users can now choose the desired plugin and river in one step.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
68 public ModuleSelection() {
5815
2aabd9752d5e Initial interaction model for riverselection on image map.
Raimund Renkert <rrenkert@intevation.de>
parents: 4131
diff changeset
69 rivers = null;
2aabd9752d5e Initial interaction model for riverselection on image map.
Raimund Renkert <rrenkert@intevation.de>
parents: 4131
diff changeset
70 //TODO: put all the rivers into a config file, or something.
2aabd9752d5e Initial interaction model for riverselection on image map.
Raimund Renkert <rrenkert@intevation.de>
parents: 4131
diff changeset
71 fixRivers = new ArrayList();
2aabd9752d5e Initial interaction model for riverselection on image map.
Raimund Renkert <rrenkert@intevation.de>
parents: 4131
diff changeset
72 fixRivers.add("Rhein");
2aabd9752d5e Initial interaction model for riverselection on image map.
Raimund Renkert <rrenkert@intevation.de>
parents: 4131
diff changeset
73 fixRivers.add("Elbe");
2aabd9752d5e Initial interaction model for riverselection on image map.
Raimund Renkert <rrenkert@intevation.de>
parents: 4131
diff changeset
74 fixRivers.add("Donau");
2aabd9752d5e Initial interaction model for riverselection on image map.
Raimund Renkert <rrenkert@intevation.de>
parents: 4131
diff changeset
75
2aabd9752d5e Initial interaction model for riverselection on image map.
Raimund Renkert <rrenkert@intevation.de>
parents: 4131
diff changeset
76 minfoRivers = new ArrayList<String>();
2aabd9752d5e Initial interaction model for riverselection on image map.
Raimund Renkert <rrenkert@intevation.de>
parents: 4131
diff changeset
77 minfoRivers.add("Elbe");
2aabd9752d5e Initial interaction model for riverselection on image map.
Raimund Renkert <rrenkert@intevation.de>
parents: 4131
diff changeset
78 minfoRivers.add("Rhein");
2aabd9752d5e Initial interaction model for riverselection on image map.
Raimund Renkert <rrenkert@intevation.de>
parents: 4131
diff changeset
79 minfoRivers.add("Oder");
2aabd9752d5e Initial interaction model for riverselection on image map.
Raimund Renkert <rrenkert@intevation.de>
parents: 4131
diff changeset
80
3518
33ed40aa1201 User ModuleService to get all modules for a user
Bjoern Ricks <bjoern.ricks@intevation.de>
parents: 2522
diff changeset
81 readModules();
30
5709bd8f4d7c Added a new widget that combines the module and the river selection. Users can now choose the desired plugin and river in one step.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
82 }
5709bd8f4d7c Added a new widget that combines the module and the river selection. Users can now choose the desired plugin and river in one step.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
83
5709bd8f4d7c Added a new widget that combines the module and the river selection. Users can now choose the desired plugin and river in one step.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
84
5709bd8f4d7c Added a new widget that combines the module and the river selection. Users can now choose the desired plugin and river in one step.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
85 /**
5709bd8f4d7c Added a new widget that combines the module and the river selection. Users can now choose the desired plugin and river in one step.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
86 * This method returns a widget that renders the checkboxes for each module
5709bd8f4d7c Added a new widget that combines the module and the river selection. Users can now choose the desired plugin and river in one step.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
87 * and the MapSelection that lets the user choose the river.
5709bd8f4d7c Added a new widget that combines the module and the river selection. Users can now choose the desired plugin and river in one step.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
88 *
5709bd8f4d7c Added a new widget that combines the module and the river selection. Users can now choose the desired plugin and river in one step.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
89 * @param data The provided rivers.
5709bd8f4d7c Added a new widget that combines the module and the river selection. Users can now choose the desired plugin and river in one step.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
90 *
5709bd8f4d7c Added a new widget that combines the module and the river selection. Users can now choose the desired plugin and river in one step.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
91 * @return the module selection combined with the river selection.
5709bd8f4d7c Added a new widget that combines the module and the river selection. Users can now choose the desired plugin and river in one step.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
92 */
4131
360e22afb98b Cosmetics, warnings and minor TODOs.
Christian Lins <christian.lins@intevation.de>
parents: 3530
diff changeset
93 @Override
51
a2923d63f530 Introduced a data structure DataList to manage to list of Data objects of a single state.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 45
diff changeset
94 public Canvas create(DataList data) {
3518
33ed40aa1201 User ModuleService to get all modules for a user
Bjoern Ricks <bjoern.ricks@intevation.de>
parents: 2522
diff changeset
95 GWT.log("ModuleSelection - create()");
30
5709bd8f4d7c Added a new widget that combines the module and the river selection. Users can now choose the desired plugin and river in one step.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
96 VLayout newLayout = new VLayout();
5709bd8f4d7c Added a new widget that combines the module and the river selection. Users can now choose the desired plugin and river in one step.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
97 newLayout.setMembersMargin(10);
282
e92f7ef455d6 Show rivers as links instead of a combobox.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
98 newLayout.setAlign(VerticalAlignment.TOP);
30
5709bd8f4d7c Added a new widget that combines the module and the river selection. Users can now choose the desired plugin and river in one step.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
99 Canvas moduleSelection = createWidget();
5709bd8f4d7c Added a new widget that combines the module and the river selection. Users can now choose the desired plugin and river in one step.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
100
282
e92f7ef455d6 Show rivers as links instead of a combobox.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
101 moduleSelection.setHeight(100);
e92f7ef455d6 Show rivers as links instead of a combobox.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
102 newLayout.setHeight(70);
30
5709bd8f4d7c Added a new widget that combines the module and the river selection. Users can now choose the desired plugin and river in one step.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
103 newLayout.addMember(moduleSelection);
5709bd8f4d7c Added a new widget that combines the module and the river selection. Users can now choose the desired plugin and river in one step.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
104
5709bd8f4d7c Added a new widget that combines the module and the river selection. Users can now choose the desired plugin and river in one step.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
105 return newLayout;
5709bd8f4d7c Added a new widget that combines the module and the river selection. Users can now choose the desired plugin and river in one step.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
106 }
5709bd8f4d7c Added a new widget that combines the module and the river selection. Users can now choose the desired plugin and river in one step.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
107
3518
33ed40aa1201 User ModuleService to get all modules for a user
Bjoern Ricks <bjoern.ricks@intevation.de>
parents: 2522
diff changeset
108 private void readModules() {
33ed40aa1201 User ModuleService to get all modules for a user
Bjoern Ricks <bjoern.ricks@intevation.de>
parents: 2522
diff changeset
109 Config config = Config.getInstance();
33ed40aa1201 User ModuleService to get all modules for a user
Bjoern Ricks <bjoern.ricks@intevation.de>
parents: 2522
diff changeset
110 String locale = config.getLocale();
33ed40aa1201 User ModuleService to get all modules for a user
Bjoern Ricks <bjoern.ricks@intevation.de>
parents: 2522
diff changeset
111
33ed40aa1201 User ModuleService to get all modules for a user
Bjoern Ricks <bjoern.ricks@intevation.de>
parents: 2522
diff changeset
112 moduleService.list(locale, new AsyncCallback<Module[]>() {
33ed40aa1201 User ModuleService to get all modules for a user
Bjoern Ricks <bjoern.ricks@intevation.de>
parents: 2522
diff changeset
113 @Override
33ed40aa1201 User ModuleService to get all modules for a user
Bjoern Ricks <bjoern.ricks@intevation.de>
parents: 2522
diff changeset
114 public void onFailure(Throwable caught) {
33ed40aa1201 User ModuleService to get all modules for a user
Bjoern Ricks <bjoern.ricks@intevation.de>
parents: 2522
diff changeset
115 GWT.log("Could not recieve a list of modules.");
33ed40aa1201 User ModuleService to get all modules for a user
Bjoern Ricks <bjoern.ricks@intevation.de>
parents: 2522
diff changeset
116 SC.warn(MSG.getString(caught.getMessage()));
33ed40aa1201 User ModuleService to get all modules for a user
Bjoern Ricks <bjoern.ricks@intevation.de>
parents: 2522
diff changeset
117 }
33ed40aa1201 User ModuleService to get all modules for a user
Bjoern Ricks <bjoern.ricks@intevation.de>
parents: 2522
diff changeset
118
33ed40aa1201 User ModuleService to get all modules for a user
Bjoern Ricks <bjoern.ricks@intevation.de>
parents: 2522
diff changeset
119 @Override
33ed40aa1201 User ModuleService to get all modules for a user
Bjoern Ricks <bjoern.ricks@intevation.de>
parents: 2522
diff changeset
120 public void onSuccess(Module[] newmodules) {
33ed40aa1201 User ModuleService to get all modules for a user
Bjoern Ricks <bjoern.ricks@intevation.de>
parents: 2522
diff changeset
121 GWT.log("Retrieved " + newmodules.length + " modules.");
33ed40aa1201 User ModuleService to get all modules for a user
Bjoern Ricks <bjoern.ricks@intevation.de>
parents: 2522
diff changeset
122 modules = newmodules;
33ed40aa1201 User ModuleService to get all modules for a user
Bjoern Ricks <bjoern.ricks@intevation.de>
parents: 2522
diff changeset
123 setModules();
33ed40aa1201 User ModuleService to get all modules for a user
Bjoern Ricks <bjoern.ricks@intevation.de>
parents: 2522
diff changeset
124 }
33ed40aa1201 User ModuleService to get all modules for a user
Bjoern Ricks <bjoern.ricks@intevation.de>
parents: 2522
diff changeset
125 });
33ed40aa1201 User ModuleService to get all modules for a user
Bjoern Ricks <bjoern.ricks@intevation.de>
parents: 2522
diff changeset
126 }
33ed40aa1201 User ModuleService to get all modules for a user
Bjoern Ricks <bjoern.ricks@intevation.de>
parents: 2522
diff changeset
127
33ed40aa1201 User ModuleService to get all modules for a user
Bjoern Ricks <bjoern.ricks@intevation.de>
parents: 2522
diff changeset
128 private void setModules() {
4131
360e22afb98b Cosmetics, warnings and minor TODOs.
Christian Lins <christian.lins@intevation.de>
parents: 3530
diff changeset
129 LinkedHashMap<String, String> values = new LinkedHashMap<String, String>();
3530
8c9c202292fe Set the default value of the RadioGroupItem if a loaded module is selected
Bjoern Ricks <bjoern.ricks@intevation.de>
parents: 3518
diff changeset
130
3518
33ed40aa1201 User ModuleService to get all modules for a user
Bjoern Ricks <bjoern.ricks@intevation.de>
parents: 2522
diff changeset
131 if (this.modules!= null) {
33ed40aa1201 User ModuleService to get all modules for a user
Bjoern Ricks <bjoern.ricks@intevation.de>
parents: 2522
diff changeset
132 for(Module module : this.modules) {
33ed40aa1201 User ModuleService to get all modules for a user
Bjoern Ricks <bjoern.ricks@intevation.de>
parents: 2522
diff changeset
133 values.put(module.getName(), module.getLocalizedName());
3530
8c9c202292fe Set the default value of the RadioGroupItem if a loaded module is selected
Bjoern Ricks <bjoern.ricks@intevation.de>
parents: 3518
diff changeset
134 if (module.isSelected()) {
8c9c202292fe Set the default value of the RadioGroupItem if a loaded module is selected
Bjoern Ricks <bjoern.ricks@intevation.de>
parents: 3518
diff changeset
135 GWT.log("Module " + module.getName() + " is selected.");
8c9c202292fe Set the default value of the RadioGroupItem if a loaded module is selected
Bjoern Ricks <bjoern.ricks@intevation.de>
parents: 3518
diff changeset
136 if (radio != null) {
8c9c202292fe Set the default value of the RadioGroupItem if a loaded module is selected
Bjoern Ricks <bjoern.ricks@intevation.de>
parents: 3518
diff changeset
137 radio.setDefaultValue(module.getName());
8c9c202292fe Set the default value of the RadioGroupItem if a loaded module is selected
Bjoern Ricks <bjoern.ricks@intevation.de>
parents: 3518
diff changeset
138 GWT.log("Setting " + module.getName() + " as selected.");
8c9c202292fe Set the default value of the RadioGroupItem if a loaded module is selected
Bjoern Ricks <bjoern.ricks@intevation.de>
parents: 3518
diff changeset
139 }
8c9c202292fe Set the default value of the RadioGroupItem if a loaded module is selected
Bjoern Ricks <bjoern.ricks@intevation.de>
parents: 3518
diff changeset
140 }
3518
33ed40aa1201 User ModuleService to get all modules for a user
Bjoern Ricks <bjoern.ricks@intevation.de>
parents: 2522
diff changeset
141 }
33ed40aa1201 User ModuleService to get all modules for a user
Bjoern Ricks <bjoern.ricks@intevation.de>
parents: 2522
diff changeset
142 }
33ed40aa1201 User ModuleService to get all modules for a user
Bjoern Ricks <bjoern.ricks@intevation.de>
parents: 2522
diff changeset
143 if (radio != null) {
33ed40aa1201 User ModuleService to get all modules for a user
Bjoern Ricks <bjoern.ricks@intevation.de>
parents: 2522
diff changeset
144 radio.setValueMap(values);
33ed40aa1201 User ModuleService to get all modules for a user
Bjoern Ricks <bjoern.ricks@intevation.de>
parents: 2522
diff changeset
145 }
33ed40aa1201 User ModuleService to get all modules for a user
Bjoern Ricks <bjoern.ricks@intevation.de>
parents: 2522
diff changeset
146 }
30
5709bd8f4d7c Added a new widget that combines the module and the river selection. Users can now choose the desired plugin and river in one step.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
147
5709bd8f4d7c Added a new widget that combines the module and the river selection. Users can now choose the desired plugin and river in one step.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
148 /**
5709bd8f4d7c Added a new widget that combines the module and the river selection. Users can now choose the desired plugin and river in one step.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
149 * Creates a widget that displays a checkbox for each module.
5709bd8f4d7c Added a new widget that combines the module and the river selection. Users can now choose the desired plugin and river in one step.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
150 *
5709bd8f4d7c Added a new widget that combines the module and the river selection. Users can now choose the desired plugin and river in one step.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
151 * @return a widget with checkboxes.
5709bd8f4d7c Added a new widget that combines the module and the river selection. Users can now choose the desired plugin and river in one step.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
152 */
5709bd8f4d7c Added a new widget that combines the module and the river selection. Users can now choose the desired plugin and river in one step.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
153 protected Canvas createWidget() {
5709bd8f4d7c Added a new widget that combines the module and the river selection. Users can now choose the desired plugin and river in one step.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
154 HLayout layout = new HLayout();
5709bd8f4d7c Added a new widget that combines the module and the river selection. Users can now choose the desired plugin and river in one step.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
155
5709bd8f4d7c Added a new widget that combines the module and the river selection. Users can now choose the desired plugin and river in one step.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
156 Label label = new Label(MESSAGES.module_selection());
5709bd8f4d7c Added a new widget that combines the module and the river selection. Users can now choose the desired plugin and river in one step.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
157 DynamicForm form = new DynamicForm();
5709bd8f4d7c Added a new widget that combines the module and the river selection. Users can now choose the desired plugin and river in one step.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
158
5709bd8f4d7c Added a new widget that combines the module and the river selection. Users can now choose the desired plugin and river in one step.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
159 radio = new RadioGroupItem("plugin");
5709bd8f4d7c Added a new widget that combines the module and the river selection. Users can now choose the desired plugin and river in one step.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
160
5815
2aabd9752d5e Initial interaction model for riverselection on image map.
Raimund Renkert <rrenkert@intevation.de>
parents: 4131
diff changeset
161 radio.addChangeHandler(new ChangeHandler() {
2aabd9752d5e Initial interaction model for riverselection on image map.
Raimund Renkert <rrenkert@intevation.de>
parents: 4131
diff changeset
162 @Override
2aabd9752d5e Initial interaction model for riverselection on image map.
Raimund Renkert <rrenkert@intevation.de>
parents: 4131
diff changeset
163 public void onChange(ChangeEvent event) {
2aabd9752d5e Initial interaction model for riverselection on image map.
Raimund Renkert <rrenkert@intevation.de>
parents: 4131
diff changeset
164 String selected = (String)event.getValue();
2aabd9752d5e Initial interaction model for riverselection on image map.
Raimund Renkert <rrenkert@intevation.de>
parents: 4131
diff changeset
165 if (!rivers.isEmpty()) {
2aabd9752d5e Initial interaction model for riverselection on image map.
Raimund Renkert <rrenkert@intevation.de>
parents: 4131
diff changeset
166 for (Map.Entry<String, LinkItem> s: rivers.entrySet()) {
2aabd9752d5e Initial interaction model for riverselection on image map.
Raimund Renkert <rrenkert@intevation.de>
parents: 4131
diff changeset
167 if (selected.equals("minfo") && !minfoRivers.contains(s.getKey())) {
2aabd9752d5e Initial interaction model for riverselection on image map.
Raimund Renkert <rrenkert@intevation.de>
parents: 4131
diff changeset
168 s.getValue().hide();
2aabd9752d5e Initial interaction model for riverselection on image map.
Raimund Renkert <rrenkert@intevation.de>
parents: 4131
diff changeset
169 }
2aabd9752d5e Initial interaction model for riverselection on image map.
Raimund Renkert <rrenkert@intevation.de>
parents: 4131
diff changeset
170 else if (selected.equals("fixanalysis") && !fixRivers.contains(s.getKey())) {
2aabd9752d5e Initial interaction model for riverselection on image map.
Raimund Renkert <rrenkert@intevation.de>
parents: 4131
diff changeset
171 s.getValue().hide();
2aabd9752d5e Initial interaction model for riverselection on image map.
Raimund Renkert <rrenkert@intevation.de>
parents: 4131
diff changeset
172 }
2aabd9752d5e Initial interaction model for riverselection on image map.
Raimund Renkert <rrenkert@intevation.de>
parents: 4131
diff changeset
173 else {
2aabd9752d5e Initial interaction model for riverselection on image map.
Raimund Renkert <rrenkert@intevation.de>
parents: 4131
diff changeset
174 s.getValue().show();
2aabd9752d5e Initial interaction model for riverselection on image map.
Raimund Renkert <rrenkert@intevation.de>
parents: 4131
diff changeset
175 }
2aabd9752d5e Initial interaction model for riverselection on image map.
Raimund Renkert <rrenkert@intevation.de>
parents: 4131
diff changeset
176 }
2aabd9752d5e Initial interaction model for riverselection on image map.
Raimund Renkert <rrenkert@intevation.de>
parents: 4131
diff changeset
177 }
2aabd9752d5e Initial interaction model for riverselection on image map.
Raimund Renkert <rrenkert@intevation.de>
parents: 4131
diff changeset
178 }
2aabd9752d5e Initial interaction model for riverselection on image map.
Raimund Renkert <rrenkert@intevation.de>
parents: 4131
diff changeset
179 });
30
5709bd8f4d7c Added a new widget that combines the module and the river selection. Users can now choose the desired plugin and river in one step.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
180 label.setWidth(50);
282
e92f7ef455d6 Show rivers as links instead of a combobox.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
181 label.setHeight(25);
30
5709bd8f4d7c Added a new widget that combines the module and the river selection. Users can now choose the desired plugin and river in one step.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
182
45
f99c5f8e4672 Some GUI improvements in the Location/Distance, W/Q and Module panels.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 38
diff changeset
183
30
5709bd8f4d7c Added a new widget that combines the module and the river selection. Users can now choose the desired plugin and river in one step.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
184 radio.setShowTitle(false);
86
eae92a05282e Added a further plugin in the module selection and changed its alignment to vertical.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 83
diff changeset
185 radio.setVertical(true);
45
f99c5f8e4672 Some GUI improvements in the Location/Distance, W/Q and Module panels.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 38
diff changeset
186
3518
33ed40aa1201 User ModuleService to get all modules for a user
Bjoern Ricks <bjoern.ricks@intevation.de>
parents: 2522
diff changeset
187 setModules();
33ed40aa1201 User ModuleService to get all modules for a user
Bjoern Ricks <bjoern.ricks@intevation.de>
parents: 2522
diff changeset
188
30
5709bd8f4d7c Added a new widget that combines the module and the river selection. Users can now choose the desired plugin and river in one step.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
189 form.setFields(radio);
5709bd8f4d7c Added a new widget that combines the module and the river selection. Users can now choose the desired plugin and river in one step.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
190
5709bd8f4d7c Added a new widget that combines the module and the river selection. Users can now choose the desired plugin and river in one step.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
191 layout.addMember(label);
5709bd8f4d7c Added a new widget that combines the module and the river selection. Users can now choose the desired plugin and river in one step.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
192 layout.addMember(form);
5709bd8f4d7c Added a new widget that combines the module and the river selection. Users can now choose the desired plugin and river in one step.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
193
5709bd8f4d7c Added a new widget that combines the module and the river selection. Users can now choose the desired plugin and river in one step.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
194 return layout;
5709bd8f4d7c Added a new widget that combines the module and the river selection. Users can now choose the desired plugin and river in one step.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
195 }
5709bd8f4d7c Added a new widget that combines the module and the river selection. Users can now choose the desired plugin and river in one step.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
196
5709bd8f4d7c Added a new widget that combines the module and the river selection. Users can now choose the desired plugin and river in one step.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
197
5709bd8f4d7c Added a new widget that combines the module and the river selection. Users can now choose the desired plugin and river in one step.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
198 /**
5709bd8f4d7c Added a new widget that combines the module and the river selection. Users can now choose the desired plugin and river in one step.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
199 * This method prepares the data of two widgets - the module selection and
5709bd8f4d7c Added a new widget that combines the module and the river selection. Users can now choose the desired plugin and river in one step.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
200 * the river selection. The returning field will contain the Data that
5709bd8f4d7c Added a new widget that combines the module and the river selection. Users can now choose the desired plugin and river in one step.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
201 * represents the module selection at first position, the second position
5709bd8f4d7c Added a new widget that combines the module and the river selection. Users can now choose the desired plugin and river in one step.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
202 * stores the Data object that represents the river selection.
5709bd8f4d7c Added a new widget that combines the module and the river selection. Users can now choose the desired plugin and river in one step.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
203 *
5709bd8f4d7c Added a new widget that combines the module and the river selection. Users can now choose the desired plugin and river in one step.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
204 * @return the Data that was chosen in this widget.
5709bd8f4d7c Added a new widget that combines the module and the river selection. Users can now choose the desired plugin and river in one step.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
205 */
4131
360e22afb98b Cosmetics, warnings and minor TODOs.
Christian Lins <christian.lins@intevation.de>
parents: 3530
diff changeset
206 @Override
30
5709bd8f4d7c Added a new widget that combines the module and the river selection. Users can now choose the desired plugin and river in one step.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
207 protected Data[] getData() {
5709bd8f4d7c Added a new widget that combines the module and the river selection. Users can now choose the desired plugin and river in one step.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
208
5709bd8f4d7c Added a new widget that combines the module and the river selection. Users can now choose the desired plugin and river in one step.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
209 String module = radio.getValueAsString();
5709bd8f4d7c Added a new widget that combines the module and the river selection. Users can now choose the desired plugin and river in one step.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
210
5709bd8f4d7c Added a new widget that combines the module and the river selection. Users can now choose the desired plugin and river in one step.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
211 DataItem[] items = new DefaultDataItem[1];
5709bd8f4d7c Added a new widget that combines the module and the river selection. Users can now choose the desired plugin and river in one step.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
212 items[0] = new DefaultDataItem(module, module, module);
5709bd8f4d7c Added a new widget that combines the module and the river selection. Users can now choose the desired plugin and river in one step.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
213
51
a2923d63f530 Introduced a data structure DataList to manage to list of Data objects of a single state.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 45
diff changeset
214 Data data = new DefaultData("module", null, null, items);
30
5709bd8f4d7c Added a new widget that combines the module and the river selection. Users can now choose the desired plugin and river in one step.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
215
282
e92f7ef455d6 Show rivers as links instead of a combobox.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
216 return new Data[] {data};
30
5709bd8f4d7c Added a new widget that combines the module and the river selection. Users can now choose the desired plugin and river in one step.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
217 }
5815
2aabd9752d5e Initial interaction model for riverselection on image map.
Raimund Renkert <rrenkert@intevation.de>
parents: 4131
diff changeset
218
2aabd9752d5e Initial interaction model for riverselection on image map.
Raimund Renkert <rrenkert@intevation.de>
parents: 4131
diff changeset
219 public void setRivers(Map<String, LinkItem> rivers) {
2aabd9752d5e Initial interaction model for riverselection on image map.
Raimund Renkert <rrenkert@intevation.de>
parents: 4131
diff changeset
220 this.rivers = rivers;
2aabd9752d5e Initial interaction model for riverselection on image map.
Raimund Renkert <rrenkert@intevation.de>
parents: 4131
diff changeset
221 }
30
5709bd8f4d7c Added a new widget that combines the module and the river selection. Users can now choose the desired plugin and river in one step.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
222 }
5709bd8f4d7c Added a new widget that combines the module and the river selection. Users can now choose the desired plugin and river in one step.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
223 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :

http://dive4elements.wald.intevation.org