annotate flys-client/src/main/java/de/intevation/flys/client/client/ui/map/MapThemePanel.java @ 1422:25be27e33b77

#421 Ask the user before removing themes from chart or map. flys-client/trunk@3364 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Ingo Weinzierl <ingo.weinzierl@intevation.de>
date Thu, 08 Dec 2011 06:51:20 +0000
parents d50c3262e638
children c39aa5a6478c
rev   line source
805
f43d06d6a4a2 Refactored code of theme panel and added a MapThemePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
1 package de.intevation.flys.client.client.ui.map;
f43d06d6a4a2 Refactored code of theme panel and added a MapThemePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
2
f43d06d6a4a2 Refactored code of theme panel and added a MapThemePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
3 import com.google.gwt.core.client.GWT;
f43d06d6a4a2 Refactored code of theme panel and added a MapThemePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
4
1422
25be27e33b77 #421 Ask the user before removing themes from chart or map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1421
diff changeset
5 import com.smartgwt.client.util.SC;
25be27e33b77 #421 Ask the user before removing themes from chart or map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1421
diff changeset
6 import com.smartgwt.client.util.BooleanCallback;
1327
8a93fb299e64 #288 Added legend symbols to the MapThemePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1303
diff changeset
7 import com.smartgwt.client.types.ImageStyle;
805
f43d06d6a4a2 Refactored code of theme panel and added a MapThemePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
8 import com.smartgwt.client.types.ListGridFieldType;
1327
8a93fb299e64 #288 Added legend symbols to the MapThemePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1303
diff changeset
9 import com.smartgwt.client.types.VerticalAlignment;
8a93fb299e64 #288 Added legend symbols to the MapThemePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1303
diff changeset
10 import com.smartgwt.client.widgets.Canvas;
8a93fb299e64 #288 Added legend symbols to the MapThemePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1303
diff changeset
11 import com.smartgwt.client.widgets.Img;
8a93fb299e64 #288 Added legend symbols to the MapThemePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1303
diff changeset
12 import com.smartgwt.client.widgets.grid.ListGrid;
805
f43d06d6a4a2 Refactored code of theme panel and added a MapThemePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
13 import com.smartgwt.client.widgets.grid.ListGridField;
1327
8a93fb299e64 #288 Added legend symbols to the MapThemePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1303
diff changeset
14 import com.smartgwt.client.widgets.grid.ListGridRecord;
8a93fb299e64 #288 Added legend symbols to the MapThemePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1303
diff changeset
15 import com.smartgwt.client.widgets.layout.HLayout;
805
f43d06d6a4a2 Refactored code of theme panel and added a MapThemePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
16 import com.smartgwt.client.widgets.layout.VLayout;
1377
b0fe35d4ce6b Added a 'zoom to layer' menu item to the map theme panel which triggers a zoom to the specific layer/theme.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1327
diff changeset
17 import com.smartgwt.client.widgets.menu.Menu;
b0fe35d4ce6b Added a 'zoom to layer' menu item to the map theme panel which triggers a zoom to the specific layer/theme.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1327
diff changeset
18 import com.smartgwt.client.widgets.menu.MenuItem;
b0fe35d4ce6b Added a 'zoom to layer' menu item to the map theme panel which triggers a zoom to the specific layer/theme.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1327
diff changeset
19 import com.smartgwt.client.widgets.menu.events.ClickHandler;
b0fe35d4ce6b Added a 'zoom to layer' menu item to the map theme panel which triggers a zoom to the specific layer/theme.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1327
diff changeset
20 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
21
1421
d50c3262e638 Reorder the map themes at the end of the layer initialization to be in sync with the map theme panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1403
diff changeset
22 import org.gwtopenmaps.openlayers.client.Map;
d50c3262e638 Reorder the map themes at the end of the layer initialization to be in sync with the map theme panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1403
diff changeset
23 import org.gwtopenmaps.openlayers.client.layer.Layer;
d50c3262e638 Reorder the map themes at the end of the layer initialization to be in sync with the map theme panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1403
diff changeset
24
1327
8a93fb299e64 #288 Added legend symbols to the MapThemePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1303
diff changeset
25 import de.intevation.flys.client.shared.MapUtils;
8a93fb299e64 #288 Added legend symbols to the MapThemePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1303
diff changeset
26 import de.intevation.flys.client.shared.model.AttributedTheme;
805
f43d06d6a4a2 Refactored code of theme panel and added a MapThemePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
27 import de.intevation.flys.client.shared.model.Collection;
1327
8a93fb299e64 #288 Added legend symbols to the MapThemePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1303
diff changeset
28 import de.intevation.flys.client.shared.model.FacetRecord;
805
f43d06d6a4a2 Refactored code of theme panel and added a MapThemePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
29 import de.intevation.flys.client.shared.model.Theme;
f43d06d6a4a2 Refactored code of theme panel and added a MapThemePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
30 import de.intevation.flys.client.shared.model.OutputMode;
f43d06d6a4a2 Refactored code of theme panel and added a MapThemePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
31
f43d06d6a4a2 Refactored code of theme panel and added a MapThemePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
32 import de.intevation.flys.client.client.FLYSConstants;
f43d06d6a4a2 Refactored code of theme panel and added a MapThemePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
33 import de.intevation.flys.client.client.ui.ThemePanel;
f43d06d6a4a2 Refactored code of theme panel and added a MapThemePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
34
f43d06d6a4a2 Refactored code of theme panel and added a MapThemePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
35
f43d06d6a4a2 Refactored code of theme panel and added a MapThemePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
36 /**
f43d06d6a4a2 Refactored code of theme panel and added a MapThemePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
37 * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a>
f43d06d6a4a2 Refactored code of theme panel and added a MapThemePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
38 */
f43d06d6a4a2 Refactored code of theme panel and added a MapThemePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
39 public class MapThemePanel extends ThemePanel {
f43d06d6a4a2 Refactored code of theme panel and added a MapThemePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
40
1327
8a93fb299e64 #288 Added legend symbols to the MapThemePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1303
diff changeset
41 public static final int CELL_HEIGHT = 75;
8a93fb299e64 #288 Added legend symbols to the MapThemePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1303
diff changeset
42 public static final int STYLE_CELL_WIDTH = 125;
8a93fb299e64 #288 Added legend symbols to the MapThemePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1303
diff changeset
43
8a93fb299e64 #288 Added legend symbols to the MapThemePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1303
diff changeset
44
806
e50da1f74e58 The layers created in the floodmap reflect to the facets this output mode has.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 805
diff changeset
45 public interface ActivateCallback {
e50da1f74e58 The layers created in the floodmap reflect to the facets this output mode has.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 805
diff changeset
46 void activate(Theme theme, boolean activate);
e50da1f74e58 The layers created in the floodmap reflect to the facets this output mode has.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 805
diff changeset
47 }
e50da1f74e58 The layers created in the floodmap reflect to the facets this output mode has.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 805
diff changeset
48
e50da1f74e58 The layers created in the floodmap reflect to the facets this output mode has.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 805
diff changeset
49
1303
84c50f1d939b Added the option for the MapThemePanel to listen to Theme move events.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 806
diff changeset
50 public interface ThemeMovedCallback {
84c50f1d939b Added the option for the MapThemePanel to listen to Theme move events.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 806
diff changeset
51 void onThemeMoved(Theme theme, int oldIdx, int newIdx);
84c50f1d939b Added the option for the MapThemePanel to listen to Theme move events.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 806
diff changeset
52 }
84c50f1d939b Added the option for the MapThemePanel to listen to Theme move events.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 806
diff changeset
53
1377
b0fe35d4ce6b Added a 'zoom to layer' menu item to the map theme panel which triggers a zoom to the specific layer/theme.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1327
diff changeset
54 public interface LayerZoomCallback {
b0fe35d4ce6b Added a 'zoom to layer' menu item to the map theme panel which triggers a zoom to the specific layer/theme.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1327
diff changeset
55 void onLayerZoom(Theme theme, String extent);
b0fe35d4ce6b Added a 'zoom to layer' menu item to the map theme panel which triggers a zoom to the specific layer/theme.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1327
diff changeset
56 }
b0fe35d4ce6b Added a 'zoom to layer' menu item to the map theme panel which triggers a zoom to the specific layer/theme.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1327
diff changeset
57
1303
84c50f1d939b Added the option for the MapThemePanel to listen to Theme move events.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 806
diff changeset
58
806
e50da1f74e58 The layers created in the floodmap reflect to the facets this output mode has.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 805
diff changeset
59
805
f43d06d6a4a2 Refactored code of theme panel and added a MapThemePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
60 private FLYSConstants MSG = GWT.create(FLYSConstants.class);
f43d06d6a4a2 Refactored code of theme panel and added a MapThemePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
61
f43d06d6a4a2 Refactored code of theme panel and added a MapThemePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
62
1303
84c50f1d939b Added the option for the MapThemePanel to listen to Theme move events.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 806
diff changeset
63 protected ActivateCallback activateCallback;
84c50f1d939b Added the option for the MapThemePanel to listen to Theme move events.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 806
diff changeset
64 protected ThemeMovedCallback themeMovedCallback;
1377
b0fe35d4ce6b Added a 'zoom to layer' menu item to the map theme panel which triggers a zoom to the specific layer/theme.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1327
diff changeset
65 protected LayerZoomCallback layerZoomCallback;
806
e50da1f74e58 The layers created in the floodmap reflect to the facets this output mode has.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 805
diff changeset
66
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: 1377
diff changeset
67 protected ListGridRecord[] oldRecords;
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: 1377
diff changeset
68
806
e50da1f74e58 The layers created in the floodmap reflect to the facets this output mode has.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 805
diff changeset
69
805
f43d06d6a4a2 Refactored code of theme panel and added a MapThemePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
70 public static final String GRID_FIELD_ACTIVE = "active";
1327
8a93fb299e64 #288 Added legend symbols to the MapThemePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1303
diff changeset
71 public static final String GRID_FIELD_STYLE = "style";
805
f43d06d6a4a2 Refactored code of theme panel and added a MapThemePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
72 public static final String GRID_FIELD_NAME = "name";
f43d06d6a4a2 Refactored code of theme panel and added a MapThemePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
73
f43d06d6a4a2 Refactored code of theme panel and added a MapThemePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
74
f43d06d6a4a2 Refactored code of theme panel and added a MapThemePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
75 protected MapOutputTab mapOut;
f43d06d6a4a2 Refactored code of theme panel and added a MapThemePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
76
f43d06d6a4a2 Refactored code of theme panel and added a MapThemePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
77
806
e50da1f74e58 The layers created in the floodmap reflect to the facets this output mode has.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 805
diff changeset
78 public MapThemePanel(
1303
84c50f1d939b Added the option for the MapThemePanel to listen to Theme move events.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 806
diff changeset
79 Collection collection,
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: 1377
diff changeset
80 MapOutputTab mapOut,
1303
84c50f1d939b Added the option for the MapThemePanel to listen to Theme move events.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 806
diff changeset
81 OutputMode mode,
84c50f1d939b Added the option for the MapThemePanel to listen to Theme move events.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 806
diff changeset
82 ActivateCallback activateCallback
84c50f1d939b Added the option for the MapThemePanel to listen to Theme move events.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 806
diff changeset
83 ) {
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: 1377
diff changeset
84 this(collection, mode, mapOut, activateCallback, null, null);
1303
84c50f1d939b Added the option for the MapThemePanel to listen to Theme move events.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 806
diff changeset
85 }
84c50f1d939b Added the option for the MapThemePanel to listen to Theme move events.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 806
diff changeset
86
84c50f1d939b Added the option for the MapThemePanel to listen to Theme move events.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 806
diff changeset
87
84c50f1d939b Added the option for the MapThemePanel to listen to Theme move events.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 806
diff changeset
88 public MapThemePanel(
84c50f1d939b Added the option for the MapThemePanel to listen to Theme move events.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 806
diff changeset
89 Collection collection,
84c50f1d939b Added the option for the MapThemePanel to listen to Theme move events.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 806
diff changeset
90 OutputMode mode,
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: 1377
diff changeset
91 MapOutputTab mapOut,
1303
84c50f1d939b Added the option for the MapThemePanel to listen to Theme move events.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 806
diff changeset
92 ActivateCallback activateCallback,
1377
b0fe35d4ce6b Added a 'zoom to layer' menu item to the map theme panel which triggers a zoom to the specific layer/theme.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1327
diff changeset
93 ThemeMovedCallback themeMovedCallback,
b0fe35d4ce6b Added a 'zoom to layer' menu item to the map theme panel which triggers a zoom to the specific layer/theme.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1327
diff changeset
94 LayerZoomCallback layerZoomCallback
1303
84c50f1d939b Added the option for the MapThemePanel to listen to Theme move events.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 806
diff changeset
95 ) {
805
f43d06d6a4a2 Refactored code of theme panel and added a MapThemePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
96 super(collection, mode);
f43d06d6a4a2 Refactored code of theme panel and added a MapThemePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
97
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: 1377
diff changeset
98 this.mapOut = mapOut;
1303
84c50f1d939b Added the option for the MapThemePanel to listen to Theme move events.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 806
diff changeset
99 this.activateCallback = activateCallback;
84c50f1d939b Added the option for the MapThemePanel to listen to Theme move events.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 806
diff changeset
100 this.themeMovedCallback = themeMovedCallback;
1377
b0fe35d4ce6b Added a 'zoom to layer' menu item to the map theme panel which triggers a zoom to the specific layer/theme.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1327
diff changeset
101 this.layerZoomCallback = layerZoomCallback;
806
e50da1f74e58 The layers created in the floodmap reflect to the facets this output mode has.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 805
diff changeset
102
805
f43d06d6a4a2 Refactored code of theme panel and added a MapThemePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
103 initGrid();
f43d06d6a4a2 Refactored code of theme panel and added a MapThemePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
104 initLayout();
f43d06d6a4a2 Refactored code of theme panel and added a MapThemePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
105
f43d06d6a4a2 Refactored code of theme panel and added a MapThemePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
106 updateGrid();
f43d06d6a4a2 Refactored code of theme panel and added a MapThemePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
107 }
f43d06d6a4a2 Refactored code of theme panel and added a MapThemePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
108
f43d06d6a4a2 Refactored code of theme panel and added a MapThemePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
109
f43d06d6a4a2 Refactored code of theme panel and added a MapThemePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
110 protected void initLayout() {
f43d06d6a4a2 Refactored code of theme panel and added a MapThemePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
111 setWidth100();
f43d06d6a4a2 Refactored code of theme panel and added a MapThemePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
112 setHeight100();
f43d06d6a4a2 Refactored code of theme panel and added a MapThemePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
113
f43d06d6a4a2 Refactored code of theme panel and added a MapThemePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
114 VLayout layout = new VLayout();
f43d06d6a4a2 Refactored code of theme panel and added a MapThemePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
115 layout.setWidth100();
f43d06d6a4a2 Refactored code of theme panel and added a MapThemePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
116 layout.setHeight100();
f43d06d6a4a2 Refactored code of theme panel and added a MapThemePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
117
f43d06d6a4a2 Refactored code of theme panel and added a MapThemePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
118 layout.addMember(list);
f43d06d6a4a2 Refactored code of theme panel and added a MapThemePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
119 layout.addMember(navigation);
f43d06d6a4a2 Refactored code of theme panel and added a MapThemePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
120
f43d06d6a4a2 Refactored code of theme panel and added a MapThemePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
121 addChild(layout);
f43d06d6a4a2 Refactored code of theme panel and added a MapThemePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
122 }
f43d06d6a4a2 Refactored code of theme panel and added a MapThemePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
123
f43d06d6a4a2 Refactored code of theme panel and added a MapThemePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
124
f43d06d6a4a2 Refactored code of theme panel and added a MapThemePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
125 protected void initGrid() {
f43d06d6a4a2 Refactored code of theme panel and added a MapThemePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
126 list.setCanEdit(true);
f43d06d6a4a2 Refactored code of theme panel and added a MapThemePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
127 list.setCanSort(false);
f43d06d6a4a2 Refactored code of theme panel and added a MapThemePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
128 list.setShowRecordComponents(false);
f43d06d6a4a2 Refactored code of theme panel and added a MapThemePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
129 list.setShowRecordComponentsByCell(true);
f43d06d6a4a2 Refactored code of theme panel and added a MapThemePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
130 list.setShowHeader(true);
f43d06d6a4a2 Refactored code of theme panel and added a MapThemePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
131 list.setShowHeaderContextMenu(false);
f43d06d6a4a2 Refactored code of theme panel and added a MapThemePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
132 list.setWidth100();
f43d06d6a4a2 Refactored code of theme panel and added a MapThemePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
133 list.setHeight100();
f43d06d6a4a2 Refactored code of theme panel and added a MapThemePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
134
1327
8a93fb299e64 #288 Added legend symbols to the MapThemePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1303
diff changeset
135 list.setCellHeight(CELL_HEIGHT);
8a93fb299e64 #288 Added legend symbols to the MapThemePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1303
diff changeset
136 list.setShowRecordComponents(true);
8a93fb299e64 #288 Added legend symbols to the MapThemePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1303
diff changeset
137 list.setShowRecordComponentsByCell(true);
8a93fb299e64 #288 Added legend symbols to the MapThemePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1303
diff changeset
138 list.setShowAllRecords(true);
8a93fb299e64 #288 Added legend symbols to the MapThemePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1303
diff changeset
139
805
f43d06d6a4a2 Refactored code of theme panel and added a MapThemePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
140 list.addEditCompleteHandler(this);
f43d06d6a4a2 Refactored code of theme panel and added a MapThemePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
141
f43d06d6a4a2 Refactored code of theme panel and added a MapThemePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
142 ListGridField active = new ListGridField(GRID_FIELD_ACTIVE, " ", 20);
f43d06d6a4a2 Refactored code of theme panel and added a MapThemePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
143 active.setType(ListGridFieldType.BOOLEAN);
1327
8a93fb299e64 #288 Added legend symbols to the MapThemePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1303
diff changeset
144 active.setCanDragResize(false);
8a93fb299e64 #288 Added legend symbols to the MapThemePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1303
diff changeset
145
8a93fb299e64 #288 Added legend symbols to the MapThemePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1303
diff changeset
146 ListGridField style = new ListGridField(
8a93fb299e64 #288 Added legend symbols to the MapThemePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1303
diff changeset
147 GRID_FIELD_STYLE,
8a93fb299e64 #288 Added legend symbols to the MapThemePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1303
diff changeset
148 MSG.map_themepanel_header_style(),
8a93fb299e64 #288 Added legend symbols to the MapThemePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1303
diff changeset
149 STYLE_CELL_WIDTH);
8a93fb299e64 #288 Added legend symbols to the MapThemePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1303
diff changeset
150 style.setCanEdit(false);
8a93fb299e64 #288 Added legend symbols to the MapThemePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1303
diff changeset
151 style.setCanDragResize(false);
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 ListGridField name = new ListGridField(
f43d06d6a4a2 Refactored code of theme panel and added a MapThemePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
154 GRID_FIELD_NAME, MSG.chart_themepanel_header_themes());
f43d06d6a4a2 Refactored code of theme panel and added a MapThemePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
155 name.setType(ListGridFieldType.TEXT);
f43d06d6a4a2 Refactored code of theme panel and added a MapThemePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
156
1327
8a93fb299e64 #288 Added legend symbols to the MapThemePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1303
diff changeset
157 list.setFields(active, style, name);
8a93fb299e64 #288 Added legend symbols to the MapThemePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1303
diff changeset
158 }
8a93fb299e64 #288 Added legend symbols to the MapThemePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1303
diff changeset
159
8a93fb299e64 #288 Added legend symbols to the MapThemePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1303
diff changeset
160
8a93fb299e64 #288 Added legend symbols to the MapThemePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1303
diff changeset
161 @Override
8a93fb299e64 #288 Added legend symbols to the MapThemePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1303
diff changeset
162 protected ListGrid createNewGrid() {
8a93fb299e64 #288 Added legend symbols to the MapThemePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1303
diff changeset
163 ListGrid grid = new ListGrid() {
8a93fb299e64 #288 Added legend symbols to the MapThemePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1303
diff changeset
164 @Override
8a93fb299e64 #288 Added legend symbols to the MapThemePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1303
diff changeset
165 protected Canvas createRecordComponent(final ListGridRecord record, Integer colNum) {
8a93fb299e64 #288 Added legend symbols to the MapThemePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1303
diff changeset
166 String fieldname = getFieldName(colNum);
8a93fb299e64 #288 Added legend symbols to the MapThemePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1303
diff changeset
167
8a93fb299e64 #288 Added legend symbols to the MapThemePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1303
diff changeset
168 if (fieldname.equals(GRID_FIELD_STYLE)) {
8a93fb299e64 #288 Added legend symbols to the MapThemePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1303
diff changeset
169 FacetRecord r = (FacetRecord) record;
8a93fb299e64 #288 Added legend symbols to the MapThemePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1303
diff changeset
170 AttributedTheme at = (AttributedTheme) r.getTheme();
8a93fb299e64 #288 Added legend symbols to the MapThemePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1303
diff changeset
171
8a93fb299e64 #288 Added legend symbols to the MapThemePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1303
diff changeset
172 String imgUrl = MapUtils.getLegendGraphicUrl(
8a93fb299e64 #288 Added legend symbols to the MapThemePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1303
diff changeset
173 at.getAttr("url"),
8a93fb299e64 #288 Added legend symbols to the MapThemePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1303
diff changeset
174 at.getAttr("layers"));
8a93fb299e64 #288 Added legend symbols to the MapThemePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1303
diff changeset
175
8a93fb299e64 #288 Added legend symbols to the MapThemePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1303
diff changeset
176 HLayout layout = new HLayout();
8a93fb299e64 #288 Added legend symbols to the MapThemePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1303
diff changeset
177 layout.setAlign(VerticalAlignment.CENTER);
8a93fb299e64 #288 Added legend symbols to the MapThemePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1303
diff changeset
178 layout.setLayoutAlign(VerticalAlignment.CENTER);
8a93fb299e64 #288 Added legend symbols to the MapThemePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1303
diff changeset
179
8a93fb299e64 #288 Added legend symbols to the MapThemePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1303
diff changeset
180 Img img = new Img(imgUrl);
8a93fb299e64 #288 Added legend symbols to the MapThemePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1303
diff changeset
181 img.setImageType(ImageStyle.CENTER);
8a93fb299e64 #288 Added legend symbols to the MapThemePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1303
diff changeset
182
8a93fb299e64 #288 Added legend symbols to the MapThemePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1303
diff changeset
183 layout.addMember(img);
8a93fb299e64 #288 Added legend symbols to the MapThemePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1303
diff changeset
184
8a93fb299e64 #288 Added legend symbols to the MapThemePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1303
diff changeset
185 return layout;
8a93fb299e64 #288 Added legend symbols to the MapThemePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1303
diff changeset
186 }
8a93fb299e64 #288 Added legend symbols to the MapThemePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1303
diff changeset
187
8a93fb299e64 #288 Added legend symbols to the MapThemePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1303
diff changeset
188 return super.createRecordComponent(record, colNum);
8a93fb299e64 #288 Added legend symbols to the MapThemePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1303
diff changeset
189 }
8a93fb299e64 #288 Added legend symbols to the MapThemePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1303
diff changeset
190 };
8a93fb299e64 #288 Added legend symbols to the MapThemePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1303
diff changeset
191
8a93fb299e64 #288 Added legend symbols to the MapThemePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1303
diff changeset
192 return grid;
805
f43d06d6a4a2 Refactored code of theme panel and added a MapThemePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
193 }
f43d06d6a4a2 Refactored code of theme panel and added a MapThemePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
194
f43d06d6a4a2 Refactored code of theme panel and added a MapThemePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
195
f43d06d6a4a2 Refactored code of theme panel and added a MapThemePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
196 @Override
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: 1377
diff changeset
197 protected void clearGrid() {
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: 1377
diff changeset
198 oldRecords = list.getRecords();
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: 1377
diff changeset
199 super.clearGrid();
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: 1377
diff changeset
200 }
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: 1377
diff changeset
201
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: 1377
diff changeset
202
1421
d50c3262e638 Reorder the map themes at the end of the layer initialization to be in sync with the map theme panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1403
diff changeset
203 /**
d50c3262e638 Reorder the map themes at the end of the layer initialization to be in sync with the map theme panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1403
diff changeset
204 * This method calls super.updateGrid() at first. Finally, it is used to
d50c3262e638 Reorder the map themes at the end of the layer initialization to be in sync with the map theme panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1403
diff changeset
205 * reorder the layers in the map. The first layer added to the map is the
d50c3262e638 Reorder the map themes at the end of the layer initialization to be in sync with the map theme panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1403
diff changeset
206 * layer which is least visible. So, the order needs to be reflected.
d50c3262e638 Reorder the map themes at the end of the layer initialization to be in sync with the map theme panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1403
diff changeset
207 */
d50c3262e638 Reorder the map themes at the end of the layer initialization to be in sync with the map theme panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1403
diff changeset
208 @Override
d50c3262e638 Reorder the map themes at the end of the layer initialization to be in sync with the map theme panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1403
diff changeset
209 protected void updateGrid() {
d50c3262e638 Reorder the map themes at the end of the layer initialization to be in sync with the map theme panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1403
diff changeset
210 super.updateGrid();
d50c3262e638 Reorder the map themes at the end of the layer initialization to be in sync with the map theme panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1403
diff changeset
211
d50c3262e638 Reorder the map themes at the end of the layer initialization to be in sync with the map theme panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1403
diff changeset
212 Map map = mapOut.getMap();
d50c3262e638 Reorder the map themes at the end of the layer initialization to be in sync with the map theme panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1403
diff changeset
213 int num = map.getNumLayers() - 1; // without the vector layer
d50c3262e638 Reorder the map themes at the end of the layer initialization to be in sync with the map theme panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1403
diff changeset
214
d50c3262e638 Reorder the map themes at the end of the layer initialization to be in sync with the map theme panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1403
diff changeset
215 Layer[] layers = map.getLayers();
d50c3262e638 Reorder the map themes at the end of the layer initialization to be in sync with the map theme panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1403
diff changeset
216
d50c3262e638 Reorder the map themes at the end of the layer initialization to be in sync with the map theme panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1403
diff changeset
217 for (int i = 1; i < num; i++) {
d50c3262e638 Reorder the map themes at the end of the layer initialization to be in sync with the map theme panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1403
diff changeset
218 map.raiseLayer(layers[i], num-i);
d50c3262e638 Reorder the map themes at the end of the layer initialization to be in sync with the map theme panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1403
diff changeset
219 }
d50c3262e638 Reorder the map themes at the end of the layer initialization to be in sync with the map theme panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1403
diff changeset
220 }
d50c3262e638 Reorder the map themes at the end of the layer initialization to be in sync with the map theme panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1403
diff changeset
221
d50c3262e638 Reorder the map themes at the end of the layer initialization to be in sync with the map theme panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1403
diff changeset
222
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: 1377
diff changeset
223 @Override
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: 1377
diff changeset
224 protected void addFacetRecord(FacetRecord rec) {
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: 1377
diff changeset
225 Theme newTheme = rec.getTheme();
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: 1377
diff changeset
226 boolean isNew = true;
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: 1377
diff changeset
227
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: 1377
diff changeset
228 for (ListGridRecord old: getOldRecords()) {
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: 1377
diff changeset
229 FacetRecord fr = (FacetRecord) old;
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: 1377
diff changeset
230
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: 1377
diff changeset
231 if (newTheme.equals(fr.getTheme())) {
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: 1377
diff changeset
232 isNew = false;
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: 1377
diff changeset
233 break;
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: 1377
diff changeset
234 }
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: 1377
diff changeset
235 }
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: 1377
diff changeset
236
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: 1377
diff changeset
237 if (isNew && mapOut != null) {
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: 1377
diff changeset
238 mapOut.addLayer(mapOut.createWMSLayer(newTheme));
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: 1377
diff changeset
239 }
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: 1377
diff changeset
240
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: 1377
diff changeset
241 super.addFacetRecord(rec);
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: 1377
diff changeset
242 }
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: 1377
diff changeset
243
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: 1377
diff changeset
244
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: 1377
diff changeset
245 @Override
1377
b0fe35d4ce6b Added a 'zoom to layer' menu item to the map theme panel which triggers a zoom to the specific layer/theme.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1327
diff changeset
246 protected Menu getSingleContextMenu(final ListGridRecord[] records) {
b0fe35d4ce6b Added a 'zoom to layer' menu item to the map theme panel which triggers a zoom to the specific layer/theme.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1327
diff changeset
247 Menu menu = super.getSingleContextMenu(records);
b0fe35d4ce6b Added a 'zoom to layer' menu item to the map theme panel which triggers a zoom to the specific layer/theme.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1327
diff changeset
248
b0fe35d4ce6b Added a 'zoom to layer' menu item to the map theme panel which triggers a zoom to the specific layer/theme.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1327
diff changeset
249 MenuItem layerZoom = createLayerZoomItem(records);
b0fe35d4ce6b Added a 'zoom to layer' menu item to the map theme panel which triggers a zoom to the specific layer/theme.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1327
diff changeset
250 if (layerZoom != null) {
b0fe35d4ce6b Added a 'zoom to layer' menu item to the map theme panel which triggers a zoom to the specific layer/theme.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1327
diff changeset
251 menu.addItem(layerZoom);
b0fe35d4ce6b Added a 'zoom to layer' menu item to the map theme panel which triggers a zoom to the specific layer/theme.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1327
diff changeset
252 }
b0fe35d4ce6b Added a 'zoom to layer' menu item to the map theme panel which triggers a zoom to the specific layer/theme.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1327
diff changeset
253
b0fe35d4ce6b Added a 'zoom to layer' menu item to the map theme panel which triggers a zoom to the specific layer/theme.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1327
diff changeset
254 return menu;
b0fe35d4ce6b Added a 'zoom to layer' menu item to the map theme panel which triggers a zoom to the specific layer/theme.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1327
diff changeset
255 }
b0fe35d4ce6b Added a 'zoom to layer' menu item to the map theme panel which triggers a zoom to the specific layer/theme.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1327
diff changeset
256
b0fe35d4ce6b Added a 'zoom to layer' menu item to the map theme panel which triggers a zoom to the specific layer/theme.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1327
diff changeset
257
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: 1377
diff changeset
258 @Override
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: 1377
diff changeset
259 protected MenuItem createRemoveItem(final ListGridRecord[] records) {
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: 1377
diff changeset
260 MenuItem item = super.createRemoveItem(records);
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: 1377
diff changeset
261 item.addClickHandler(new ClickHandler() {
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: 1377
diff changeset
262 @Override
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: 1377
diff changeset
263 public void onClick(MenuItemClickEvent evt) {
1422
25be27e33b77 #421 Ask the user before removing themes from chart or map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1421
diff changeset
264 SC.ask(MSG.askThemeRemove(), new BooleanCallback() {
25be27e33b77 #421 Ask the user before removing themes from chart or map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1421
diff changeset
265 @Override
25be27e33b77 #421 Ask the user before removing themes from chart or map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1421
diff changeset
266 public void execute(Boolean value) {
25be27e33b77 #421 Ask the user before removing themes from chart or map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1421
diff changeset
267 if (value) {
25be27e33b77 #421 Ask the user before removing themes from chart or map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1421
diff changeset
268 for (ListGridRecord record: records) {
25be27e33b77 #421 Ask the user before removing themes from chart or map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1421
diff changeset
269 FacetRecord facet = (FacetRecord) record;
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: 1377
diff changeset
270
1422
25be27e33b77 #421 Ask the user before removing themes from chart or map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1421
diff changeset
271 Theme theme = facet.getTheme();
25be27e33b77 #421 Ask the user before removing themes from chart or map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1421
diff changeset
272 theme.setVisible(0);
25be27e33b77 #421 Ask the user before removing themes from chart or map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1421
diff changeset
273 theme.setActive(0);
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: 1377
diff changeset
274
1422
25be27e33b77 #421 Ask the user before removing themes from chart or map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1421
diff changeset
275 AttributedTheme at = (AttributedTheme) theme;
25be27e33b77 #421 Ask the user before removing themes from chart or map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1421
diff changeset
276 getMapOutputTab().removeLayer(at.getAttr("layers"));
25be27e33b77 #421 Ask the user before removing themes from chart or map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1421
diff changeset
277 }
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: 1377
diff changeset
278
1422
25be27e33b77 #421 Ask the user before removing themes from chart or map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1421
diff changeset
279 updateCollection();
25be27e33b77 #421 Ask the user before removing themes from chart or map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1421
diff changeset
280 }
25be27e33b77 #421 Ask the user before removing themes from chart or map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1421
diff changeset
281 }
25be27e33b77 #421 Ask the user before removing themes from chart or map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1421
diff changeset
282 });
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: 1377
diff changeset
283 }
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: 1377
diff changeset
284 });
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: 1377
diff changeset
285
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: 1377
diff changeset
286 return item;
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: 1377
diff changeset
287 }
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: 1377
diff changeset
288
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: 1377
diff changeset
289
1377
b0fe35d4ce6b Added a 'zoom to layer' menu item to the map theme panel which triggers a zoom to the specific layer/theme.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1327
diff changeset
290 protected MenuItem createLayerZoomItem(final ListGridRecord[] recs) {
b0fe35d4ce6b Added a 'zoom to layer' menu item to the map theme panel which triggers a zoom to the specific layer/theme.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1327
diff changeset
291 final FacetRecord fr = (FacetRecord) recs[0];
b0fe35d4ce6b Added a 'zoom to layer' menu item to the map theme panel which triggers a zoom to the specific layer/theme.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1327
diff changeset
292 final AttributedTheme at = (AttributedTheme) fr.getTheme();
b0fe35d4ce6b Added a 'zoom to layer' menu item to the map theme panel which triggers a zoom to the specific layer/theme.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1327
diff changeset
293
b0fe35d4ce6b Added a 'zoom to layer' menu item to the map theme panel which triggers a zoom to the specific layer/theme.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1327
diff changeset
294 final String extent = at.getAttr("extent");
b0fe35d4ce6b Added a 'zoom to layer' menu item to the map theme panel which triggers a zoom to the specific layer/theme.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1327
diff changeset
295
b0fe35d4ce6b Added a 'zoom to layer' menu item to the map theme panel which triggers a zoom to the specific layer/theme.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1327
diff changeset
296 if (extent == null || extent.length() == 0) {
b0fe35d4ce6b Added a 'zoom to layer' menu item to the map theme panel which triggers a zoom to the specific layer/theme.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1327
diff changeset
297 return null;
b0fe35d4ce6b Added a 'zoom to layer' menu item to the map theme panel which triggers a zoom to the specific layer/theme.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1327
diff changeset
298 }
b0fe35d4ce6b Added a 'zoom to layer' menu item to the map theme panel which triggers a zoom to the specific layer/theme.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1327
diff changeset
299
b0fe35d4ce6b Added a 'zoom to layer' menu item to the map theme panel which triggers a zoom to the specific layer/theme.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1327
diff changeset
300 MenuItem zoom = new MenuItem(MSG.zoomToLayer());
b0fe35d4ce6b Added a 'zoom to layer' menu item to the map theme panel which triggers a zoom to the specific layer/theme.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1327
diff changeset
301 zoom.addClickHandler(new ClickHandler() {
b0fe35d4ce6b Added a 'zoom to layer' menu item to the map theme panel which triggers a zoom to the specific layer/theme.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1327
diff changeset
302 @Override
b0fe35d4ce6b Added a 'zoom to layer' menu item to the map theme panel which triggers a zoom to the specific layer/theme.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1327
diff changeset
303 public void onClick(MenuItemClickEvent evt) {
b0fe35d4ce6b Added a 'zoom to layer' menu item to the map theme panel which triggers a zoom to the specific layer/theme.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1327
diff changeset
304 if (layerZoomCallback != null) {
b0fe35d4ce6b Added a 'zoom to layer' menu item to the map theme panel which triggers a zoom to the specific layer/theme.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1327
diff changeset
305 layerZoomCallback.onLayerZoom(at, extent);
b0fe35d4ce6b Added a 'zoom to layer' menu item to the map theme panel which triggers a zoom to the specific layer/theme.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1327
diff changeset
306 }
b0fe35d4ce6b Added a 'zoom to layer' menu item to the map theme panel which triggers a zoom to the specific layer/theme.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1327
diff changeset
307 }
b0fe35d4ce6b Added a 'zoom to layer' menu item to the map theme panel which triggers a zoom to the specific layer/theme.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1327
diff changeset
308 });
b0fe35d4ce6b Added a 'zoom to layer' menu item to the map theme panel which triggers a zoom to the specific layer/theme.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1327
diff changeset
309
b0fe35d4ce6b Added a 'zoom to layer' menu item to the map theme panel which triggers a zoom to the specific layer/theme.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1327
diff changeset
310 return zoom;
b0fe35d4ce6b Added a 'zoom to layer' menu item to the map theme panel which triggers a zoom to the specific layer/theme.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1327
diff changeset
311 }
b0fe35d4ce6b Added a 'zoom to layer' menu item to the map theme panel which triggers a zoom to the specific layer/theme.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1327
diff changeset
312
b0fe35d4ce6b Added a 'zoom to layer' menu item to the map theme panel which triggers a zoom to the specific layer/theme.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1327
diff changeset
313
b0fe35d4ce6b Added a 'zoom to layer' menu item to the map theme panel which triggers a zoom to the specific layer/theme.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1327
diff changeset
314 @Override
805
f43d06d6a4a2 Refactored code of theme panel and added a MapThemePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
315 public void activateTheme(Theme theme, boolean active) {
806
e50da1f74e58 The layers created in the floodmap reflect to the facets this output mode has.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 805
diff changeset
316 if (activateCallback != null) {
e50da1f74e58 The layers created in the floodmap reflect to the facets this output mode has.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 805
diff changeset
317 activateCallback.activate(theme, active);
e50da1f74e58 The layers created in the floodmap reflect to the facets this output mode has.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 805
diff changeset
318 }
e50da1f74e58 The layers created in the floodmap reflect to the facets this output mode has.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 805
diff changeset
319
805
f43d06d6a4a2 Refactored code of theme panel and added a MapThemePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
320 theme.setActive(active ? 1 : 0);
f43d06d6a4a2 Refactored code of theme panel and added a MapThemePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
321 }
1303
84c50f1d939b Added the option for the MapThemePanel to listen to Theme move events.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 806
diff changeset
322
84c50f1d939b Added the option for the MapThemePanel to listen to Theme move events.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 806
diff changeset
323
84c50f1d939b Added the option for the MapThemePanel to listen to Theme move events.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 806
diff changeset
324 @Override
84c50f1d939b Added the option for the MapThemePanel to listen to Theme move events.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 806
diff changeset
325 protected void fireThemeMoved(Theme theme, int oldIdx, int newIdx) {
84c50f1d939b Added the option for the MapThemePanel to listen to Theme move events.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 806
diff changeset
326 if (themeMovedCallback != null) {
84c50f1d939b Added the option for the MapThemePanel to listen to Theme move events.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 806
diff changeset
327 themeMovedCallback.onThemeMoved(theme, oldIdx, newIdx);
84c50f1d939b Added the option for the MapThemePanel to listen to Theme move events.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 806
diff changeset
328 }
84c50f1d939b Added the option for the MapThemePanel to listen to Theme move events.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 806
diff changeset
329 }
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: 1377
diff changeset
330
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: 1377
diff changeset
331
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: 1377
diff changeset
332 protected ListGridRecord[] getOldRecords() {
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: 1377
diff changeset
333 return oldRecords != null ? oldRecords : new ListGridRecord[0];
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: 1377
diff changeset
334 }
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: 1377
diff changeset
335
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: 1377
diff changeset
336
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: 1377
diff changeset
337 protected MapOutputTab getMapOutputTab() {
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: 1377
diff changeset
338 return mapOut;
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: 1377
diff changeset
339 }
805
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 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :

http://dive4elements.wald.intevation.org