annotate flys-client/src/main/java/de/intevation/flys/client/client/ui/ModuleSelection.java @ 3518:33ed40aa1201

User ModuleService to get all modules for a user Don't hardcode the Modules instead load them from the ModuleService. This allows to show only modules that a user is allowed to access. flys-client/trunk@5292 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Bjoern Ricks <bjoern.ricks@intevation.de>
date Wed, 29 Aug 2012 12:38:06 +0000
parents 6455bb59a26e
children 8c9c202292fe
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
45
f99c5f8e4672 Some GUI improvements in the Location/Distance, W/Q and Module panels.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 38
diff changeset
3 import java.util.LinkedHashMap;
f99c5f8e4672 Some GUI improvements in the Location/Distance, W/Q and Module panels.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 38
diff changeset
4
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 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
6 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
7
83
4784ca718476 Improved the positioning of helper widgets and some layout specific stuff.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 57
diff changeset
8 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
9 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
10 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
11 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
12 import com.smartgwt.client.widgets.form.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
13 import com.smartgwt.client.widgets.form.fields.RadioGroupItem;
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
14 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
15 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
16
3518
33ed40aa1201 User ModuleService to get all modules for a user
Bjoern Ricks <bjoern.ricks@intevation.de>
parents: 2522
diff changeset
17 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
18 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
19 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
20 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
21 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
22 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
23 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
24 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
25
3518
33ed40aa1201 User ModuleService to get all modules for a user
Bjoern Ricks <bjoern.ricks@intevation.de>
parents: 2522
diff changeset
26 import de.intevation.flys.client.client.Config;
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
27 import de.intevation.flys.client.client.FLYSConstants;
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
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
29 /**
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
30 * 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
31 * 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
32 * 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
33 * 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
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 * @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
36 */
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 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
38
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 /** 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
40 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
41
45
f99c5f8e4672 Some GUI improvements in the Location/Distance, W/Q and Module panels.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 38
diff changeset
42
f99c5f8e4672 Some GUI improvements in the Location/Distance, W/Q and Module panels.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 38
diff changeset
43 /** Constant field name for the plugin selection.*/
f99c5f8e4672 Some GUI improvements in the Location/Distance, W/Q and Module panels.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 38
diff changeset
44 public static final String FIELD_PLUGIN = "plugin";
f99c5f8e4672 Some GUI improvements in the Location/Distance, W/Q and Module panels.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 38
diff changeset
45
f99c5f8e4672 Some GUI improvements in the Location/Distance, W/Q and Module panels.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 38
diff changeset
46 /** Constant value for the WINFO plugin.*/
f99c5f8e4672 Some GUI improvements in the Location/Distance, W/Q and Module panels.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 38
diff changeset
47 public static final String FIELD_PLUGIN_WINFO = "winfo";
f99c5f8e4672 Some GUI improvements in the Location/Distance, W/Q and Module panels.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 38
diff changeset
48
f99c5f8e4672 Some GUI improvements in the Location/Distance, W/Q and Module panels.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 38
diff changeset
49 /** Constant value for the MINFO plugin.*/
f99c5f8e4672 Some GUI improvements in the Location/Distance, W/Q and Module panels.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 38
diff changeset
50 public static final String FIELD_PLUGIN_MINFO = "minfo";
f99c5f8e4672 Some GUI improvements in the Location/Distance, W/Q and Module panels.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 38
diff changeset
51
f99c5f8e4672 Some GUI improvements in the Location/Distance, W/Q and Module panels.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 38
diff changeset
52 /** Constant value for the MAP plugin.*/
1516
102e472bd2a1 Changed the visible i18n strings for module 'new map.'
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1467
diff changeset
53 public static final String FIELD_PLUGIN_MAP = "new_map";
45
f99c5f8e4672 Some GUI improvements in the Location/Distance, W/Q and Module panels.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 38
diff changeset
54
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
55 /** Constant value for the CHART plugin.*/
1520
77fdb2359ef4 Changed internal string for new chart module.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1516
diff changeset
56 public static final String FIELD_PLUGIN_CHART = "new_chart";
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
57
45
f99c5f8e4672 Some GUI improvements in the Location/Distance, W/Q and Module panels.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 38
diff changeset
58 /** Constant value for the FIX plugin.*/
2522
6455bb59a26e Fix fixation analysis module select.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1520
diff changeset
59 public static final String FIELD_PLUGIN_FIX = "fixanalysis";
45
f99c5f8e4672 Some GUI improvements in the Location/Distance, W/Q and Module panels.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 38
diff changeset
60
f99c5f8e4672 Some GUI improvements in the Location/Distance, W/Q and Module panels.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 38
diff changeset
61
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
62 /** 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
63 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
64
3518
33ed40aa1201 User ModuleService to get all modules for a user
Bjoern Ricks <bjoern.ricks@intevation.de>
parents: 2522
diff changeset
65 /** */
33ed40aa1201 User ModuleService to get all modules for a user
Bjoern Ricks <bjoern.ricks@intevation.de>
parents: 2522
diff changeset
66 protected Module[] modules;
33ed40aa1201 User ModuleService to get all modules for a user
Bjoern Ricks <bjoern.ricks@intevation.de>
parents: 2522
diff changeset
67
33ed40aa1201 User ModuleService to get all modules for a user
Bjoern Ricks <bjoern.ricks@intevation.de>
parents: 2522
diff changeset
68 /** 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
69 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
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
71
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
72 /**
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
73 * 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
74 */
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
75 public ModuleSelection() {
3518
33ed40aa1201 User ModuleService to get all modules for a user
Bjoern Ricks <bjoern.ricks@intevation.de>
parents: 2522
diff changeset
76 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
77 }
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
78
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
79
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
80 /**
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
81 * 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
82 * 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
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 * @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
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 * @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
87 */
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
88 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
89 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
90 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
91 newLayout.setMembersMargin(10);
282
e92f7ef455d6 Show rivers as links instead of a combobox.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
92 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
93 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
94
282
e92f7ef455d6 Show rivers as links instead of a combobox.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
95 moduleSelection.setHeight(100);
e92f7ef455d6 Show rivers as links instead of a combobox.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
96 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
97 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
98
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 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
100 }
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
101
3518
33ed40aa1201 User ModuleService to get all modules for a user
Bjoern Ricks <bjoern.ricks@intevation.de>
parents: 2522
diff changeset
102 private void readModules() {
33ed40aa1201 User ModuleService to get all modules for a user
Bjoern Ricks <bjoern.ricks@intevation.de>
parents: 2522
diff changeset
103 Config config = Config.getInstance();
33ed40aa1201 User ModuleService to get all modules for a user
Bjoern Ricks <bjoern.ricks@intevation.de>
parents: 2522
diff changeset
104 String locale = config.getLocale();
33ed40aa1201 User ModuleService to get all modules for a user
Bjoern Ricks <bjoern.ricks@intevation.de>
parents: 2522
diff changeset
105
33ed40aa1201 User ModuleService to get all modules for a user
Bjoern Ricks <bjoern.ricks@intevation.de>
parents: 2522
diff changeset
106 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
107 @Override
33ed40aa1201 User ModuleService to get all modules for a user
Bjoern Ricks <bjoern.ricks@intevation.de>
parents: 2522
diff changeset
108 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
109 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
110 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
111 }
33ed40aa1201 User ModuleService to get all modules for a user
Bjoern Ricks <bjoern.ricks@intevation.de>
parents: 2522
diff changeset
112
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 onSuccess(Module[] newmodules) {
33ed40aa1201 User ModuleService to get all modules for a user
Bjoern Ricks <bjoern.ricks@intevation.de>
parents: 2522
diff changeset
115 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
116 modules = newmodules;
33ed40aa1201 User ModuleService to get all modules for a user
Bjoern Ricks <bjoern.ricks@intevation.de>
parents: 2522
diff changeset
117 setModules();
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 });
33ed40aa1201 User ModuleService to get all modules for a user
Bjoern Ricks <bjoern.ricks@intevation.de>
parents: 2522
diff changeset
120 }
33ed40aa1201 User ModuleService to get all modules for a user
Bjoern Ricks <bjoern.ricks@intevation.de>
parents: 2522
diff changeset
121
33ed40aa1201 User ModuleService to get all modules for a user
Bjoern Ricks <bjoern.ricks@intevation.de>
parents: 2522
diff changeset
122 private void setModules() {
33ed40aa1201 User ModuleService to get all modules for a user
Bjoern Ricks <bjoern.ricks@intevation.de>
parents: 2522
diff changeset
123 LinkedHashMap values = new LinkedHashMap();
33ed40aa1201 User ModuleService to get all modules for a user
Bjoern Ricks <bjoern.ricks@intevation.de>
parents: 2522
diff changeset
124 if (this.modules!= null) {
33ed40aa1201 User ModuleService to get all modules for a user
Bjoern Ricks <bjoern.ricks@intevation.de>
parents: 2522
diff changeset
125 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
126 values.put(module.getName(), module.getLocalizedName());
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 }
33ed40aa1201 User ModuleService to get all modules for a user
Bjoern Ricks <bjoern.ricks@intevation.de>
parents: 2522
diff changeset
129 if (radio != null) {
33ed40aa1201 User ModuleService to get all modules for a user
Bjoern Ricks <bjoern.ricks@intevation.de>
parents: 2522
diff changeset
130 radio.setValueMap(values);
33ed40aa1201 User ModuleService to get all modules for a user
Bjoern Ricks <bjoern.ricks@intevation.de>
parents: 2522
diff changeset
131 }
33ed40aa1201 User ModuleService to get all modules for a user
Bjoern Ricks <bjoern.ricks@intevation.de>
parents: 2522
diff changeset
132 }
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
133
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
134 /**
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
135 * 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
136 *
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
137 * @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
138 */
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
139 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
140 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
141
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
142 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
143 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
144
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
145 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
146
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 label.setWidth(50);
282
e92f7ef455d6 Show rivers as links instead of a combobox.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
148 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
149
45
f99c5f8e4672 Some GUI improvements in the Location/Distance, W/Q and Module panels.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 38
diff changeset
150
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
151 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
152 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
153
3518
33ed40aa1201 User ModuleService to get all modules for a user
Bjoern Ricks <bjoern.ricks@intevation.de>
parents: 2522
diff changeset
154 setModules();
33ed40aa1201 User ModuleService to get all modules for a user
Bjoern Ricks <bjoern.ricks@intevation.de>
parents: 2522
diff changeset
155
33ed40aa1201 User ModuleService to get all modules for a user
Bjoern Ricks <bjoern.ricks@intevation.de>
parents: 2522
diff changeset
156 /* LinkedHashMap initial = new LinkedHashMap(); */
33ed40aa1201 User ModuleService to get all modules for a user
Bjoern Ricks <bjoern.ricks@intevation.de>
parents: 2522
diff changeset
157 /* initial.put(FIELD_PLUGIN, FIELD_PLUGIN_WINFO); */
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
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 form.setFields(radio);
3518
33ed40aa1201 User ModuleService to get all modules for a user
Bjoern Ricks <bjoern.ricks@intevation.de>
parents: 2522
diff changeset
160 /* form.setValues(initial); */
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
161
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
162 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
163 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
164
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
165 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
166 }
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
167
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
168
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
169 /**
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
170 * 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
171 * 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
172 * 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
173 * 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
174 *
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
175 * @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
176 */
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
177 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
178
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
179 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
180
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
181 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
182 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
183
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
184 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
185
282
e92f7ef455d6 Show rivers as links instead of a combobox.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 211
diff changeset
186 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
187 }
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
188 }
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 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :

http://dive4elements.wald.intevation.org