Mercurial > dive4elements > river
annotate flys-client/src/main/java/de/intevation/flys/client/client/ui/chart/ChartThemePanel.java @ 1286:b643622d77fe
Added context menu to themes list.
flys-client/trunk@2872 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Raimund Renkert <raimund.renkert@intevation.de> |
---|---|
date | Fri, 30 Sep 2011 11:03:33 +0000 |
parents | f6c14ffdfd07 |
children | 95ecb98c6015 |
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; |
523
0785a8ba5e6d
Implemented the first step of a theme control panel for charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
31 |
854
67c678903280
Refactored to allow specialized controls within the ChartThemePanel, stubby
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
805
diff
changeset
|
32 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
|
33 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
|
34 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
|
35 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
|
36 |
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 * @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
|
39 */ |
805
f43d06d6a4a2
Refactored code of theme panel and added a MapThemePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
804
diff
changeset
|
40 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
|
41 |
523
0785a8ba5e6d
Implemented the first step of a theme control panel for charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
42 /** 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
|
43 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
|
44 |
1286
b643622d77fe
Added context menu to themes list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
891
diff
changeset
|
45 /** The collection */ |
b643622d77fe
Added context menu to themes list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
891
diff
changeset
|
46 protected Collection collection; |
b643622d77fe
Added context menu to themes list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
891
diff
changeset
|
47 |
b643622d77fe
Added context menu to themes list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
891
diff
changeset
|
48 /** 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
|
49 protected CollectionItemAttributeServiceAsync itemAttributeService = |
b643622d77fe
Added context menu to themes list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
891
diff
changeset
|
50 GWT.create(CollectionItemAttributeService.class); |
b643622d77fe
Added context menu to themes list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
891
diff
changeset
|
51 |
854
67c678903280
Refactored to allow specialized controls within the ChartThemePanel, stubby
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
805
diff
changeset
|
52 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
|
53 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
|
54 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
|
55 |
854
67c678903280
Refactored to allow specialized controls within the ChartThemePanel, stubby
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
805
diff
changeset
|
56 FeedServiceAsync feedService = GWT.create( |
67c678903280
Refactored to allow specialized controls within the ChartThemePanel, stubby
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
805
diff
changeset
|
57 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
|
58 |
0785a8ba5e6d
Implemented the first step of a theme control panel for charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
59 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
|
60 super(collection, mode); |
1286
b643622d77fe
Added context menu to themes list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
891
diff
changeset
|
61 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
|
62 |
0785a8ba5e6d
Implemented the first step of a theme control panel for charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
63 initGrid(); |
0785a8ba5e6d
Implemented the first step of a theme control panel for charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
64 initLayout(); |
0785a8ba5e6d
Implemented the first step of a theme control panel for charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
65 |
0785a8ba5e6d
Implemented the first step of a theme control panel for charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
66 updateGrid(); |
0785a8ba5e6d
Implemented the first step of a theme control panel for charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
67 } |
0785a8ba5e6d
Implemented the first step of a theme control panel for charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
68 |
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 /** |
0785a8ba5e6d
Implemented the first step of a theme control panel for charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
71 * 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
|
72 */ |
0785a8ba5e6d
Implemented the first step of a theme control panel for charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
73 protected void initLayout() { |
0785a8ba5e6d
Implemented the first step of a theme control panel for charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
74 setWidth100(); |
0785a8ba5e6d
Implemented the first step of a theme control panel for charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
75 setHeight100(); |
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 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
|
78 layout.setWidth100(); |
0785a8ba5e6d
Implemented the first step of a theme control panel for charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
79 layout.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 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
|
82 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
|
83 |
0785a8ba5e6d
Implemented the first step of a theme control panel for charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
84 addChild(layout); |
0785a8ba5e6d
Implemented the first step of a theme control panel for charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
85 } |
0785a8ba5e6d
Implemented the first step of a theme control panel for charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
86 |
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 /** |
0785a8ba5e6d
Implemented the first step of a theme control panel for charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
89 * 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
|
90 */ |
0785a8ba5e6d
Implemented the first step of a theme control panel for charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
91 protected void initGrid() { |
0785a8ba5e6d
Implemented the first step of a theme control panel for charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
92 list.setCanEdit(true); |
0785a8ba5e6d
Implemented the first step of a theme control panel for charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
93 list.setCanSort(false); |
858
9f07f67f60a5
Subclassed ChartThemePanel, trigger redraws of Chart when interaction with
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
854
diff
changeset
|
94 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
|
95 list.setShowRecordComponentsByCell(true); |
0785a8ba5e6d
Implemented the first step of a theme control panel for charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
96 list.setShowHeader(true); |
0785a8ba5e6d
Implemented the first step of a theme control panel for charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
97 list.setShowHeaderContextMenu(false); |
0785a8ba5e6d
Implemented the first step of a theme control panel for charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
98 list.setWidth100(); |
0785a8ba5e6d
Implemented the first step of a theme control panel for charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
99 list.setHeight100(); |
0785a8ba5e6d
Implemented the first step of a theme control panel for charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
100 |
0785a8ba5e6d
Implemented the first step of a theme control panel for charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
101 list.addEditCompleteHandler(this); |
1286
b643622d77fe
Added context menu to themes list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
891
diff
changeset
|
102 list.addRowContextClickHandler(new RowContextClickHandler() { |
b643622d77fe
Added context menu to themes list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
891
diff
changeset
|
103 public void onRowContextClick(RowContextClickEvent event) { |
b643622d77fe
Added context menu to themes list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
891
diff
changeset
|
104 FacetRecord record = (FacetRecord) event.getRecord(); |
b643622d77fe
Added context menu to themes list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
891
diff
changeset
|
105 |
b643622d77fe
Added context menu to themes list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
891
diff
changeset
|
106 Menu menu = createContextMenu(record); |
b643622d77fe
Added context menu to themes list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
891
diff
changeset
|
107 list.setContextMenu(menu); |
b643622d77fe
Added context menu to themes list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
891
diff
changeset
|
108 menu.showContextMenu(); |
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 event.cancel(); |
b643622d77fe
Added context menu to themes list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
891
diff
changeset
|
111 } |
b643622d77fe
Added context menu to themes list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
891
diff
changeset
|
112 }); |
523
0785a8ba5e6d
Implemented the first step of a theme control panel for charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
113 |
891
f6c14ffdfd07
Rest for fix for flys/issue311 .
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
858
diff
changeset
|
114 ListGridField active = new ListGridField(GRID_FIELD_ACTIVE, |
f6c14ffdfd07
Rest for fix for flys/issue311 .
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
858
diff
changeset
|
115 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
|
116 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
|
117 |
0785a8ba5e6d
Implemented the first step of a theme control panel for charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
118 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
|
119 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
|
120 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
|
121 |
858
9f07f67f60a5
Subclassed ChartThemePanel, trigger redraws of Chart when interaction with
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
854
diff
changeset
|
122 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
|
123 } |
0785a8ba5e6d
Implemented the first step of a theme control panel for charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
124 |
0785a8ba5e6d
Implemented the first step of a theme control panel for charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
125 |
1286
b643622d77fe
Added context menu to themes list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
891
diff
changeset
|
126 protected Menu createContextMenu(final FacetRecord record) { |
b643622d77fe
Added context menu to themes list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
891
diff
changeset
|
127 Menu menu = new Menu(); |
b643622d77fe
Added context menu to themes list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
891
diff
changeset
|
128 |
b643622d77fe
Added context menu to themes list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
891
diff
changeset
|
129 MenuItem properties = new MenuItem(MSG.properties()); |
b643622d77fe
Added context menu to themes list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
891
diff
changeset
|
130 properties.addClickHandler(new ClickHandler() { |
b643622d77fe
Added context menu to themes list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
891
diff
changeset
|
131 public void onClick(MenuItemClickEvent evt) { |
b643622d77fe
Added context menu to themes list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
891
diff
changeset
|
132 GWT.log("clicked properties"); |
b643622d77fe
Added context menu to themes list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
891
diff
changeset
|
133 getItemAttributes(record); |
b643622d77fe
Added context menu to themes list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
891
diff
changeset
|
134 } |
b643622d77fe
Added context menu to themes list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
891
diff
changeset
|
135 }); |
b643622d77fe
Added context menu to themes list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
891
diff
changeset
|
136 menu.addItem(properties); |
b643622d77fe
Added context menu to themes list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
891
diff
changeset
|
137 return menu; |
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 |
805
f43d06d6a4a2
Refactored code of theme panel and added a MapThemePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
804
diff
changeset
|
141 @Override |
f43d06d6a4a2
Refactored code of theme panel and added a MapThemePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
804
diff
changeset
|
142 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
|
143 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
|
144 } |
1286
b643622d77fe
Added context menu to themes list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
891
diff
changeset
|
145 |
b643622d77fe
Added context menu to themes list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
891
diff
changeset
|
146 |
b643622d77fe
Added context menu to themes list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
891
diff
changeset
|
147 protected void getItemAttributes(FacetRecord record) { |
b643622d77fe
Added context menu to themes list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
891
diff
changeset
|
148 Config config = Config.getInstance(); |
b643622d77fe
Added context menu to themes list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
891
diff
changeset
|
149 String url = config.getServerUrl(); |
b643622d77fe
Added context menu to themes list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
891
diff
changeset
|
150 String locale = config.getLocale(); |
b643622d77fe
Added context menu to themes list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
891
diff
changeset
|
151 |
b643622d77fe
Added context menu to themes list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
891
diff
changeset
|
152 String artifact = record.getTheme().getArtifact(); |
b643622d77fe
Added context menu to themes list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
891
diff
changeset
|
153 |
b643622d77fe
Added context menu to themes list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
891
diff
changeset
|
154 itemAttributeService.getCollectionItemAttribute( |
b643622d77fe
Added context menu to themes list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
891
diff
changeset
|
155 this.collection, |
b643622d77fe
Added context menu to themes list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
891
diff
changeset
|
156 artifact, |
b643622d77fe
Added context menu to themes list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
891
diff
changeset
|
157 url, |
b643622d77fe
Added context menu to themes list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
891
diff
changeset
|
158 locale, |
b643622d77fe
Added context menu to themes list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
891
diff
changeset
|
159 new AsyncCallback<CollectionItemAttribute>() { |
b643622d77fe
Added context menu to themes list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
891
diff
changeset
|
160 public void onFailure (Throwable caught) { |
b643622d77fe
Added context menu to themes list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
891
diff
changeset
|
161 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
|
162 } |
b643622d77fe
Added context menu to themes list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
891
diff
changeset
|
163 public void onSuccess(CollectionItemAttribute cia) { |
b643622d77fe
Added context menu to themes list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
891
diff
changeset
|
164 GWT.log("Successfully loaded collectionitem attributes."); |
b643622d77fe
Added context menu to themes list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
891
diff
changeset
|
165 } |
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 } |
523
0785a8ba5e6d
Implemented the first step of a theme control panel for charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
168 } |
0785a8ba5e6d
Implemented the first step of a theme control panel for charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
169 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : |