annotate gwt-client/src/main/java/org/dive4elements/river/client/client/ui/ThemePanel.java @ 9580:839b2aa84dd0

minuend/subtrahend-UI-switch
author gernotbelger
date Tue, 08 Jan 2019 17:01:09 +0100
parents cff7636035ce
children
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: 5861
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: 5861
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;
805
f43d06d6a4a2 Refactored code of theme panel and added a MapThemePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
10
9416
05405292a7ca Navigationtheme panel now shows themes of dWt and WQ charts grayed out, if the current station is outside the valid range of the theme.
gernotbelger
parents: 8856
diff changeset
11 import java.util.ArrayList;
05405292a7ca Navigationtheme panel now shows themes of dWt and WQ charts grayed out, if the current station is outside the valid range of the theme.
gernotbelger
parents: 8856
diff changeset
12 import java.util.List;
805
f43d06d6a4a2 Refactored code of theme panel and added a MapThemePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
13
5835
821a02bbfb4e Fixed internal java dependencies
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5834
diff changeset
14 import org.dive4elements.river.client.client.Config;
821a02bbfb4e Fixed internal java dependencies
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5834
diff changeset
15 import org.dive4elements.river.client.client.FLYSConstants;
821a02bbfb4e Fixed internal java dependencies
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5834
diff changeset
16 import org.dive4elements.river.client.client.event.HasOutputParameterChangeHandlers;
821a02bbfb4e Fixed internal java dependencies
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5834
diff changeset
17 import org.dive4elements.river.client.client.event.HasRedrawRequestHandlers;
821a02bbfb4e Fixed internal java dependencies
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5834
diff changeset
18 import org.dive4elements.river.client.client.event.OnMoveEvent;
821a02bbfb4e Fixed internal java dependencies
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5834
diff changeset
19 import org.dive4elements.river.client.client.event.OnMoveHandler;
821a02bbfb4e Fixed internal java dependencies
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5834
diff changeset
20 import org.dive4elements.river.client.client.event.OutputParameterChangeEvent;
821a02bbfb4e Fixed internal java dependencies
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5834
diff changeset
21 import org.dive4elements.river.client.client.event.OutputParameterChangeHandler;
821a02bbfb4e Fixed internal java dependencies
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5834
diff changeset
22 import org.dive4elements.river.client.client.event.RedrawRequestEvent;
821a02bbfb4e Fixed internal java dependencies
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5834
diff changeset
23 import org.dive4elements.river.client.client.event.RedrawRequestEvent.Type;
821a02bbfb4e Fixed internal java dependencies
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5834
diff changeset
24 import org.dive4elements.river.client.client.event.RedrawRequestHandler;
821a02bbfb4e Fixed internal java dependencies
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5834
diff changeset
25 import org.dive4elements.river.client.client.services.CollectionAttributeService;
821a02bbfb4e Fixed internal java dependencies
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5834
diff changeset
26 import org.dive4elements.river.client.client.services.CollectionAttributeServiceAsync;
821a02bbfb4e Fixed internal java dependencies
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5834
diff changeset
27 import org.dive4elements.river.client.client.services.CollectionItemAttributeService;
821a02bbfb4e Fixed internal java dependencies
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5834
diff changeset
28 import org.dive4elements.river.client.client.services.CollectionItemAttributeServiceAsync;
821a02bbfb4e Fixed internal java dependencies
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5834
diff changeset
29 import org.dive4elements.river.client.shared.model.Collection;
821a02bbfb4e Fixed internal java dependencies
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5834
diff changeset
30 import org.dive4elements.river.client.shared.model.CollectionItemAttribute;
821a02bbfb4e Fixed internal java dependencies
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5834
diff changeset
31 import org.dive4elements.river.client.shared.model.FacetRecord;
821a02bbfb4e Fixed internal java dependencies
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5834
diff changeset
32 import org.dive4elements.river.client.shared.model.OutputMode;
9575
cff7636035ce no style warning for wms themes
gernotbelger
parents: 9416
diff changeset
33 import org.dive4elements.river.client.shared.model.Style;
5835
821a02bbfb4e Fixed internal java dependencies
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5834
diff changeset
34 import org.dive4elements.river.client.shared.model.Theme;
821a02bbfb4e Fixed internal java dependencies
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5834
diff changeset
35 import org.dive4elements.river.client.shared.model.ThemeList;
4184
03de5c424f95 Fix warnings and minor TODOs in flys-client.
Christian Lins <christian.lins@intevation.de>
parents: 3547
diff changeset
36
9416
05405292a7ca Navigationtheme panel now shows themes of dWt and WQ charts grayed out, if the current station is outside the valid range of the theme.
gernotbelger
parents: 8856
diff changeset
37 import com.google.gwt.core.client.GWT;
05405292a7ca Navigationtheme panel now shows themes of dWt and WQ charts grayed out, if the current station is outside the valid range of the theme.
gernotbelger
parents: 8856
diff changeset
38 import com.google.gwt.user.client.rpc.AsyncCallback;
05405292a7ca Navigationtheme panel now shows themes of dWt and WQ charts grayed out, if the current station is outside the valid range of the theme.
gernotbelger
parents: 8856
diff changeset
39 import com.smartgwt.client.util.BooleanCallback;
05405292a7ca Navigationtheme panel now shows themes of dWt and WQ charts grayed out, if the current station is outside the valid range of the theme.
gernotbelger
parents: 8856
diff changeset
40 import com.smartgwt.client.util.SC;
05405292a7ca Navigationtheme panel now shows themes of dWt and WQ charts grayed out, if the current station is outside the valid range of the theme.
gernotbelger
parents: 8856
diff changeset
41 import com.smartgwt.client.widgets.Canvas;
05405292a7ca Navigationtheme panel now shows themes of dWt and WQ charts grayed out, if the current station is outside the valid range of the theme.
gernotbelger
parents: 8856
diff changeset
42 import com.smartgwt.client.widgets.grid.ListGrid;
05405292a7ca Navigationtheme panel now shows themes of dWt and WQ charts grayed out, if the current station is outside the valid range of the theme.
gernotbelger
parents: 8856
diff changeset
43 import com.smartgwt.client.widgets.grid.ListGridRecord;
05405292a7ca Navigationtheme panel now shows themes of dWt and WQ charts grayed out, if the current station is outside the valid range of the theme.
gernotbelger
parents: 8856
diff changeset
44 import com.smartgwt.client.widgets.grid.events.EditCompleteEvent;
05405292a7ca Navigationtheme panel now shows themes of dWt and WQ charts grayed out, if the current station is outside the valid range of the theme.
gernotbelger
parents: 8856
diff changeset
45 import com.smartgwt.client.widgets.grid.events.EditCompleteHandler;
05405292a7ca Navigationtheme panel now shows themes of dWt and WQ charts grayed out, if the current station is outside the valid range of the theme.
gernotbelger
parents: 8856
diff changeset
46 import com.smartgwt.client.widgets.grid.events.RowContextClickEvent;
05405292a7ca Navigationtheme panel now shows themes of dWt and WQ charts grayed out, if the current station is outside the valid range of the theme.
gernotbelger
parents: 8856
diff changeset
47 import com.smartgwt.client.widgets.grid.events.RowContextClickHandler;
05405292a7ca Navigationtheme panel now shows themes of dWt and WQ charts grayed out, if the current station is outside the valid range of the theme.
gernotbelger
parents: 8856
diff changeset
48 import com.smartgwt.client.widgets.menu.Menu;
05405292a7ca Navigationtheme panel now shows themes of dWt and WQ charts grayed out, if the current station is outside the valid range of the theme.
gernotbelger
parents: 8856
diff changeset
49 import com.smartgwt.client.widgets.menu.MenuItem;
05405292a7ca Navigationtheme panel now shows themes of dWt and WQ charts grayed out, if the current station is outside the valid range of the theme.
gernotbelger
parents: 8856
diff changeset
50 import com.smartgwt.client.widgets.menu.events.ClickHandler;
05405292a7ca Navigationtheme panel now shows themes of dWt and WQ charts grayed out, if the current station is outside the valid range of the theme.
gernotbelger
parents: 8856
diff changeset
51 import com.smartgwt.client.widgets.menu.events.MenuItemClickEvent;
805
f43d06d6a4a2 Refactored code of theme panel and added a MapThemePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
52
1430
6bb6d43eeb2d Cosmetics.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1425
diff changeset
53 /**
6bb6d43eeb2d Cosmetics.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1425
diff changeset
54 * ThemePanel on the left in CollectionView.
8856
5e38e2924c07 Fix code style.
Tom Gottfried <tom@intevation.de>
parents: 5993
diff changeset
55 * Contains control widgets for "themes", which are plotted in
5e38e2924c07 Fix code style.
Tom Gottfried <tom@intevation.de>
parents: 5993
diff changeset
56 * a diagram (chart).
1430
6bb6d43eeb2d Cosmetics.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1425
diff changeset
57 *
6bb6d43eeb2d Cosmetics.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1425
diff changeset
58 * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a>
6bb6d43eeb2d Cosmetics.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1425
diff changeset
59 */
9416
05405292a7ca Navigationtheme panel now shows themes of dWt and WQ charts grayed out, if the current station is outside the valid range of the theme.
gernotbelger
parents: 8856
diff changeset
60 public abstract class ThemePanel extends Canvas implements OnMoveHandler, EditCompleteHandler, HasOutputParameterChangeHandlers, HasRedrawRequestHandlers {
05405292a7ca Navigationtheme panel now shows themes of dWt and WQ charts grayed out, if the current station is outside the valid range of the theme.
gernotbelger
parents: 8856
diff changeset
61
05405292a7ca Navigationtheme panel now shows themes of dWt and WQ charts grayed out, if the current station is outside the valid range of the theme.
gernotbelger
parents: 8856
diff changeset
62 private final CollectionAttributeServiceAsync updater = GWT.create(CollectionAttributeService.class);
805
f43d06d6a4a2 Refactored code of theme panel and added a MapThemePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
63
1309
a95e82d6bcc1 Refactored the code to create a context menu and a style editor so that it is also available for maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1303
diff changeset
64 /** The service used to get collection item attributes. */
9416
05405292a7ca Navigationtheme panel now shows themes of dWt and WQ charts grayed out, if the current station is outside the valid range of the theme.
gernotbelger
parents: 8856
diff changeset
65 private final CollectionItemAttributeServiceAsync itemAttributeService = GWT.create(CollectionItemAttributeService.class);
1309
a95e82d6bcc1 Refactored the code to create a context menu and a style editor so that it is also available for maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1303
diff changeset
66
1443
ec0460dbbae2 Added method to create a menuitem separator.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1430
diff changeset
67 /** i18ner. */
9416
05405292a7ca Navigationtheme panel now shows themes of dWt and WQ charts grayed out, if the current station is outside the valid range of the theme.
gernotbelger
parents: 8856
diff changeset
68 protected final FLYSConstants MSG = GWT.create(FLYSConstants.class);
805
f43d06d6a4a2 Refactored code of theme panel and added a MapThemePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
69
858
9f07f67f60a5 Subclassed ChartThemePanel, trigger redraws of Chart when interaction with
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 854
diff changeset
70 /** List of OutParameterChangedHandler. */
9416
05405292a7ca Navigationtheme panel now shows themes of dWt and WQ charts grayed out, if the current station is outside the valid range of the theme.
gernotbelger
parents: 8856
diff changeset
71 private final List<OutputParameterChangeHandler> outHandlers;
1443
ec0460dbbae2 Added method to create a menuitem separator.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1430
diff changeset
72
858
9f07f67f60a5 Subclassed ChartThemePanel, trigger redraws of Chart when interaction with
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 854
diff changeset
73 /** List of ChartShallRedrawHandler. */
9416
05405292a7ca Navigationtheme panel now shows themes of dWt and WQ charts grayed out, if the current station is outside the valid range of the theme.
gernotbelger
parents: 8856
diff changeset
74 protected final List<RedrawRequestHandler> redrawRequestHandlers;
805
f43d06d6a4a2 Refactored code of theme panel and added a MapThemePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
75
9416
05405292a7ca Navigationtheme panel now shows themes of dWt and WQ charts grayed out, if the current station is outside the valid range of the theme.
gernotbelger
parents: 8856
diff changeset
76 protected final OutputMode mode;
805
f43d06d6a4a2 Refactored code of theme panel and added a MapThemePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
77
9416
05405292a7ca Navigationtheme panel now shows themes of dWt and WQ charts grayed out, if the current station is outside the valid range of the theme.
gernotbelger
parents: 8856
diff changeset
78 protected final ThemeNavigationPanel navigation;
05405292a7ca Navigationtheme panel now shows themes of dWt and WQ charts grayed out, if the current station is outside the valid range of the theme.
gernotbelger
parents: 8856
diff changeset
79
05405292a7ca Navigationtheme panel now shows themes of dWt and WQ charts grayed out, if the current station is outside the valid range of the theme.
gernotbelger
parents: 8856
diff changeset
80 protected final ListGrid list;
05405292a7ca Navigationtheme panel now shows themes of dWt and WQ charts grayed out, if the current station is outside the valid range of the theme.
gernotbelger
parents: 8856
diff changeset
81
05405292a7ca Navigationtheme panel now shows themes of dWt and WQ charts grayed out, if the current station is outside the valid range of the theme.
gernotbelger
parents: 8856
diff changeset
82 /** The collection view */
1309
a95e82d6bcc1 Refactored the code to create a context menu and a style editor so that it is also available for maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1303
diff changeset
83 protected CollectionView view;
a95e82d6bcc1 Refactored the code to create a context menu and a style editor so that it is also available for maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1303
diff changeset
84
9416
05405292a7ca Navigationtheme panel now shows themes of dWt and WQ charts grayed out, if the current station is outside the valid range of the theme.
gernotbelger
parents: 8856
diff changeset
85 private final IThemeRecordHandler recordHandler;
05405292a7ca Navigationtheme panel now shows themes of dWt and WQ charts grayed out, if the current station is outside the valid range of the theme.
gernotbelger
parents: 8856
diff changeset
86
854
67c678903280 Refactored to allow specialized controls within the ChartThemePanel, stubby
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 805
diff changeset
87 /**
67c678903280 Refactored to allow specialized controls within the ChartThemePanel, stubby
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 805
diff changeset
88 * Setup Grid, navigation bar.
9416
05405292a7ca Navigationtheme panel now shows themes of dWt and WQ charts grayed out, if the current station is outside the valid range of the theme.
gernotbelger
parents: 8856
diff changeset
89 *
05405292a7ca Navigationtheme panel now shows themes of dWt and WQ charts grayed out, if the current station is outside the valid range of the theme.
gernotbelger
parents: 8856
diff changeset
90 * @param collection
05405292a7ca Navigationtheme panel now shows themes of dWt and WQ charts grayed out, if the current station is outside the valid range of the theme.
gernotbelger
parents: 8856
diff changeset
91 * Collection for which to show themes.
854
67c678903280 Refactored to allow specialized controls within the ChartThemePanel, stubby
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 805
diff changeset
92 */
9416
05405292a7ca Navigationtheme panel now shows themes of dWt and WQ charts grayed out, if the current station is outside the valid range of the theme.
gernotbelger
parents: 8856
diff changeset
93 public ThemePanel(final OutputMode mode, final CollectionView view, final IThemeRecordHandler recordHandler) {
05405292a7ca Navigationtheme panel now shows themes of dWt and WQ charts grayed out, if the current station is outside the valid range of the theme.
gernotbelger
parents: 8856
diff changeset
94 this.mode = mode;
05405292a7ca Navigationtheme panel now shows themes of dWt and WQ charts grayed out, if the current station is outside the valid range of the theme.
gernotbelger
parents: 8856
diff changeset
95 this.recordHandler = recordHandler;
05405292a7ca Navigationtheme panel now shows themes of dWt and WQ charts grayed out, if the current station is outside the valid range of the theme.
gernotbelger
parents: 8856
diff changeset
96 this.list = createGrid();
05405292a7ca Navigationtheme panel now shows themes of dWt and WQ charts grayed out, if the current station is outside the valid range of the theme.
gernotbelger
parents: 8856
diff changeset
97 this.view = view;
05405292a7ca Navigationtheme panel now shows themes of dWt and WQ charts grayed out, if the current station is outside the valid range of the theme.
gernotbelger
parents: 8856
diff changeset
98
05405292a7ca Navigationtheme panel now shows themes of dWt and WQ charts grayed out, if the current station is outside the valid range of the theme.
gernotbelger
parents: 8856
diff changeset
99 this.list.addRowContextClickHandler(new RowContextClickHandler() {
4184
03de5c424f95 Fix warnings and minor TODOs in flys-client.
Christian Lins <christian.lins@intevation.de>
parents: 3547
diff changeset
100 @Override
9416
05405292a7ca Navigationtheme panel now shows themes of dWt and WQ charts grayed out, if the current station is outside the valid range of the theme.
gernotbelger
parents: 8856
diff changeset
101 public void onRowContextClick(final RowContextClickEvent event) {
05405292a7ca Navigationtheme panel now shows themes of dWt and WQ charts grayed out, if the current station is outside the valid range of the theme.
gernotbelger
parents: 8856
diff changeset
102 final ListGridRecord[] records = ThemePanel.this.list.getSelectedRecords();
1358
c437e4f0f7be Moved the context menu handler to constructor to have the menu
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1340
diff changeset
103
c437e4f0f7be Moved the context menu handler to constructor to have the menu
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1340
diff changeset
104 Menu menu = null;
c437e4f0f7be Moved the context menu handler to constructor to have the menu
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1340
diff changeset
105
c437e4f0f7be Moved the context menu handler to constructor to have the menu
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1340
diff changeset
106 if (records == null || records.length == 0) {
c437e4f0f7be Moved the context menu handler to constructor to have the menu
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1340
diff changeset
107 return;
9416
05405292a7ca Navigationtheme panel now shows themes of dWt and WQ charts grayed out, if the current station is outside the valid range of the theme.
gernotbelger
parents: 8856
diff changeset
108 } else if (records.length == 1) {
1358
c437e4f0f7be Moved the context menu handler to constructor to have the menu
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1340
diff changeset
109 menu = getSingleContextMenu(records);
9416
05405292a7ca Navigationtheme panel now shows themes of dWt and WQ charts grayed out, if the current station is outside the valid range of the theme.
gernotbelger
parents: 8856
diff changeset
110 } else if (records.length > 1) {
1358
c437e4f0f7be Moved the context menu handler to constructor to have the menu
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1340
diff changeset
111 menu = getMultiContextMenu(records);
c437e4f0f7be Moved the context menu handler to constructor to have the menu
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1340
diff changeset
112 }
c437e4f0f7be Moved the context menu handler to constructor to have the menu
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1340
diff changeset
113
c437e4f0f7be Moved the context menu handler to constructor to have the menu
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1340
diff changeset
114 if (menu != null) {
9416
05405292a7ca Navigationtheme panel now shows themes of dWt and WQ charts grayed out, if the current station is outside the valid range of the theme.
gernotbelger
parents: 8856
diff changeset
115 ThemePanel.this.list.setContextMenu(menu);
1358
c437e4f0f7be Moved the context menu handler to constructor to have the menu
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1340
diff changeset
116 menu.showContextMenu();
c437e4f0f7be Moved the context menu handler to constructor to have the menu
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1340
diff changeset
117
c437e4f0f7be Moved the context menu handler to constructor to have the menu
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1340
diff changeset
118 event.cancel();
c437e4f0f7be Moved the context menu handler to constructor to have the menu
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1340
diff changeset
119 }
c437e4f0f7be Moved the context menu handler to constructor to have the menu
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1340
diff changeset
120 }
c437e4f0f7be Moved the context menu handler to constructor to have the menu
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1340
diff changeset
121 });
854
67c678903280 Refactored to allow specialized controls within the ChartThemePanel, stubby
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 805
diff changeset
122
858
9f07f67f60a5 Subclassed ChartThemePanel, trigger redraws of Chart when interaction with
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 854
diff changeset
123 this.redrawRequestHandlers = new ArrayList<RedrawRequestHandler>();
805
f43d06d6a4a2 Refactored code of theme panel and added a MapThemePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
124 this.outHandlers = new ArrayList<OutputParameterChangeHandler>();
9416
05405292a7ca Navigationtheme panel now shows themes of dWt and WQ charts grayed out, if the current station is outside the valid range of the theme.
gernotbelger
parents: 8856
diff changeset
125 this.navigation = new ThemeNavigationPanel();
805
f43d06d6a4a2 Refactored code of theme panel and added a MapThemePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
126 this.navigation.addOnMoveHandler(this);
3547
8a16ff3b9a7f Removed trailing whitespace
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3532
diff changeset
127
3532
69fdeca46f7a ThemePanel are now resizable (fix for #750)
Christian Lins <christian.lins@intevation.de>
parents: 2987
diff changeset
128 this.setShowResizeBar(true);
805
f43d06d6a4a2 Refactored code of theme panel and added a MapThemePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
129 }
f43d06d6a4a2 Refactored code of theme panel and added a MapThemePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
130
f43d06d6a4a2 Refactored code of theme panel and added a MapThemePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
131 public abstract void activateTheme(Theme theme, boolean active);
f43d06d6a4a2 Refactored code of theme panel and added a MapThemePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
132
f43d06d6a4a2 Refactored code of theme panel and added a MapThemePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
133 /**
f43d06d6a4a2 Refactored code of theme panel and added a MapThemePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
134 * Replace the current collection with a new one. <b>NOTE: this operation
f43d06d6a4a2 Refactored code of theme panel and added a MapThemePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
135 * triggers updateGrid() which modifies the themes in the grid.</b>
f43d06d6a4a2 Refactored code of theme panel and added a MapThemePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
136 *
9416
05405292a7ca Navigationtheme panel now shows themes of dWt and WQ charts grayed out, if the current station is outside the valid range of the theme.
gernotbelger
parents: 8856
diff changeset
137 * @param collection
05405292a7ca Navigationtheme panel now shows themes of dWt and WQ charts grayed out, if the current station is outside the valid range of the theme.
gernotbelger
parents: 8856
diff changeset
138 * The new collection object.
805
f43d06d6a4a2 Refactored code of theme panel and added a MapThemePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
139 */
9416
05405292a7ca Navigationtheme panel now shows themes of dWt and WQ charts grayed out, if the current station is outside the valid range of the theme.
gernotbelger
parents: 8856
diff changeset
140 protected void setCollection(final Collection collection) {
1555
c057ef91b268 Refactored Collection reference out of Panels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1551
diff changeset
141 // Set collection of view, but do not trigger event shooting.
c057ef91b268 Refactored Collection reference out of Panels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1551
diff changeset
142 this.view.setCollection(collection, true);
805
f43d06d6a4a2 Refactored code of theme panel and added a MapThemePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
143
f43d06d6a4a2 Refactored code of theme panel and added a MapThemePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
144 updateGrid();
f43d06d6a4a2 Refactored code of theme panel and added a MapThemePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
145 }
f43d06d6a4a2 Refactored code of theme panel and added a MapThemePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
146
1551
cfe88143ee89 Display edited manual points next time the point editor is opened.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1531
diff changeset
147 /** Get Collection. */
cfe88143ee89 Display edited manual points next time the point editor is opened.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1531
diff changeset
148 public Collection getCollection() {
9416
05405292a7ca Navigationtheme panel now shows themes of dWt and WQ charts grayed out, if the current station is outside the valid range of the theme.
gernotbelger
parents: 8856
diff changeset
149 return this.view.getCollection();
1551
cfe88143ee89 Display edited manual points next time the point editor is opened.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1531
diff changeset
150 }
cfe88143ee89 Display edited manual points next time the point editor is opened.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1531
diff changeset
151
805
f43d06d6a4a2 Refactored code of theme panel and added a MapThemePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
152 /**
f43d06d6a4a2 Refactored code of theme panel and added a MapThemePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
153 * Returns the ThemeList of the current collection and output mode.
f43d06d6a4a2 Refactored code of theme panel and added a MapThemePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
154 *
f43d06d6a4a2 Refactored code of theme panel and added a MapThemePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
155 * @return the current ThemeList.
f43d06d6a4a2 Refactored code of theme panel and added a MapThemePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
156 */
f43d06d6a4a2 Refactored code of theme panel and added a MapThemePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
157 public ThemeList getThemeList() {
9416
05405292a7ca Navigationtheme panel now shows themes of dWt and WQ charts grayed out, if the current station is outside the valid range of the theme.
gernotbelger
parents: 8856
diff changeset
158 return getCollection().getThemeList(this.mode.getName());
805
f43d06d6a4a2 Refactored code of theme panel and added a MapThemePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
159 }
f43d06d6a4a2 Refactored code of theme panel and added a MapThemePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
160
5794
af2aa716152f Fix issue1254, make GetFeatureInfo work reliably
Andre Heinecke <aheinecke@intevation.de>
parents: 4184
diff changeset
161 public ListGridRecord[] getSelectedRecords() {
9416
05405292a7ca Navigationtheme panel now shows themes of dWt and WQ charts grayed out, if the current station is outside the valid range of the theme.
gernotbelger
parents: 8856
diff changeset
162 return this.list.getSelectedRecords();
5794
af2aa716152f Fix issue1254, make GetFeatureInfo work reliably
Andre Heinecke <aheinecke@intevation.de>
parents: 4184
diff changeset
163 }
805
f43d06d6a4a2 Refactored code of theme panel and added a MapThemePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
164
f43d06d6a4a2 Refactored code of theme panel and added a MapThemePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
165 /**
f43d06d6a4a2 Refactored code of theme panel and added a MapThemePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
166 * Registers a new OutputParameterChangeHandler.
f43d06d6a4a2 Refactored code of theme panel and added a MapThemePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
167 *
9416
05405292a7ca Navigationtheme panel now shows themes of dWt and WQ charts grayed out, if the current station is outside the valid range of the theme.
gernotbelger
parents: 8856
diff changeset
168 * @param h
05405292a7ca Navigationtheme panel now shows themes of dWt and WQ charts grayed out, if the current station is outside the valid range of the theme.
gernotbelger
parents: 8856
diff changeset
169 * The new handler.
805
f43d06d6a4a2 Refactored code of theme panel and added a MapThemePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
170 */
4184
03de5c424f95 Fix warnings and minor TODOs in flys-client.
Christian Lins <christian.lins@intevation.de>
parents: 3547
diff changeset
171 @Override
9416
05405292a7ca Navigationtheme panel now shows themes of dWt and WQ charts grayed out, if the current station is outside the valid range of the theme.
gernotbelger
parents: 8856
diff changeset
172 public void addOutputParameterChangeHandler(final OutputParameterChangeHandler h) {
805
f43d06d6a4a2 Refactored code of theme panel and added a MapThemePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
173 if (h != null) {
9416
05405292a7ca Navigationtheme panel now shows themes of dWt and WQ charts grayed out, if the current station is outside the valid range of the theme.
gernotbelger
parents: 8856
diff changeset
174 this.outHandlers.add(h);
805
f43d06d6a4a2 Refactored code of theme panel and added a MapThemePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
175 }
f43d06d6a4a2 Refactored code of theme panel and added a MapThemePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
176 }
f43d06d6a4a2 Refactored code of theme panel and added a MapThemePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
177
f43d06d6a4a2 Refactored code of theme panel and added a MapThemePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
178 /**
858
9f07f67f60a5 Subclassed ChartThemePanel, trigger redraws of Chart when interaction with
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 854
diff changeset
179 * Registers a RedrawRequestHandler.
9f07f67f60a5 Subclassed ChartThemePanel, trigger redraws of Chart when interaction with
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 854
diff changeset
180 *
9416
05405292a7ca Navigationtheme panel now shows themes of dWt and WQ charts grayed out, if the current station is outside the valid range of the theme.
gernotbelger
parents: 8856
diff changeset
181 * @param h
05405292a7ca Navigationtheme panel now shows themes of dWt and WQ charts grayed out, if the current station is outside the valid range of the theme.
gernotbelger
parents: 8856
diff changeset
182 * The new handler.
858
9f07f67f60a5 Subclassed ChartThemePanel, trigger redraws of Chart when interaction with
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 854
diff changeset
183 */
4184
03de5c424f95 Fix warnings and minor TODOs in flys-client.
Christian Lins <christian.lins@intevation.de>
parents: 3547
diff changeset
184 @Override
9416
05405292a7ca Navigationtheme panel now shows themes of dWt and WQ charts grayed out, if the current station is outside the valid range of the theme.
gernotbelger
parents: 8856
diff changeset
185 public void addRedrawRequestHandler(final RedrawRequestHandler h) {
858
9f07f67f60a5 Subclassed ChartThemePanel, trigger redraws of Chart when interaction with
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 854
diff changeset
186 if (h != null) {
9416
05405292a7ca Navigationtheme panel now shows themes of dWt and WQ charts grayed out, if the current station is outside the valid range of the theme.
gernotbelger
parents: 8856
diff changeset
187 this.redrawRequestHandlers.add(h);
858
9f07f67f60a5 Subclassed ChartThemePanel, trigger redraws of Chart when interaction with
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 854
diff changeset
188 }
9f07f67f60a5 Subclassed ChartThemePanel, trigger redraws of Chart when interaction with
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 854
diff changeset
189 }
9f07f67f60a5 Subclassed ChartThemePanel, trigger redraws of Chart when interaction with
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 854
diff changeset
190
9f07f67f60a5 Subclassed ChartThemePanel, trigger redraws of Chart when interaction with
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 854
diff changeset
191 /**
9f07f67f60a5 Subclassed ChartThemePanel, trigger redraws of Chart when interaction with
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 854
diff changeset
192 * Request a redraw of e.g. a Chart.
9f07f67f60a5 Subclassed ChartThemePanel, trigger redraws of Chart when interaction with
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 854
diff changeset
193 */
1379
546f7f890ffa Cosmetics, refactoring.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1361
diff changeset
194 final public void requestRedraw() {
9416
05405292a7ca Navigationtheme panel now shows themes of dWt and WQ charts grayed out, if the current station is outside the valid range of the theme.
gernotbelger
parents: 8856
diff changeset
195 for (final RedrawRequestHandler handler : this.redrawRequestHandlers) {
1509
8c911c935b58 Issue 435
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1474
diff changeset
196 handler.onRedrawRequest(new RedrawRequestEvent(Type.DEFAULT));
858
9f07f67f60a5 Subclassed ChartThemePanel, trigger redraws of Chart when interaction with
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 854
diff changeset
197 }
9f07f67f60a5 Subclassed ChartThemePanel, trigger redraws of Chart when interaction with
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 854
diff changeset
198 }
9f07f67f60a5 Subclassed ChartThemePanel, trigger redraws of Chart when interaction with
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 854
diff changeset
199
9f07f67f60a5 Subclassed ChartThemePanel, trigger redraws of Chart when interaction with
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 854
diff changeset
200 /**
805
f43d06d6a4a2 Refactored code of theme panel and added a MapThemePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
201 * Called when the attribution of an output changed. It informs the
f43d06d6a4a2 Refactored code of theme panel and added a MapThemePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
202 * registered handlers about the changes.
f43d06d6a4a2 Refactored code of theme panel and added a MapThemePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
203 */
f43d06d6a4a2 Refactored code of theme panel and added a MapThemePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
204 protected void fireOutputParameterChanged() {
9416
05405292a7ca Navigationtheme panel now shows themes of dWt and WQ charts grayed out, if the current station is outside the valid range of the theme.
gernotbelger
parents: 8856
diff changeset
205 final OutputParameterChangeEvent evt = new OutputParameterChangeEvent();
805
f43d06d6a4a2 Refactored code of theme panel and added a MapThemePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
206
9416
05405292a7ca Navigationtheme panel now shows themes of dWt and WQ charts grayed out, if the current station is outside the valid range of the theme.
gernotbelger
parents: 8856
diff changeset
207 for (final OutputParameterChangeHandler handler : this.outHandlers) {
805
f43d06d6a4a2 Refactored code of theme panel and added a MapThemePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
208 handler.onOutputParameterChanged(evt);
f43d06d6a4a2 Refactored code of theme panel and added a MapThemePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
209 }
f43d06d6a4a2 Refactored code of theme panel and added a MapThemePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
210 }
f43d06d6a4a2 Refactored code of theme panel and added a MapThemePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
211
1560
1c47de6ccfb1 Cosmetics.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1555
diff changeset
212 /** Registers the CollectionView associated to this ThemePanel. */
9416
05405292a7ca Navigationtheme panel now shows themes of dWt and WQ charts grayed out, if the current station is outside the valid range of the theme.
gernotbelger
parents: 8856
diff changeset
213 public void setCollectionView(final CollectionView view) {
1309
a95e82d6bcc1 Refactored the code to create a context menu and a style editor so that it is also available for maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1303
diff changeset
214 this.view = view;
a95e82d6bcc1 Refactored the code to create a context menu and a style editor so that it is also available for maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1303
diff changeset
215 }
a95e82d6bcc1 Refactored the code to create a context menu and a style editor so that it is also available for maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1303
diff changeset
216
805
f43d06d6a4a2 Refactored code of theme panel and added a MapThemePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
217 /**
f43d06d6a4a2 Refactored code of theme panel and added a MapThemePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
218 * This method is used to clear the current theme grid and add new updated
f43d06d6a4a2 Refactored code of theme panel and added a MapThemePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
219 * data.
f43d06d6a4a2 Refactored code of theme panel and added a MapThemePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
220 */
f43d06d6a4a2 Refactored code of theme panel and added a MapThemePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
221 protected void updateGrid() {
f43d06d6a4a2 Refactored code of theme panel and added a MapThemePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
222 GWT.log("ThemePanel.updateGrid");
f43d06d6a4a2 Refactored code of theme panel and added a MapThemePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
223
9416
05405292a7ca Navigationtheme panel now shows themes of dWt and WQ charts grayed out, if the current station is outside the valid range of the theme.
gernotbelger
parents: 8856
diff changeset
224 final ListGridRecord[] selected = this.list.getSelectedRecords();
1361
9d67cd17ab78 Bugfix: #352 Keep grid selection in theme panels alive after themes has been modified.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1358
diff changeset
225
805
f43d06d6a4a2 Refactored code of theme panel and added a MapThemePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
226 clearGrid();
f43d06d6a4a2 Refactored code of theme panel and added a MapThemePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
227
9416
05405292a7ca Navigationtheme panel now shows themes of dWt and WQ charts grayed out, if the current station is outside the valid range of the theme.
gernotbelger
parents: 8856
diff changeset
228 final ThemeList themeList = getThemeList();
805
f43d06d6a4a2 Refactored code of theme panel and added a MapThemePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
229
f43d06d6a4a2 Refactored code of theme panel and added a MapThemePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
230 if (themeList == null) {
f43d06d6a4a2 Refactored code of theme panel and added a MapThemePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
231 GWT.log("ERROR: No theme list.");
f43d06d6a4a2 Refactored code of theme panel and added a MapThemePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
232 return;
f43d06d6a4a2 Refactored code of theme panel and added a MapThemePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
233 }
f43d06d6a4a2 Refactored code of theme panel and added a MapThemePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
234
9416
05405292a7ca Navigationtheme panel now shows themes of dWt and WQ charts grayed out, if the current station is outside the valid range of the theme.
gernotbelger
parents: 8856
diff changeset
235 final int count = themeList.getThemeCount();
805
f43d06d6a4a2 Refactored code of theme panel and added a MapThemePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
236
f43d06d6a4a2 Refactored code of theme panel and added a MapThemePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
237 for (int i = 1; i <= count; i++) {
9416
05405292a7ca Navigationtheme panel now shows themes of dWt and WQ charts grayed out, if the current station is outside the valid range of the theme.
gernotbelger
parents: 8856
diff changeset
238 final Theme theme = themeList.getThemeAt(i);
805
f43d06d6a4a2 Refactored code of theme panel and added a MapThemePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
239
1578
df11c4c8c578 Avoid certain npes.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1568
diff changeset
240 if (theme == null) {
df11c4c8c578 Avoid certain npes.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1568
diff changeset
241 continue;
df11c4c8c578 Avoid certain npes.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1568
diff changeset
242 }
df11c4c8c578 Avoid certain npes.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1568
diff changeset
243
df11c4c8c578 Avoid certain npes.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1568
diff changeset
244 if (theme.getFacet().equals("empty.facet")) {
1531
8b4688a2e25d Set the empty facet to invisible.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1509
diff changeset
245 theme.setVisible(0);
8b4688a2e25d Set the empty facet to invisible.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1509
diff changeset
246 }
8b4688a2e25d Set the empty facet to invisible.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1509
diff changeset
247
1578
df11c4c8c578 Avoid certain npes.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1568
diff changeset
248 if (theme.getVisible() == 0) {
805
f43d06d6a4a2 Refactored code of theme panel and added a MapThemePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
249 continue;
f43d06d6a4a2 Refactored code of theme panel and added a MapThemePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
250 }
f43d06d6a4a2 Refactored code of theme panel and added a MapThemePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
251
9416
05405292a7ca Navigationtheme panel now shows themes of dWt and WQ charts grayed out, if the current station is outside the valid range of the theme.
gernotbelger
parents: 8856
diff changeset
252 final FacetRecord newRecord = createRecord(theme);
1382
78542ff1f562 Update map and theme panel when new layers are added via datacage or removed by context menu.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1379
diff changeset
253 addFacetRecord(newRecord);
1361
9d67cd17ab78 Bugfix: #352 Keep grid selection in theme panels alive after themes has been modified.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1358
diff changeset
254
9416
05405292a7ca Navigationtheme panel now shows themes of dWt and WQ charts grayed out, if the current station is outside the valid range of the theme.
gernotbelger
parents: 8856
diff changeset
255 final String newArtifact = theme.getArtifact();
05405292a7ca Navigationtheme panel now shows themes of dWt and WQ charts grayed out, if the current station is outside the valid range of the theme.
gernotbelger
parents: 8856
diff changeset
256 final String newFacet = theme.getFacet();
05405292a7ca Navigationtheme panel now shows themes of dWt and WQ charts grayed out, if the current station is outside the valid range of the theme.
gernotbelger
parents: 8856
diff changeset
257 final int newIndex = theme.getIndex();
1361
9d67cd17ab78 Bugfix: #352 Keep grid selection in theme panels alive after themes has been modified.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1358
diff changeset
258
9416
05405292a7ca Navigationtheme panel now shows themes of dWt and WQ charts grayed out, if the current station is outside the valid range of the theme.
gernotbelger
parents: 8856
diff changeset
259 for (final ListGridRecord r : selected) {
05405292a7ca Navigationtheme panel now shows themes of dWt and WQ charts grayed out, if the current station is outside the valid range of the theme.
gernotbelger
parents: 8856
diff changeset
260 final FacetRecord sel = (FacetRecord) r;
05405292a7ca Navigationtheme panel now shows themes of dWt and WQ charts grayed out, if the current station is outside the valid range of the theme.
gernotbelger
parents: 8856
diff changeset
261 final Theme oldTheme = sel.getTheme();
1361
9d67cd17ab78 Bugfix: #352 Keep grid selection in theme panels alive after themes has been modified.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1358
diff changeset
262
9416
05405292a7ca Navigationtheme panel now shows themes of dWt and WQ charts grayed out, if the current station is outside the valid range of the theme.
gernotbelger
parents: 8856
diff changeset
263 if (oldTheme.getArtifact().equals(newArtifact) && oldTheme.getFacet().equals(newFacet) && oldTheme.getIndex() == newIndex) {
05405292a7ca Navigationtheme panel now shows themes of dWt and WQ charts grayed out, if the current station is outside the valid range of the theme.
gernotbelger
parents: 8856
diff changeset
264 this.list.selectRecord(newRecord);
1361
9d67cd17ab78 Bugfix: #352 Keep grid selection in theme panels alive after themes has been modified.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1358
diff changeset
265 }
9d67cd17ab78 Bugfix: #352 Keep grid selection in theme panels alive after themes has been modified.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1358
diff changeset
266 }
805
f43d06d6a4a2 Refactored code of theme panel and added a MapThemePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
267 }
f43d06d6a4a2 Refactored code of theme panel and added a MapThemePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
268
9416
05405292a7ca Navigationtheme panel now shows themes of dWt and WQ charts grayed out, if the current station is outside the valid range of the theme.
gernotbelger
parents: 8856
diff changeset
269 updateThemes();
05405292a7ca Navigationtheme panel now shows themes of dWt and WQ charts grayed out, if the current station is outside the valid range of the theme.
gernotbelger
parents: 8856
diff changeset
270
805
f43d06d6a4a2 Refactored code of theme panel and added a MapThemePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
271 fireOutputParameterChanged();
f43d06d6a4a2 Refactored code of theme panel and added a MapThemePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
272 }
f43d06d6a4a2 Refactored code of theme panel and added a MapThemePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
273
1430
6bb6d43eeb2d Cosmetics.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1425
diff changeset
274 /** Adds given Record to the list (table). */
9416
05405292a7ca Navigationtheme panel now shows themes of dWt and WQ charts grayed out, if the current station is outside the valid range of the theme.
gernotbelger
parents: 8856
diff changeset
275 protected void addFacetRecord(final FacetRecord rec) {
05405292a7ca Navigationtheme panel now shows themes of dWt and WQ charts grayed out, if the current station is outside the valid range of the theme.
gernotbelger
parents: 8856
diff changeset
276 this.list.addData(rec);
1382
78542ff1f562 Update map and theme panel when new layers are added via datacage or removed by context menu.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1379
diff changeset
277 }
78542ff1f562 Update map and theme panel when new layers are added via datacage or removed by context menu.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1379
diff changeset
278
1430
6bb6d43eeb2d Cosmetics.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1425
diff changeset
279 /** Create a FacetRecord that wraps given theme. */
9416
05405292a7ca Navigationtheme panel now shows themes of dWt and WQ charts grayed out, if the current station is outside the valid range of the theme.
gernotbelger
parents: 8856
diff changeset
280 protected final FacetRecord createRecord(final Theme theme) {
1327
8a93fb299e64 #288 Added legend symbols to the MapThemePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1310
diff changeset
281 return new FacetRecord(theme);
8a93fb299e64 #288 Added legend symbols to the MapThemePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1310
diff changeset
282 }
8a93fb299e64 #288 Added legend symbols to the MapThemePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1310
diff changeset
283
805
f43d06d6a4a2 Refactored code of theme panel and added a MapThemePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
284 /**
f43d06d6a4a2 Refactored code of theme panel and added a MapThemePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
285 * This method triggers the CollectionAttributeService. Based on the current
f43d06d6a4a2 Refactored code of theme panel and added a MapThemePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
286 * collectin settings, the attribute of the collection is modified or not.
f43d06d6a4a2 Refactored code of theme panel and added a MapThemePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
287 * But in every case, we will get a new collection object - which might be
f43d06d6a4a2 Refactored code of theme panel and added a MapThemePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
288 * the same as the current one.
f43d06d6a4a2 Refactored code of theme panel and added a MapThemePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
289 */
f43d06d6a4a2 Refactored code of theme panel and added a MapThemePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
290 public void updateCollection() {
f43d06d6a4a2 Refactored code of theme panel and added a MapThemePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
291 final Config config = Config.getInstance();
9416
05405292a7ca Navigationtheme panel now shows themes of dWt and WQ charts grayed out, if the current station is outside the valid range of the theme.
gernotbelger
parents: 8856
diff changeset
292 final String loc = config.getLocale();
805
f43d06d6a4a2 Refactored code of theme panel and added a MapThemePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
293
f43d06d6a4a2 Refactored code of theme panel and added a MapThemePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
294 GWT.log("ThemePanel.updateCollection via RPC now");
f43d06d6a4a2 Refactored code of theme panel and added a MapThemePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
295
1430
6bb6d43eeb2d Cosmetics.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1425
diff changeset
296 // Don't forget to enable the panel after the request has finished!
805
f43d06d6a4a2 Refactored code of theme panel and added a MapThemePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
297 disable();
f43d06d6a4a2 Refactored code of theme panel and added a MapThemePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
298
9416
05405292a7ca Navigationtheme panel now shows themes of dWt and WQ charts grayed out, if the current station is outside the valid range of the theme.
gernotbelger
parents: 8856
diff changeset
299 this.updater.update(getCollection(), loc, new AsyncCallback<Collection>() {
4184
03de5c424f95 Fix warnings and minor TODOs in flys-client.
Christian Lins <christian.lins@intevation.de>
parents: 3547
diff changeset
300 @Override
9416
05405292a7ca Navigationtheme panel now shows themes of dWt and WQ charts grayed out, if the current station is outside the valid range of the theme.
gernotbelger
parents: 8856
diff changeset
301 public void onFailure(final Throwable caught) {
805
f43d06d6a4a2 Refactored code of theme panel and added a MapThemePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
302 GWT.log("Could not update collection attributes.");
9416
05405292a7ca Navigationtheme panel now shows themes of dWt and WQ charts grayed out, if the current station is outside the valid range of the theme.
gernotbelger
parents: 8856
diff changeset
303 SC.warn(ThemePanel.this.MSG.getString(caught.getMessage()));
805
f43d06d6a4a2 Refactored code of theme panel and added a MapThemePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
304
f43d06d6a4a2 Refactored code of theme panel and added a MapThemePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
305 enable();
f43d06d6a4a2 Refactored code of theme panel and added a MapThemePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
306 }
f43d06d6a4a2 Refactored code of theme panel and added a MapThemePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
307
4184
03de5c424f95 Fix warnings and minor TODOs in flys-client.
Christian Lins <christian.lins@intevation.de>
parents: 3547
diff changeset
308 @Override
9416
05405292a7ca Navigationtheme panel now shows themes of dWt and WQ charts grayed out, if the current station is outside the valid range of the theme.
gernotbelger
parents: 8856
diff changeset
309 public void onSuccess(final Collection collection) {
805
f43d06d6a4a2 Refactored code of theme panel and added a MapThemePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
310 setCollection(collection);
f43d06d6a4a2 Refactored code of theme panel and added a MapThemePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
311
f43d06d6a4a2 Refactored code of theme panel and added a MapThemePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
312 enable();
f43d06d6a4a2 Refactored code of theme panel and added a MapThemePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
313 }
f43d06d6a4a2 Refactored code of theme panel and added a MapThemePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
314 });
f43d06d6a4a2 Refactored code of theme panel and added a MapThemePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
315 }
f43d06d6a4a2 Refactored code of theme panel and added a MapThemePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
316
854
67c678903280 Refactored to allow specialized controls within the ChartThemePanel, stubby
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 805
diff changeset
317 /**
67c678903280 Refactored to allow specialized controls within the ChartThemePanel, stubby
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 805
diff changeset
318 * Create and configure the Grid to display.
67c678903280 Refactored to allow specialized controls within the ChartThemePanel, stubby
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 805
diff changeset
319 */
67c678903280 Refactored to allow specialized controls within the ChartThemePanel, stubby
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 805
diff changeset
320 protected ListGrid createGrid() {
9416
05405292a7ca Navigationtheme panel now shows themes of dWt and WQ charts grayed out, if the current station is outside the valid range of the theme.
gernotbelger
parents: 8856
diff changeset
321 final ListGrid grid = new ListGrid();
2445
1de15a7bfc59 Removed the scrollbar gap in the theme panels.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2443
diff changeset
322 grid.setLeaveScrollbarGap(false);
1309
a95e82d6bcc1 Refactored the code to create a context menu and a style editor so that it is also available for maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1303
diff changeset
323
a95e82d6bcc1 Refactored the code to create a context menu and a style editor so that it is also available for maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1303
diff changeset
324 return grid;
854
67c678903280 Refactored to allow specialized controls within the ChartThemePanel, stubby
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 805
diff changeset
325 }
805
f43d06d6a4a2 Refactored code of theme panel and added a MapThemePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
326
f43d06d6a4a2 Refactored code of theme panel and added a MapThemePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
327 /**
f43d06d6a4a2 Refactored code of theme panel and added a MapThemePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
328 * A method that removes all records from theme grid.
f43d06d6a4a2 Refactored code of theme panel and added a MapThemePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
329 */
f43d06d6a4a2 Refactored code of theme panel and added a MapThemePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
330 protected void clearGrid() {
9416
05405292a7ca Navigationtheme panel now shows themes of dWt and WQ charts grayed out, if the current station is outside the valid range of the theme.
gernotbelger
parents: 8856
diff changeset
331 final ListGridRecord[] records = this.list.getRecords();
805
f43d06d6a4a2 Refactored code of theme panel and added a MapThemePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
332
f43d06d6a4a2 Refactored code of theme panel and added a MapThemePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
333 if (records == null || records.length == 0) {
f43d06d6a4a2 Refactored code of theme panel and added a MapThemePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
334 return;
f43d06d6a4a2 Refactored code of theme panel and added a MapThemePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
335 }
f43d06d6a4a2 Refactored code of theme panel and added a MapThemePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
336
9416
05405292a7ca Navigationtheme panel now shows themes of dWt and WQ charts grayed out, if the current station is outside the valid range of the theme.
gernotbelger
parents: 8856
diff changeset
337 for (final ListGridRecord record : records) {
05405292a7ca Navigationtheme panel now shows themes of dWt and WQ charts grayed out, if the current station is outside the valid range of the theme.
gernotbelger
parents: 8856
diff changeset
338 this.list.removeData(record);
805
f43d06d6a4a2 Refactored code of theme panel and added a MapThemePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
339 }
f43d06d6a4a2 Refactored code of theme panel and added a MapThemePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
340 }
f43d06d6a4a2 Refactored code of theme panel and added a MapThemePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
341
1443
ec0460dbbae2 Added method to create a menuitem separator.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1430
diff changeset
342 /** Return 'separator'- menu-item. */
ec0460dbbae2 Added method to create a menuitem separator.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1430
diff changeset
343 protected MenuItem createSeparator() {
9416
05405292a7ca Navigationtheme panel now shows themes of dWt and WQ charts grayed out, if the current station is outside the valid range of the theme.
gernotbelger
parents: 8856
diff changeset
344 final MenuItem separator = new MenuItem();
1443
ec0460dbbae2 Added method to create a menuitem separator.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1430
diff changeset
345 separator.setIsSeparator(true);
ec0460dbbae2 Added method to create a menuitem separator.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1430
diff changeset
346 return separator;
ec0460dbbae2 Added method to create a menuitem separator.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1430
diff changeset
347 }
805
f43d06d6a4a2 Refactored code of theme panel and added a MapThemePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
348
1443
ec0460dbbae2 Added method to create a menuitem separator.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1430
diff changeset
349 /**
ec0460dbbae2 Added method to create a menuitem separator.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1430
diff changeset
350 * Get the context menu for a (right mouse button)click on a single item.
ec0460dbbae2 Added method to create a menuitem separator.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1430
diff changeset
351 */
1309
a95e82d6bcc1 Refactored the code to create a context menu and a style editor so that it is also available for maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1303
diff changeset
352 protected Menu getSingleContextMenu(final ListGridRecord[] records) {
9416
05405292a7ca Navigationtheme panel now shows themes of dWt and WQ charts grayed out, if the current station is outside the valid range of the theme.
gernotbelger
parents: 8856
diff changeset
353 final Menu menu = new Menu();
1309
a95e82d6bcc1 Refactored the code to create a context menu and a style editor so that it is also available for maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1303
diff changeset
354
a95e82d6bcc1 Refactored the code to create a context menu and a style editor so that it is also available for maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1303
diff changeset
355 menu.addItem(createActivateItem(records));
a95e82d6bcc1 Refactored the code to create a context menu and a style editor so that it is also available for maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1303
diff changeset
356 menu.addItem(createDeactivateItem(records));
a95e82d6bcc1 Refactored the code to create a context menu and a style editor so that it is also available for maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1303
diff changeset
357 menu.addItem(createRemoveItem(records));
1443
ec0460dbbae2 Added method to create a menuitem separator.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1430
diff changeset
358 menu.addItem(createSeparator());
1309
a95e82d6bcc1 Refactored the code to create a context menu and a style editor so that it is also available for maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1303
diff changeset
359 menu.addItem(createPropertiesItem(records));
a95e82d6bcc1 Refactored the code to create a context menu and a style editor so that it is also available for maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1303
diff changeset
360
a95e82d6bcc1 Refactored the code to create a context menu and a style editor so that it is also available for maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1303
diff changeset
361 return menu;
a95e82d6bcc1 Refactored the code to create a context menu and a style editor so that it is also available for maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1303
diff changeset
362 }
a95e82d6bcc1 Refactored the code to create a context menu and a style editor so that it is also available for maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1303
diff changeset
363
a95e82d6bcc1 Refactored the code to create a context menu and a style editor so that it is also available for maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1303
diff changeset
364 protected Menu getMultiContextMenu(final ListGridRecord[] records) {
9416
05405292a7ca Navigationtheme panel now shows themes of dWt and WQ charts grayed out, if the current station is outside the valid range of the theme.
gernotbelger
parents: 8856
diff changeset
365 final Menu menu = new Menu();
1309
a95e82d6bcc1 Refactored the code to create a context menu and a style editor so that it is also available for maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1303
diff changeset
366
a95e82d6bcc1 Refactored the code to create a context menu and a style editor so that it is also available for maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1303
diff changeset
367 menu.addItem(createActivateItem(records));
a95e82d6bcc1 Refactored the code to create a context menu and a style editor so that it is also available for maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1303
diff changeset
368 menu.addItem(createDeactivateItem(records));
a95e82d6bcc1 Refactored the code to create a context menu and a style editor so that it is also available for maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1303
diff changeset
369 menu.addItem(createRemoveItem(records));
a95e82d6bcc1 Refactored the code to create a context menu and a style editor so that it is also available for maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1303
diff changeset
370
a95e82d6bcc1 Refactored the code to create a context menu and a style editor so that it is also available for maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1303
diff changeset
371 return menu;
a95e82d6bcc1 Refactored the code to create a context menu and a style editor so that it is also available for maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1303
diff changeset
372 }
a95e82d6bcc1 Refactored the code to create a context menu and a style editor so that it is also available for maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1303
diff changeset
373
1453
e8aec81af22b Cosmetics.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1443
diff changeset
374 /** The properties menu item (opens style editor on click). */
1309
a95e82d6bcc1 Refactored the code to create a context menu and a style editor so that it is also available for maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1303
diff changeset
375 protected MenuItem createPropertiesItem(final ListGridRecord[] records) {
9416
05405292a7ca Navigationtheme panel now shows themes of dWt and WQ charts grayed out, if the current station is outside the valid range of the theme.
gernotbelger
parents: 8856
diff changeset
376 final MenuItem properties = new MenuItem(this.MSG.properties());
1309
a95e82d6bcc1 Refactored the code to create a context menu and a style editor so that it is also available for maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1303
diff changeset
377
a95e82d6bcc1 Refactored the code to create a context menu and a style editor so that it is also available for maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1303
diff changeset
378 properties.addClickHandler(new ClickHandler() {
4184
03de5c424f95 Fix warnings and minor TODOs in flys-client.
Christian Lins <christian.lins@intevation.de>
parents: 3547
diff changeset
379 @Override
9416
05405292a7ca Navigationtheme panel now shows themes of dWt and WQ charts grayed out, if the current station is outside the valid range of the theme.
gernotbelger
parents: 8856
diff changeset
380 public void onClick(final MenuItemClickEvent evt) {
1309
a95e82d6bcc1 Refactored the code to create a context menu and a style editor so that it is also available for maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1303
diff changeset
381 GWT.log("clicked properties");
9416
05405292a7ca Navigationtheme panel now shows themes of dWt and WQ charts grayed out, if the current station is outside the valid range of the theme.
gernotbelger
parents: 8856
diff changeset
382 for (final ListGridRecord record : records) {
1309
a95e82d6bcc1 Refactored the code to create a context menu and a style editor so that it is also available for maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1303
diff changeset
383 openStyleEditor((FacetRecord) record);
a95e82d6bcc1 Refactored the code to create a context menu and a style editor so that it is also available for maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1303
diff changeset
384 }
a95e82d6bcc1 Refactored the code to create a context menu and a style editor so that it is also available for maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1303
diff changeset
385 }
a95e82d6bcc1 Refactored the code to create a context menu and a style editor so that it is also available for maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1303
diff changeset
386 });
a95e82d6bcc1 Refactored the code to create a context menu and a style editor so that it is also available for maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1303
diff changeset
387
a95e82d6bcc1 Refactored the code to create a context menu and a style editor so that it is also available for maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1303
diff changeset
388 return properties;
a95e82d6bcc1 Refactored the code to create a context menu and a style editor so that it is also available for maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1303
diff changeset
389 }
a95e82d6bcc1 Refactored the code to create a context menu and a style editor so that it is also available for maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1303
diff changeset
390
a95e82d6bcc1 Refactored the code to create a context menu and a style editor so that it is also available for maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1303
diff changeset
391 protected MenuItem createActivateItem(final ListGridRecord[] records) {
9416
05405292a7ca Navigationtheme panel now shows themes of dWt and WQ charts grayed out, if the current station is outside the valid range of the theme.
gernotbelger
parents: 8856
diff changeset
392 final MenuItem activate = new MenuItem(this.MSG.activateTheme());
1309
a95e82d6bcc1 Refactored the code to create a context menu and a style editor so that it is also available for maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1303
diff changeset
393
a95e82d6bcc1 Refactored the code to create a context menu and a style editor so that it is also available for maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1303
diff changeset
394 activate.addClickHandler(new ClickHandler() {
4184
03de5c424f95 Fix warnings and minor TODOs in flys-client.
Christian Lins <christian.lins@intevation.de>
parents: 3547
diff changeset
395 @Override
9416
05405292a7ca Navigationtheme panel now shows themes of dWt and WQ charts grayed out, if the current station is outside the valid range of the theme.
gernotbelger
parents: 8856
diff changeset
396 public void onClick(final MenuItemClickEvent evt) {
05405292a7ca Navigationtheme panel now shows themes of dWt and WQ charts grayed out, if the current station is outside the valid range of the theme.
gernotbelger
parents: 8856
diff changeset
397 for (final ListGridRecord record : records) {
05405292a7ca Navigationtheme panel now shows themes of dWt and WQ charts grayed out, if the current station is outside the valid range of the theme.
gernotbelger
parents: 8856
diff changeset
398 final FacetRecord facet = (FacetRecord) record;
1309
a95e82d6bcc1 Refactored the code to create a context menu and a style editor so that it is also available for maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1303
diff changeset
399 activateTheme(facet.getTheme(), true);
a95e82d6bcc1 Refactored the code to create a context menu and a style editor so that it is also available for maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1303
diff changeset
400 }
a95e82d6bcc1 Refactored the code to create a context menu and a style editor so that it is also available for maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1303
diff changeset
401
a95e82d6bcc1 Refactored the code to create a context menu and a style editor so that it is also available for maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1303
diff changeset
402 updateCollection();
a95e82d6bcc1 Refactored the code to create a context menu and a style editor so that it is also available for maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1303
diff changeset
403 }
a95e82d6bcc1 Refactored the code to create a context menu and a style editor so that it is also available for maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1303
diff changeset
404 });
a95e82d6bcc1 Refactored the code to create a context menu and a style editor so that it is also available for maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1303
diff changeset
405
a95e82d6bcc1 Refactored the code to create a context menu and a style editor so that it is also available for maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1303
diff changeset
406 return activate;
a95e82d6bcc1 Refactored the code to create a context menu and a style editor so that it is also available for maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1303
diff changeset
407 }
a95e82d6bcc1 Refactored the code to create a context menu and a style editor so that it is also available for maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1303
diff changeset
408
a95e82d6bcc1 Refactored the code to create a context menu and a style editor so that it is also available for maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1303
diff changeset
409 protected MenuItem createDeactivateItem(final ListGridRecord[] records) {
9416
05405292a7ca Navigationtheme panel now shows themes of dWt and WQ charts grayed out, if the current station is outside the valid range of the theme.
gernotbelger
parents: 8856
diff changeset
410 final MenuItem deactivate = new MenuItem(this.MSG.deactivateTheme());
1309
a95e82d6bcc1 Refactored the code to create a context menu and a style editor so that it is also available for maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1303
diff changeset
411
a95e82d6bcc1 Refactored the code to create a context menu and a style editor so that it is also available for maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1303
diff changeset
412 deactivate.addClickHandler(new ClickHandler() {
4184
03de5c424f95 Fix warnings and minor TODOs in flys-client.
Christian Lins <christian.lins@intevation.de>
parents: 3547
diff changeset
413 @Override
9416
05405292a7ca Navigationtheme panel now shows themes of dWt and WQ charts grayed out, if the current station is outside the valid range of the theme.
gernotbelger
parents: 8856
diff changeset
414 public void onClick(final MenuItemClickEvent evt) {
05405292a7ca Navigationtheme panel now shows themes of dWt and WQ charts grayed out, if the current station is outside the valid range of the theme.
gernotbelger
parents: 8856
diff changeset
415 for (final ListGridRecord record : records) {
05405292a7ca Navigationtheme panel now shows themes of dWt and WQ charts grayed out, if the current station is outside the valid range of the theme.
gernotbelger
parents: 8856
diff changeset
416 final FacetRecord facet = (FacetRecord) record;
1309
a95e82d6bcc1 Refactored the code to create a context menu and a style editor so that it is also available for maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1303
diff changeset
417 activateTheme(facet.getTheme(), false);
a95e82d6bcc1 Refactored the code to create a context menu and a style editor so that it is also available for maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1303
diff changeset
418 }
a95e82d6bcc1 Refactored the code to create a context menu and a style editor so that it is also available for maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1303
diff changeset
419
a95e82d6bcc1 Refactored the code to create a context menu and a style editor so that it is also available for maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1303
diff changeset
420 updateCollection();
a95e82d6bcc1 Refactored the code to create a context menu and a style editor so that it is also available for maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1303
diff changeset
421 }
a95e82d6bcc1 Refactored the code to create a context menu and a style editor so that it is also available for maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1303
diff changeset
422 });
a95e82d6bcc1 Refactored the code to create a context menu and a style editor so that it is also available for maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1303
diff changeset
423
a95e82d6bcc1 Refactored the code to create a context menu and a style editor so that it is also available for maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1303
diff changeset
424 return deactivate;
a95e82d6bcc1 Refactored the code to create a context menu and a style editor so that it is also available for maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1303
diff changeset
425 }
a95e82d6bcc1 Refactored the code to create a context menu and a style editor so that it is also available for maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1303
diff changeset
426
2443
993871f8e2f2 Partial fix flys/issue624 (removing cross section).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1578
diff changeset
427 /** Remove given themes (not asking for confirmation). */
993871f8e2f2 Partial fix flys/issue624 (removing cross section).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1578
diff changeset
428 protected void removeThemes(final ListGridRecord[] records) {
9416
05405292a7ca Navigationtheme panel now shows themes of dWt and WQ charts grayed out, if the current station is outside the valid range of the theme.
gernotbelger
parents: 8856
diff changeset
429 for (final ListGridRecord record : records) {
05405292a7ca Navigationtheme panel now shows themes of dWt and WQ charts grayed out, if the current station is outside the valid range of the theme.
gernotbelger
parents: 8856
diff changeset
430 final FacetRecord facet = (FacetRecord) record;
05405292a7ca Navigationtheme panel now shows themes of dWt and WQ charts grayed out, if the current station is outside the valid range of the theme.
gernotbelger
parents: 8856
diff changeset
431 final Theme theme = facet.getTheme();
2443
993871f8e2f2 Partial fix flys/issue624 (removing cross section).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1578
diff changeset
432 theme.setVisible(0);
993871f8e2f2 Partial fix flys/issue624 (removing cross section).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1578
diff changeset
433 theme.setActive(0);
993871f8e2f2 Partial fix flys/issue624 (removing cross section).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1578
diff changeset
434 updateCollection();
993871f8e2f2 Partial fix flys/issue624 (removing cross section).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1578
diff changeset
435 }
993871f8e2f2 Partial fix flys/issue624 (removing cross section).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1578
diff changeset
436 }
993871f8e2f2 Partial fix flys/issue624 (removing cross section).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1578
diff changeset
437
993871f8e2f2 Partial fix flys/issue624 (removing cross section).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1578
diff changeset
438 /** Create menu item for removing theme(s). Will ask for confirmation. */
1309
a95e82d6bcc1 Refactored the code to create a context menu and a style editor so that it is also available for maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1303
diff changeset
439 protected MenuItem createRemoveItem(final ListGridRecord[] records) {
9416
05405292a7ca Navigationtheme panel now shows themes of dWt and WQ charts grayed out, if the current station is outside the valid range of the theme.
gernotbelger
parents: 8856
diff changeset
440 final MenuItem remove = new MenuItem(this.MSG.removeTheme());
1309
a95e82d6bcc1 Refactored the code to create a context menu and a style editor so that it is also available for maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1303
diff changeset
441
a95e82d6bcc1 Refactored the code to create a context menu and a style editor so that it is also available for maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1303
diff changeset
442 remove.addClickHandler(new ClickHandler() {
4184
03de5c424f95 Fix warnings and minor TODOs in flys-client.
Christian Lins <christian.lins@intevation.de>
parents: 3547
diff changeset
443 @Override
9416
05405292a7ca Navigationtheme panel now shows themes of dWt and WQ charts grayed out, if the current station is outside the valid range of the theme.
gernotbelger
parents: 8856
diff changeset
444 public void onClick(final MenuItemClickEvent evt) {
05405292a7ca Navigationtheme panel now shows themes of dWt and WQ charts grayed out, if the current station is outside the valid range of the theme.
gernotbelger
parents: 8856
diff changeset
445 SC.ask(ThemePanel.this.MSG.askThemeRemove(), new BooleanCallback() {
1422
25be27e33b77 #421 Ask the user before removing themes from chart or map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1382
diff changeset
446 @Override
9416
05405292a7ca Navigationtheme panel now shows themes of dWt and WQ charts grayed out, if the current station is outside the valid range of the theme.
gernotbelger
parents: 8856
diff changeset
447 public void execute(final Boolean value) {
1422
25be27e33b77 #421 Ask the user before removing themes from chart or map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1382
diff changeset
448 if (value) {
2443
993871f8e2f2 Partial fix flys/issue624 (removing cross section).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1578
diff changeset
449 removeThemes(records);
1422
25be27e33b77 #421 Ask the user before removing themes from chart or map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1382
diff changeset
450 }
25be27e33b77 #421 Ask the user before removing themes from chart or map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1382
diff changeset
451 }
25be27e33b77 #421 Ask the user before removing themes from chart or map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1382
diff changeset
452 });
1309
a95e82d6bcc1 Refactored the code to create a context menu and a style editor so that it is also available for maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1303
diff changeset
453 }
a95e82d6bcc1 Refactored the code to create a context menu and a style editor so that it is also available for maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1303
diff changeset
454 });
a95e82d6bcc1 Refactored the code to create a context menu and a style editor so that it is also available for maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1303
diff changeset
455
a95e82d6bcc1 Refactored the code to create a context menu and a style editor so that it is also available for maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1303
diff changeset
456 return remove;
a95e82d6bcc1 Refactored the code to create a context menu and a style editor so that it is also available for maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1303
diff changeset
457 }
a95e82d6bcc1 Refactored the code to create a context menu and a style editor so that it is also available for maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1303
diff changeset
458
805
f43d06d6a4a2 Refactored code of theme panel and added a MapThemePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
459 /**
f43d06d6a4a2 Refactored code of theme panel and added a MapThemePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
460 * This method is called after a cell in the theme grid has been modified.
f43d06d6a4a2 Refactored code of theme panel and added a MapThemePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
461 *
9416
05405292a7ca Navigationtheme panel now shows themes of dWt and WQ charts grayed out, if the current station is outside the valid range of the theme.
gernotbelger
parents: 8856
diff changeset
462 * @param event
05405292a7ca Navigationtheme panel now shows themes of dWt and WQ charts grayed out, if the current station is outside the valid range of the theme.
gernotbelger
parents: 8856
diff changeset
463 * The event that stores information about the modified record.
805
f43d06d6a4a2 Refactored code of theme panel and added a MapThemePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
464 */
f43d06d6a4a2 Refactored code of theme panel and added a MapThemePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
465 @Override
9416
05405292a7ca Navigationtheme panel now shows themes of dWt and WQ charts grayed out, if the current station is outside the valid range of the theme.
gernotbelger
parents: 8856
diff changeset
466 public void onEditComplete(final EditCompleteEvent event) {
805
f43d06d6a4a2 Refactored code of theme panel and added a MapThemePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
467 GWT.log("Edited record.");
f43d06d6a4a2 Refactored code of theme panel and added a MapThemePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
468
9416
05405292a7ca Navigationtheme panel now shows themes of dWt and WQ charts grayed out, if the current station is outside the valid range of the theme.
gernotbelger
parents: 8856
diff changeset
469 final int row = event.getRowNum();
05405292a7ca Navigationtheme panel now shows themes of dWt and WQ charts grayed out, if the current station is outside the valid range of the theme.
gernotbelger
parents: 8856
diff changeset
470 final FacetRecord rec = (FacetRecord) this.list.getRecord(row);
805
f43d06d6a4a2 Refactored code of theme panel and added a MapThemePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
471
9416
05405292a7ca Navigationtheme panel now shows themes of dWt and WQ charts grayed out, if the current station is outside the valid range of the theme.
gernotbelger
parents: 8856
diff changeset
472 final Theme theme = rec.getTheme();
1331
aa2313e0f18d #366 Modifications on theme description in theme panels are now persisted to artifact server.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1327
diff changeset
473
aa2313e0f18d #366 Modifications on theme description in theme panels are now persisted to artifact server.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1327
diff changeset
474 theme.setDescription(rec.getName());
aa2313e0f18d #366 Modifications on theme description in theme panels are now persisted to artifact server.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1327
diff changeset
475 activateTheme(theme, rec.getActive());
805
f43d06d6a4a2 Refactored code of theme panel and added a MapThemePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
476
f43d06d6a4a2 Refactored code of theme panel and added a MapThemePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
477 updateCollection();
f43d06d6a4a2 Refactored code of theme panel and added a MapThemePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
478 }
f43d06d6a4a2 Refactored code of theme panel and added a MapThemePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
479
1303
84c50f1d939b Added the option for the MapThemePanel to listen to Theme move events.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 911
diff changeset
480 /**
84c50f1d939b Added the option for the MapThemePanel to listen to Theme move events.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 911
diff changeset
481 * This method should be defined in subclasses that wants to listen to this
84c50f1d939b Added the option for the MapThemePanel to listen to Theme move events.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 911
diff changeset
482 * event.
84c50f1d939b Added the option for the MapThemePanel to listen to Theme move events.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 911
diff changeset
483 *
9416
05405292a7ca Navigationtheme panel now shows themes of dWt and WQ charts grayed out, if the current station is outside the valid range of the theme.
gernotbelger
parents: 8856
diff changeset
484 * @param theme
05405292a7ca Navigationtheme panel now shows themes of dWt and WQ charts grayed out, if the current station is outside the valid range of the theme.
gernotbelger
parents: 8856
diff changeset
485 * The theme that is moved.
05405292a7ca Navigationtheme panel now shows themes of dWt and WQ charts grayed out, if the current station is outside the valid range of the theme.
gernotbelger
parents: 8856
diff changeset
486 * @param oldIdx
05405292a7ca Navigationtheme panel now shows themes of dWt and WQ charts grayed out, if the current station is outside the valid range of the theme.
gernotbelger
parents: 8856
diff changeset
487 * The index of the theme before it was moved.
05405292a7ca Navigationtheme panel now shows themes of dWt and WQ charts grayed out, if the current station is outside the valid range of the theme.
gernotbelger
parents: 8856
diff changeset
488 * @param newIdx
05405292a7ca Navigationtheme panel now shows themes of dWt and WQ charts grayed out, if the current station is outside the valid range of the theme.
gernotbelger
parents: 8856
diff changeset
489 * The index of the theme after it was moved.
1303
84c50f1d939b Added the option for the MapThemePanel to listen to Theme move events.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 911
diff changeset
490 */
9416
05405292a7ca Navigationtheme panel now shows themes of dWt and WQ charts grayed out, if the current station is outside the valid range of the theme.
gernotbelger
parents: 8856
diff changeset
491 protected void fireThemeMoved(final Theme theme, final int oldIdx, final int newIdx) {
4184
03de5c424f95 Fix warnings and minor TODOs in flys-client.
Christian Lins <christian.lins@intevation.de>
parents: 3547
diff changeset
492 // Do nothing
1303
84c50f1d939b Added the option for the MapThemePanel to listen to Theme move events.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 911
diff changeset
493 }
84c50f1d939b Added the option for the MapThemePanel to listen to Theme move events.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 911
diff changeset
494
805
f43d06d6a4a2 Refactored code of theme panel and added a MapThemePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
495 @Override
9416
05405292a7ca Navigationtheme panel now shows themes of dWt and WQ charts grayed out, if the current station is outside the valid range of the theme.
gernotbelger
parents: 8856
diff changeset
496 public void onMove(final OnMoveEvent event) {
05405292a7ca Navigationtheme panel now shows themes of dWt and WQ charts grayed out, if the current station is outside the valid range of the theme.
gernotbelger
parents: 8856
diff changeset
497 final int type = event.getType();
805
f43d06d6a4a2 Refactored code of theme panel and added a MapThemePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
498
f43d06d6a4a2 Refactored code of theme panel and added a MapThemePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
499 GWT.log("ThemePanel.onMove: " + type);
f43d06d6a4a2 Refactored code of theme panel and added a MapThemePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
500
9416
05405292a7ca Navigationtheme panel now shows themes of dWt and WQ charts grayed out, if the current station is outside the valid range of the theme.
gernotbelger
parents: 8856
diff changeset
501 final ListGridRecord[] records = this.list.getSelectedRecords();
805
f43d06d6a4a2 Refactored code of theme panel and added a MapThemePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
502
f43d06d6a4a2 Refactored code of theme panel and added a MapThemePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
503 if (records == null || records.length == 0) {
f43d06d6a4a2 Refactored code of theme panel and added a MapThemePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
504 GWT.log("ThemePanel.onMove: No records selected.");
f43d06d6a4a2 Refactored code of theme panel and added a MapThemePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
505 return;
f43d06d6a4a2 Refactored code of theme panel and added a MapThemePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
506 }
f43d06d6a4a2 Refactored code of theme panel and added a MapThemePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
507
f43d06d6a4a2 Refactored code of theme panel and added a MapThemePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
508 switch (type) {
9416
05405292a7ca Navigationtheme panel now shows themes of dWt and WQ charts grayed out, if the current station is outside the valid range of the theme.
gernotbelger
parents: 8856
diff changeset
509 case 0:
05405292a7ca Navigationtheme panel now shows themes of dWt and WQ charts grayed out, if the current station is outside the valid range of the theme.
gernotbelger
parents: 8856
diff changeset
510 moveRecordsTop(records);
05405292a7ca Navigationtheme panel now shows themes of dWt and WQ charts grayed out, if the current station is outside the valid range of the theme.
gernotbelger
parents: 8856
diff changeset
511 break;
05405292a7ca Navigationtheme panel now shows themes of dWt and WQ charts grayed out, if the current station is outside the valid range of the theme.
gernotbelger
parents: 8856
diff changeset
512 case 1:
05405292a7ca Navigationtheme panel now shows themes of dWt and WQ charts grayed out, if the current station is outside the valid range of the theme.
gernotbelger
parents: 8856
diff changeset
513 moveRecordsUp(records);
05405292a7ca Navigationtheme panel now shows themes of dWt and WQ charts grayed out, if the current station is outside the valid range of the theme.
gernotbelger
parents: 8856
diff changeset
514 break;
05405292a7ca Navigationtheme panel now shows themes of dWt and WQ charts grayed out, if the current station is outside the valid range of the theme.
gernotbelger
parents: 8856
diff changeset
515 case 2:
05405292a7ca Navigationtheme panel now shows themes of dWt and WQ charts grayed out, if the current station is outside the valid range of the theme.
gernotbelger
parents: 8856
diff changeset
516 moveRecordsDown(records);
05405292a7ca Navigationtheme panel now shows themes of dWt and WQ charts grayed out, if the current station is outside the valid range of the theme.
gernotbelger
parents: 8856
diff changeset
517 break;
05405292a7ca Navigationtheme panel now shows themes of dWt and WQ charts grayed out, if the current station is outside the valid range of the theme.
gernotbelger
parents: 8856
diff changeset
518 case 3:
05405292a7ca Navigationtheme panel now shows themes of dWt and WQ charts grayed out, if the current station is outside the valid range of the theme.
gernotbelger
parents: 8856
diff changeset
519 moveRecordsBottom(records);
05405292a7ca Navigationtheme panel now shows themes of dWt and WQ charts grayed out, if the current station is outside the valid range of the theme.
gernotbelger
parents: 8856
diff changeset
520 break;
805
f43d06d6a4a2 Refactored code of theme panel and added a MapThemePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
521 }
f43d06d6a4a2 Refactored code of theme panel and added a MapThemePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
522
f43d06d6a4a2 Refactored code of theme panel and added a MapThemePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
523 updateCollection();
f43d06d6a4a2 Refactored code of theme panel and added a MapThemePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
524 }
f43d06d6a4a2 Refactored code of theme panel and added a MapThemePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
525
f43d06d6a4a2 Refactored code of theme panel and added a MapThemePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
526 /**
f43d06d6a4a2 Refactored code of theme panel and added a MapThemePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
527 * Moves the selected grid records (themes) to the top of the grid.
f43d06d6a4a2 Refactored code of theme panel and added a MapThemePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
528 *
9416
05405292a7ca Navigationtheme panel now shows themes of dWt and WQ charts grayed out, if the current station is outside the valid range of the theme.
gernotbelger
parents: 8856
diff changeset
529 * @param records
05405292a7ca Navigationtheme panel now shows themes of dWt and WQ charts grayed out, if the current station is outside the valid range of the theme.
gernotbelger
parents: 8856
diff changeset
530 * The selected themes in the list. Null not permitted.
805
f43d06d6a4a2 Refactored code of theme panel and added a MapThemePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
531 */
9416
05405292a7ca Navigationtheme panel now shows themes of dWt and WQ charts grayed out, if the current station is outside the valid range of the theme.
gernotbelger
parents: 8856
diff changeset
532 protected void moveRecordsTop(final ListGridRecord[] records) {
05405292a7ca Navigationtheme panel now shows themes of dWt and WQ charts grayed out, if the current station is outside the valid range of the theme.
gernotbelger
parents: 8856
diff changeset
533 final ThemeList themeList = getThemeList();
805
f43d06d6a4a2 Refactored code of theme panel and added a MapThemePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
534
f43d06d6a4a2 Refactored code of theme panel and added a MapThemePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
535 int idx = 1;
f43d06d6a4a2 Refactored code of theme panel and added a MapThemePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
536
9416
05405292a7ca Navigationtheme panel now shows themes of dWt and WQ charts grayed out, if the current station is outside the valid range of the theme.
gernotbelger
parents: 8856
diff changeset
537 for (final ListGridRecord record : records) {
05405292a7ca Navigationtheme panel now shows themes of dWt and WQ charts grayed out, if the current station is outside the valid range of the theme.
gernotbelger
parents: 8856
diff changeset
538 final Theme theme = ((FacetRecord) record).getTheme();
1303
84c50f1d939b Added the option for the MapThemePanel to listen to Theme move events.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 911
diff changeset
539 fireThemeMoved(theme, theme.getPosition(), idx);
805
f43d06d6a4a2 Refactored code of theme panel and added a MapThemePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
540 themeList.setThemePosition(theme, idx++);
f43d06d6a4a2 Refactored code of theme panel and added a MapThemePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
541 }
f43d06d6a4a2 Refactored code of theme panel and added a MapThemePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
542
f43d06d6a4a2 Refactored code of theme panel and added a MapThemePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
543 updateGrid();
f43d06d6a4a2 Refactored code of theme panel and added a MapThemePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
544 }
f43d06d6a4a2 Refactored code of theme panel and added a MapThemePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
545
f43d06d6a4a2 Refactored code of theme panel and added a MapThemePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
546 /**
f43d06d6a4a2 Refactored code of theme panel and added a MapThemePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
547 * Moves the selected grid records (themes) one step up.
f43d06d6a4a2 Refactored code of theme panel and added a MapThemePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
548 *
9416
05405292a7ca Navigationtheme panel now shows themes of dWt and WQ charts grayed out, if the current station is outside the valid range of the theme.
gernotbelger
parents: 8856
diff changeset
549 * @param records
05405292a7ca Navigationtheme panel now shows themes of dWt and WQ charts grayed out, if the current station is outside the valid range of the theme.
gernotbelger
parents: 8856
diff changeset
550 * The selected themes in the list. Null not permitted.
805
f43d06d6a4a2 Refactored code of theme panel and added a MapThemePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
551 */
9416
05405292a7ca Navigationtheme panel now shows themes of dWt and WQ charts grayed out, if the current station is outside the valid range of the theme.
gernotbelger
parents: 8856
diff changeset
552 protected void moveRecordsUp(final ListGridRecord[] records) {
05405292a7ca Navigationtheme panel now shows themes of dWt and WQ charts grayed out, if the current station is outside the valid range of the theme.
gernotbelger
parents: 8856
diff changeset
553 final ThemeList themeList = getThemeList();
805
f43d06d6a4a2 Refactored code of theme panel and added a MapThemePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
554
9416
05405292a7ca Navigationtheme panel now shows themes of dWt and WQ charts grayed out, if the current station is outside the valid range of the theme.
gernotbelger
parents: 8856
diff changeset
555 final int[] newPos = new int[records.length];
805
f43d06d6a4a2 Refactored code of theme panel and added a MapThemePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
556
9416
05405292a7ca Navigationtheme panel now shows themes of dWt and WQ charts grayed out, if the current station is outside the valid range of the theme.
gernotbelger
parents: 8856
diff changeset
557 for (int i = 0; i < records.length; i++) {
05405292a7ca Navigationtheme panel now shows themes of dWt and WQ charts grayed out, if the current station is outside the valid range of the theme.
gernotbelger
parents: 8856
diff changeset
558 final Theme theme = ((FacetRecord) records[i]).getTheme();
05405292a7ca Navigationtheme panel now shows themes of dWt and WQ charts grayed out, if the current station is outside the valid range of the theme.
gernotbelger
parents: 8856
diff changeset
559 newPos[i] = theme.getPosition() - 1;
805
f43d06d6a4a2 Refactored code of theme panel and added a MapThemePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
560 }
f43d06d6a4a2 Refactored code of theme panel and added a MapThemePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
561
9416
05405292a7ca Navigationtheme panel now shows themes of dWt and WQ charts grayed out, if the current station is outside the valid range of the theme.
gernotbelger
parents: 8856
diff changeset
562 for (int i = 0; i < records.length; i++) {
05405292a7ca Navigationtheme panel now shows themes of dWt and WQ charts grayed out, if the current station is outside the valid range of the theme.
gernotbelger
parents: 8856
diff changeset
563 final Theme theme = ((FacetRecord) records[i]).getTheme();
1303
84c50f1d939b Added the option for the MapThemePanel to listen to Theme move events.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 911
diff changeset
564 fireThemeMoved(theme, theme.getPosition(), newPos[i]);
805
f43d06d6a4a2 Refactored code of theme panel and added a MapThemePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
565 themeList.setThemePosition(theme, newPos[i]);
f43d06d6a4a2 Refactored code of theme panel and added a MapThemePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
566 }
f43d06d6a4a2 Refactored code of theme panel and added a MapThemePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
567
f43d06d6a4a2 Refactored code of theme panel and added a MapThemePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
568 updateGrid();
f43d06d6a4a2 Refactored code of theme panel and added a MapThemePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
569 }
f43d06d6a4a2 Refactored code of theme panel and added a MapThemePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
570
9416
05405292a7ca Navigationtheme panel now shows themes of dWt and WQ charts grayed out, if the current station is outside the valid range of the theme.
gernotbelger
parents: 8856
diff changeset
571 /**
05405292a7ca Navigationtheme panel now shows themes of dWt and WQ charts grayed out, if the current station is outside the valid range of the theme.
gernotbelger
parents: 8856
diff changeset
572 * Moves the selected grid records (themes) one step down.
05405292a7ca Navigationtheme panel now shows themes of dWt and WQ charts grayed out, if the current station is outside the valid range of the theme.
gernotbelger
parents: 8856
diff changeset
573 *
05405292a7ca Navigationtheme panel now shows themes of dWt and WQ charts grayed out, if the current station is outside the valid range of the theme.
gernotbelger
parents: 8856
diff changeset
574 * @param records
05405292a7ca Navigationtheme panel now shows themes of dWt and WQ charts grayed out, if the current station is outside the valid range of the theme.
gernotbelger
parents: 8856
diff changeset
575 * The selected themes in the list. Null not permitted.
05405292a7ca Navigationtheme panel now shows themes of dWt and WQ charts grayed out, if the current station is outside the valid range of the theme.
gernotbelger
parents: 8856
diff changeset
576 */
05405292a7ca Navigationtheme panel now shows themes of dWt and WQ charts grayed out, if the current station is outside the valid range of the theme.
gernotbelger
parents: 8856
diff changeset
577 protected void moveRecordsDown(final ListGridRecord[] records) {
05405292a7ca Navigationtheme panel now shows themes of dWt and WQ charts grayed out, if the current station is outside the valid range of the theme.
gernotbelger
parents: 8856
diff changeset
578 final ThemeList themeList = getThemeList();
05405292a7ca Navigationtheme panel now shows themes of dWt and WQ charts grayed out, if the current station is outside the valid range of the theme.
gernotbelger
parents: 8856
diff changeset
579
05405292a7ca Navigationtheme panel now shows themes of dWt and WQ charts grayed out, if the current station is outside the valid range of the theme.
gernotbelger
parents: 8856
diff changeset
580 final int[] newPos = new int[records.length];
05405292a7ca Navigationtheme panel now shows themes of dWt and WQ charts grayed out, if the current station is outside the valid range of the theme.
gernotbelger
parents: 8856
diff changeset
581
05405292a7ca Navigationtheme panel now shows themes of dWt and WQ charts grayed out, if the current station is outside the valid range of the theme.
gernotbelger
parents: 8856
diff changeset
582 for (int i = records.length - 1; i >= 0; i--) {
05405292a7ca Navigationtheme panel now shows themes of dWt and WQ charts grayed out, if the current station is outside the valid range of the theme.
gernotbelger
parents: 8856
diff changeset
583 final Theme theme = ((FacetRecord) records[i]).getTheme();
05405292a7ca Navigationtheme panel now shows themes of dWt and WQ charts grayed out, if the current station is outside the valid range of the theme.
gernotbelger
parents: 8856
diff changeset
584 newPos[i] = theme.getPosition() + 1;
05405292a7ca Navigationtheme panel now shows themes of dWt and WQ charts grayed out, if the current station is outside the valid range of the theme.
gernotbelger
parents: 8856
diff changeset
585 }
05405292a7ca Navigationtheme panel now shows themes of dWt and WQ charts grayed out, if the current station is outside the valid range of the theme.
gernotbelger
parents: 8856
diff changeset
586
05405292a7ca Navigationtheme panel now shows themes of dWt and WQ charts grayed out, if the current station is outside the valid range of the theme.
gernotbelger
parents: 8856
diff changeset
587 for (int i = records.length - 1; i >= 0; i--) {
05405292a7ca Navigationtheme panel now shows themes of dWt and WQ charts grayed out, if the current station is outside the valid range of the theme.
gernotbelger
parents: 8856
diff changeset
588 final Theme theme = ((FacetRecord) records[i]).getTheme();
05405292a7ca Navigationtheme panel now shows themes of dWt and WQ charts grayed out, if the current station is outside the valid range of the theme.
gernotbelger
parents: 8856
diff changeset
589 fireThemeMoved(theme, theme.getPosition(), newPos[i]);
05405292a7ca Navigationtheme panel now shows themes of dWt and WQ charts grayed out, if the current station is outside the valid range of the theme.
gernotbelger
parents: 8856
diff changeset
590 themeList.setThemePosition(theme, newPos[i]);
05405292a7ca Navigationtheme panel now shows themes of dWt and WQ charts grayed out, if the current station is outside the valid range of the theme.
gernotbelger
parents: 8856
diff changeset
591 }
05405292a7ca Navigationtheme panel now shows themes of dWt and WQ charts grayed out, if the current station is outside the valid range of the theme.
gernotbelger
parents: 8856
diff changeset
592
05405292a7ca Navigationtheme panel now shows themes of dWt and WQ charts grayed out, if the current station is outside the valid range of the theme.
gernotbelger
parents: 8856
diff changeset
593 updateGrid();
05405292a7ca Navigationtheme panel now shows themes of dWt and WQ charts grayed out, if the current station is outside the valid range of the theme.
gernotbelger
parents: 8856
diff changeset
594 }
805
f43d06d6a4a2 Refactored code of theme panel and added a MapThemePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
595
f43d06d6a4a2 Refactored code of theme panel and added a MapThemePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
596 /**
f43d06d6a4a2 Refactored code of theme panel and added a MapThemePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
597 * Moves the selected grid records (themes) to the bottom of the grid.
f43d06d6a4a2 Refactored code of theme panel and added a MapThemePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
598 *
9416
05405292a7ca Navigationtheme panel now shows themes of dWt and WQ charts grayed out, if the current station is outside the valid range of the theme.
gernotbelger
parents: 8856
diff changeset
599 * @param records
05405292a7ca Navigationtheme panel now shows themes of dWt and WQ charts grayed out, if the current station is outside the valid range of the theme.
gernotbelger
parents: 8856
diff changeset
600 * The selected themes in the list. Null not permitted.
805
f43d06d6a4a2 Refactored code of theme panel and added a MapThemePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
601 */
9416
05405292a7ca Navigationtheme panel now shows themes of dWt and WQ charts grayed out, if the current station is outside the valid range of the theme.
gernotbelger
parents: 8856
diff changeset
602 protected void moveRecordsBottom(final ListGridRecord[] records) {
05405292a7ca Navigationtheme panel now shows themes of dWt and WQ charts grayed out, if the current station is outside the valid range of the theme.
gernotbelger
parents: 8856
diff changeset
603 final ThemeList themeList = getThemeList();
805
f43d06d6a4a2 Refactored code of theme panel and added a MapThemePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
604
f43d06d6a4a2 Refactored code of theme panel and added a MapThemePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
605 int idx = themeList.getThemeCount();
f43d06d6a4a2 Refactored code of theme panel and added a MapThemePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
606
9416
05405292a7ca Navigationtheme panel now shows themes of dWt and WQ charts grayed out, if the current station is outside the valid range of the theme.
gernotbelger
parents: 8856
diff changeset
607 for (int i = records.length - 1; i >= 0; i--) {
05405292a7ca Navigationtheme panel now shows themes of dWt and WQ charts grayed out, if the current station is outside the valid range of the theme.
gernotbelger
parents: 8856
diff changeset
608 final Theme theme = ((FacetRecord) records[i]).getTheme();
1303
84c50f1d939b Added the option for the MapThemePanel to listen to Theme move events.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 911
diff changeset
609 fireThemeMoved(theme, theme.getPosition(), idx);
805
f43d06d6a4a2 Refactored code of theme panel and added a MapThemePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
610 themeList.setThemePosition(theme, idx--);
f43d06d6a4a2 Refactored code of theme panel and added a MapThemePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
611 }
f43d06d6a4a2 Refactored code of theme panel and added a MapThemePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
612
f43d06d6a4a2 Refactored code of theme panel and added a MapThemePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
613 updateGrid();
f43d06d6a4a2 Refactored code of theme panel and added a MapThemePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
614 }
1309
a95e82d6bcc1 Refactored the code to create a context menu and a style editor so that it is also available for maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1303
diff changeset
615
a95e82d6bcc1 Refactored the code to create a context menu and a style editor so that it is also available for maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1303
diff changeset
616 protected void openStyleEditor(final FacetRecord record) {
9416
05405292a7ca Navigationtheme panel now shows themes of dWt and WQ charts grayed out, if the current station is outside the valid range of the theme.
gernotbelger
parents: 8856
diff changeset
617 final Config config = Config.getInstance();
05405292a7ca Navigationtheme panel now shows themes of dWt and WQ charts grayed out, if the current station is outside the valid range of the theme.
gernotbelger
parents: 8856
diff changeset
618 final String locale = config.getLocale();
1309
a95e82d6bcc1 Refactored the code to create a context menu and a style editor so that it is also available for maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1303
diff changeset
619
9416
05405292a7ca Navigationtheme panel now shows themes of dWt and WQ charts grayed out, if the current station is outside the valid range of the theme.
gernotbelger
parents: 8856
diff changeset
620 final String artifact = record.getTheme().getArtifact();
05405292a7ca Navigationtheme panel now shows themes of dWt and WQ charts grayed out, if the current station is outside the valid range of the theme.
gernotbelger
parents: 8856
diff changeset
621
05405292a7ca Navigationtheme panel now shows themes of dWt and WQ charts grayed out, if the current station is outside the valid range of the theme.
gernotbelger
parents: 8856
diff changeset
622 this.itemAttributeService.getCollectionItemAttribute(this.getCollection(), artifact, locale, new AsyncCallback<CollectionItemAttribute>() {
05405292a7ca Navigationtheme panel now shows themes of dWt and WQ charts grayed out, if the current station is outside the valid range of the theme.
gernotbelger
parents: 8856
diff changeset
623 @Override
05405292a7ca Navigationtheme panel now shows themes of dWt and WQ charts grayed out, if the current station is outside the valid range of the theme.
gernotbelger
parents: 8856
diff changeset
624 public void onFailure(final Throwable caught) {
05405292a7ca Navigationtheme panel now shows themes of dWt and WQ charts grayed out, if the current station is outside the valid range of the theme.
gernotbelger
parents: 8856
diff changeset
625 SC.warn(ThemePanel.this.MSG.getString(caught.getMessage()));
05405292a7ca Navigationtheme panel now shows themes of dWt and WQ charts grayed out, if the current station is outside the valid range of the theme.
gernotbelger
parents: 8856
diff changeset
626 }
05405292a7ca Navigationtheme panel now shows themes of dWt and WQ charts grayed out, if the current station is outside the valid range of the theme.
gernotbelger
parents: 8856
diff changeset
627
05405292a7ca Navigationtheme panel now shows themes of dWt and WQ charts grayed out, if the current station is outside the valid range of the theme.
gernotbelger
parents: 8856
diff changeset
628 @Override
05405292a7ca Navigationtheme panel now shows themes of dWt and WQ charts grayed out, if the current station is outside the valid range of the theme.
gernotbelger
parents: 8856
diff changeset
629 public void onSuccess(final CollectionItemAttribute cia) {
05405292a7ca Navigationtheme panel now shows themes of dWt and WQ charts grayed out, if the current station is outside the valid range of the theme.
gernotbelger
parents: 8856
diff changeset
630 GWT.log("Successfully loaded collectionitem attributes.");
05405292a7ca Navigationtheme panel now shows themes of dWt and WQ charts grayed out, if the current station is outside the valid range of the theme.
gernotbelger
parents: 8856
diff changeset
631 showStyleEditor(cia, record);
05405292a7ca Navigationtheme panel now shows themes of dWt and WQ charts grayed out, if the current station is outside the valid range of the theme.
gernotbelger
parents: 8856
diff changeset
632 }
05405292a7ca Navigationtheme panel now shows themes of dWt and WQ charts grayed out, if the current station is outside the valid range of the theme.
gernotbelger
parents: 8856
diff changeset
633 });
1309
a95e82d6bcc1 Refactored the code to create a context menu and a style editor so that it is also available for maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1303
diff changeset
634 }
1336
ceb989d64cd2 Request redraw on style attribute change.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1331
diff changeset
635
9416
05405292a7ca Navigationtheme panel now shows themes of dWt and WQ charts grayed out, if the current station is outside the valid range of the theme.
gernotbelger
parents: 8856
diff changeset
636 protected void showStyleEditor(final CollectionItemAttribute cia, final FacetRecord record) {
9575
cff7636035ce no style warning for wms themes
gernotbelger
parents: 9416
diff changeset
637
cff7636035ce no style warning for wms themes
gernotbelger
parents: 9416
diff changeset
638 final Theme theme = record.getTheme();
cff7636035ce no style warning for wms themes
gernotbelger
parents: 9416
diff changeset
639 final Style style = cia.getStyle(theme.getFacet(), theme.getIndex());
cff7636035ce no style warning for wms themes
gernotbelger
parents: 9416
diff changeset
640 if (style == null) {
cff7636035ce no style warning for wms themes
gernotbelger
parents: 9416
diff changeset
641 SC.warn(this.MSG.error_no_theme_styles_found());
cff7636035ce no style warning for wms themes
gernotbelger
parents: 9416
diff changeset
642 return;
cff7636035ce no style warning for wms themes
gernotbelger
parents: 9416
diff changeset
643 }
cff7636035ce no style warning for wms themes
gernotbelger
parents: 9416
diff changeset
644
9416
05405292a7ca Navigationtheme panel now shows themes of dWt and WQ charts grayed out, if the current station is outside the valid range of the theme.
gernotbelger
parents: 8856
diff changeset
645 final StyleEditorWindow win = new StyleEditorWindow(getCollection(), cia, record);
1336
ceb989d64cd2 Request redraw on style attribute change.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1331
diff changeset
646 win.setThemePanel(this);
1338
c730f0438510 Set window position to page center.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1336
diff changeset
647 win.centerInPage();
1336
ceb989d64cd2 Request redraw on style attribute change.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1331
diff changeset
648 win.show();
ceb989d64cd2 Request redraw on style attribute change.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1331
diff changeset
649 }
1568
2432973ccced Handle manual points on a per-chart(type) basis.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1560
diff changeset
650
2432973ccced Handle manual points on a per-chart(type) basis.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1560
diff changeset
651 /** Get OutputMode of this Panel. */
2432973ccced Handle manual points on a per-chart(type) basis.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1560
diff changeset
652 public OutputMode getMode() {
2432973ccced Handle manual points on a per-chart(type) basis.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1560
diff changeset
653 return this.mode;
2432973ccced Handle manual points on a per-chart(type) basis.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1560
diff changeset
654 }
9416
05405292a7ca Navigationtheme panel now shows themes of dWt and WQ charts grayed out, if the current station is outside the valid range of the theme.
gernotbelger
parents: 8856
diff changeset
655
05405292a7ca Navigationtheme panel now shows themes of dWt and WQ charts grayed out, if the current station is outside the valid range of the theme.
gernotbelger
parents: 8856
diff changeset
656 public void updateThemes() {
05405292a7ca Navigationtheme panel now shows themes of dWt and WQ charts grayed out, if the current station is outside the valid range of the theme.
gernotbelger
parents: 8856
diff changeset
657
05405292a7ca Navigationtheme panel now shows themes of dWt and WQ charts grayed out, if the current station is outside the valid range of the theme.
gernotbelger
parents: 8856
diff changeset
658 final ListGridRecord[] records = this.list.getRecords();
05405292a7ca Navigationtheme panel now shows themes of dWt and WQ charts grayed out, if the current station is outside the valid range of the theme.
gernotbelger
parents: 8856
diff changeset
659 for (final ListGridRecord record : records) {
05405292a7ca Navigationtheme panel now shows themes of dWt and WQ charts grayed out, if the current station is outside the valid range of the theme.
gernotbelger
parents: 8856
diff changeset
660 final FacetRecord facetRecord = (FacetRecord) record;
05405292a7ca Navigationtheme panel now shows themes of dWt and WQ charts grayed out, if the current station is outside the valid range of the theme.
gernotbelger
parents: 8856
diff changeset
661
05405292a7ca Navigationtheme panel now shows themes of dWt and WQ charts grayed out, if the current station is outside the valid range of the theme.
gernotbelger
parents: 8856
diff changeset
662 this.recordHandler.handle(facetRecord);
05405292a7ca Navigationtheme panel now shows themes of dWt and WQ charts grayed out, if the current station is outside the valid range of the theme.
gernotbelger
parents: 8856
diff changeset
663 }
05405292a7ca Navigationtheme panel now shows themes of dWt and WQ charts grayed out, if the current station is outside the valid range of the theme.
gernotbelger
parents: 8856
diff changeset
664
05405292a7ca Navigationtheme panel now shows themes of dWt and WQ charts grayed out, if the current station is outside the valid range of the theme.
gernotbelger
parents: 8856
diff changeset
665 this.list.markForRedraw();
05405292a7ca Navigationtheme panel now shows themes of dWt and WQ charts grayed out, if the current station is outside the valid range of the theme.
gernotbelger
parents: 8856
diff changeset
666 }
05405292a7ca Navigationtheme panel now shows themes of dWt and WQ charts grayed out, if the current station is outside the valid range of the theme.
gernotbelger
parents: 8856
diff changeset
667 }

http://dive4elements.wald.intevation.org