annotate flys-client/src/main/java/de/intevation/flys/client/client/ui/chart/CrossSectionChartThemePanel.java @ 1449:8da36efc839a

Removed unused imports. flys-client/trunk@3466 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Ingo Weinzierl <ingo.weinzierl@intevation.de>
date Mon, 19 Dec 2011 15:38:10 +0000
parents df7ebcbff984
children fa63366ba115
rev   line source
858
9f07f67f60a5 Subclassed ChartThemePanel, trigger redraws of Chart when interaction with
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
1 package de.intevation.flys.client.client.ui.chart;
9f07f67f60a5 Subclassed ChartThemePanel, trigger redraws of Chart when interaction with
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
2
1436
29fc2d1dfe9b Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1425
diff changeset
3 import java.util.HashMap;
29fc2d1dfe9b Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1425
diff changeset
4 import java.util.Map;
29fc2d1dfe9b Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1425
diff changeset
5 import java.util.LinkedHashMap;
29fc2d1dfe9b Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1425
diff changeset
6
858
9f07f67f60a5 Subclassed ChartThemePanel, trigger redraws of Chart when interaction with
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
7 import com.google.gwt.core.client.GWT;
9f07f67f60a5 Subclassed ChartThemePanel, trigger redraws of Chart when interaction with
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
8
1436
29fc2d1dfe9b Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1425
diff changeset
9 import com.google.gwt.user.client.rpc.AsyncCallback;
29fc2d1dfe9b Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1425
diff changeset
10
29fc2d1dfe9b Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1425
diff changeset
11 import com.smartgwt.client.util.SC;
29fc2d1dfe9b Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1425
diff changeset
12
858
9f07f67f60a5 Subclassed ChartThemePanel, trigger redraws of Chart when interaction with
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
13 import com.smartgwt.client.types.Alignment;
1436
29fc2d1dfe9b Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1425
diff changeset
14 import com.smartgwt.client.types.ListGridFieldType;
29fc2d1dfe9b Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1425
diff changeset
15
858
9f07f67f60a5 Subclassed ChartThemePanel, trigger redraws of Chart when interaction with
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
16 import com.smartgwt.client.widgets.Canvas;
9f07f67f60a5 Subclassed ChartThemePanel, trigger redraws of Chart when interaction with
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
17 import com.smartgwt.client.widgets.grid.ListGrid;
9f07f67f60a5 Subclassed ChartThemePanel, trigger redraws of Chart when interaction with
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
18 import com.smartgwt.client.widgets.grid.ListGridField;
9f07f67f60a5 Subclassed ChartThemePanel, trigger redraws of Chart when interaction with
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
19 import com.smartgwt.client.widgets.grid.ListGridRecord;
9f07f67f60a5 Subclassed ChartThemePanel, trigger redraws of Chart when interaction with
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
20 import com.smartgwt.client.widgets.layout.HLayout;
1436
29fc2d1dfe9b Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1425
diff changeset
21 import com.smartgwt.client.widgets.layout.VLayout;
1444
bdac8a72f7e6 Area creation UI update.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1438
diff changeset
22 import com.smartgwt.client.widgets.menu.events.ClickHandler;
bdac8a72f7e6 Area creation UI update.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1438
diff changeset
23 import com.smartgwt.client.widgets.menu.Menu;
bdac8a72f7e6 Area creation UI update.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1438
diff changeset
24 import com.smartgwt.client.widgets.menu.MenuItem;
bdac8a72f7e6 Area creation UI update.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1438
diff changeset
25 import com.smartgwt.client.widgets.menu.events.MenuItemClickEvent;
858
9f07f67f60a5 Subclassed ChartThemePanel, trigger redraws of Chart when interaction with
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
26 import com.smartgwt.client.widgets.form.fields.SpinnerItem;
9f07f67f60a5 Subclassed ChartThemePanel, trigger redraws of Chart when interaction with
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
27 import com.smartgwt.client.widgets.form.DynamicForm;
1436
29fc2d1dfe9b Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1425
diff changeset
28
29fc2d1dfe9b Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1425
diff changeset
29 import com.smartgwt.client.widgets.form.fields.SelectItem;
29fc2d1dfe9b Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1425
diff changeset
30 import com.smartgwt.client.widgets.form.fields.events.ChangeEvent;
858
9f07f67f60a5 Subclassed ChartThemePanel, trigger redraws of Chart when interaction with
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
31 import com.smartgwt.client.widgets.form.fields.events.ChangedEvent;
9f07f67f60a5 Subclassed ChartThemePanel, trigger redraws of Chart when interaction with
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
32 import com.smartgwt.client.widgets.form.fields.events.ChangedHandler;
1436
29fc2d1dfe9b Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1425
diff changeset
33 import com.smartgwt.client.widgets.form.fields.events.ChangeHandler;
858
9f07f67f60a5 Subclassed ChartThemePanel, trigger redraws of Chart when interaction with
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
34
9f07f67f60a5 Subclassed ChartThemePanel, trigger redraws of Chart when interaction with
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
35 import de.intevation.flys.client.client.Config;
9f07f67f60a5 Subclassed ChartThemePanel, trigger redraws of Chart when interaction with
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
36 import de.intevation.flys.client.shared.model.Artifact;
9f07f67f60a5 Subclassed ChartThemePanel, trigger redraws of Chart when interaction with
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
37 import de.intevation.flys.client.shared.model.Collection;
1436
29fc2d1dfe9b Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1425
diff changeset
38 import de.intevation.flys.client.shared.model.CollectionItem;
858
9f07f67f60a5 Subclassed ChartThemePanel, trigger redraws of Chart when interaction with
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
39 import de.intevation.flys.client.shared.model.Data;
9f07f67f60a5 Subclassed ChartThemePanel, trigger redraws of Chart when interaction with
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
40 import de.intevation.flys.client.shared.model.DefaultArtifact;
9f07f67f60a5 Subclassed ChartThemePanel, trigger redraws of Chart when interaction with
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
41 import de.intevation.flys.client.shared.model.DefaultData;
9f07f67f60a5 Subclassed ChartThemePanel, trigger redraws of Chart when interaction with
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
42 import de.intevation.flys.client.shared.model.FacetRecord;
1436
29fc2d1dfe9b Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1425
diff changeset
43 import de.intevation.flys.client.shared.model.OutputMode;
1444
bdac8a72f7e6 Area creation UI update.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1438
diff changeset
44 import de.intevation.flys.client.shared.model.Recommendation;
1436
29fc2d1dfe9b Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1425
diff changeset
45 import de.intevation.flys.client.shared.model.Theme;
29fc2d1dfe9b Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1425
diff changeset
46 import de.intevation.flys.client.shared.model.ThemeList;
858
9f07f67f60a5 Subclassed ChartThemePanel, trigger redraws of Chart when interaction with
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
47
1444
bdac8a72f7e6 Area creation UI update.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1438
diff changeset
48 import de.intevation.flys.client.client.services.CrossSectionKMServiceAsync;
1379
546f7f890ffa Cosmetics, refactoring.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1378
diff changeset
49 import de.intevation.flys.client.client.services.FeedServiceAsync;
1444
bdac8a72f7e6 Area creation UI update.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1438
diff changeset
50 import de.intevation.flys.client.client.services.LoadArtifactService;
bdac8a72f7e6 Area creation UI update.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1438
diff changeset
51 import de.intevation.flys.client.client.services.LoadArtifactServiceAsync;
bdac8a72f7e6 Area creation UI update.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1438
diff changeset
52
bdac8a72f7e6 Area creation UI update.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1438
diff changeset
53
858
9f07f67f60a5 Subclassed ChartThemePanel, trigger redraws of Chart when interaction with
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
54
9f07f67f60a5 Subclassed ChartThemePanel, trigger redraws of Chart when interaction with
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
55 /**
9f07f67f60a5 Subclassed ChartThemePanel, trigger redraws of Chart when interaction with
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
56 * ThemePanel much like ChartThemePanel, but shows an "Actions" column,
1436
29fc2d1dfe9b Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1425
diff changeset
57 * needed for interaction in the CrossSection Charts and a selctor to
29fc2d1dfe9b Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1425
diff changeset
58 * declare which cross section profile is "master".
858
9f07f67f60a5 Subclassed ChartThemePanel, trigger redraws of Chart when interaction with
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
59 */
9f07f67f60a5 Subclassed ChartThemePanel, trigger redraws of Chart when interaction with
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
60 public class CrossSectionChartThemePanel
9f07f67f60a5 Subclassed ChartThemePanel, trigger redraws of Chart when interaction with
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
61 extends ChartThemePanel {
1444
bdac8a72f7e6 Area creation UI update.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1438
diff changeset
62 /** Artifact Clone/Creation service. */
bdac8a72f7e6 Area creation UI update.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1438
diff changeset
63 protected LoadArtifactServiceAsync loadService =
bdac8a72f7e6 Area creation UI update.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1438
diff changeset
64 GWT.create(LoadArtifactService.class);
858
9f07f67f60a5 Subclassed ChartThemePanel, trigger redraws of Chart when interaction with
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
65
1436
29fc2d1dfe9b Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1425
diff changeset
66 /** Service to query measurement points of cross sections. */
29fc2d1dfe9b Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1425
diff changeset
67 CrossSectionKMServiceAsync kmService = GWT.create(
29fc2d1dfe9b Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1425
diff changeset
68 de.intevation.flys.client.client.services.CrossSectionKMService.class);
29fc2d1dfe9b Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1425
diff changeset
69
29fc2d1dfe9b Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1425
diff changeset
70 /** UUID of the current "master" cross section. */
29fc2d1dfe9b Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1425
diff changeset
71 protected String currentMasterUUID;
29fc2d1dfe9b Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1425
diff changeset
72
29fc2d1dfe9b Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1425
diff changeset
73 /** The layout (used for visual active/inactive feedback). */
29fc2d1dfe9b Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1425
diff changeset
74 protected VLayout layout;
29fc2d1dfe9b Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1425
diff changeset
75
858
9f07f67f60a5 Subclassed ChartThemePanel, trigger redraws of Chart when interaction with
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
76 /**
9f07f67f60a5 Subclassed ChartThemePanel, trigger redraws of Chart when interaction with
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
77 * Trivial constructor.
9f07f67f60a5 Subclassed ChartThemePanel, trigger redraws of Chart when interaction with
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
78 */
9f07f67f60a5 Subclassed ChartThemePanel, trigger redraws of Chart when interaction with
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
79 public CrossSectionChartThemePanel(
1436
29fc2d1dfe9b Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1425
diff changeset
80 Collection collection,
29fc2d1dfe9b Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1425
diff changeset
81 OutputMode mode)
858
9f07f67f60a5 Subclassed ChartThemePanel, trigger redraws of Chart when interaction with
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
82 {
9f07f67f60a5 Subclassed ChartThemePanel, trigger redraws of Chart when interaction with
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
83 super(collection, mode);
9f07f67f60a5 Subclassed ChartThemePanel, trigger redraws of Chart when interaction with
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
84 }
9f07f67f60a5 Subclassed ChartThemePanel, trigger redraws of Chart when interaction with
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
85
9f07f67f60a5 Subclassed ChartThemePanel, trigger redraws of Chart when interaction with
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
86
9f07f67f60a5 Subclassed ChartThemePanel, trigger redraws of Chart when interaction with
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
87 /**
1436
29fc2d1dfe9b Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1425
diff changeset
88 * Feed an artifact to let it know that it is master wrt cross-sections.
29fc2d1dfe9b Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1425
diff changeset
89 * @param artifact uuid of an artifact.
29fc2d1dfe9b Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1425
diff changeset
90 */
29fc2d1dfe9b Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1425
diff changeset
91 public void feedTellMaster(final String artifact) {
29fc2d1dfe9b Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1425
diff changeset
92 Data[] feedData = DefaultData.createSimpleStringDataArray(
29fc2d1dfe9b Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1425
diff changeset
93 "cross_section.master?", "1");
29fc2d1dfe9b Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1425
diff changeset
94
29fc2d1dfe9b Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1425
diff changeset
95 feedService.feed(
29fc2d1dfe9b Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1425
diff changeset
96 Config.getInstance().getLocale(),
29fc2d1dfe9b Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1425
diff changeset
97 new DefaultArtifact(artifact, "TODO:hash"),
29fc2d1dfe9b Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1425
diff changeset
98 feedData,
29fc2d1dfe9b Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1425
diff changeset
99 new AsyncCallback<Artifact>() {
29fc2d1dfe9b Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1425
diff changeset
100 public void onFailure(Throwable caught) {
29fc2d1dfe9b Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1425
diff changeset
101 GWT.log("Could not feed artifact (" + artifact
29fc2d1dfe9b Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1425
diff changeset
102 + ") with master marker: " + caught.getMessage());
29fc2d1dfe9b Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1425
diff changeset
103 SC.warn(MSG.getString(caught.getMessage()));
29fc2d1dfe9b Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1425
diff changeset
104 enable();
29fc2d1dfe9b Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1425
diff changeset
105 }
29fc2d1dfe9b Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1425
diff changeset
106 public void onSuccess(Artifact artifact) {
29fc2d1dfe9b Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1425
diff changeset
107 GWT.log("Successfully injected master mark to " + artifact);
29fc2d1dfe9b Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1425
diff changeset
108 setCurrentMaster(artifact.getUuid());
29fc2d1dfe9b Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1425
diff changeset
109 requestRedraw();
29fc2d1dfe9b Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1425
diff changeset
110 enable();
29fc2d1dfe9b Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1425
diff changeset
111 }
29fc2d1dfe9b Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1425
diff changeset
112 });
29fc2d1dfe9b Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1425
diff changeset
113 }
29fc2d1dfe9b Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1425
diff changeset
114
29fc2d1dfe9b Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1425
diff changeset
115
29fc2d1dfe9b Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1425
diff changeset
116 /**
1444
bdac8a72f7e6 Area creation UI update.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1438
diff changeset
117 * Tell an area artifact where to get the upper and lower curve from.
1445
df7ebcbff984 Bugfixing and feature-adding for cross-sections/areas.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1444
diff changeset
118 * @param over if null, something
1444
bdac8a72f7e6 Area creation UI update.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1438
diff changeset
119 */
bdac8a72f7e6 Area creation UI update.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1438
diff changeset
120 public void feedTellArea(final String artifact, Theme under, Theme over) {
1445
df7ebcbff984 Bugfixing and feature-adding for cross-sections/areas.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1444
diff changeset
121
df7ebcbff984 Bugfixing and feature-adding for cross-sections/areas.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1444
diff changeset
122 Data[] feedData;
df7ebcbff984 Bugfixing and feature-adding for cross-sections/areas.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1444
diff changeset
123
df7ebcbff984 Bugfixing and feature-adding for cross-sections/areas.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1444
diff changeset
124 if (over != null) {
df7ebcbff984 Bugfixing and feature-adding for cross-sections/areas.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1444
diff changeset
125 feedData = new Data[] {
df7ebcbff984 Bugfixing and feature-adding for cross-sections/areas.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1444
diff changeset
126 DefaultData.createSimpleStringData("area.curve_under",
df7ebcbff984 Bugfixing and feature-adding for cross-sections/areas.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1444
diff changeset
127 under.getArtifact() + under.getIndex()),
df7ebcbff984 Bugfixing and feature-adding for cross-sections/areas.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1444
diff changeset
128 DefaultData.createSimpleStringData("area.curve_under",
df7ebcbff984 Bugfixing and feature-adding for cross-sections/areas.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1444
diff changeset
129 under.getArtifact() + under.getIndex()),
df7ebcbff984 Bugfixing and feature-adding for cross-sections/areas.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1444
diff changeset
130 DefaultData.createSimpleStringData("area.name",
df7ebcbff984 Bugfixing and feature-adding for cross-sections/areas.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1444
diff changeset
131 over.getDescription() + " / " + under.getDescription())
df7ebcbff984 Bugfixing and feature-adding for cross-sections/areas.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1444
diff changeset
132 };
df7ebcbff984 Bugfixing and feature-adding for cross-sections/areas.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1444
diff changeset
133 }
df7ebcbff984 Bugfixing and feature-adding for cross-sections/areas.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1444
diff changeset
134 else {
df7ebcbff984 Bugfixing and feature-adding for cross-sections/areas.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1444
diff changeset
135 feedData = new Data[] {
df7ebcbff984 Bugfixing and feature-adding for cross-sections/areas.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1444
diff changeset
136 DefaultData.createSimpleStringData("area.curve_under",
df7ebcbff984 Bugfixing and feature-adding for cross-sections/areas.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1444
diff changeset
137 under.getArtifact() + under.getIndex()),
df7ebcbff984 Bugfixing and feature-adding for cross-sections/areas.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1444
diff changeset
138 DefaultData.createSimpleStringData("area.name",
df7ebcbff984 Bugfixing and feature-adding for cross-sections/areas.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1444
diff changeset
139 under.getDescription() + " / " + MSG.getString("x_axis"))
df7ebcbff984 Bugfixing and feature-adding for cross-sections/areas.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1444
diff changeset
140 };
df7ebcbff984 Bugfixing and feature-adding for cross-sections/areas.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1444
diff changeset
141 }
1444
bdac8a72f7e6 Area creation UI update.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1438
diff changeset
142
bdac8a72f7e6 Area creation UI update.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1438
diff changeset
143 feedService.feed(
bdac8a72f7e6 Area creation UI update.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1438
diff changeset
144 Config.getInstance().getLocale(),
bdac8a72f7e6 Area creation UI update.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1438
diff changeset
145 new DefaultArtifact(artifact, "TODO:hash"),
bdac8a72f7e6 Area creation UI update.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1438
diff changeset
146 feedData,
bdac8a72f7e6 Area creation UI update.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1438
diff changeset
147 new AsyncCallback<Artifact>() {
bdac8a72f7e6 Area creation UI update.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1438
diff changeset
148 public void onFailure(Throwable caught) {
bdac8a72f7e6 Area creation UI update.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1438
diff changeset
149 GWT.log("Could not feed artifact (" + artifact
bdac8a72f7e6 Area creation UI update.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1438
diff changeset
150 + ") with area info: " + caught.getMessage());
bdac8a72f7e6 Area creation UI update.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1438
diff changeset
151 SC.warn(MSG.getString(caught.getMessage()));
bdac8a72f7e6 Area creation UI update.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1438
diff changeset
152 enable();
bdac8a72f7e6 Area creation UI update.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1438
diff changeset
153 }
bdac8a72f7e6 Area creation UI update.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1438
diff changeset
154 public void onSuccess(Artifact artifact) {
bdac8a72f7e6 Area creation UI update.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1438
diff changeset
155 GWT.log("Successfully set area params to " + artifact);
bdac8a72f7e6 Area creation UI update.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1438
diff changeset
156 requestRedraw();
1445
df7ebcbff984 Bugfixing and feature-adding for cross-sections/areas.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1444
diff changeset
157 updateCollection();
df7ebcbff984 Bugfixing and feature-adding for cross-sections/areas.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1444
diff changeset
158 updateGrid();
1444
bdac8a72f7e6 Area creation UI update.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1438
diff changeset
159 enable();
bdac8a72f7e6 Area creation UI update.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1438
diff changeset
160 }
bdac8a72f7e6 Area creation UI update.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1438
diff changeset
161 });
bdac8a72f7e6 Area creation UI update.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1438
diff changeset
162 }
bdac8a72f7e6 Area creation UI update.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1438
diff changeset
163
bdac8a72f7e6 Area creation UI update.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1438
diff changeset
164 /**
1438
432180235caf Minor refactoring and fix initial settings when creating ui.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1436
diff changeset
165 * sets currentMasterUUID.
432180235caf Minor refactoring and fix initial settings when creating ui.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1436
diff changeset
166 */
432180235caf Minor refactoring and fix initial settings when creating ui.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1436
diff changeset
167 public String findCurrentMaster() {
432180235caf Minor refactoring and fix initial settings when creating ui.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1436
diff changeset
168 ThemeList themeList = getThemeList();
432180235caf Minor refactoring and fix initial settings when creating ui.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1436
diff changeset
169 int count = getThemeList().getThemeCount();
1445
df7ebcbff984 Bugfixing and feature-adding for cross-sections/areas.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1444
diff changeset
170 String firstCSUuid = null;
1438
432180235caf Minor refactoring and fix initial settings when creating ui.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1436
diff changeset
171 for (int i = 1; i <= count; i++) {
432180235caf Minor refactoring and fix initial settings when creating ui.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1436
diff changeset
172 Theme theme = themeList.getThemeAt(i);
432180235caf Minor refactoring and fix initial settings when creating ui.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1436
diff changeset
173 String value = theme.getCollectionItem().getData().get("cross_section.master?");
432180235caf Minor refactoring and fix initial settings when creating ui.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1436
diff changeset
174
1445
df7ebcbff984 Bugfixing and feature-adding for cross-sections/areas.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1444
diff changeset
175 if (value != null) {
df7ebcbff984 Bugfixing and feature-adding for cross-sections/areas.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1444
diff changeset
176 if (firstCSUuid == null) {
df7ebcbff984 Bugfixing and feature-adding for cross-sections/areas.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1444
diff changeset
177 firstCSUuid = theme.getArtifact();
df7ebcbff984 Bugfixing and feature-adding for cross-sections/areas.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1444
diff changeset
178 }
df7ebcbff984 Bugfixing and feature-adding for cross-sections/areas.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1444
diff changeset
179 if (!value.equals("0")) {
df7ebcbff984 Bugfixing and feature-adding for cross-sections/areas.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1444
diff changeset
180 setCurrentMaster(theme.getArtifact());
df7ebcbff984 Bugfixing and feature-adding for cross-sections/areas.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1444
diff changeset
181 GWT.log("found a master: " + currentMasterUUID + "/" + theme.getDescription());
df7ebcbff984 Bugfixing and feature-adding for cross-sections/areas.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1444
diff changeset
182 return theme.getDescription();
df7ebcbff984 Bugfixing and feature-adding for cross-sections/areas.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1444
diff changeset
183 }
1438
432180235caf Minor refactoring and fix initial settings when creating ui.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1436
diff changeset
184 }
432180235caf Minor refactoring and fix initial settings when creating ui.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1436
diff changeset
185 }
1445
df7ebcbff984 Bugfixing and feature-adding for cross-sections/areas.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1444
diff changeset
186 // There is none selected. Take the first one.
df7ebcbff984 Bugfixing and feature-adding for cross-sections/areas.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1444
diff changeset
187 if (firstCSUuid != null) {
df7ebcbff984 Bugfixing and feature-adding for cross-sections/areas.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1444
diff changeset
188 setCurrentMaster(firstCSUuid);
df7ebcbff984 Bugfixing and feature-adding for cross-sections/areas.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1444
diff changeset
189 feedTellMaster(firstCSUuid);
df7ebcbff984 Bugfixing and feature-adding for cross-sections/areas.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1444
diff changeset
190 }
1438
432180235caf Minor refactoring and fix initial settings when creating ui.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1436
diff changeset
191 return null;
432180235caf Minor refactoring and fix initial settings when creating ui.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1436
diff changeset
192 }
432180235caf Minor refactoring and fix initial settings when creating ui.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1436
diff changeset
193
1444
bdac8a72f7e6 Area creation UI update.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1438
diff changeset
194
1438
432180235caf Minor refactoring and fix initial settings when creating ui.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1436
diff changeset
195 /**
1436
29fc2d1dfe9b Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1425
diff changeset
196 * Create Layout, add a master selection box beneath.
29fc2d1dfe9b Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1425
diff changeset
197 */
29fc2d1dfe9b Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1425
diff changeset
198 @Override
29fc2d1dfe9b Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1425
diff changeset
199 protected VLayout createLayout() {
1438
432180235caf Minor refactoring and fix initial settings when creating ui.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1436
diff changeset
200 layout = super.createLayout();
1436
29fc2d1dfe9b Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1425
diff changeset
201
29fc2d1dfe9b Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1425
diff changeset
202 // Create "set master" combobox.
29fc2d1dfe9b Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1425
diff changeset
203 SelectItem cbItem = new SelectItem();
29fc2d1dfe9b Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1425
diff changeset
204
29fc2d1dfe9b Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1425
diff changeset
205 cbItem.setTitle(MSG.chart_themepanel_set_master());
29fc2d1dfe9b Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1425
diff changeset
206 cbItem.setType("comboBox");
29fc2d1dfe9b Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1425
diff changeset
207 final LinkedHashMap<String, String> valueMap =
29fc2d1dfe9b Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1425
diff changeset
208 getThemeList().toMapArtifactUUIDDescription("cross_section");
29fc2d1dfe9b Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1425
diff changeset
209 cbItem.setValueMap(valueMap);
29fc2d1dfe9b Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1425
diff changeset
210
29fc2d1dfe9b Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1425
diff changeset
211 final DynamicForm form = new DynamicForm();
29fc2d1dfe9b Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1425
diff changeset
212 form.setWidth(200);
29fc2d1dfe9b Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1425
diff changeset
213 form.setFields(cbItem);
29fc2d1dfe9b Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1425
diff changeset
214 layout.addMember(form);
29fc2d1dfe9b Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1425
diff changeset
215
1438
432180235caf Minor refactoring and fix initial settings when creating ui.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1436
diff changeset
216 Config config = Config.getInstance();
432180235caf Minor refactoring and fix initial settings when creating ui.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1436
diff changeset
217 final String locale = config.getLocale();
432180235caf Minor refactoring and fix initial settings when creating ui.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1436
diff changeset
218 findCurrentMaster();
432180235caf Minor refactoring and fix initial settings when creating ui.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1436
diff changeset
219 cbItem.setValue(getCurrentMaster());
1436
29fc2d1dfe9b Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1425
diff changeset
220
29fc2d1dfe9b Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1425
diff changeset
221 // Add Change Handler to first unset the old master and then set the
29fc2d1dfe9b Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1425
diff changeset
222 // new master.
29fc2d1dfe9b Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1425
diff changeset
223 cbItem.addChangeHandler(new ChangeHandler() {
29fc2d1dfe9b Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1425
diff changeset
224 public void onChange(ChangeEvent event) {
29fc2d1dfe9b Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1425
diff changeset
225 String selectedItem = (String) event.getValue();
29fc2d1dfe9b Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1425
diff changeset
226 final String artifact = selectedItem;
29fc2d1dfe9b Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1425
diff changeset
227
29fc2d1dfe9b Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1425
diff changeset
228 disable();
29fc2d1dfe9b Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1425
diff changeset
229
29fc2d1dfe9b Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1425
diff changeset
230 // Tell current master that he is not master anymore.
29fc2d1dfe9b Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1425
diff changeset
231 if (getCurrentMaster() != null) {
29fc2d1dfe9b Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1425
diff changeset
232 Data[] feedData = DefaultData.createSimpleStringDataArray(
29fc2d1dfe9b Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1425
diff changeset
233 "cross_section.master?", "0");
29fc2d1dfe9b Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1425
diff changeset
234 feedService.feed(
29fc2d1dfe9b Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1425
diff changeset
235 locale,
29fc2d1dfe9b Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1425
diff changeset
236 new DefaultArtifact(getCurrentMaster(), "TODO:hash"),
29fc2d1dfe9b Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1425
diff changeset
237 feedData,
29fc2d1dfe9b Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1425
diff changeset
238 new AsyncCallback<Artifact>() {
29fc2d1dfe9b Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1425
diff changeset
239 public void onFailure(Throwable caught) {
1438
432180235caf Minor refactoring and fix initial settings when creating ui.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1436
diff changeset
240 GWT.log("Could not un-master artifact ("+getCurrentMaster()+"): " +
1436
29fc2d1dfe9b Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1425
diff changeset
241 caught.getMessage());
29fc2d1dfe9b Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1425
diff changeset
242 SC.warn(MSG.getString(caught.getMessage()));
29fc2d1dfe9b Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1425
diff changeset
243 enable();
29fc2d1dfe9b Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1425
diff changeset
244 }
29fc2d1dfe9b Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1425
diff changeset
245 public void onSuccess(Artifact oldMaster) {
29fc2d1dfe9b Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1425
diff changeset
246 GWT.log("Successfully un-mastered artifact.");
29fc2d1dfe9b Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1425
diff changeset
247 feedTellMaster(artifact);
29fc2d1dfe9b Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1425
diff changeset
248 }
29fc2d1dfe9b Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1425
diff changeset
249 });
29fc2d1dfe9b Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1425
diff changeset
250 }
29fc2d1dfe9b Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1425
diff changeset
251 else {
29fc2d1dfe9b Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1425
diff changeset
252 feedTellMaster(artifact);
29fc2d1dfe9b Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1425
diff changeset
253 }
29fc2d1dfe9b Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1425
diff changeset
254 }
29fc2d1dfe9b Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1425
diff changeset
255 });
29fc2d1dfe9b Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1425
diff changeset
256
29fc2d1dfe9b Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1425
diff changeset
257 return layout;
29fc2d1dfe9b Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1425
diff changeset
258 }
29fc2d1dfe9b Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1425
diff changeset
259
29fc2d1dfe9b Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1425
diff changeset
260
29fc2d1dfe9b Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1425
diff changeset
261 /** Disable the UI (becomes gray, inresponsive to user input). */
29fc2d1dfe9b Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1425
diff changeset
262 public void disable() {
29fc2d1dfe9b Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1425
diff changeset
263 this.layout.setDisabled(true);
29fc2d1dfe9b Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1425
diff changeset
264 }
29fc2d1dfe9b Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1425
diff changeset
265
29fc2d1dfe9b Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1425
diff changeset
266
29fc2d1dfe9b Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1425
diff changeset
267 /** DisDisable the UI (becomes ungray, responsive to user input). */
29fc2d1dfe9b Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1425
diff changeset
268 public void enable() {
29fc2d1dfe9b Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1425
diff changeset
269 this.layout.setDisabled(false);
29fc2d1dfe9b Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1425
diff changeset
270 }
29fc2d1dfe9b Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1425
diff changeset
271
29fc2d1dfe9b Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1425
diff changeset
272
29fc2d1dfe9b Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1425
diff changeset
273 /**
29fc2d1dfe9b Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1425
diff changeset
274 * Returns a double from the list that has the smallest distance to the
29fc2d1dfe9b Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1425
diff changeset
275 * given to value. In case of multiple values with the same difference,
29fc2d1dfe9b Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1425
diff changeset
276 * the last one is taken.
29fc2d1dfe9b Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1425
diff changeset
277 * @param in possible return values.
29fc2d1dfe9b Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1425
diff changeset
278 * @param to the value to be as close to as possible.
29fc2d1dfe9b Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1425
diff changeset
279 * @return value from in that is closest to to, -1 if none.
29fc2d1dfe9b Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1425
diff changeset
280 */
29fc2d1dfe9b Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1425
diff changeset
281 public static double closest(Double[] in, double to) {
29fc2d1dfe9b Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1425
diff changeset
282 if (in == null || in.length == 0) {
29fc2d1dfe9b Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1425
diff changeset
283 return -1;
29fc2d1dfe9b Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1425
diff changeset
284 }
29fc2d1dfe9b Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1425
diff changeset
285 if (in[0] == to) {
29fc2d1dfe9b Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1425
diff changeset
286 return to;
29fc2d1dfe9b Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1425
diff changeset
287 }
29fc2d1dfe9b Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1425
diff changeset
288 double minDiff = Math.abs(to - in[0]);
29fc2d1dfe9b Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1425
diff changeset
289 double bestMatch = in[0];
29fc2d1dfe9b Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1425
diff changeset
290 for (int i = 1; i < in.length; i++) {
29fc2d1dfe9b Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1425
diff changeset
291 if (in[i] == to) {
29fc2d1dfe9b Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1425
diff changeset
292 return to;
29fc2d1dfe9b Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1425
diff changeset
293 }
29fc2d1dfe9b Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1425
diff changeset
294 double diff = Math.abs(to - in[0]);
29fc2d1dfe9b Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1425
diff changeset
295 if (diff < minDiff) {
29fc2d1dfe9b Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1425
diff changeset
296 minDiff = diff;
29fc2d1dfe9b Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1425
diff changeset
297 bestMatch = in[i];
29fc2d1dfe9b Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1425
diff changeset
298 }
29fc2d1dfe9b Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1425
diff changeset
299 }
29fc2d1dfe9b Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1425
diff changeset
300 return bestMatch;
29fc2d1dfe9b Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1425
diff changeset
301 }
29fc2d1dfe9b Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1425
diff changeset
302
29fc2d1dfe9b Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1425
diff changeset
303
29fc2d1dfe9b Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1425
diff changeset
304 /** Feed a single artifact with the km of the crosssection to display. */
29fc2d1dfe9b Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1425
diff changeset
305 public void sendFeed(FacetRecord facetRecord, double kmD) {
29fc2d1dfe9b Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1425
diff changeset
306 Config config = Config.getInstance();
29fc2d1dfe9b Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1425
diff changeset
307 final String locale = config.getLocale();
29fc2d1dfe9b Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1425
diff changeset
308
29fc2d1dfe9b Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1425
diff changeset
309 Data[] feedData =
29fc2d1dfe9b Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1425
diff changeset
310 DefaultData.createSimpleStringDataArray("cross_section.km",
29fc2d1dfe9b Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1425
diff changeset
311 Double.valueOf(kmD).toString());
29fc2d1dfe9b Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1425
diff changeset
312
29fc2d1dfe9b Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1425
diff changeset
313 disable();
29fc2d1dfe9b Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1425
diff changeset
314 feedService.feed(
29fc2d1dfe9b Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1425
diff changeset
315 locale,
29fc2d1dfe9b Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1425
diff changeset
316 new DefaultArtifact(
29fc2d1dfe9b Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1425
diff changeset
317 facetRecord.getTheme().getArtifact(),
29fc2d1dfe9b Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1425
diff changeset
318 "TODO:hash"),
29fc2d1dfe9b Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1425
diff changeset
319 feedData,
29fc2d1dfe9b Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1425
diff changeset
320 new AsyncCallback<Artifact>() {
29fc2d1dfe9b Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1425
diff changeset
321 @Override
29fc2d1dfe9b Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1425
diff changeset
322 public void onFailure(Throwable caught) {
29fc2d1dfe9b Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1425
diff changeset
323 GWT.log("Could not feed artifact " + caught.getMessage());
29fc2d1dfe9b Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1425
diff changeset
324 SC.warn(MSG.getString(caught.getMessage()));
29fc2d1dfe9b Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1425
diff changeset
325 enable();
29fc2d1dfe9b Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1425
diff changeset
326 }
29fc2d1dfe9b Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1425
diff changeset
327 @Override
29fc2d1dfe9b Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1425
diff changeset
328 public void onSuccess(Artifact artifact) {
29fc2d1dfe9b Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1425
diff changeset
329 GWT.log("Successfully fed");
29fc2d1dfe9b Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1425
diff changeset
330 requestRedraw();
1438
432180235caf Minor refactoring and fix initial settings when creating ui.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1436
diff changeset
331 // TODO also feed the winfo/masterartifact? (for plot subtitle)
1436
29fc2d1dfe9b Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1425
diff changeset
332 enable();
29fc2d1dfe9b Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1425
diff changeset
333 }
29fc2d1dfe9b Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1425
diff changeset
334 });
29fc2d1dfe9b Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1425
diff changeset
335 }
29fc2d1dfe9b Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1425
diff changeset
336
29fc2d1dfe9b Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1425
diff changeset
337
29fc2d1dfe9b Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1425
diff changeset
338 /**
1379
546f7f890ffa Cosmetics, refactoring.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1378
diff changeset
339 * Create the handler for ChangeEvents on the Spinner in the
546f7f890ffa Cosmetics, refactoring.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1378
diff changeset
340 * facets that control km of cross section.
546f7f890ffa Cosmetics, refactoring.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1378
diff changeset
341 *
546f7f890ffa Cosmetics, refactoring.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1378
diff changeset
342 * @param feedService The FeedService to send (changed) data to.
546f7f890ffa Cosmetics, refactoring.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1378
diff changeset
343 * @param facetRecord The FacetRecord (~row in table) where this
546f7f890ffa Cosmetics, refactoring.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1378
diff changeset
344 * handler is added to (to a child, to be exact).
546f7f890ffa Cosmetics, refactoring.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1378
diff changeset
345 */
546f7f890ffa Cosmetics, refactoring.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1378
diff changeset
346 public final ChangedHandler createSpinnerHandler(
546f7f890ffa Cosmetics, refactoring.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1378
diff changeset
347 final FeedServiceAsync feedService,
546f7f890ffa Cosmetics, refactoring.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1378
diff changeset
348 final FacetRecord facetRecord)
546f7f890ffa Cosmetics, refactoring.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1378
diff changeset
349 {
546f7f890ffa Cosmetics, refactoring.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1378
diff changeset
350 Config config = Config.getInstance();
546f7f890ffa Cosmetics, refactoring.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1378
diff changeset
351 final String locale = config.getLocale();
546f7f890ffa Cosmetics, refactoring.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1378
diff changeset
352
546f7f890ffa Cosmetics, refactoring.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1378
diff changeset
353 ChangedHandler handler = new ChangedHandler()
546f7f890ffa Cosmetics, refactoring.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1378
diff changeset
354 {
546f7f890ffa Cosmetics, refactoring.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1378
diff changeset
355 @Override
1436
29fc2d1dfe9b Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1425
diff changeset
356 public void onChanged(final ChangedEvent ce) {
1379
546f7f890ffa Cosmetics, refactoring.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1378
diff changeset
357 if (ce.getValue() == null) {
546f7f890ffa Cosmetics, refactoring.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1378
diff changeset
358 return;
546f7f890ffa Cosmetics, refactoring.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1378
diff changeset
359 }
1436
29fc2d1dfe9b Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1425
diff changeset
360
29fc2d1dfe9b Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1425
diff changeset
361 // Now, query the value with the kmService.
29fc2d1dfe9b Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1425
diff changeset
362 Map<Integer, Double> map = new HashMap<Integer,Double>();
29fc2d1dfe9b Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1425
diff changeset
363 final double selected_km =
29fc2d1dfe9b Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1425
diff changeset
364 Double.parseDouble(ce.getValue().toString());
29fc2d1dfe9b Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1425
diff changeset
365
29fc2d1dfe9b Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1425
diff changeset
366 int _dbid = -1;
29fc2d1dfe9b Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1425
diff changeset
367 try {
29fc2d1dfe9b Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1425
diff changeset
368 _dbid = Integer.valueOf(facetRecord.getTheme()
29fc2d1dfe9b Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1425
diff changeset
369 .getCollectionItem()
29fc2d1dfe9b Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1425
diff changeset
370 .getData().get("cross_section.dbid"));
29fc2d1dfe9b Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1425
diff changeset
371 }
29fc2d1dfe9b Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1425
diff changeset
372 catch (NumberFormatException nfe) {
29fc2d1dfe9b Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1425
diff changeset
373 GWT.log("Could not extract cross-section db id from data.");
29fc2d1dfe9b Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1425
diff changeset
374 }
29fc2d1dfe9b Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1425
diff changeset
375 final int dbid = _dbid;
29fc2d1dfe9b Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1425
diff changeset
376
29fc2d1dfe9b Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1425
diff changeset
377 map.put(dbid, Double.parseDouble(ce.getValue().toString()));
29fc2d1dfe9b Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1425
diff changeset
378
29fc2d1dfe9b Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1425
diff changeset
379 disable();
29fc2d1dfe9b Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1425
diff changeset
380
29fc2d1dfe9b Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1425
diff changeset
381 kmService.getCrossSectionKMs(locale, map, 2,
29fc2d1dfe9b Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1425
diff changeset
382 new AsyncCallback<Map<Integer, Double[]>>() {
29fc2d1dfe9b Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1425
diff changeset
383 @Override
1379
546f7f890ffa Cosmetics, refactoring.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1378
diff changeset
384 public void onFailure(Throwable caught) {
1436
29fc2d1dfe9b Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1425
diff changeset
385 GWT.log("Could not get single km for "
29fc2d1dfe9b Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1425
diff changeset
386 + dbid + ": "+ caught.getMessage());
29fc2d1dfe9b Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1425
diff changeset
387 SC.warn(MSG.getString(caught.getMessage()));
29fc2d1dfe9b Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1425
diff changeset
388 updateCollection();
29fc2d1dfe9b Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1425
diff changeset
389 updateGrid();
29fc2d1dfe9b Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1425
diff changeset
390 enable();
1379
546f7f890ffa Cosmetics, refactoring.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1378
diff changeset
391 }
1436
29fc2d1dfe9b Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1425
diff changeset
392 @Override
29fc2d1dfe9b Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1425
diff changeset
393 public void onSuccess(Map<Integer, Double[]> obj) {
29fc2d1dfe9b Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1425
diff changeset
394 Double[] kms = obj.get(dbid);
29fc2d1dfe9b Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1425
diff changeset
395 double closest =
29fc2d1dfe9b Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1425
diff changeset
396 CrossSectionChartThemePanel.closest(kms,
29fc2d1dfe9b Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1425
diff changeset
397 selected_km);
29fc2d1dfe9b Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1425
diff changeset
398 GWT.log("Got single km for " + dbid + ", it is "
29fc2d1dfe9b Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1425
diff changeset
399 + closest);
29fc2d1dfe9b Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1425
diff changeset
400 SpinnerItem item = (SpinnerItem) ce.getItem();
29fc2d1dfe9b Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1425
diff changeset
401 item.setValue(closest);
29fc2d1dfe9b Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1425
diff changeset
402 sendFeed(facetRecord, closest);
1379
546f7f890ffa Cosmetics, refactoring.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1378
diff changeset
403 }
1436
29fc2d1dfe9b Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1425
diff changeset
404 });
1379
546f7f890ffa Cosmetics, refactoring.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1378
diff changeset
405 }
546f7f890ffa Cosmetics, refactoring.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1378
diff changeset
406 };
546f7f890ffa Cosmetics, refactoring.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1378
diff changeset
407 return handler;
546f7f890ffa Cosmetics, refactoring.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1378
diff changeset
408 }
546f7f890ffa Cosmetics, refactoring.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1378
diff changeset
409
546f7f890ffa Cosmetics, refactoring.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1378
diff changeset
410
546f7f890ffa Cosmetics, refactoring.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1378
diff changeset
411 /**
1436
29fc2d1dfe9b Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1425
diff changeset
412 * Get the chosen km for given cross-section.
29fc2d1dfe9b Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1425
diff changeset
413 */
29fc2d1dfe9b Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1425
diff changeset
414 final public double getKmForCrossSectionIdx(final int index) {
29fc2d1dfe9b Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1425
diff changeset
415 double km = 0d;
29fc2d1dfe9b Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1425
diff changeset
416 int collIdx = 0;
29fc2d1dfe9b Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1425
diff changeset
417 while (km == 0d) {
29fc2d1dfe9b Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1425
diff changeset
418 CollectionItem item = collection.getItem(collIdx++);
29fc2d1dfe9b Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1425
diff changeset
419 if (item == null) {
29fc2d1dfe9b Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1425
diff changeset
420 break;
29fc2d1dfe9b Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1425
diff changeset
421 }
29fc2d1dfe9b Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1425
diff changeset
422 if (item.getData() == null) continue;
29fc2d1dfe9b Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1425
diff changeset
423 String d = item.getData().get("cross_section" + index + ".km");
29fc2d1dfe9b Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1425
diff changeset
424 if (d == null) {
29fc2d1dfe9b Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1425
diff changeset
425 continue;
29fc2d1dfe9b Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1425
diff changeset
426 }
29fc2d1dfe9b Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1425
diff changeset
427 km = Double.valueOf(d);
29fc2d1dfe9b Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1425
diff changeset
428 }
29fc2d1dfe9b Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1425
diff changeset
429 return km;
29fc2d1dfe9b Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1425
diff changeset
430 }
29fc2d1dfe9b Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1425
diff changeset
431
29fc2d1dfe9b Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1425
diff changeset
432
29fc2d1dfe9b Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1425
diff changeset
433 /**
1438
432180235caf Minor refactoring and fix initial settings when creating ui.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1436
diff changeset
434 * Create a "kilometer spinner" for CrossSection Facets.
432180235caf Minor refactoring and fix initial settings when creating ui.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1436
diff changeset
435 * @param facetRecord The respective Facet/Theme.
432180235caf Minor refactoring and fix initial settings when creating ui.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1436
diff changeset
436 * @return label, intialized SpinnerItem.
432180235caf Minor refactoring and fix initial settings when creating ui.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1436
diff changeset
437 */
432180235caf Minor refactoring and fix initial settings when creating ui.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1436
diff changeset
438 public SpinnerItem createSpinnerItem(FacetRecord facetRecord) {
432180235caf Minor refactoring and fix initial settings when creating ui.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1436
diff changeset
439 SpinnerItem spinnerItem = new SpinnerItem();
432180235caf Minor refactoring and fix initial settings when creating ui.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1436
diff changeset
440 spinnerItem.setShowTitle(false);
432180235caf Minor refactoring and fix initial settings when creating ui.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1436
diff changeset
441 spinnerItem.setTitle("Waterlevel-Spinner");
432180235caf Minor refactoring and fix initial settings when creating ui.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1436
diff changeset
442 spinnerItem.setWidth(45);
432180235caf Minor refactoring and fix initial settings when creating ui.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1436
diff changeset
443 spinnerItem.setDefaultValue(facetRecord.getTheme()
432180235caf Minor refactoring and fix initial settings when creating ui.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1436
diff changeset
444 .getCollectionItem()
432180235caf Minor refactoring and fix initial settings when creating ui.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1436
diff changeset
445 .getData().get("cross_section.km"));
432180235caf Minor refactoring and fix initial settings when creating ui.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1436
diff changeset
446
432180235caf Minor refactoring and fix initial settings when creating ui.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1436
diff changeset
447 // TODO actually use crosssectionkmservice with
432180235caf Minor refactoring and fix initial settings when creating ui.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1436
diff changeset
448 // min/max-extension
432180235caf Minor refactoring and fix initial settings when creating ui.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1436
diff changeset
449 spinnerItem.setMin(0);
432180235caf Minor refactoring and fix initial settings when creating ui.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1436
diff changeset
450 spinnerItem.setMax(1000);
1445
df7ebcbff984 Bugfixing and feature-adding for cross-sections/areas.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1444
diff changeset
451 spinnerItem.setStep(0.5f);
1438
432180235caf Minor refactoring and fix initial settings when creating ui.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1436
diff changeset
452 spinnerItem.setChangeOnKeypress(true);
432180235caf Minor refactoring and fix initial settings when creating ui.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1436
diff changeset
453 return spinnerItem;
432180235caf Minor refactoring and fix initial settings when creating ui.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1436
diff changeset
454 }
432180235caf Minor refactoring and fix initial settings when creating ui.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1436
diff changeset
455
432180235caf Minor refactoring and fix initial settings when creating ui.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1436
diff changeset
456
432180235caf Minor refactoring and fix initial settings when creating ui.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1436
diff changeset
457 /**
858
9f07f67f60a5 Subclassed ChartThemePanel, trigger redraws of Chart when interaction with
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
458 * Create and configure the Grid to display.
1438
432180235caf Minor refactoring and fix initial settings when creating ui.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1436
diff changeset
459 * @return ListGrid with Themes and related controls inside.
858
9f07f67f60a5 Subclassed ChartThemePanel, trigger redraws of Chart when interaction with
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
460 */
9f07f67f60a5 Subclassed ChartThemePanel, trigger redraws of Chart when interaction with
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
461 @Override
9f07f67f60a5 Subclassed ChartThemePanel, trigger redraws of Chart when interaction with
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
462 protected ListGrid createGrid() {
9f07f67f60a5 Subclassed ChartThemePanel, trigger redraws of Chart when interaction with
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
463 ListGrid list = new ListGrid() {
9f07f67f60a5 Subclassed ChartThemePanel, trigger redraws of Chart when interaction with
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
464 @Override
1379
546f7f890ffa Cosmetics, refactoring.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1378
diff changeset
465 protected Canvas createRecordComponent(
546f7f890ffa Cosmetics, refactoring.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1378
diff changeset
466 final ListGridRecord record,
546f7f890ffa Cosmetics, refactoring.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1378
diff changeset
467 Integer colNum)
546f7f890ffa Cosmetics, refactoring.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1378
diff changeset
468 {
861
65204f30877b Display Action Widget only for cross_section theme/facet.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 858
diff changeset
469 // Only cross_section Facets display an action widget.
65204f30877b Display Action Widget only for cross_section theme/facet.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 858
diff changeset
470 final FacetRecord facetRecord = (FacetRecord) record;
65204f30877b Display Action Widget only for cross_section theme/facet.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 858
diff changeset
471 if (!facetRecord.getTheme().getFacet().equals(
1379
546f7f890ffa Cosmetics, refactoring.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1378
diff changeset
472 "cross_section"))
546f7f890ffa Cosmetics, refactoring.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1378
diff changeset
473 {
861
65204f30877b Display Action Widget only for cross_section theme/facet.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 858
diff changeset
474 return null;
65204f30877b Display Action Widget only for cross_section theme/facet.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 858
diff changeset
475 }
858
9f07f67f60a5 Subclassed ChartThemePanel, trigger redraws of Chart when interaction with
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
476
9f07f67f60a5 Subclassed ChartThemePanel, trigger redraws of Chart when interaction with
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
477 String fieldName = this.getFieldName(colNum);
9f07f67f60a5 Subclassed ChartThemePanel, trigger redraws of Chart when interaction with
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
478
888
d6b88f8f88dd Fix issue flys/issue311 (i18n crossection).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 861
diff changeset
479 if (fieldName.equals(GRID_FIELD_ACTIONS)) {
858
9f07f67f60a5 Subclassed ChartThemePanel, trigger redraws of Chart when interaction with
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
480 HLayout recordCanvas = new HLayout(3);
9f07f67f60a5 Subclassed ChartThemePanel, trigger redraws of Chart when interaction with
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
481 recordCanvas.setHeight(22);
9f07f67f60a5 Subclassed ChartThemePanel, trigger redraws of Chart when interaction with
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
482 recordCanvas.setAlign(Alignment.CENTER);
9f07f67f60a5 Subclassed ChartThemePanel, trigger redraws of Chart when interaction with
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
483 // TODO Refactor in createSpinner(data, artifact)
1438
432180235caf Minor refactoring and fix initial settings when creating ui.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1436
diff changeset
484 SpinnerItem spinnerItem = createSpinnerItem(facetRecord);
1379
546f7f890ffa Cosmetics, refactoring.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1378
diff changeset
485 spinnerItem.addChangedHandler(
1438
432180235caf Minor refactoring and fix initial settings when creating ui.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1436
diff changeset
486 createSpinnerHandler(feedService, facetRecord));
858
9f07f67f60a5 Subclassed ChartThemePanel, trigger redraws of Chart when interaction with
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
487
9f07f67f60a5 Subclassed ChartThemePanel, trigger redraws of Chart when interaction with
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
488 DynamicForm formWrap = new DynamicForm();
9f07f67f60a5 Subclassed ChartThemePanel, trigger redraws of Chart when interaction with
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
489 formWrap.setFields(spinnerItem);
9f07f67f60a5 Subclassed ChartThemePanel, trigger redraws of Chart when interaction with
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
490 formWrap.setTitlePrefix("");
9f07f67f60a5 Subclassed ChartThemePanel, trigger redraws of Chart when interaction with
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
491 formWrap.setTitleSuffix("");
9f07f67f60a5 Subclassed ChartThemePanel, trigger redraws of Chart when interaction with
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
492 recordCanvas.addMember(formWrap);
9f07f67f60a5 Subclassed ChartThemePanel, trigger redraws of Chart when interaction with
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
493 return recordCanvas;
9f07f67f60a5 Subclassed ChartThemePanel, trigger redraws of Chart when interaction with
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
494 }
9f07f67f60a5 Subclassed ChartThemePanel, trigger redraws of Chart when interaction with
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
495 else {
9f07f67f60a5 Subclassed ChartThemePanel, trigger redraws of Chart when interaction with
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
496 return null;
9f07f67f60a5 Subclassed ChartThemePanel, trigger redraws of Chart when interaction with
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
497 }
9f07f67f60a5 Subclassed ChartThemePanel, trigger redraws of Chart when interaction with
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
498 }
9f07f67f60a5 Subclassed ChartThemePanel, trigger redraws of Chart when interaction with
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
499 };
9f07f67f60a5 Subclassed ChartThemePanel, trigger redraws of Chart when interaction with
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
500 list.setCanResizeFields(true);
9f07f67f60a5 Subclassed ChartThemePanel, trigger redraws of Chart when interaction with
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
501 list.setShowRecordComponents(true);
9f07f67f60a5 Subclassed ChartThemePanel, trigger redraws of Chart when interaction with
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
502 list.setShowRecordComponentsByCell(true);
9f07f67f60a5 Subclassed ChartThemePanel, trigger redraws of Chart when interaction with
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
503 list.setShowAllRecords(true);
1378
ebba8a8618e6 Fix flys/issue306 (CrossSections: Remove table header context menu).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 891
diff changeset
504 list.setShowHeaderContextMenu(false);
858
9f07f67f60a5 Subclassed ChartThemePanel, trigger redraws of Chart when interaction with
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
505 return list;
9f07f67f60a5 Subclassed ChartThemePanel, trigger redraws of Chart when interaction with
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
506 }
9f07f67f60a5 Subclassed ChartThemePanel, trigger redraws of Chart when interaction with
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
507
9f07f67f60a5 Subclassed ChartThemePanel, trigger redraws of Chart when interaction with
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
508
9f07f67f60a5 Subclassed ChartThemePanel, trigger redraws of Chart when interaction with
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
509 /**
9f07f67f60a5 Subclassed ChartThemePanel, trigger redraws of Chart when interaction with
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
510 * Initializes the components (columns) of the theme grid.
9f07f67f60a5 Subclassed ChartThemePanel, trigger redraws of Chart when interaction with
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
511 */
9f07f67f60a5 Subclassed ChartThemePanel, trigger redraws of Chart when interaction with
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
512 @Override
9f07f67f60a5 Subclassed ChartThemePanel, trigger redraws of Chart when interaction with
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
513 protected void initGrid() {
9f07f67f60a5 Subclassed ChartThemePanel, trigger redraws of Chart when interaction with
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
514 list.setCanEdit(true);
9f07f67f60a5 Subclassed ChartThemePanel, trigger redraws of Chart when interaction with
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
515 list.setCanSort(false);
9f07f67f60a5 Subclassed ChartThemePanel, trigger redraws of Chart when interaction with
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
516 list.setShowRecordComponents(true);
9f07f67f60a5 Subclassed ChartThemePanel, trigger redraws of Chart when interaction with
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
517 list.setShowRecordComponentsByCell(true);
9f07f67f60a5 Subclassed ChartThemePanel, trigger redraws of Chart when interaction with
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
518 list.setShowHeader(true);
9f07f67f60a5 Subclassed ChartThemePanel, trigger redraws of Chart when interaction with
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
519 list.setWidth100();
9f07f67f60a5 Subclassed ChartThemePanel, trigger redraws of Chart when interaction with
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
520 list.setHeight100();
9f07f67f60a5 Subclassed ChartThemePanel, trigger redraws of Chart when interaction with
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
521
9f07f67f60a5 Subclassed ChartThemePanel, trigger redraws of Chart when interaction with
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
522 list.addEditCompleteHandler(this);
9f07f67f60a5 Subclassed ChartThemePanel, trigger redraws of Chart when interaction with
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
523
9f07f67f60a5 Subclassed ChartThemePanel, trigger redraws of Chart when interaction with
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
524 ListGridField active = new ListGridField(GRID_FIELD_ACTIVE, " ", 20);
9f07f67f60a5 Subclassed ChartThemePanel, trigger redraws of Chart when interaction with
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
525 active.setType(ListGridFieldType.BOOLEAN);
9f07f67f60a5 Subclassed ChartThemePanel, trigger redraws of Chart when interaction with
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
526
9f07f67f60a5 Subclassed ChartThemePanel, trigger redraws of Chart when interaction with
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
527 ListGridField name = new ListGridField(
9f07f67f60a5 Subclassed ChartThemePanel, trigger redraws of Chart when interaction with
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
528 GRID_FIELD_NAME, MSG.chart_themepanel_header_themes());
9f07f67f60a5 Subclassed ChartThemePanel, trigger redraws of Chart when interaction with
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
529 name.setType(ListGridFieldType.TEXT);
9f07f67f60a5 Subclassed ChartThemePanel, trigger redraws of Chart when interaction with
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
530
9f07f67f60a5 Subclassed ChartThemePanel, trigger redraws of Chart when interaction with
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
531 ListGridField actions = new ListGridField(GRID_FIELD_ACTIONS,
891
f6c14ffdfd07 Rest for fix for flys/issue311 .
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 890
diff changeset
532 MSG.chart_themepanel_header_actions(), 50);
858
9f07f67f60a5 Subclassed ChartThemePanel, trigger redraws of Chart when interaction with
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
533
9f07f67f60a5 Subclassed ChartThemePanel, trigger redraws of Chart when interaction with
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
534 list.setFields(active, name, actions);
9f07f67f60a5 Subclassed ChartThemePanel, trigger redraws of Chart when interaction with
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
535 }
1436
29fc2d1dfe9b Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1425
diff changeset
536
29fc2d1dfe9b Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1425
diff changeset
537
29fc2d1dfe9b Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1425
diff changeset
538 /** Get Current Cross-section Masters uuid. */
29fc2d1dfe9b Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1425
diff changeset
539 public String getCurrentMaster() {
29fc2d1dfe9b Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1425
diff changeset
540 return currentMasterUUID;
29fc2d1dfe9b Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1425
diff changeset
541 }
29fc2d1dfe9b Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1425
diff changeset
542
29fc2d1dfe9b Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1425
diff changeset
543
29fc2d1dfe9b Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1425
diff changeset
544 /** Set Current Cross-section Masters uuid. */
29fc2d1dfe9b Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1425
diff changeset
545 public void setCurrentMaster(String currentMasterUuid) {
29fc2d1dfe9b Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1425
diff changeset
546 this.currentMasterUUID = currentMasterUuid;
29fc2d1dfe9b Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1425
diff changeset
547 }
1444
bdac8a72f7e6 Area creation UI update.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1438
diff changeset
548
bdac8a72f7e6 Area creation UI update.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1438
diff changeset
549
bdac8a72f7e6 Area creation UI update.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1438
diff changeset
550 /**
bdac8a72f7e6 Area creation UI update.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1438
diff changeset
551 * Create and parameterize a new area artifact.
1445
df7ebcbff984 Bugfixing and feature-adding for cross-sections/areas.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1444
diff changeset
552 * @param under
df7ebcbff984 Bugfixing and feature-adding for cross-sections/areas.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1444
diff changeset
553 * @param over if null, something.
1444
bdac8a72f7e6 Area creation UI update.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1438
diff changeset
554 */
bdac8a72f7e6 Area creation UI update.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1438
diff changeset
555 public void createAreaArtifact(final Theme under, final Theme over) {
bdac8a72f7e6 Area creation UI update.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1438
diff changeset
556 Config config = Config.getInstance();
bdac8a72f7e6 Area creation UI update.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1438
diff changeset
557 String locale = config.getLocale();
bdac8a72f7e6 Area creation UI update.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1438
diff changeset
558
bdac8a72f7e6 Area creation UI update.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1438
diff changeset
559 Recommendation area = new Recommendation(
bdac8a72f7e6 Area creation UI update.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1438
diff changeset
560 "area",
bdac8a72f7e6 Area creation UI update.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1438
diff changeset
561 "",
bdac8a72f7e6 Area creation UI update.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1438
diff changeset
562 "",
bdac8a72f7e6 Area creation UI update.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1438
diff changeset
563 null);
bdac8a72f7e6 Area creation UI update.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1438
diff changeset
564 Recommendation[] recommendations = new Recommendation[] {area};
bdac8a72f7e6 Area creation UI update.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1438
diff changeset
565
bdac8a72f7e6 Area creation UI update.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1438
diff changeset
566 loadService.loadMany(
bdac8a72f7e6 Area creation UI update.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1438
diff changeset
567 this.collection,
bdac8a72f7e6 Area creation UI update.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1438
diff changeset
568 recommendations,
bdac8a72f7e6 Area creation UI update.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1438
diff changeset
569 null, //use individual factories.
bdac8a72f7e6 Area creation UI update.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1438
diff changeset
570 locale,
bdac8a72f7e6 Area creation UI update.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1438
diff changeset
571 new AsyncCallback<Artifact[]>() {
bdac8a72f7e6 Area creation UI update.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1438
diff changeset
572 public void onFailure(Throwable caught) {
bdac8a72f7e6 Area creation UI update.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1438
diff changeset
573 GWT.log("Failed, no area artifact: " + caught.getMessage());
bdac8a72f7e6 Area creation UI update.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1438
diff changeset
574 enable();
bdac8a72f7e6 Area creation UI update.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1438
diff changeset
575 // TODO SC.warn
bdac8a72f7e6 Area creation UI update.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1438
diff changeset
576 }
bdac8a72f7e6 Area creation UI update.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1438
diff changeset
577 public void onSuccess(Artifact[] artifacts) {
bdac8a72f7e6 Area creation UI update.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1438
diff changeset
578 GWT.log("Success, created area artifact: "
bdac8a72f7e6 Area creation UI update.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1438
diff changeset
579 + artifacts[0].getUuid());
bdac8a72f7e6 Area creation UI update.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1438
diff changeset
580 // Now, feed the artifact with the relevant data.
bdac8a72f7e6 Area creation UI update.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1438
diff changeset
581 feedTellArea(artifacts[0].getUuid(), under, over);
bdac8a72f7e6 Area creation UI update.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1438
diff changeset
582 }
bdac8a72f7e6 Area creation UI update.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1438
diff changeset
583 }
bdac8a72f7e6 Area creation UI update.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1438
diff changeset
584 );
bdac8a72f7e6 Area creation UI update.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1438
diff changeset
585 }
bdac8a72f7e6 Area creation UI update.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1438
diff changeset
586
bdac8a72f7e6 Area creation UI update.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1438
diff changeset
587 /**
bdac8a72f7e6 Area creation UI update.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1438
diff changeset
588 * Include area specific menu items.
bdac8a72f7e6 Area creation UI update.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1438
diff changeset
589 */
bdac8a72f7e6 Area creation UI update.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1438
diff changeset
590 protected Menu getSingleContextMenu(final ListGridRecord[] records) {
bdac8a72f7e6 Area creation UI update.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1438
diff changeset
591 Menu menu = super.getSingleContextMenu(records);
bdac8a72f7e6 Area creation UI update.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1438
diff changeset
592
bdac8a72f7e6 Area creation UI update.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1438
diff changeset
593 final Theme facetTheme = ((FacetRecord)records[0]).getTheme();
bdac8a72f7e6 Area creation UI update.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1438
diff changeset
594 String thisItem = facetTheme.getDescription();
bdac8a72f7e6 Area creation UI update.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1438
diff changeset
595 if (facetTheme.getFacet().equals("area")) {
bdac8a72f7e6 Area creation UI update.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1438
diff changeset
596 return menu;
bdac8a72f7e6 Area creation UI update.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1438
diff changeset
597 }
bdac8a72f7e6 Area creation UI update.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1438
diff changeset
598
bdac8a72f7e6 Area creation UI update.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1438
diff changeset
599 menu.addItem(createSeparator());
bdac8a72f7e6 Area creation UI update.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1438
diff changeset
600
bdac8a72f7e6 Area creation UI update.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1438
diff changeset
601 // TODO i18n
bdac8a72f7e6 Area creation UI update.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1438
diff changeset
602 //MenuItem properties = new MenuItem(MSG.properties());
bdac8a72f7e6 Area creation UI update.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1438
diff changeset
603 MenuItem areaMenuItem = new MenuItem("New Area...");
bdac8a72f7e6 Area creation UI update.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1438
diff changeset
604 Menu areaMenu = new Menu();
bdac8a72f7e6 Area creation UI update.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1438
diff changeset
605
bdac8a72f7e6 Area creation UI update.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1438
diff changeset
606 ThemeList themes = getThemeList();
bdac8a72f7e6 Area creation UI update.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1438
diff changeset
607 int nThemes = themes.getThemeCount();
bdac8a72f7e6 Area creation UI update.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1438
diff changeset
608 for (int i = 0; i < nThemes; i++) {
bdac8a72f7e6 Area creation UI update.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1438
diff changeset
609 final Theme theme = themes.getThemeAt(i+1);
bdac8a72f7e6 Area creation UI update.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1438
diff changeset
610 if (theme.getDescription().equals(thisItem)
bdac8a72f7e6 Area creation UI update.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1438
diff changeset
611 || theme.getFacet().equals("area")) {
bdac8a72f7e6 Area creation UI update.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1438
diff changeset
612 continue;
bdac8a72f7e6 Area creation UI update.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1438
diff changeset
613 }
bdac8a72f7e6 Area creation UI update.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1438
diff changeset
614 MenuItem againster = new MenuItem(theme.getDescription());
bdac8a72f7e6 Area creation UI update.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1438
diff changeset
615 areaMenu.addItem(againster);
bdac8a72f7e6 Area creation UI update.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1438
diff changeset
616
bdac8a72f7e6 Area creation UI update.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1438
diff changeset
617 againster.addClickHandler(new ClickHandler() {
bdac8a72f7e6 Area creation UI update.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1438
diff changeset
618 public void onClick(MenuItemClickEvent evt) {
bdac8a72f7e6 Area creation UI update.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1438
diff changeset
619 disable();
bdac8a72f7e6 Area creation UI update.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1438
diff changeset
620 createAreaArtifact(facetTheme, theme);
bdac8a72f7e6 Area creation UI update.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1438
diff changeset
621 }
bdac8a72f7e6 Area creation UI update.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1438
diff changeset
622 });
bdac8a72f7e6 Area creation UI update.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1438
diff changeset
623 }
bdac8a72f7e6 Area creation UI update.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1438
diff changeset
624
bdac8a72f7e6 Area creation UI update.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1438
diff changeset
625 MenuItem underMenuItem = new MenuItem("Under ...");
1445
df7ebcbff984 Bugfixing and feature-adding for cross-sections/areas.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1444
diff changeset
626 underMenuItem.addClickHandler(new ClickHandler() {
df7ebcbff984 Bugfixing and feature-adding for cross-sections/areas.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1444
diff changeset
627 public void onClick(MenuItemClickEvent evt) {
df7ebcbff984 Bugfixing and feature-adding for cross-sections/areas.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1444
diff changeset
628 disable();
df7ebcbff984 Bugfixing and feature-adding for cross-sections/areas.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1444
diff changeset
629 createAreaArtifact(facetTheme, null);
df7ebcbff984 Bugfixing and feature-adding for cross-sections/areas.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1444
diff changeset
630 }
df7ebcbff984 Bugfixing and feature-adding for cross-sections/areas.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1444
diff changeset
631 });
1444
bdac8a72f7e6 Area creation UI update.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1438
diff changeset
632 MenuItem overMenuItem = new MenuItem("Over ...");
1445
df7ebcbff984 Bugfixing and feature-adding for cross-sections/areas.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1444
diff changeset
633 overMenuItem.addClickHandler(new ClickHandler() {
df7ebcbff984 Bugfixing and feature-adding for cross-sections/areas.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1444
diff changeset
634 public void onClick(MenuItemClickEvent evt) {
df7ebcbff984 Bugfixing and feature-adding for cross-sections/areas.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1444
diff changeset
635 disable();
df7ebcbff984 Bugfixing and feature-adding for cross-sections/areas.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1444
diff changeset
636 createAreaArtifact(facetTheme, null);
df7ebcbff984 Bugfixing and feature-adding for cross-sections/areas.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1444
diff changeset
637 }
df7ebcbff984 Bugfixing and feature-adding for cross-sections/areas.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1444
diff changeset
638 });
1444
bdac8a72f7e6 Area creation UI update.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1438
diff changeset
639 areaMenu.addItem(createSeparator());
bdac8a72f7e6 Area creation UI update.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1438
diff changeset
640 areaMenu.addItem(underMenuItem);
bdac8a72f7e6 Area creation UI update.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1438
diff changeset
641 areaMenu.addItem(overMenuItem);
bdac8a72f7e6 Area creation UI update.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1438
diff changeset
642
bdac8a72f7e6 Area creation UI update.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1438
diff changeset
643 areaMenuItem.setSubmenu(areaMenu);
bdac8a72f7e6 Area creation UI update.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1438
diff changeset
644 menu.addItem(areaMenuItem);
bdac8a72f7e6 Area creation UI update.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1438
diff changeset
645
bdac8a72f7e6 Area creation UI update.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1438
diff changeset
646 return menu;
bdac8a72f7e6 Area creation UI update.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1438
diff changeset
647 }
858
9f07f67f60a5 Subclassed ChartThemePanel, trigger redraws of Chart when interaction with
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
648 }
9f07f67f60a5 Subclassed ChartThemePanel, trigger redraws of Chart when interaction with
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
649 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :

http://dive4elements.wald.intevation.org