Mercurial > dive4elements > river
annotate gwt-client/src/main/java/org/dive4elements/river/client/client/ui/ModuleSelection.java @ 8870:c26fb37899ca
Introduced groups for modules. Modules marked with the same group-id, will be put together in the ui.
Also using now the localization info from the server instead of localizing the modules again on the client side.
author | gernotbelger |
---|---|
date | Wed, 07 Feb 2018 11:59:13 +0100 |
parents | 5e38e2924c07 |
children | 60278b5fe4d9 |
rev | line source |
---|---|
5861
172338b1407f
GWT client: Added copyright header.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5838
diff
changeset
|
1 /* Copyright (C) 2011, 2012, 2013 by Bundesanstalt für Gewässerkunde |
172338b1407f
GWT client: Added copyright header.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5838
diff
changeset
|
2 * Software engineering by Intevation GmbH |
172338b1407f
GWT client: Added copyright header.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5838
diff
changeset
|
3 * |
5993
ea9eef426962
Removed trailing whitespace.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5967
diff
changeset
|
4 * This file is Free Software under the GNU AGPL (>=v3) |
5861
172338b1407f
GWT client: Added copyright header.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5838
diff
changeset
|
5 * and comes with ABSOLUTELY NO WARRANTY! Check out the |
5993
ea9eef426962
Removed trailing whitespace.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5967
diff
changeset
|
6 * documentation coming with Dive4Elements River for details. |
5861
172338b1407f
GWT client: Added copyright header.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5838
diff
changeset
|
7 */ |
172338b1407f
GWT client: Added copyright header.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5838
diff
changeset
|
8 |
5835
821a02bbfb4e
Fixed internal java dependencies
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5834
diff
changeset
|
9 package org.dive4elements.river.client.client.ui; |
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 |
8870
c26fb37899ca
Introduced groups for modules. Modules marked with the same group-id, will be put together in the ui.
gernotbelger
parents:
8856
diff
changeset
|
11 import java.util.Collection; |
c26fb37899ca
Introduced groups for modules. Modules marked with the same group-id, will be put together in the ui.
gernotbelger
parents:
8856
diff
changeset
|
12 import java.util.HashMap; |
c26fb37899ca
Introduced groups for modules. Modules marked with the same group-id, will be put together in the ui.
gernotbelger
parents:
8856
diff
changeset
|
13 import java.util.LinkedHashMap; |
c26fb37899ca
Introduced groups for modules. Modules marked with the same group-id, will be put together in the ui.
gernotbelger
parents:
8856
diff
changeset
|
14 import java.util.LinkedList; |
c26fb37899ca
Introduced groups for modules. Modules marked with the same group-id, will be put together in the ui.
gernotbelger
parents:
8856
diff
changeset
|
15 import java.util.List; |
c26fb37899ca
Introduced groups for modules. Modules marked with the same group-id, will be put together in the ui.
gernotbelger
parents:
8856
diff
changeset
|
16 import java.util.Map; |
c26fb37899ca
Introduced groups for modules. Modules marked with the same group-id, will be put together in the ui.
gernotbelger
parents:
8856
diff
changeset
|
17 import java.util.Map.Entry; |
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
|
18 |
5835
821a02bbfb4e
Fixed internal java dependencies
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5834
diff
changeset
|
19 import org.dive4elements.river.client.client.Config; |
821a02bbfb4e
Fixed internal java dependencies
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5834
diff
changeset
|
20 import org.dive4elements.river.client.client.FLYSConstants; |
821a02bbfb4e
Fixed internal java dependencies
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5834
diff
changeset
|
21 import org.dive4elements.river.client.client.services.ModuleService; |
821a02bbfb4e
Fixed internal java dependencies
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5834
diff
changeset
|
22 import org.dive4elements.river.client.client.services.ModuleServiceAsync; |
821a02bbfb4e
Fixed internal java dependencies
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5834
diff
changeset
|
23 import org.dive4elements.river.client.shared.model.Data; |
821a02bbfb4e
Fixed internal java dependencies
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5834
diff
changeset
|
24 import org.dive4elements.river.client.shared.model.DataItem; |
821a02bbfb4e
Fixed internal java dependencies
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5834
diff
changeset
|
25 import org.dive4elements.river.client.shared.model.DataList; |
821a02bbfb4e
Fixed internal java dependencies
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5834
diff
changeset
|
26 import org.dive4elements.river.client.shared.model.DefaultData; |
821a02bbfb4e
Fixed internal java dependencies
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5834
diff
changeset
|
27 import org.dive4elements.river.client.shared.model.DefaultDataItem; |
821a02bbfb4e
Fixed internal java dependencies
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5834
diff
changeset
|
28 import org.dive4elements.river.client.shared.model.Module; |
8870
c26fb37899ca
Introduced groups for modules. Modules marked with the same group-id, will be put together in the ui.
gernotbelger
parents:
8856
diff
changeset
|
29 import org.dive4elements.river.client.shared.model.ModuleGroup; |
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
|
30 |
8870
c26fb37899ca
Introduced groups for modules. Modules marked with the same group-id, will be put together in the ui.
gernotbelger
parents:
8856
diff
changeset
|
31 import com.google.gwt.core.client.GWT; |
c26fb37899ca
Introduced groups for modules. Modules marked with the same group-id, will be put together in the ui.
gernotbelger
parents:
8856
diff
changeset
|
32 import com.google.gwt.user.client.rpc.AsyncCallback; |
c26fb37899ca
Introduced groups for modules. Modules marked with the same group-id, will be put together in the ui.
gernotbelger
parents:
8856
diff
changeset
|
33 import com.smartgwt.client.types.VerticalAlignment; |
c26fb37899ca
Introduced groups for modules. Modules marked with the same group-id, will be put together in the ui.
gernotbelger
parents:
8856
diff
changeset
|
34 import com.smartgwt.client.util.SC; |
c26fb37899ca
Introduced groups for modules. Modules marked with the same group-id, will be put together in the ui.
gernotbelger
parents:
8856
diff
changeset
|
35 import com.smartgwt.client.widgets.Canvas; |
c26fb37899ca
Introduced groups for modules. Modules marked with the same group-id, will be put together in the ui.
gernotbelger
parents:
8856
diff
changeset
|
36 import com.smartgwt.client.widgets.Label; |
c26fb37899ca
Introduced groups for modules. Modules marked with the same group-id, will be put together in the ui.
gernotbelger
parents:
8856
diff
changeset
|
37 import com.smartgwt.client.widgets.form.DynamicForm; |
c26fb37899ca
Introduced groups for modules. Modules marked with the same group-id, will be put together in the ui.
gernotbelger
parents:
8856
diff
changeset
|
38 import com.smartgwt.client.widgets.form.fields.RadioGroupItem; |
c26fb37899ca
Introduced groups for modules. Modules marked with the same group-id, will be put together in the ui.
gernotbelger
parents:
8856
diff
changeset
|
39 import com.smartgwt.client.widgets.form.fields.events.ChangeEvent; |
c26fb37899ca
Introduced groups for modules. Modules marked with the same group-id, will be put together in the ui.
gernotbelger
parents:
8856
diff
changeset
|
40 import com.smartgwt.client.widgets.form.fields.events.ChangeHandler; |
c26fb37899ca
Introduced groups for modules. Modules marked with the same group-id, will be put together in the ui.
gernotbelger
parents:
8856
diff
changeset
|
41 import com.smartgwt.client.widgets.layout.HLayout; |
c26fb37899ca
Introduced groups for modules. Modules marked with the same group-id, will be put together in the ui.
gernotbelger
parents:
8856
diff
changeset
|
42 import com.smartgwt.client.widgets.layout.LayoutSpacer; |
c26fb37899ca
Introduced groups for modules. Modules marked with the same group-id, will be put together in the ui.
gernotbelger
parents:
8856
diff
changeset
|
43 import com.smartgwt.client.widgets.layout.VLayout; |
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
|
44 |
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
|
45 /** |
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
|
46 * 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
|
47 * 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
|
48 * 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
|
49 * 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
|
50 * |
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 * @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
|
52 */ |
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 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
|
54 |
4131
360e22afb98b
Cosmetics, warnings and minor TODOs.
Christian Lins <christian.lins@intevation.de>
parents:
3530
diff
changeset
|
55 private static final long serialVersionUID = -5634831815175543328L; |
360e22afb98b
Cosmetics, warnings and minor TODOs.
Christian Lins <christian.lins@intevation.de>
parents:
3530
diff
changeset
|
56 |
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
|
57 /** The message class that provides i18n strings.*/ |
8870
c26fb37899ca
Introduced groups for modules. Modules marked with the same group-id, will be put together in the ui.
gernotbelger
parents:
8856
diff
changeset
|
58 private FLYSConstants MESSAGES = GWT.create(FLYSConstants.class); |
3518
33ed40aa1201
User ModuleService to get all modules for a user
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
2522
diff
changeset
|
59 |
33ed40aa1201
User ModuleService to get all modules for a user
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
2522
diff
changeset
|
60 /** The ModuleService used to retrieve the available modules of a user.*/ |
8870
c26fb37899ca
Introduced groups for modules. Modules marked with the same group-id, will be put together in the ui.
gernotbelger
parents:
8856
diff
changeset
|
61 private ModuleServiceAsync moduleService = GWT.create(ModuleService.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
|
62 |
8870
c26fb37899ca
Introduced groups for modules. Modules marked with the same group-id, will be put together in the ui.
gernotbelger
parents:
8856
diff
changeset
|
63 private Map<String, List<String> > modulesRiverMap = new LinkedHashMap<String, List<String> >(); |
c26fb37899ca
Introduced groups for modules. Modules marked with the same group-id, will be put together in the ui.
gernotbelger
parents:
8856
diff
changeset
|
64 |
c26fb37899ca
Introduced groups for modules. Modules marked with the same group-id, will be put together in the ui.
gernotbelger
parents:
8856
diff
changeset
|
65 private Map<String, Module> modulesByName = new HashMap<String, Module>(); |
c26fb37899ca
Introduced groups for modules. Modules marked with the same group-id, will be put together in the ui.
gernotbelger
parents:
8856
diff
changeset
|
66 |
c26fb37899ca
Introduced groups for modules. Modules marked with the same group-id, will be put together in the ui.
gernotbelger
parents:
8856
diff
changeset
|
67 private Map<ModuleGroup, List<Module>> modulesByGroup = new LinkedHashMap<ModuleGroup, List<Module>>(); |
c26fb37899ca
Introduced groups for modules. Modules marked with the same group-id, will be put together in the ui.
gernotbelger
parents:
8856
diff
changeset
|
68 |
c26fb37899ca
Introduced groups for modules. Modules marked with the same group-id, will be put together in the ui.
gernotbelger
parents:
8856
diff
changeset
|
69 private Map<ModuleGroup, RadioGroupItem> groupToRadios = new LinkedHashMap<ModuleGroup, RadioGroupItem>(); |
c26fb37899ca
Introduced groups for modules. Modules marked with the same group-id, will be put together in the ui.
gernotbelger
parents:
8856
diff
changeset
|
70 |
c26fb37899ca
Introduced groups for modules. Modules marked with the same group-id, will be put together in the ui.
gernotbelger
parents:
8856
diff
changeset
|
71 private Map<ModuleGroup, Canvas> groupToCanvas = new LinkedHashMap<ModuleGroup, Canvas>(); |
c26fb37899ca
Introduced groups for modules. Modules marked with the same group-id, will be put together in the ui.
gernotbelger
parents:
8856
diff
changeset
|
72 |
c26fb37899ca
Introduced groups for modules. Modules marked with the same group-id, will be put together in the ui.
gernotbelger
parents:
8856
diff
changeset
|
73 private Map<String, HLayout> rivers = null; |
c26fb37899ca
Introduced groups for modules. Modules marked with the same group-id, will be put together in the ui.
gernotbelger
parents:
8856
diff
changeset
|
74 |
c26fb37899ca
Introduced groups for modules. Modules marked with the same group-id, will be put together in the ui.
gernotbelger
parents:
8856
diff
changeset
|
75 private VLayout radioPanel; |
c26fb37899ca
Introduced groups for modules. Modules marked with the same group-id, will be put together in the ui.
gernotbelger
parents:
8856
diff
changeset
|
76 |
c26fb37899ca
Introduced groups for modules. Modules marked with the same group-id, will be put together in the ui.
gernotbelger
parents:
8856
diff
changeset
|
77 /* TODO: seems that it needs to be static for the callback, is this really necessary? |
c26fb37899ca
Introduced groups for modules. Modules marked with the same group-id, will be put together in the ui.
gernotbelger
parents:
8856
diff
changeset
|
78 * TODO: what happens if we have several 'new project' windows open in parallel? |
c26fb37899ca
Introduced groups for modules. Modules marked with the same group-id, will be put together in the ui.
gernotbelger
parents:
8856
diff
changeset
|
79 * */ |
c26fb37899ca
Introduced groups for modules. Modules marked with the same group-id, will be put together in the ui.
gernotbelger
parents:
8856
diff
changeset
|
80 private static Module selectedModule = null; |
c26fb37899ca
Introduced groups for modules. Modules marked with the same group-id, will be put together in the ui.
gernotbelger
parents:
8856
diff
changeset
|
81 |
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 public ModuleSelection() { |
3518
33ed40aa1201
User ModuleService to get all modules for a user
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
2522
diff
changeset
|
83 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
|
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 /** |
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 * 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
|
88 * 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
|
89 * |
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 * @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
|
91 * |
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 * @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
|
93 */ |
4131
360e22afb98b
Cosmetics, warnings and minor TODOs.
Christian Lins <christian.lins@intevation.de>
parents:
3530
diff
changeset
|
94 @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
|
95 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
|
96 GWT.log("ModuleSelection - create()"); |
6133
3ff2a4317167
Added JavaScript callback to get the selected module in native JavaScript code.
Raimund Renkert <rrenkert@intevation.de>
parents:
6119
diff
changeset
|
97 createCallback(); |
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
|
98 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
|
99 newLayout.setMembersMargin(10); |
282
e92f7ef455d6
Show rivers as links instead of a combobox.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
211
diff
changeset
|
100 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
|
101 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
|
102 |
282
e92f7ef455d6
Show rivers as links instead of a combobox.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
211
diff
changeset
|
103 moduleSelection.setHeight(100); |
e92f7ef455d6
Show rivers as links instead of a combobox.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
211
diff
changeset
|
104 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
|
105 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
|
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 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
|
108 } |
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
|
109 |
3518
33ed40aa1201
User ModuleService to get all modules for a user
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
2522
diff
changeset
|
110 private void readModules() { |
33ed40aa1201
User ModuleService to get all modules for a user
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
2522
diff
changeset
|
111 Config config = Config.getInstance(); |
33ed40aa1201
User ModuleService to get all modules for a user
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
2522
diff
changeset
|
112 String locale = config.getLocale(); |
33ed40aa1201
User ModuleService to get all modules for a user
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
2522
diff
changeset
|
113 |
33ed40aa1201
User ModuleService to get all modules for a user
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
2522
diff
changeset
|
114 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
|
115 @Override |
33ed40aa1201
User ModuleService to get all modules for a user
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
2522
diff
changeset
|
116 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
|
117 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
|
118 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
|
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 @Override |
33ed40aa1201
User ModuleService to get all modules for a user
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
2522
diff
changeset
|
122 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
|
123 GWT.log("Retrieved " + newmodules.length + " modules."); |
8870
c26fb37899ca
Introduced groups for modules. Modules marked with the same group-id, will be put together in the ui.
gernotbelger
parents:
8856
diff
changeset
|
124 setModules(newmodules); |
c26fb37899ca
Introduced groups for modules. Modules marked with the same group-id, will be put together in the ui.
gernotbelger
parents:
8856
diff
changeset
|
125 updateRadioPanels(); |
3518
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 } |
33ed40aa1201
User ModuleService to get all modules for a user
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
2522
diff
changeset
|
129 |
8870
c26fb37899ca
Introduced groups for modules. Modules marked with the same group-id, will be put together in the ui.
gernotbelger
parents:
8856
diff
changeset
|
130 // TODO: bad. Too much knowledge spread over the application. |
c26fb37899ca
Introduced groups for modules. Modules marked with the same group-id, will be put together in the ui.
gernotbelger
parents:
8856
diff
changeset
|
131 // TODO: instead, e.g. use a controller that knows both (ModuleSelection and LinkSelection) and let him do this kind of things |
8528
f7d1a7e66b12
(issue1795) Handle modules configuration for any module
Andre Heinecke <andre.heinecke@intevation.de>
parents:
7763
diff
changeset
|
132 private void checkRivers(String selected) { |
8870
c26fb37899ca
Introduced groups for modules. Modules marked with the same group-id, will be put together in the ui.
gernotbelger
parents:
8856
diff
changeset
|
133 if (rivers == null || rivers.isEmpty() || /*modules == null || */ selected == null ) |
c26fb37899ca
Introduced groups for modules. Modules marked with the same group-id, will be put together in the ui.
gernotbelger
parents:
8856
diff
changeset
|
134 return; |
c26fb37899ca
Introduced groups for modules. Modules marked with the same group-id, will be put together in the ui.
gernotbelger
parents:
8856
diff
changeset
|
135 |
c26fb37899ca
Introduced groups for modules. Modules marked with the same group-id, will be put together in the ui.
gernotbelger
parents:
8856
diff
changeset
|
136 final List<String> allowedRivers = modulesRiverMap.get(selected); |
c26fb37899ca
Introduced groups for modules. Modules marked with the same group-id, will be put together in the ui.
gernotbelger
parents:
8856
diff
changeset
|
137 if ( allowedRivers == null ) |
c26fb37899ca
Introduced groups for modules. Modules marked with the same group-id, will be put together in the ui.
gernotbelger
parents:
8856
diff
changeset
|
138 GWT.log("No configured rivers for module: " + selected); |
c26fb37899ca
Introduced groups for modules. Modules marked with the same group-id, will be put together in the ui.
gernotbelger
parents:
8856
diff
changeset
|
139 |
c26fb37899ca
Introduced groups for modules. Modules marked with the same group-id, will be put together in the ui.
gernotbelger
parents:
8856
diff
changeset
|
140 for (final Map.Entry<String, HLayout> s: rivers.entrySet()) { |
c26fb37899ca
Introduced groups for modules. Modules marked with the same group-id, will be put together in the ui.
gernotbelger
parents:
8856
diff
changeset
|
141 if (allowedRivers == null || !allowedRivers.contains(s.getKey())) { |
c26fb37899ca
Introduced groups for modules. Modules marked with the same group-id, will be put together in the ui.
gernotbelger
parents:
8856
diff
changeset
|
142 s.getValue().hide(); |
c26fb37899ca
Introduced groups for modules. Modules marked with the same group-id, will be put together in the ui.
gernotbelger
parents:
8856
diff
changeset
|
143 } else { |
c26fb37899ca
Introduced groups for modules. Modules marked with the same group-id, will be put together in the ui.
gernotbelger
parents:
8856
diff
changeset
|
144 s.getValue().show(); |
8528
f7d1a7e66b12
(issue1795) Handle modules configuration for any module
Andre Heinecke <andre.heinecke@intevation.de>
parents:
7763
diff
changeset
|
145 } |
f7d1a7e66b12
(issue1795) Handle modules configuration for any module
Andre Heinecke <andre.heinecke@intevation.de>
parents:
7763
diff
changeset
|
146 } |
f7d1a7e66b12
(issue1795) Handle modules configuration for any module
Andre Heinecke <andre.heinecke@intevation.de>
parents:
7763
diff
changeset
|
147 } |
8870
c26fb37899ca
Introduced groups for modules. Modules marked with the same group-id, will be put together in the ui.
gernotbelger
parents:
8856
diff
changeset
|
148 |
c26fb37899ca
Introduced groups for modules. Modules marked with the same group-id, will be put together in the ui.
gernotbelger
parents:
8856
diff
changeset
|
149 protected final void setModules(Module[] newmodules) { |
c26fb37899ca
Introduced groups for modules. Modules marked with the same group-id, will be put together in the ui.
gernotbelger
parents:
8856
diff
changeset
|
150 modulesRiverMap.clear(); |
c26fb37899ca
Introduced groups for modules. Modules marked with the same group-id, will be put together in the ui.
gernotbelger
parents:
8856
diff
changeset
|
151 |
c26fb37899ca
Introduced groups for modules. Modules marked with the same group-id, will be put together in the ui.
gernotbelger
parents:
8856
diff
changeset
|
152 if( newmodules == null ) |
c26fb37899ca
Introduced groups for modules. Modules marked with the same group-id, will be put together in the ui.
gernotbelger
parents:
8856
diff
changeset
|
153 return; |
c26fb37899ca
Introduced groups for modules. Modules marked with the same group-id, will be put together in the ui.
gernotbelger
parents:
8856
diff
changeset
|
154 |
c26fb37899ca
Introduced groups for modules. Modules marked with the same group-id, will be put together in the ui.
gernotbelger
parents:
8856
diff
changeset
|
155 for(final Module module : newmodules) { |
c26fb37899ca
Introduced groups for modules. Modules marked with the same group-id, will be put together in the ui.
gernotbelger
parents:
8856
diff
changeset
|
156 final String name = module.getName(); |
c26fb37899ca
Introduced groups for modules. Modules marked with the same group-id, will be put together in the ui.
gernotbelger
parents:
8856
diff
changeset
|
157 |
c26fb37899ca
Introduced groups for modules. Modules marked with the same group-id, will be put together in the ui.
gernotbelger
parents:
8856
diff
changeset
|
158 /* remember rivers per module */ |
c26fb37899ca
Introduced groups for modules. Modules marked with the same group-id, will be put together in the ui.
gernotbelger
parents:
8856
diff
changeset
|
159 modulesRiverMap.put(name, module.getRivers()); |
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
|
160 |
8870
c26fb37899ca
Introduced groups for modules. Modules marked with the same group-id, will be put together in the ui.
gernotbelger
parents:
8856
diff
changeset
|
161 /* hash by name */ |
c26fb37899ca
Introduced groups for modules. Modules marked with the same group-id, will be put together in the ui.
gernotbelger
parents:
8856
diff
changeset
|
162 modulesByName.put(name, module); |
c26fb37899ca
Introduced groups for modules. Modules marked with the same group-id, will be put together in the ui.
gernotbelger
parents:
8856
diff
changeset
|
163 |
c26fb37899ca
Introduced groups for modules. Modules marked with the same group-id, will be put together in the ui.
gernotbelger
parents:
8856
diff
changeset
|
164 /* hash by group */ |
c26fb37899ca
Introduced groups for modules. Modules marked with the same group-id, will be put together in the ui.
gernotbelger
parents:
8856
diff
changeset
|
165 final ModuleGroup group = module.getGroup(); |
c26fb37899ca
Introduced groups for modules. Modules marked with the same group-id, will be put together in the ui.
gernotbelger
parents:
8856
diff
changeset
|
166 if( !modulesByGroup.containsKey( group ) ) |
c26fb37899ca
Introduced groups for modules. Modules marked with the same group-id, will be put together in the ui.
gernotbelger
parents:
8856
diff
changeset
|
167 modulesByGroup.put(group, new LinkedList<Module>()); |
c26fb37899ca
Introduced groups for modules. Modules marked with the same group-id, will be put together in the ui.
gernotbelger
parents:
8856
diff
changeset
|
168 |
c26fb37899ca
Introduced groups for modules. Modules marked with the same group-id, will be put together in the ui.
gernotbelger
parents:
8856
diff
changeset
|
169 final List<Module> modulesGroup = modulesByGroup.get(group); |
c26fb37899ca
Introduced groups for modules. Modules marked with the same group-id, will be put together in the ui.
gernotbelger
parents:
8856
diff
changeset
|
170 modulesGroup.add(module); |
3518
33ed40aa1201
User ModuleService to get all modules for a user
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
2522
diff
changeset
|
171 } |
33ed40aa1201
User ModuleService to get all modules for a user
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
2522
diff
changeset
|
172 } |
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
|
173 |
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 * 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
|
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 * @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
|
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 protected Canvas createWidget() { |
8870
c26fb37899ca
Introduced groups for modules. Modules marked with the same group-id, will be put together in the ui.
gernotbelger
parents:
8856
diff
changeset
|
180 |
c26fb37899ca
Introduced groups for modules. Modules marked with the same group-id, will be put together in the ui.
gernotbelger
parents:
8856
diff
changeset
|
181 final HLayout layout = new HLayout(); |
c26fb37899ca
Introduced groups for modules. Modules marked with the same group-id, will be put together in the ui.
gernotbelger
parents:
8856
diff
changeset
|
182 |
c26fb37899ca
Introduced groups for modules. Modules marked with the same group-id, will be put together in the ui.
gernotbelger
parents:
8856
diff
changeset
|
183 radioPanel = new VLayout(); |
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 |
8870
c26fb37899ca
Introduced groups for modules. Modules marked with the same group-id, will be put together in the ui.
gernotbelger
parents:
8856
diff
changeset
|
185 final Label label = new Label(MESSAGES.module_selection()); |
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
|
186 label.setWidth(50); |
282
e92f7ef455d6
Show rivers as links instead of a combobox.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
211
diff
changeset
|
187 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
|
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 layout.addMember(label); |
8870
c26fb37899ca
Introduced groups for modules. Modules marked with the same group-id, will be put together in the ui.
gernotbelger
parents:
8856
diff
changeset
|
190 layout.addMember(radioPanel); |
c26fb37899ca
Introduced groups for modules. Modules marked with the same group-id, will be put together in the ui.
gernotbelger
parents:
8856
diff
changeset
|
191 |
c26fb37899ca
Introduced groups for modules. Modules marked with the same group-id, will be put together in the ui.
gernotbelger
parents:
8856
diff
changeset
|
192 updateRadioPanels(); |
c26fb37899ca
Introduced groups for modules. Modules marked with the same group-id, will be put together in the ui.
gernotbelger
parents:
8856
diff
changeset
|
193 |
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
|
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 |
8870
c26fb37899ca
Introduced groups for modules. Modules marked with the same group-id, will be put together in the ui.
gernotbelger
parents:
8856
diff
changeset
|
197 protected final void updateRadioPanels() { |
c26fb37899ca
Introduced groups for modules. Modules marked with the same group-id, will be put together in the ui.
gernotbelger
parents:
8856
diff
changeset
|
198 |
c26fb37899ca
Introduced groups for modules. Modules marked with the same group-id, will be put together in the ui.
gernotbelger
parents:
8856
diff
changeset
|
199 /* first clear existing panels, if any exist */ |
c26fb37899ca
Introduced groups for modules. Modules marked with the same group-id, will be put together in the ui.
gernotbelger
parents:
8856
diff
changeset
|
200 final Collection<Canvas> oldforms = groupToCanvas.values(); |
c26fb37899ca
Introduced groups for modules. Modules marked with the same group-id, will be put together in the ui.
gernotbelger
parents:
8856
diff
changeset
|
201 for (Canvas oldCanvas : oldforms) { |
c26fb37899ca
Introduced groups for modules. Modules marked with the same group-id, will be put together in the ui.
gernotbelger
parents:
8856
diff
changeset
|
202 radioPanel.removeMember(oldCanvas); |
c26fb37899ca
Introduced groups for modules. Modules marked with the same group-id, will be put together in the ui.
gernotbelger
parents:
8856
diff
changeset
|
203 oldCanvas.destroy(); |
c26fb37899ca
Introduced groups for modules. Modules marked with the same group-id, will be put together in the ui.
gernotbelger
parents:
8856
diff
changeset
|
204 } |
c26fb37899ca
Introduced groups for modules. Modules marked with the same group-id, will be put together in the ui.
gernotbelger
parents:
8856
diff
changeset
|
205 |
c26fb37899ca
Introduced groups for modules. Modules marked with the same group-id, will be put together in the ui.
gernotbelger
parents:
8856
diff
changeset
|
206 groupToCanvas.clear(); |
c26fb37899ca
Introduced groups for modules. Modules marked with the same group-id, will be put together in the ui.
gernotbelger
parents:
8856
diff
changeset
|
207 groupToRadios.clear(); |
c26fb37899ca
Introduced groups for modules. Modules marked with the same group-id, will be put together in the ui.
gernotbelger
parents:
8856
diff
changeset
|
208 selectedModule = null; |
c26fb37899ca
Introduced groups for modules. Modules marked with the same group-id, will be put together in the ui.
gernotbelger
parents:
8856
diff
changeset
|
209 |
c26fb37899ca
Introduced groups for modules. Modules marked with the same group-id, will be put together in the ui.
gernotbelger
parents:
8856
diff
changeset
|
210 if( radioPanel == null ) |
c26fb37899ca
Introduced groups for modules. Modules marked with the same group-id, will be put together in the ui.
gernotbelger
parents:
8856
diff
changeset
|
211 return; |
c26fb37899ca
Introduced groups for modules. Modules marked with the same group-id, will be put together in the ui.
gernotbelger
parents:
8856
diff
changeset
|
212 |
c26fb37899ca
Introduced groups for modules. Modules marked with the same group-id, will be put together in the ui.
gernotbelger
parents:
8856
diff
changeset
|
213 /* now create radio items per group */ |
c26fb37899ca
Introduced groups for modules. Modules marked with the same group-id, will be put together in the ui.
gernotbelger
parents:
8856
diff
changeset
|
214 int count = 0; |
c26fb37899ca
Introduced groups for modules. Modules marked with the same group-id, will be put together in the ui.
gernotbelger
parents:
8856
diff
changeset
|
215 for (final Entry<ModuleGroup, List<Module>> groupEntry : modulesByGroup.entrySet()) { |
c26fb37899ca
Introduced groups for modules. Modules marked with the same group-id, will be put together in the ui.
gernotbelger
parents:
8856
diff
changeset
|
216 |
c26fb37899ca
Introduced groups for modules. Modules marked with the same group-id, will be put together in the ui.
gernotbelger
parents:
8856
diff
changeset
|
217 final ModuleGroup group = groupEntry.getKey(); |
c26fb37899ca
Introduced groups for modules. Modules marked with the same group-id, will be put together in the ui.
gernotbelger
parents:
8856
diff
changeset
|
218 final List<Module> groupModule = groupEntry.getValue(); |
c26fb37899ca
Introduced groups for modules. Modules marked with the same group-id, will be put together in the ui.
gernotbelger
parents:
8856
diff
changeset
|
219 |
c26fb37899ca
Introduced groups for modules. Modules marked with the same group-id, will be put together in the ui.
gernotbelger
parents:
8856
diff
changeset
|
220 final HLayout groupPanel = new HLayout(); |
c26fb37899ca
Introduced groups for modules. Modules marked with the same group-id, will be put together in the ui.
gernotbelger
parents:
8856
diff
changeset
|
221 |
c26fb37899ca
Introduced groups for modules. Modules marked with the same group-id, will be put together in the ui.
gernotbelger
parents:
8856
diff
changeset
|
222 if( group.showGroupFrame() ) |
c26fb37899ca
Introduced groups for modules. Modules marked with the same group-id, will be put together in the ui.
gernotbelger
parents:
8856
diff
changeset
|
223 { |
c26fb37899ca
Introduced groups for modules. Modules marked with the same group-id, will be put together in the ui.
gernotbelger
parents:
8856
diff
changeset
|
224 final LayoutSpacer spacer = new LayoutSpacer(); |
c26fb37899ca
Introduced groups for modules. Modules marked with the same group-id, will be put together in the ui.
gernotbelger
parents:
8856
diff
changeset
|
225 spacer.setWidth(25); |
c26fb37899ca
Introduced groups for modules. Modules marked with the same group-id, will be put together in the ui.
gernotbelger
parents:
8856
diff
changeset
|
226 groupPanel.addMember(spacer); |
c26fb37899ca
Introduced groups for modules. Modules marked with the same group-id, will be put together in the ui.
gernotbelger
parents:
8856
diff
changeset
|
227 |
c26fb37899ca
Introduced groups for modules. Modules marked with the same group-id, will be put together in the ui.
gernotbelger
parents:
8856
diff
changeset
|
228 final Label label = new Label(group.toString()); |
c26fb37899ca
Introduced groups for modules. Modules marked with the same group-id, will be put together in the ui.
gernotbelger
parents:
8856
diff
changeset
|
229 label.setWidth(25); |
c26fb37899ca
Introduced groups for modules. Modules marked with the same group-id, will be put together in the ui.
gernotbelger
parents:
8856
diff
changeset
|
230 label.setHeight(25); |
c26fb37899ca
Introduced groups for modules. Modules marked with the same group-id, will be put together in the ui.
gernotbelger
parents:
8856
diff
changeset
|
231 groupPanel.addMember(label); |
c26fb37899ca
Introduced groups for modules. Modules marked with the same group-id, will be put together in the ui.
gernotbelger
parents:
8856
diff
changeset
|
232 } |
c26fb37899ca
Introduced groups for modules. Modules marked with the same group-id, will be put together in the ui.
gernotbelger
parents:
8856
diff
changeset
|
233 |
c26fb37899ca
Introduced groups for modules. Modules marked with the same group-id, will be put together in the ui.
gernotbelger
parents:
8856
diff
changeset
|
234 final DynamicForm groupForm = new DynamicForm(); |
c26fb37899ca
Introduced groups for modules. Modules marked with the same group-id, will be put together in the ui.
gernotbelger
parents:
8856
diff
changeset
|
235 |
c26fb37899ca
Introduced groups for modules. Modules marked with the same group-id, will be put together in the ui.
gernotbelger
parents:
8856
diff
changeset
|
236 final RadioGroupItem moduleRadio = new RadioGroupItem("modulegroup" + count++); |
c26fb37899ca
Introduced groups for modules. Modules marked with the same group-id, will be put together in the ui.
gernotbelger
parents:
8856
diff
changeset
|
237 moduleRadio.setShowTitle(false); |
c26fb37899ca
Introduced groups for modules. Modules marked with the same group-id, will be put together in the ui.
gernotbelger
parents:
8856
diff
changeset
|
238 moduleRadio.setVertical(true); |
c26fb37899ca
Introduced groups for modules. Modules marked with the same group-id, will be put together in the ui.
gernotbelger
parents:
8856
diff
changeset
|
239 |
c26fb37899ca
Introduced groups for modules. Modules marked with the same group-id, will be put together in the ui.
gernotbelger
parents:
8856
diff
changeset
|
240 moduleRadio.addChangeHandler(new ChangeHandler() { |
c26fb37899ca
Introduced groups for modules. Modules marked with the same group-id, will be put together in the ui.
gernotbelger
parents:
8856
diff
changeset
|
241 @Override |
c26fb37899ca
Introduced groups for modules. Modules marked with the same group-id, will be put together in the ui.
gernotbelger
parents:
8856
diff
changeset
|
242 public void onChange(ChangeEvent event) { |
c26fb37899ca
Introduced groups for modules. Modules marked with the same group-id, will be put together in the ui.
gernotbelger
parents:
8856
diff
changeset
|
243 final String selectedModuleName = (String) event.getValue(); |
c26fb37899ca
Introduced groups for modules. Modules marked with the same group-id, will be put together in the ui.
gernotbelger
parents:
8856
diff
changeset
|
244 handleModuleSelected(selectedModuleName); |
c26fb37899ca
Introduced groups for modules. Modules marked with the same group-id, will be put together in the ui.
gernotbelger
parents:
8856
diff
changeset
|
245 } |
c26fb37899ca
Introduced groups for modules. Modules marked with the same group-id, will be put together in the ui.
gernotbelger
parents:
8856
diff
changeset
|
246 }); |
c26fb37899ca
Introduced groups for modules. Modules marked with the same group-id, will be put together in the ui.
gernotbelger
parents:
8856
diff
changeset
|
247 |
c26fb37899ca
Introduced groups for modules. Modules marked with the same group-id, will be put together in the ui.
gernotbelger
parents:
8856
diff
changeset
|
248 groupForm.setItems(moduleRadio); |
c26fb37899ca
Introduced groups for modules. Modules marked with the same group-id, will be put together in the ui.
gernotbelger
parents:
8856
diff
changeset
|
249 groupPanel.addMember(groupForm); |
c26fb37899ca
Introduced groups for modules. Modules marked with the same group-id, will be put together in the ui.
gernotbelger
parents:
8856
diff
changeset
|
250 |
c26fb37899ca
Introduced groups for modules. Modules marked with the same group-id, will be put together in the ui.
gernotbelger
parents:
8856
diff
changeset
|
251 final LinkedHashMap<String, String> values = new LinkedHashMap<String, String>(); |
c26fb37899ca
Introduced groups for modules. Modules marked with the same group-id, will be put together in the ui.
gernotbelger
parents:
8856
diff
changeset
|
252 for(final Module module : groupModule) { |
c26fb37899ca
Introduced groups for modules. Modules marked with the same group-id, will be put together in the ui.
gernotbelger
parents:
8856
diff
changeset
|
253 values.put(module.getName(), module.getLocalizedName()); |
c26fb37899ca
Introduced groups for modules. Modules marked with the same group-id, will be put together in the ui.
gernotbelger
parents:
8856
diff
changeset
|
254 if (module.isSelected()) { |
c26fb37899ca
Introduced groups for modules. Modules marked with the same group-id, will be put together in the ui.
gernotbelger
parents:
8856
diff
changeset
|
255 GWT.log("Module " + module.getName() + " is selected."); |
c26fb37899ca
Introduced groups for modules. Modules marked with the same group-id, will be put together in the ui.
gernotbelger
parents:
8856
diff
changeset
|
256 selectedModule = module; |
c26fb37899ca
Introduced groups for modules. Modules marked with the same group-id, will be put together in the ui.
gernotbelger
parents:
8856
diff
changeset
|
257 moduleRadio.setValue(module.getName()); |
c26fb37899ca
Introduced groups for modules. Modules marked with the same group-id, will be put together in the ui.
gernotbelger
parents:
8856
diff
changeset
|
258 } |
c26fb37899ca
Introduced groups for modules. Modules marked with the same group-id, will be put together in the ui.
gernotbelger
parents:
8856
diff
changeset
|
259 } |
c26fb37899ca
Introduced groups for modules. Modules marked with the same group-id, will be put together in the ui.
gernotbelger
parents:
8856
diff
changeset
|
260 |
c26fb37899ca
Introduced groups for modules. Modules marked with the same group-id, will be put together in the ui.
gernotbelger
parents:
8856
diff
changeset
|
261 this.groupToRadios.put( group, moduleRadio ); |
c26fb37899ca
Introduced groups for modules. Modules marked with the same group-id, will be put together in the ui.
gernotbelger
parents:
8856
diff
changeset
|
262 this.groupToCanvas.put( group, groupPanel ); |
c26fb37899ca
Introduced groups for modules. Modules marked with the same group-id, will be put together in the ui.
gernotbelger
parents:
8856
diff
changeset
|
263 |
c26fb37899ca
Introduced groups for modules. Modules marked with the same group-id, will be put together in the ui.
gernotbelger
parents:
8856
diff
changeset
|
264 moduleRadio.setValueMap(values); |
c26fb37899ca
Introduced groups for modules. Modules marked with the same group-id, will be put together in the ui.
gernotbelger
parents:
8856
diff
changeset
|
265 |
c26fb37899ca
Introduced groups for modules. Modules marked with the same group-id, will be put together in the ui.
gernotbelger
parents:
8856
diff
changeset
|
266 |
c26fb37899ca
Introduced groups for modules. Modules marked with the same group-id, will be put together in the ui.
gernotbelger
parents:
8856
diff
changeset
|
267 radioPanel.addMember(groupPanel); |
c26fb37899ca
Introduced groups for modules. Modules marked with the same group-id, will be put together in the ui.
gernotbelger
parents:
8856
diff
changeset
|
268 } |
c26fb37899ca
Introduced groups for modules. Modules marked with the same group-id, will be put together in the ui.
gernotbelger
parents:
8856
diff
changeset
|
269 |
c26fb37899ca
Introduced groups for modules. Modules marked with the same group-id, will be put together in the ui.
gernotbelger
parents:
8856
diff
changeset
|
270 checkRivers(getSelectedModule()); |
c26fb37899ca
Introduced groups for modules. Modules marked with the same group-id, will be put together in the ui.
gernotbelger
parents:
8856
diff
changeset
|
271 } |
c26fb37899ca
Introduced groups for modules. Modules marked with the same group-id, will be put together in the ui.
gernotbelger
parents:
8856
diff
changeset
|
272 |
c26fb37899ca
Introduced groups for modules. Modules marked with the same group-id, will be put together in the ui.
gernotbelger
parents:
8856
diff
changeset
|
273 protected void handleModuleSelected(final String selectedModuleName) { |
c26fb37899ca
Introduced groups for modules. Modules marked with the same group-id, will be put together in the ui.
gernotbelger
parents:
8856
diff
changeset
|
274 |
c26fb37899ca
Introduced groups for modules. Modules marked with the same group-id, will be put together in the ui.
gernotbelger
parents:
8856
diff
changeset
|
275 /* remember selected module for later */ |
c26fb37899ca
Introduced groups for modules. Modules marked with the same group-id, will be put together in the ui.
gernotbelger
parents:
8856
diff
changeset
|
276 selectedModule = modulesByName.get(selectedModuleName); |
c26fb37899ca
Introduced groups for modules. Modules marked with the same group-id, will be put together in the ui.
gernotbelger
parents:
8856
diff
changeset
|
277 |
c26fb37899ca
Introduced groups for modules. Modules marked with the same group-id, will be put together in the ui.
gernotbelger
parents:
8856
diff
changeset
|
278 /* because radios might in different radio-groups, we need to de-select them manually */ |
c26fb37899ca
Introduced groups for modules. Modules marked with the same group-id, will be put together in the ui.
gernotbelger
parents:
8856
diff
changeset
|
279 final ModuleGroup group = selectedModule.getGroup(); |
c26fb37899ca
Introduced groups for modules. Modules marked with the same group-id, will be put together in the ui.
gernotbelger
parents:
8856
diff
changeset
|
280 |
c26fb37899ca
Introduced groups for modules. Modules marked with the same group-id, will be put together in the ui.
gernotbelger
parents:
8856
diff
changeset
|
281 for (final Entry<ModuleGroup, RadioGroupItem> entry : groupToRadios.entrySet()) { |
c26fb37899ca
Introduced groups for modules. Modules marked with the same group-id, will be put together in the ui.
gernotbelger
parents:
8856
diff
changeset
|
282 final ModuleGroup radioGroup = entry.getKey(); |
c26fb37899ca
Introduced groups for modules. Modules marked with the same group-id, will be put together in the ui.
gernotbelger
parents:
8856
diff
changeset
|
283 |
c26fb37899ca
Introduced groups for modules. Modules marked with the same group-id, will be put together in the ui.
gernotbelger
parents:
8856
diff
changeset
|
284 if( !group.equals(radioGroup)) |
c26fb37899ca
Introduced groups for modules. Modules marked with the same group-id, will be put together in the ui.
gernotbelger
parents:
8856
diff
changeset
|
285 { |
c26fb37899ca
Introduced groups for modules. Modules marked with the same group-id, will be put together in the ui.
gernotbelger
parents:
8856
diff
changeset
|
286 final RadioGroupItem groupRadio = entry.getValue(); |
c26fb37899ca
Introduced groups for modules. Modules marked with the same group-id, will be put together in the ui.
gernotbelger
parents:
8856
diff
changeset
|
287 groupRadio.setValue((String)null); |
c26fb37899ca
Introduced groups for modules. Modules marked with the same group-id, will be put together in the ui.
gernotbelger
parents:
8856
diff
changeset
|
288 } |
c26fb37899ca
Introduced groups for modules. Modules marked with the same group-id, will be put together in the ui.
gernotbelger
parents:
8856
diff
changeset
|
289 } |
c26fb37899ca
Introduced groups for modules. Modules marked with the same group-id, will be put together in the ui.
gernotbelger
parents:
8856
diff
changeset
|
290 |
c26fb37899ca
Introduced groups for modules. Modules marked with the same group-id, will be put together in the ui.
gernotbelger
parents:
8856
diff
changeset
|
291 checkRivers(selectedModuleName); |
c26fb37899ca
Introduced groups for modules. Modules marked with the same group-id, will be put together in the ui.
gernotbelger
parents:
8856
diff
changeset
|
292 } |
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
|
293 |
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
|
294 /** |
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
|
295 * 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
|
296 * 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
|
297 * 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
|
298 * 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
|
299 * |
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
|
300 * @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
|
301 */ |
4131
360e22afb98b
Cosmetics, warnings and minor TODOs.
Christian Lins <christian.lins@intevation.de>
parents:
3530
diff
changeset
|
302 @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
|
303 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
|
304 |
8870
c26fb37899ca
Introduced groups for modules. Modules marked with the same group-id, will be put together in the ui.
gernotbelger
parents:
8856
diff
changeset
|
305 final Module module = selectedModule; |
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
|
306 |
8870
c26fb37899ca
Introduced groups for modules. Modules marked with the same group-id, will be put together in the ui.
gernotbelger
parents:
8856
diff
changeset
|
307 final DataItem[] items = new DefaultDataItem[] { new DefaultDataItem(module.getLocalizedName(), module.getLocalizedName(), module.getName()) }; |
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
|
308 |
8870
c26fb37899ca
Introduced groups for modules. Modules marked with the same group-id, will be put together in the ui.
gernotbelger
parents:
8856
diff
changeset
|
309 final Data data = new DefaultData("module", null, null, items); |
282
e92f7ef455d6
Show rivers as links instead of a combobox.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
211
diff
changeset
|
310 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
|
311 } |
5928
34392dc16546
Implemented interaction design in project startup page.
Raimund Renkert <rrenkert@intevation.de>
parents:
5861
diff
changeset
|
312 |
6119
0b9f0d37fe6e
We have a much faster interactive image map!
Raimund Renkert <rrenkert@intevation.de>
parents:
5993
diff
changeset
|
313 public void setRivers(Map<String, HLayout> rivers) { |
5928
34392dc16546
Implemented interaction design in project startup page.
Raimund Renkert <rrenkert@intevation.de>
parents:
5861
diff
changeset
|
314 this.rivers = rivers; |
34392dc16546
Implemented interaction design in project startup page.
Raimund Renkert <rrenkert@intevation.de>
parents:
5861
diff
changeset
|
315 } |
6133
3ff2a4317167
Added JavaScript callback to get the selected module in native JavaScript code.
Raimund Renkert <rrenkert@intevation.de>
parents:
6119
diff
changeset
|
316 |
3ff2a4317167
Added JavaScript callback to get the selected module in native JavaScript code.
Raimund Renkert <rrenkert@intevation.de>
parents:
6119
diff
changeset
|
317 private native void createCallback() /*-{ |
3ff2a4317167
Added JavaScript callback to get the selected module in native JavaScript code.
Raimund Renkert <rrenkert@intevation.de>
parents:
6119
diff
changeset
|
318 $wnd.getModule = @org.dive4elements.river.client.client.ui.ModuleSelection::getSelectedModule(); |
3ff2a4317167
Added JavaScript callback to get the selected module in native JavaScript code.
Raimund Renkert <rrenkert@intevation.de>
parents:
6119
diff
changeset
|
319 }-*/; |
3ff2a4317167
Added JavaScript callback to get the selected module in native JavaScript code.
Raimund Renkert <rrenkert@intevation.de>
parents:
6119
diff
changeset
|
320 |
3ff2a4317167
Added JavaScript callback to get the selected module in native JavaScript code.
Raimund Renkert <rrenkert@intevation.de>
parents:
6119
diff
changeset
|
321 private static String getSelectedModule() { |
8870
c26fb37899ca
Introduced groups for modules. Modules marked with the same group-id, will be put together in the ui.
gernotbelger
parents:
8856
diff
changeset
|
322 if (selectedModule == null) { |
8528
f7d1a7e66b12
(issue1795) Handle modules configuration for any module
Andre Heinecke <andre.heinecke@intevation.de>
parents:
7763
diff
changeset
|
323 return null; |
f7d1a7e66b12
(issue1795) Handle modules configuration for any module
Andre Heinecke <andre.heinecke@intevation.de>
parents:
7763
diff
changeset
|
324 } |
8870
c26fb37899ca
Introduced groups for modules. Modules marked with the same group-id, will be put together in the ui.
gernotbelger
parents:
8856
diff
changeset
|
325 return selectedModule.getName(); |
6133
3ff2a4317167
Added JavaScript callback to get the selected module in native JavaScript code.
Raimund Renkert <rrenkert@intevation.de>
parents:
6119
diff
changeset
|
326 } |
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
|
327 } |
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
|
328 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : |