annotate flys-client/src/main/java/de/intevation/flys/client/client/ui/chart/ChartThemePanel.java @ 1287:95ecb98c6015

Added skeleton for editor window. flys-client/trunk@2873 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Raimund Renkert <raimund.renkert@intevation.de>
date Fri, 30 Sep 2011 13:42:00 +0000
parents b643622d77fe
children 17bff7b27052
rev   line source
523
0785a8ba5e6d Implemented the first step of a theme control panel for charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
1 package de.intevation.flys.client.client.ui.chart;
0785a8ba5e6d Implemented the first step of a theme control panel for charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
2
1286
b643622d77fe Added context menu to themes list.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 891
diff changeset
3 import org.w3c.dom.Document;
b643622d77fe Added context menu to themes list.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 891
diff changeset
4 import de.intevation.artifacts.common.utils.XMLUtils;
b643622d77fe Added context menu to themes list.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 891
diff changeset
5
523
0785a8ba5e6d Implemented the first step of a theme control panel for charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
6 import com.google.gwt.core.client.GWT;
1286
b643622d77fe Added context menu to themes list.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 891
diff changeset
7 import com.google.gwt.user.client.rpc.AsyncCallback;
523
0785a8ba5e6d Implemented the first step of a theme control panel for charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
8
0785a8ba5e6d Implemented the first step of a theme control panel for charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
9 import com.smartgwt.client.types.ListGridFieldType;
0785a8ba5e6d Implemented the first step of a theme control panel for charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
10 import com.smartgwt.client.widgets.grid.ListGridField;
0785a8ba5e6d Implemented the first step of a theme control panel for charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
11 import com.smartgwt.client.widgets.layout.VLayout;
1286
b643622d77fe Added context menu to themes list.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 891
diff changeset
12 import com.smartgwt.client.widgets.grid.events.RowContextClickEvent;
b643622d77fe Added context menu to themes list.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 891
diff changeset
13 import com.smartgwt.client.widgets.grid.events.RowContextClickHandler;
b643622d77fe Added context menu to themes list.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 891
diff changeset
14 import com.smartgwt.client.widgets.menu.Menu;
b643622d77fe Added context menu to themes list.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 891
diff changeset
15 import com.smartgwt.client.widgets.menu.MenuItem;
b643622d77fe Added context menu to themes list.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 891
diff changeset
16 import com.smartgwt.client.widgets.menu.MenuItemSeparator;
b643622d77fe Added context menu to themes list.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 891
diff changeset
17 import com.smartgwt.client.widgets.menu.events.MenuItemClickEvent;
b643622d77fe Added context menu to themes list.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 891
diff changeset
18 import com.smartgwt.client.widgets.menu.events.ClickHandler;
523
0785a8ba5e6d Implemented the first step of a theme control panel for charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
19
0785a8ba5e6d Implemented the first step of a theme control panel for charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
20 import de.intevation.flys.client.shared.model.Collection;
524
ba238f917b94 The theme list information stored in the attribute of a collection is read and added in form of Themes and ThemeLists to the Collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 523
diff changeset
21 import de.intevation.flys.client.shared.model.Theme;
805
f43d06d6a4a2 Refactored code of theme panel and added a MapThemePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 804
diff changeset
22 import de.intevation.flys.client.shared.model.OutputMode;
1286
b643622d77fe Added context menu to themes list.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 891
diff changeset
23 import de.intevation.flys.client.shared.model.FacetRecord;
b643622d77fe Added context menu to themes list.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 891
diff changeset
24 import de.intevation.flys.client.shared.model.Facet;
b643622d77fe Added context menu to themes list.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 891
diff changeset
25 import de.intevation.flys.client.shared.model.Artifact;
b643622d77fe Added context menu to themes list.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 891
diff changeset
26 import de.intevation.flys.client.shared.model.CollectionItemAttribute;
523
0785a8ba5e6d Implemented the first step of a theme control panel for charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
27
0785a8ba5e6d Implemented the first step of a theme control panel for charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
28 import de.intevation.flys.client.client.FLYSConstants;
805
f43d06d6a4a2 Refactored code of theme panel and added a MapThemePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 804
diff changeset
29 import de.intevation.flys.client.client.ui.ThemePanel;
1286
b643622d77fe Added context menu to themes list.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 891
diff changeset
30 import de.intevation.flys.client.client.Config;
1287
95ecb98c6015 Added skeleton for editor window.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1286
diff changeset
31 import de.intevation.flys.client.client.ui.CollectionView;
523
0785a8ba5e6d Implemented the first step of a theme control panel for charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
32
854
67c678903280 Refactored to allow specialized controls within the ChartThemePanel, stubby
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 805
diff changeset
33 import de.intevation.flys.client.client.services.FeedService;
67c678903280 Refactored to allow specialized controls within the ChartThemePanel, stubby
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 805
diff changeset
34 import de.intevation.flys.client.client.services.FeedServiceAsync;
1286
b643622d77fe Added context menu to themes list.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 891
diff changeset
35 import de.intevation.flys.client.client.services.CollectionItemAttributeService;
b643622d77fe Added context menu to themes list.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 891
diff changeset
36 import de.intevation.flys.client.client.services.CollectionItemAttributeServiceAsync;
523
0785a8ba5e6d Implemented the first step of a theme control panel for charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
37
0785a8ba5e6d Implemented the first step of a theme control panel for charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
38 /**
0785a8ba5e6d Implemented the first step of a theme control panel for charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
39 * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a>
0785a8ba5e6d Implemented the first step of a theme control panel for charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
40 */
805
f43d06d6a4a2 Refactored code of theme panel and added a MapThemePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 804
diff changeset
41 public class ChartThemePanel extends ThemePanel {
f43d06d6a4a2 Refactored code of theme panel and added a MapThemePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 804
diff changeset
42
523
0785a8ba5e6d Implemented the first step of a theme control panel for charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
43 /** The interface that provides i18n messages. */
858
9f07f67f60a5 Subclassed ChartThemePanel, trigger redraws of Chart when interaction with
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 854
diff changeset
44 protected FLYSConstants MSG = GWT.create(FLYSConstants.class);
526
96e60e0a4345 Added a service stub to update/modify the attribute of a collection (used in the theme control panel).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 524
diff changeset
45
1286
b643622d77fe Added context menu to themes list.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 891
diff changeset
46 /** The collection */
b643622d77fe Added context menu to themes list.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 891
diff changeset
47 protected Collection collection;
b643622d77fe Added context menu to themes list.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 891
diff changeset
48
1287
95ecb98c6015 Added skeleton for editor window.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1286
diff changeset
49 /** The collection view*/
95ecb98c6015 Added skeleton for editor window.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1286
diff changeset
50 protected CollectionView view;
95ecb98c6015 Added skeleton for editor window.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1286
diff changeset
51
1286
b643622d77fe Added context menu to themes list.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 891
diff changeset
52 /** The service used to get collection item attributes. */
b643622d77fe Added context menu to themes list.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 891
diff changeset
53 protected CollectionItemAttributeServiceAsync itemAttributeService =
b643622d77fe Added context menu to themes list.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 891
diff changeset
54 GWT.create(CollectionItemAttributeService.class);
b643622d77fe Added context menu to themes list.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 891
diff changeset
55
854
67c678903280 Refactored to allow specialized controls within the ChartThemePanel, stubby
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 805
diff changeset
56 public static final String GRID_FIELD_ACTIVE = "active";
67c678903280 Refactored to allow specialized controls within the ChartThemePanel, stubby
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 805
diff changeset
57 public static final String GRID_FIELD_NAME = "name";
67c678903280 Refactored to allow specialized controls within the ChartThemePanel, stubby
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 805
diff changeset
58 public static final String GRID_FIELD_ACTIONS = "actions";
523
0785a8ba5e6d Implemented the first step of a theme control panel for charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
59
854
67c678903280 Refactored to allow specialized controls within the ChartThemePanel, stubby
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 805
diff changeset
60 FeedServiceAsync feedService = GWT.create(
67c678903280 Refactored to allow specialized controls within the ChartThemePanel, stubby
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 805
diff changeset
61 de.intevation.flys.client.client.services.FeedService.class);
523
0785a8ba5e6d Implemented the first step of a theme control panel for charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
62
0785a8ba5e6d Implemented the first step of a theme control panel for charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
63 public ChartThemePanel(Collection collection, OutputMode mode) {
805
f43d06d6a4a2 Refactored code of theme panel and added a MapThemePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 804
diff changeset
64 super(collection, mode);
1286
b643622d77fe Added context menu to themes list.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 891
diff changeset
65 this.collection = collection;
523
0785a8ba5e6d Implemented the first step of a theme control panel for charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
66
0785a8ba5e6d Implemented the first step of a theme control panel for charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
67 initGrid();
0785a8ba5e6d Implemented the first step of a theme control panel for charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
68 initLayout();
0785a8ba5e6d Implemented the first step of a theme control panel for charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
69
0785a8ba5e6d Implemented the first step of a theme control panel for charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
70 updateGrid();
0785a8ba5e6d Implemented the first step of a theme control panel for charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
71 }
0785a8ba5e6d Implemented the first step of a theme control panel for charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
72
0785a8ba5e6d Implemented the first step of a theme control panel for charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
73
0785a8ba5e6d Implemented the first step of a theme control panel for charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
74 /**
0785a8ba5e6d Implemented the first step of a theme control panel for charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
75 * Initializes the layout of this panel.
0785a8ba5e6d Implemented the first step of a theme control panel for charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
76 */
0785a8ba5e6d Implemented the first step of a theme control panel for charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
77 protected void initLayout() {
0785a8ba5e6d Implemented the first step of a theme control panel for charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
78 setWidth100();
0785a8ba5e6d Implemented the first step of a theme control panel for charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
79 setHeight100();
0785a8ba5e6d Implemented the first step of a theme control panel for charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
80
0785a8ba5e6d Implemented the first step of a theme control panel for charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
81 VLayout layout = new VLayout();
0785a8ba5e6d Implemented the first step of a theme control panel for charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
82 layout.setWidth100();
0785a8ba5e6d Implemented the first step of a theme control panel for charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
83 layout.setHeight100();
0785a8ba5e6d Implemented the first step of a theme control panel for charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
84
0785a8ba5e6d Implemented the first step of a theme control panel for charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
85 layout.addMember(list);
527
902609b5cc79 Added a navigation panel to the bottom of the theme control panel to move themes up/down (function not implemented yet).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 526
diff changeset
86 layout.addMember(navigation);
523
0785a8ba5e6d Implemented the first step of a theme control panel for charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
87
0785a8ba5e6d Implemented the first step of a theme control panel for charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
88 addChild(layout);
0785a8ba5e6d Implemented the first step of a theme control panel for charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
89 }
0785a8ba5e6d Implemented the first step of a theme control panel for charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
90
0785a8ba5e6d Implemented the first step of a theme control panel for charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
91
0785a8ba5e6d Implemented the first step of a theme control panel for charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
92 /**
0785a8ba5e6d Implemented the first step of a theme control panel for charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
93 * Initializes the components (columns) of the theme grid.
0785a8ba5e6d Implemented the first step of a theme control panel for charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
94 */
0785a8ba5e6d Implemented the first step of a theme control panel for charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
95 protected void initGrid() {
0785a8ba5e6d Implemented the first step of a theme control panel for charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
96 list.setCanEdit(true);
0785a8ba5e6d Implemented the first step of a theme control panel for charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
97 list.setCanSort(false);
858
9f07f67f60a5 Subclassed ChartThemePanel, trigger redraws of Chart when interaction with
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 854
diff changeset
98 list.setShowRecordComponents(false);
523
0785a8ba5e6d Implemented the first step of a theme control panel for charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
99 list.setShowRecordComponentsByCell(true);
0785a8ba5e6d Implemented the first step of a theme control panel for charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
100 list.setShowHeader(true);
0785a8ba5e6d Implemented the first step of a theme control panel for charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
101 list.setShowHeaderContextMenu(false);
0785a8ba5e6d Implemented the first step of a theme control panel for charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
102 list.setWidth100();
0785a8ba5e6d Implemented the first step of a theme control panel for charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
103 list.setHeight100();
0785a8ba5e6d Implemented the first step of a theme control panel for charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
104
0785a8ba5e6d Implemented the first step of a theme control panel for charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
105 list.addEditCompleteHandler(this);
1286
b643622d77fe Added context menu to themes list.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 891
diff changeset
106 list.addRowContextClickHandler(new RowContextClickHandler() {
b643622d77fe Added context menu to themes list.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 891
diff changeset
107 public void onRowContextClick(RowContextClickEvent event) {
b643622d77fe Added context menu to themes list.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 891
diff changeset
108 FacetRecord record = (FacetRecord) event.getRecord();
b643622d77fe Added context menu to themes list.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 891
diff changeset
109
b643622d77fe Added context menu to themes list.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 891
diff changeset
110 Menu menu = createContextMenu(record);
b643622d77fe Added context menu to themes list.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 891
diff changeset
111 list.setContextMenu(menu);
b643622d77fe Added context menu to themes list.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 891
diff changeset
112 menu.showContextMenu();
b643622d77fe Added context menu to themes list.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 891
diff changeset
113
b643622d77fe Added context menu to themes list.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 891
diff changeset
114 event.cancel();
b643622d77fe Added context menu to themes list.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 891
diff changeset
115 }
b643622d77fe Added context menu to themes list.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 891
diff changeset
116 });
523
0785a8ba5e6d Implemented the first step of a theme control panel for charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
117
891
f6c14ffdfd07 Rest for fix for flys/issue311 .
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 858
diff changeset
118 ListGridField active = new ListGridField(GRID_FIELD_ACTIVE,
f6c14ffdfd07 Rest for fix for flys/issue311 .
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 858
diff changeset
119 MSG.chart_themepanel_header_actions(), 20);
523
0785a8ba5e6d Implemented the first step of a theme control panel for charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
120 active.setType(ListGridFieldType.BOOLEAN);
0785a8ba5e6d Implemented the first step of a theme control panel for charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
121
0785a8ba5e6d Implemented the first step of a theme control panel for charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
122 ListGridField name = new ListGridField(
0785a8ba5e6d Implemented the first step of a theme control panel for charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
123 GRID_FIELD_NAME, MSG.chart_themepanel_header_themes());
0785a8ba5e6d Implemented the first step of a theme control panel for charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
124 name.setType(ListGridFieldType.TEXT);
0785a8ba5e6d Implemented the first step of a theme control panel for charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
125
858
9f07f67f60a5 Subclassed ChartThemePanel, trigger redraws of Chart when interaction with
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 854
diff changeset
126 list.setFields(active, name);
523
0785a8ba5e6d Implemented the first step of a theme control panel for charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
127 }
0785a8ba5e6d Implemented the first step of a theme control panel for charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
128
0785a8ba5e6d Implemented the first step of a theme control panel for charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
129
1286
b643622d77fe Added context menu to themes list.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 891
diff changeset
130 protected Menu createContextMenu(final FacetRecord record) {
b643622d77fe Added context menu to themes list.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 891
diff changeset
131 Menu menu = new Menu();
b643622d77fe Added context menu to themes list.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 891
diff changeset
132
b643622d77fe Added context menu to themes list.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 891
diff changeset
133 MenuItem properties = new MenuItem(MSG.properties());
b643622d77fe Added context menu to themes list.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 891
diff changeset
134 properties.addClickHandler(new ClickHandler() {
b643622d77fe Added context menu to themes list.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 891
diff changeset
135 public void onClick(MenuItemClickEvent evt) {
b643622d77fe Added context menu to themes list.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 891
diff changeset
136 GWT.log("clicked properties");
b643622d77fe Added context menu to themes list.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 891
diff changeset
137 getItemAttributes(record);
b643622d77fe Added context menu to themes list.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 891
diff changeset
138 }
b643622d77fe Added context menu to themes list.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 891
diff changeset
139 });
b643622d77fe Added context menu to themes list.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 891
diff changeset
140 menu.addItem(properties);
b643622d77fe Added context menu to themes list.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 891
diff changeset
141 return menu;
b643622d77fe Added context menu to themes list.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 891
diff changeset
142 }
b643622d77fe Added context menu to themes list.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 891
diff changeset
143
b643622d77fe Added context menu to themes list.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 891
diff changeset
144
805
f43d06d6a4a2 Refactored code of theme panel and added a MapThemePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 804
diff changeset
145 @Override
f43d06d6a4a2 Refactored code of theme panel and added a MapThemePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 804
diff changeset
146 public void activateTheme(Theme theme, boolean active) {
f43d06d6a4a2 Refactored code of theme panel and added a MapThemePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 804
diff changeset
147 theme.setActive(active ? 1 : 0);
527
902609b5cc79 Added a navigation panel to the bottom of the theme control panel to move themes up/down (function not implemented yet).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 526
diff changeset
148 }
1286
b643622d77fe Added context menu to themes list.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 891
diff changeset
149
b643622d77fe Added context menu to themes list.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 891
diff changeset
150
b643622d77fe Added context menu to themes list.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 891
diff changeset
151 protected void getItemAttributes(FacetRecord record) {
b643622d77fe Added context menu to themes list.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 891
diff changeset
152 Config config = Config.getInstance();
b643622d77fe Added context menu to themes list.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 891
diff changeset
153 String url = config.getServerUrl();
b643622d77fe Added context menu to themes list.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 891
diff changeset
154 String locale = config.getLocale();
b643622d77fe Added context menu to themes list.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 891
diff changeset
155
b643622d77fe Added context menu to themes list.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 891
diff changeset
156 String artifact = record.getTheme().getArtifact();
b643622d77fe Added context menu to themes list.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 891
diff changeset
157
b643622d77fe Added context menu to themes list.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 891
diff changeset
158 itemAttributeService.getCollectionItemAttribute(
b643622d77fe Added context menu to themes list.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 891
diff changeset
159 this.collection,
b643622d77fe Added context menu to themes list.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 891
diff changeset
160 artifact,
b643622d77fe Added context menu to themes list.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 891
diff changeset
161 url,
b643622d77fe Added context menu to themes list.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 891
diff changeset
162 locale,
b643622d77fe Added context menu to themes list.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 891
diff changeset
163 new AsyncCallback<CollectionItemAttribute>() {
b643622d77fe Added context menu to themes list.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 891
diff changeset
164 public void onFailure (Throwable caught) {
b643622d77fe Added context menu to themes list.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 891
diff changeset
165 GWT.log("Could not get Collection item attributes.");
b643622d77fe Added context menu to themes list.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 891
diff changeset
166 }
b643622d77fe Added context menu to themes list.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 891
diff changeset
167 public void onSuccess(CollectionItemAttribute cia) {
b643622d77fe Added context menu to themes list.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 891
diff changeset
168 GWT.log("Successfully loaded collectionitem attributes.");
1287
95ecb98c6015 Added skeleton for editor window.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1286
diff changeset
169 StyleEditorWindow win = new StyleEditorWindow(
95ecb98c6015 Added skeleton for editor window.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1286
diff changeset
170 collection,
95ecb98c6015 Added skeleton for editor window.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1286
diff changeset
171 cia);
95ecb98c6015 Added skeleton for editor window.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1286
diff changeset
172 win.setCollectionView(view);
95ecb98c6015 Added skeleton for editor window.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1286
diff changeset
173 win.show();
1286
b643622d77fe Added context menu to themes list.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 891
diff changeset
174 }
b643622d77fe Added context menu to themes list.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 891
diff changeset
175 });
b643622d77fe Added context menu to themes list.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 891
diff changeset
176 }
1287
95ecb98c6015 Added skeleton for editor window.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1286
diff changeset
177
95ecb98c6015 Added skeleton for editor window.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1286
diff changeset
178
95ecb98c6015 Added skeleton for editor window.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1286
diff changeset
179 public void setCollectionView (CollectionView view) {
95ecb98c6015 Added skeleton for editor window.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1286
diff changeset
180 this.view = view;
95ecb98c6015 Added skeleton for editor window.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1286
diff changeset
181 }
523
0785a8ba5e6d Implemented the first step of a theme control panel for charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
182 }
0785a8ba5e6d Implemented the first step of a theme control panel for charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
183 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :

http://dive4elements.wald.intevation.org