annotate flys-client/src/main/java/de/intevation/flys/client/client/ui/chart/CrossSectionChartThemePanel.java @ 1445:df7ebcbff984

Bugfixing and feature-adding for cross-sections/areas. flys-client/trunk@3457 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Felix Wolfsteller <felix.wolfsteller@intevation.de>
date Mon, 19 Dec 2011 07:37:15 +0000
parents bdac8a72f7e6
children 8da36efc839a
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.DataItem;
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.DefaultArtifact;
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.DefaultData;
9f07f67f60a5 Subclassed ChartThemePanel, trigger redraws of Chart when interaction with
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
43 import de.intevation.flys.client.shared.model.DefaultDataItem;
9f07f67f60a5 Subclassed ChartThemePanel, trigger redraws of Chart when interaction with
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
44 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
45 import de.intevation.flys.client.shared.model.OutputMode;
1444
bdac8a72f7e6 Area creation UI update.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1438
diff changeset
46 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
47 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
48 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
49
1444
bdac8a72f7e6 Area creation UI update.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1438
diff changeset
50 import de.intevation.flys.client.client.services.CrossSectionKMServiceAsync;
1379
546f7f890ffa Cosmetics, refactoring.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1378
diff changeset
51 import de.intevation.flys.client.client.services.FeedServiceAsync;
1444
bdac8a72f7e6 Area creation UI update.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1438
diff changeset
52 import de.intevation.flys.client.client.services.LoadArtifactService;
bdac8a72f7e6 Area creation UI update.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1438
diff changeset
53 import de.intevation.flys.client.client.services.LoadArtifactServiceAsync;
bdac8a72f7e6 Area creation UI update.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1438
diff changeset
54
bdac8a72f7e6 Area creation UI update.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1438
diff changeset
55
858
9f07f67f60a5 Subclassed ChartThemePanel, trigger redraws of Chart when interaction with
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
56
9f07f67f60a5 Subclassed ChartThemePanel, trigger redraws of Chart when interaction with
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
57 /**
9f07f67f60a5 Subclassed ChartThemePanel, trigger redraws of Chart when interaction with
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
58 * 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
59 * 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
60 * 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
61 */
9f07f67f60a5 Subclassed ChartThemePanel, trigger redraws of Chart when interaction with
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
62 public class CrossSectionChartThemePanel
9f07f67f60a5 Subclassed ChartThemePanel, trigger redraws of Chart when interaction with
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
63 extends ChartThemePanel {
1444
bdac8a72f7e6 Area creation UI update.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1438
diff changeset
64 /** Artifact Clone/Creation service. */
bdac8a72f7e6 Area creation UI update.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1438
diff changeset
65 protected LoadArtifactServiceAsync loadService =
bdac8a72f7e6 Area creation UI update.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1438
diff changeset
66 GWT.create(LoadArtifactService.class);
858
9f07f67f60a5 Subclassed ChartThemePanel, trigger redraws of Chart when interaction with
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
67
1436
29fc2d1dfe9b Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1425
diff changeset
68 /** 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
69 CrossSectionKMServiceAsync kmService = GWT.create(
29fc2d1dfe9b Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1425
diff changeset
70 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
71
29fc2d1dfe9b Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1425
diff changeset
72 /** 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
73 protected String currentMasterUUID;
29fc2d1dfe9b Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1425
diff changeset
74
29fc2d1dfe9b Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1425
diff changeset
75 /** 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
76 protected VLayout layout;
29fc2d1dfe9b Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1425
diff changeset
77
858
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 * Trivial constructor.
9f07f67f60a5 Subclassed ChartThemePanel, trigger redraws of Chart when interaction with
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
80 */
9f07f67f60a5 Subclassed ChartThemePanel, trigger redraws of Chart when interaction with
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
81 public CrossSectionChartThemePanel(
1436
29fc2d1dfe9b Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1425
diff changeset
82 Collection collection,
29fc2d1dfe9b Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1425
diff changeset
83 OutputMode mode)
858
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 super(collection, mode);
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
9f07f67f60a5 Subclassed ChartThemePanel, trigger redraws of Chart when interaction with
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
88
9f07f67f60a5 Subclassed ChartThemePanel, trigger redraws of Chart when interaction with
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
89 /**
1436
29fc2d1dfe9b Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1425
diff changeset
90 * 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
91 * @param artifact uuid of an artifact.
29fc2d1dfe9b Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1425
diff changeset
92 */
29fc2d1dfe9b Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1425
diff changeset
93 public void feedTellMaster(final String artifact) {
29fc2d1dfe9b Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1425
diff changeset
94 Data[] feedData = DefaultData.createSimpleStringDataArray(
29fc2d1dfe9b Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1425
diff changeset
95 "cross_section.master?", "1");
29fc2d1dfe9b Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1425
diff changeset
96
29fc2d1dfe9b Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1425
diff changeset
97 feedService.feed(
29fc2d1dfe9b Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1425
diff changeset
98 Config.getInstance().getLocale(),
29fc2d1dfe9b Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1425
diff changeset
99 new DefaultArtifact(artifact, "TODO:hash"),
29fc2d1dfe9b Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1425
diff changeset
100 feedData,
29fc2d1dfe9b Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1425
diff changeset
101 new AsyncCallback<Artifact>() {
29fc2d1dfe9b Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1425
diff changeset
102 public void onFailure(Throwable caught) {
29fc2d1dfe9b Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1425
diff changeset
103 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
104 + ") with master marker: " + caught.getMessage());
29fc2d1dfe9b Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1425
diff changeset
105 SC.warn(MSG.getString(caught.getMessage()));
29fc2d1dfe9b Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1425
diff changeset
106 enable();
29fc2d1dfe9b Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1425
diff changeset
107 }
29fc2d1dfe9b Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1425
diff changeset
108 public void onSuccess(Artifact artifact) {
29fc2d1dfe9b Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1425
diff changeset
109 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
110 setCurrentMaster(artifact.getUuid());
29fc2d1dfe9b Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1425
diff changeset
111 requestRedraw();
29fc2d1dfe9b Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1425
diff changeset
112 enable();
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
29fc2d1dfe9b Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1425
diff changeset
117
29fc2d1dfe9b Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1425
diff changeset
118 /**
1444
bdac8a72f7e6 Area creation UI update.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1438
diff changeset
119 * 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
120 * @param over if null, something
1444
bdac8a72f7e6 Area creation UI update.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1438
diff changeset
121 */
bdac8a72f7e6 Area creation UI update.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1438
diff changeset
122 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
123
df7ebcbff984 Bugfixing and feature-adding for cross-sections/areas.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1444
diff changeset
124 Data[] feedData;
df7ebcbff984 Bugfixing and feature-adding for cross-sections/areas.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1444
diff changeset
125
df7ebcbff984 Bugfixing and feature-adding for cross-sections/areas.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1444
diff changeset
126 if (over != null) {
df7ebcbff984 Bugfixing and feature-adding for cross-sections/areas.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1444
diff changeset
127 feedData = new Data[] {
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.curve_under",
df7ebcbff984 Bugfixing and feature-adding for cross-sections/areas.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1444
diff changeset
131 under.getArtifact() + under.getIndex()),
df7ebcbff984 Bugfixing and feature-adding for cross-sections/areas.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1444
diff changeset
132 DefaultData.createSimpleStringData("area.name",
df7ebcbff984 Bugfixing and feature-adding for cross-sections/areas.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1444
diff changeset
133 over.getDescription() + " / " + under.getDescription())
df7ebcbff984 Bugfixing and feature-adding for cross-sections/areas.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1444
diff changeset
134 };
df7ebcbff984 Bugfixing and feature-adding for cross-sections/areas.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1444
diff changeset
135 }
df7ebcbff984 Bugfixing and feature-adding for cross-sections/areas.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1444
diff changeset
136 else {
df7ebcbff984 Bugfixing and feature-adding for cross-sections/areas.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1444
diff changeset
137 feedData = new Data[] {
df7ebcbff984 Bugfixing and feature-adding for cross-sections/areas.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1444
diff changeset
138 DefaultData.createSimpleStringData("area.curve_under",
df7ebcbff984 Bugfixing and feature-adding for cross-sections/areas.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1444
diff changeset
139 under.getArtifact() + under.getIndex()),
df7ebcbff984 Bugfixing and feature-adding for cross-sections/areas.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1444
diff changeset
140 DefaultData.createSimpleStringData("area.name",
df7ebcbff984 Bugfixing and feature-adding for cross-sections/areas.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1444
diff changeset
141 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
142 };
df7ebcbff984 Bugfixing and feature-adding for cross-sections/areas.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1444
diff changeset
143 }
1444
bdac8a72f7e6 Area creation UI update.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1438
diff changeset
144
bdac8a72f7e6 Area creation UI update.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1438
diff changeset
145 feedService.feed(
bdac8a72f7e6 Area creation UI update.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1438
diff changeset
146 Config.getInstance().getLocale(),
bdac8a72f7e6 Area creation UI update.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1438
diff changeset
147 new DefaultArtifact(artifact, "TODO:hash"),
bdac8a72f7e6 Area creation UI update.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1438
diff changeset
148 feedData,
bdac8a72f7e6 Area creation UI update.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1438
diff changeset
149 new AsyncCallback<Artifact>() {
bdac8a72f7e6 Area creation UI update.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1438
diff changeset
150 public void onFailure(Throwable caught) {
bdac8a72f7e6 Area creation UI update.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1438
diff changeset
151 GWT.log("Could not feed artifact (" + artifact
bdac8a72f7e6 Area creation UI update.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1438
diff changeset
152 + ") with area info: " + caught.getMessage());
bdac8a72f7e6 Area creation UI update.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1438
diff changeset
153 SC.warn(MSG.getString(caught.getMessage()));
bdac8a72f7e6 Area creation UI update.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1438
diff changeset
154 enable();
bdac8a72f7e6 Area creation UI update.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1438
diff changeset
155 }
bdac8a72f7e6 Area creation UI update.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1438
diff changeset
156 public void onSuccess(Artifact artifact) {
bdac8a72f7e6 Area creation UI update.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1438
diff changeset
157 GWT.log("Successfully set area params to " + artifact);
bdac8a72f7e6 Area creation UI update.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1438
diff changeset
158 requestRedraw();
1445
df7ebcbff984 Bugfixing and feature-adding for cross-sections/areas.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1444
diff changeset
159 updateCollection();
df7ebcbff984 Bugfixing and feature-adding for cross-sections/areas.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1444
diff changeset
160 updateGrid();
1444
bdac8a72f7e6 Area creation UI update.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1438
diff changeset
161 enable();
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 }
bdac8a72f7e6 Area creation UI update.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1438
diff changeset
165
bdac8a72f7e6 Area creation UI update.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1438
diff changeset
166 /**
1438
432180235caf Minor refactoring and fix initial settings when creating ui.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1436
diff changeset
167 * sets currentMasterUUID.
432180235caf Minor refactoring and fix initial settings when creating ui.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1436
diff changeset
168 */
432180235caf Minor refactoring and fix initial settings when creating ui.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1436
diff changeset
169 public String findCurrentMaster() {
432180235caf Minor refactoring and fix initial settings when creating ui.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1436
diff changeset
170 ThemeList themeList = getThemeList();
432180235caf Minor refactoring and fix initial settings when creating ui.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1436
diff changeset
171 int count = getThemeList().getThemeCount();
1445
df7ebcbff984 Bugfixing and feature-adding for cross-sections/areas.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1444
diff changeset
172 String firstCSUuid = null;
1438
432180235caf Minor refactoring and fix initial settings when creating ui.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1436
diff changeset
173 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
174 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
175 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
176
1445
df7ebcbff984 Bugfixing and feature-adding for cross-sections/areas.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1444
diff changeset
177 if (value != null) {
df7ebcbff984 Bugfixing and feature-adding for cross-sections/areas.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1444
diff changeset
178 if (firstCSUuid == null) {
df7ebcbff984 Bugfixing and feature-adding for cross-sections/areas.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1444
diff changeset
179 firstCSUuid = theme.getArtifact();
df7ebcbff984 Bugfixing and feature-adding for cross-sections/areas.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1444
diff changeset
180 }
df7ebcbff984 Bugfixing and feature-adding for cross-sections/areas.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1444
diff changeset
181 if (!value.equals("0")) {
df7ebcbff984 Bugfixing and feature-adding for cross-sections/areas.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1444
diff changeset
182 setCurrentMaster(theme.getArtifact());
df7ebcbff984 Bugfixing and feature-adding for cross-sections/areas.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1444
diff changeset
183 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
184 return theme.getDescription();
df7ebcbff984 Bugfixing and feature-adding for cross-sections/areas.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1444
diff changeset
185 }
1438
432180235caf Minor refactoring and fix initial settings when creating ui.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1436
diff changeset
186 }
432180235caf Minor refactoring and fix initial settings when creating ui.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1436
diff changeset
187 }
1445
df7ebcbff984 Bugfixing and feature-adding for cross-sections/areas.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1444
diff changeset
188 // 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
189 if (firstCSUuid != null) {
df7ebcbff984 Bugfixing and feature-adding for cross-sections/areas.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1444
diff changeset
190 setCurrentMaster(firstCSUuid);
df7ebcbff984 Bugfixing and feature-adding for cross-sections/areas.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1444
diff changeset
191 feedTellMaster(firstCSUuid);
df7ebcbff984 Bugfixing and feature-adding for cross-sections/areas.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1444
diff changeset
192 }
1438
432180235caf Minor refactoring and fix initial settings when creating ui.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1436
diff changeset
193 return null;
432180235caf Minor refactoring and fix initial settings when creating ui.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1436
diff changeset
194 }
432180235caf Minor refactoring and fix initial settings when creating ui.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1436
diff changeset
195
1444
bdac8a72f7e6 Area creation UI update.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1438
diff changeset
196
1438
432180235caf Minor refactoring and fix initial settings when creating ui.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1436
diff changeset
197 /**
1436
29fc2d1dfe9b Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1425
diff changeset
198 * 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
199 */
29fc2d1dfe9b Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1425
diff changeset
200 @Override
29fc2d1dfe9b Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1425
diff changeset
201 protected VLayout createLayout() {
1438
432180235caf Minor refactoring and fix initial settings when creating ui.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1436
diff changeset
202 layout = super.createLayout();
1436
29fc2d1dfe9b Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1425
diff changeset
203
29fc2d1dfe9b Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1425
diff changeset
204 // Create "set master" combobox.
29fc2d1dfe9b Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1425
diff changeset
205 SelectItem cbItem = new SelectItem();
29fc2d1dfe9b Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1425
diff changeset
206
29fc2d1dfe9b Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1425
diff changeset
207 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
208 cbItem.setType("comboBox");
29fc2d1dfe9b Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1425
diff changeset
209 final LinkedHashMap<String, String> valueMap =
29fc2d1dfe9b Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1425
diff changeset
210 getThemeList().toMapArtifactUUIDDescription("cross_section");
29fc2d1dfe9b Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1425
diff changeset
211 cbItem.setValueMap(valueMap);
29fc2d1dfe9b Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1425
diff changeset
212
29fc2d1dfe9b Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1425
diff changeset
213 final DynamicForm form = new DynamicForm();
29fc2d1dfe9b Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1425
diff changeset
214 form.setWidth(200);
29fc2d1dfe9b Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1425
diff changeset
215 form.setFields(cbItem);
29fc2d1dfe9b Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1425
diff changeset
216 layout.addMember(form);
29fc2d1dfe9b Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1425
diff changeset
217
1438
432180235caf Minor refactoring and fix initial settings when creating ui.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1436
diff changeset
218 Config config = Config.getInstance();
432180235caf Minor refactoring and fix initial settings when creating ui.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1436
diff changeset
219 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
220 findCurrentMaster();
432180235caf Minor refactoring and fix initial settings when creating ui.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1436
diff changeset
221 cbItem.setValue(getCurrentMaster());
1436
29fc2d1dfe9b Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1425
diff changeset
222
29fc2d1dfe9b Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1425
diff changeset
223 // 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
224 // new master.
29fc2d1dfe9b Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1425
diff changeset
225 cbItem.addChangeHandler(new ChangeHandler() {
29fc2d1dfe9b Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1425
diff changeset
226 public void onChange(ChangeEvent event) {
29fc2d1dfe9b Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1425
diff changeset
227 String selectedItem = (String) event.getValue();
29fc2d1dfe9b Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1425
diff changeset
228 final String artifact = selectedItem;
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 disable();
29fc2d1dfe9b Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1425
diff changeset
231
29fc2d1dfe9b Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1425
diff changeset
232 // 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
233 if (getCurrentMaster() != null) {
29fc2d1dfe9b Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1425
diff changeset
234 Data[] feedData = DefaultData.createSimpleStringDataArray(
29fc2d1dfe9b Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1425
diff changeset
235 "cross_section.master?", "0");
29fc2d1dfe9b Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1425
diff changeset
236 feedService.feed(
29fc2d1dfe9b Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1425
diff changeset
237 locale,
29fc2d1dfe9b Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1425
diff changeset
238 new DefaultArtifact(getCurrentMaster(), "TODO:hash"),
29fc2d1dfe9b Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1425
diff changeset
239 feedData,
29fc2d1dfe9b Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1425
diff changeset
240 new AsyncCallback<Artifact>() {
29fc2d1dfe9b Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1425
diff changeset
241 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
242 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
243 caught.getMessage());
29fc2d1dfe9b Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1425
diff changeset
244 SC.warn(MSG.getString(caught.getMessage()));
29fc2d1dfe9b Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1425
diff changeset
245 enable();
29fc2d1dfe9b Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1425
diff changeset
246 }
29fc2d1dfe9b Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1425
diff changeset
247 public void onSuccess(Artifact oldMaster) {
29fc2d1dfe9b Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1425
diff changeset
248 GWT.log("Successfully un-mastered artifact.");
29fc2d1dfe9b Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1425
diff changeset
249 feedTellMaster(artifact);
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 });
29fc2d1dfe9b Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1425
diff changeset
252 }
29fc2d1dfe9b Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1425
diff changeset
253 else {
29fc2d1dfe9b Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1425
diff changeset
254 feedTellMaster(artifact);
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 });
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 return layout;
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
29fc2d1dfe9b Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1425
diff changeset
262
29fc2d1dfe9b Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1425
diff changeset
263 /** 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
264 public void disable() {
29fc2d1dfe9b Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1425
diff changeset
265 this.layout.setDisabled(true);
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
29fc2d1dfe9b Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1425
diff changeset
268
29fc2d1dfe9b Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1425
diff changeset
269 /** 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
270 public void enable() {
29fc2d1dfe9b Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1425
diff changeset
271 this.layout.setDisabled(false);
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
29fc2d1dfe9b Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1425
diff changeset
275 /**
29fc2d1dfe9b Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1425
diff changeset
276 * 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
277 * 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
278 * the last one is taken.
29fc2d1dfe9b Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1425
diff changeset
279 * @param in possible return values.
29fc2d1dfe9b Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1425
diff changeset
280 * @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
281 * @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
282 */
29fc2d1dfe9b Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1425
diff changeset
283 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
284 if (in == null || in.length == 0) {
29fc2d1dfe9b Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1425
diff changeset
285 return -1;
29fc2d1dfe9b Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1425
diff changeset
286 }
29fc2d1dfe9b Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1425
diff changeset
287 if (in[0] == to) {
29fc2d1dfe9b Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1425
diff changeset
288 return to;
29fc2d1dfe9b Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1425
diff changeset
289 }
29fc2d1dfe9b Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1425
diff changeset
290 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
291 double bestMatch = in[0];
29fc2d1dfe9b Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1425
diff changeset
292 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
293 if (in[i] == to) {
29fc2d1dfe9b Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1425
diff changeset
294 return to;
29fc2d1dfe9b Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1425
diff changeset
295 }
29fc2d1dfe9b Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1425
diff changeset
296 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
297 if (diff < minDiff) {
29fc2d1dfe9b Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1425
diff changeset
298 minDiff = diff;
29fc2d1dfe9b Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1425
diff changeset
299 bestMatch = in[i];
29fc2d1dfe9b Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1425
diff changeset
300 }
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 return bestMatch;
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
29fc2d1dfe9b Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1425
diff changeset
305
29fc2d1dfe9b Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1425
diff changeset
306 /** 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
307 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
308 Config config = Config.getInstance();
29fc2d1dfe9b Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1425
diff changeset
309 final String locale = config.getLocale();
29fc2d1dfe9b Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1425
diff changeset
310
29fc2d1dfe9b Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1425
diff changeset
311 Data[] feedData =
29fc2d1dfe9b Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1425
diff changeset
312 DefaultData.createSimpleStringDataArray("cross_section.km",
29fc2d1dfe9b Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1425
diff changeset
313 Double.valueOf(kmD).toString());
29fc2d1dfe9b Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1425
diff changeset
314
29fc2d1dfe9b Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1425
diff changeset
315 disable();
29fc2d1dfe9b Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1425
diff changeset
316 feedService.feed(
29fc2d1dfe9b Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1425
diff changeset
317 locale,
29fc2d1dfe9b Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1425
diff changeset
318 new DefaultArtifact(
29fc2d1dfe9b Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1425
diff changeset
319 facetRecord.getTheme().getArtifact(),
29fc2d1dfe9b Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1425
diff changeset
320 "TODO:hash"),
29fc2d1dfe9b Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1425
diff changeset
321 feedData,
29fc2d1dfe9b Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1425
diff changeset
322 new AsyncCallback<Artifact>() {
29fc2d1dfe9b Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1425
diff changeset
323 @Override
29fc2d1dfe9b Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1425
diff changeset
324 public void onFailure(Throwable caught) {
29fc2d1dfe9b Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1425
diff changeset
325 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
326 SC.warn(MSG.getString(caught.getMessage()));
29fc2d1dfe9b Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1425
diff changeset
327 enable();
29fc2d1dfe9b Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1425
diff changeset
328 }
29fc2d1dfe9b Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1425
diff changeset
329 @Override
29fc2d1dfe9b Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1425
diff changeset
330 public void onSuccess(Artifact artifact) {
29fc2d1dfe9b Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1425
diff changeset
331 GWT.log("Successfully fed");
29fc2d1dfe9b Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1425
diff changeset
332 requestRedraw();
1438
432180235caf Minor refactoring and fix initial settings when creating ui.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1436
diff changeset
333 // 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
334 enable();
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
29fc2d1dfe9b Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1425
diff changeset
339
29fc2d1dfe9b Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1425
diff changeset
340 /**
1379
546f7f890ffa Cosmetics, refactoring.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1378
diff changeset
341 * Create the handler for ChangeEvents on the Spinner in the
546f7f890ffa Cosmetics, refactoring.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1378
diff changeset
342 * facets that control km of cross section.
546f7f890ffa Cosmetics, refactoring.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1378
diff changeset
343 *
546f7f890ffa Cosmetics, refactoring.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1378
diff changeset
344 * @param feedService The FeedService to send (changed) data to.
546f7f890ffa Cosmetics, refactoring.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1378
diff changeset
345 * @param facetRecord The FacetRecord (~row in table) where this
546f7f890ffa Cosmetics, refactoring.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1378
diff changeset
346 * handler is added to (to a child, to be exact).
546f7f890ffa Cosmetics, refactoring.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1378
diff changeset
347 */
546f7f890ffa Cosmetics, refactoring.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1378
diff changeset
348 public final ChangedHandler createSpinnerHandler(
546f7f890ffa Cosmetics, refactoring.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1378
diff changeset
349 final FeedServiceAsync feedService,
546f7f890ffa Cosmetics, refactoring.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1378
diff changeset
350 final FacetRecord facetRecord)
546f7f890ffa Cosmetics, refactoring.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1378
diff changeset
351 {
546f7f890ffa Cosmetics, refactoring.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1378
diff changeset
352 Config config = Config.getInstance();
546f7f890ffa Cosmetics, refactoring.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1378
diff changeset
353 final String locale = config.getLocale();
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 ChangedHandler handler = new ChangedHandler()
546f7f890ffa Cosmetics, refactoring.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1378
diff changeset
356 {
546f7f890ffa Cosmetics, refactoring.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1378
diff changeset
357 @Override
1436
29fc2d1dfe9b Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1425
diff changeset
358 public void onChanged(final ChangedEvent ce) {
1379
546f7f890ffa Cosmetics, refactoring.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1378
diff changeset
359 if (ce.getValue() == null) {
546f7f890ffa Cosmetics, refactoring.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1378
diff changeset
360 return;
546f7f890ffa Cosmetics, refactoring.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1378
diff changeset
361 }
1436
29fc2d1dfe9b Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1425
diff changeset
362
29fc2d1dfe9b Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1425
diff changeset
363 // 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
364 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
365 final double selected_km =
29fc2d1dfe9b Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1425
diff changeset
366 Double.parseDouble(ce.getValue().toString());
29fc2d1dfe9b Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1425
diff changeset
367
29fc2d1dfe9b Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1425
diff changeset
368 int _dbid = -1;
29fc2d1dfe9b Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1425
diff changeset
369 try {
29fc2d1dfe9b Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1425
diff changeset
370 _dbid = Integer.valueOf(facetRecord.getTheme()
29fc2d1dfe9b Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1425
diff changeset
371 .getCollectionItem()
29fc2d1dfe9b Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1425
diff changeset
372 .getData().get("cross_section.dbid"));
29fc2d1dfe9b Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1425
diff changeset
373 }
29fc2d1dfe9b Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1425
diff changeset
374 catch (NumberFormatException nfe) {
29fc2d1dfe9b Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1425
diff changeset
375 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
376 }
29fc2d1dfe9b Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1425
diff changeset
377 final int dbid = _dbid;
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 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
380
29fc2d1dfe9b Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1425
diff changeset
381 disable();
29fc2d1dfe9b Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1425
diff changeset
382
29fc2d1dfe9b Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1425
diff changeset
383 kmService.getCrossSectionKMs(locale, map, 2,
29fc2d1dfe9b Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1425
diff changeset
384 new AsyncCallback<Map<Integer, Double[]>>() {
29fc2d1dfe9b Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1425
diff changeset
385 @Override
1379
546f7f890ffa Cosmetics, refactoring.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1378
diff changeset
386 public void onFailure(Throwable caught) {
1436
29fc2d1dfe9b Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1425
diff changeset
387 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
388 + dbid + ": "+ caught.getMessage());
29fc2d1dfe9b Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1425
diff changeset
389 SC.warn(MSG.getString(caught.getMessage()));
29fc2d1dfe9b Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1425
diff changeset
390 updateCollection();
29fc2d1dfe9b Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1425
diff changeset
391 updateGrid();
29fc2d1dfe9b Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1425
diff changeset
392 enable();
1379
546f7f890ffa Cosmetics, refactoring.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1378
diff changeset
393 }
1436
29fc2d1dfe9b Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1425
diff changeset
394 @Override
29fc2d1dfe9b Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1425
diff changeset
395 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
396 Double[] kms = obj.get(dbid);
29fc2d1dfe9b Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1425
diff changeset
397 double closest =
29fc2d1dfe9b Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1425
diff changeset
398 CrossSectionChartThemePanel.closest(kms,
29fc2d1dfe9b Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1425
diff changeset
399 selected_km);
29fc2d1dfe9b Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1425
diff changeset
400 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
401 + closest);
29fc2d1dfe9b Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1425
diff changeset
402 SpinnerItem item = (SpinnerItem) ce.getItem();
29fc2d1dfe9b Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1425
diff changeset
403 item.setValue(closest);
29fc2d1dfe9b Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1425
diff changeset
404 sendFeed(facetRecord, closest);
1379
546f7f890ffa Cosmetics, refactoring.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1378
diff changeset
405 }
1436
29fc2d1dfe9b Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1425
diff changeset
406 });
1379
546f7f890ffa Cosmetics, refactoring.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1378
diff changeset
407 }
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 return handler;
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
546f7f890ffa Cosmetics, refactoring.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1378
diff changeset
412
546f7f890ffa Cosmetics, refactoring.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1378
diff changeset
413 /**
1436
29fc2d1dfe9b Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1425
diff changeset
414 * 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
415 */
29fc2d1dfe9b Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1425
diff changeset
416 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
417 double km = 0d;
29fc2d1dfe9b Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1425
diff changeset
418 int collIdx = 0;
29fc2d1dfe9b Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1425
diff changeset
419 while (km == 0d) {
29fc2d1dfe9b Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1425
diff changeset
420 CollectionItem item = collection.getItem(collIdx++);
29fc2d1dfe9b Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1425
diff changeset
421 if (item == null) {
29fc2d1dfe9b Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1425
diff changeset
422 break;
29fc2d1dfe9b Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1425
diff changeset
423 }
29fc2d1dfe9b Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1425
diff changeset
424 if (item.getData() == null) continue;
29fc2d1dfe9b Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1425
diff changeset
425 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
426 if (d == null) {
29fc2d1dfe9b Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1425
diff changeset
427 continue;
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 km = Double.valueOf(d);
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 return km;
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
29fc2d1dfe9b Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1425
diff changeset
434
29fc2d1dfe9b Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1425
diff changeset
435 /**
1438
432180235caf Minor refactoring and fix initial settings when creating ui.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1436
diff changeset
436 * 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
437 * @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
438 * @return label, intialized SpinnerItem.
432180235caf Minor refactoring and fix initial settings when creating ui.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1436
diff changeset
439 */
432180235caf Minor refactoring and fix initial settings when creating ui.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1436
diff changeset
440 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
441 SpinnerItem spinnerItem = new SpinnerItem();
432180235caf Minor refactoring and fix initial settings when creating ui.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1436
diff changeset
442 spinnerItem.setShowTitle(false);
432180235caf Minor refactoring and fix initial settings when creating ui.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1436
diff changeset
443 spinnerItem.setTitle("Waterlevel-Spinner");
432180235caf Minor refactoring and fix initial settings when creating ui.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1436
diff changeset
444 spinnerItem.setWidth(45);
432180235caf Minor refactoring and fix initial settings when creating ui.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1436
diff changeset
445 spinnerItem.setDefaultValue(facetRecord.getTheme()
432180235caf Minor refactoring and fix initial settings when creating ui.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1436
diff changeset
446 .getCollectionItem()
432180235caf Minor refactoring and fix initial settings when creating ui.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1436
diff changeset
447 .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
448
432180235caf Minor refactoring and fix initial settings when creating ui.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1436
diff changeset
449 // 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
450 // min/max-extension
432180235caf Minor refactoring and fix initial settings when creating ui.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1436
diff changeset
451 spinnerItem.setMin(0);
432180235caf Minor refactoring and fix initial settings when creating ui.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1436
diff changeset
452 spinnerItem.setMax(1000);
1445
df7ebcbff984 Bugfixing and feature-adding for cross-sections/areas.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1444
diff changeset
453 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
454 spinnerItem.setChangeOnKeypress(true);
432180235caf Minor refactoring and fix initial settings when creating ui.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1436
diff changeset
455 return spinnerItem;
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
432180235caf Minor refactoring and fix initial settings when creating ui.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1436
diff changeset
458
432180235caf Minor refactoring and fix initial settings when creating ui.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1436
diff changeset
459 /**
858
9f07f67f60a5 Subclassed ChartThemePanel, trigger redraws of Chart when interaction with
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
460 * 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
461 * @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
462 */
9f07f67f60a5 Subclassed ChartThemePanel, trigger redraws of Chart when interaction with
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
463 @Override
9f07f67f60a5 Subclassed ChartThemePanel, trigger redraws of Chart when interaction with
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
464 protected ListGrid createGrid() {
9f07f67f60a5 Subclassed ChartThemePanel, trigger redraws of Chart when interaction with
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
465 ListGrid list = new ListGrid() {
9f07f67f60a5 Subclassed ChartThemePanel, trigger redraws of Chart when interaction with
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
466 @Override
1379
546f7f890ffa Cosmetics, refactoring.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1378
diff changeset
467 protected Canvas createRecordComponent(
546f7f890ffa Cosmetics, refactoring.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1378
diff changeset
468 final ListGridRecord record,
546f7f890ffa Cosmetics, refactoring.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1378
diff changeset
469 Integer colNum)
546f7f890ffa Cosmetics, refactoring.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1378
diff changeset
470 {
861
65204f30877b Display Action Widget only for cross_section theme/facet.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 858
diff changeset
471 // 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
472 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
473 if (!facetRecord.getTheme().getFacet().equals(
1379
546f7f890ffa Cosmetics, refactoring.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1378
diff changeset
474 "cross_section"))
546f7f890ffa Cosmetics, refactoring.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1378
diff changeset
475 {
861
65204f30877b Display Action Widget only for cross_section theme/facet.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 858
diff changeset
476 return null;
65204f30877b Display Action Widget only for cross_section theme/facet.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 858
diff changeset
477 }
858
9f07f67f60a5 Subclassed ChartThemePanel, trigger redraws of Chart when interaction with
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
478
9f07f67f60a5 Subclassed ChartThemePanel, trigger redraws of Chart when interaction with
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
479 String fieldName = this.getFieldName(colNum);
9f07f67f60a5 Subclassed ChartThemePanel, trigger redraws of Chart when interaction with
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
480
888
d6b88f8f88dd Fix issue flys/issue311 (i18n crossection).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 861
diff changeset
481 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
482 HLayout recordCanvas = new HLayout(3);
9f07f67f60a5 Subclassed ChartThemePanel, trigger redraws of Chart when interaction with
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
483 recordCanvas.setHeight(22);
9f07f67f60a5 Subclassed ChartThemePanel, trigger redraws of Chart when interaction with
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
484 recordCanvas.setAlign(Alignment.CENTER);
9f07f67f60a5 Subclassed ChartThemePanel, trigger redraws of Chart when interaction with
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
485 // 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
486 SpinnerItem spinnerItem = createSpinnerItem(facetRecord);
1379
546f7f890ffa Cosmetics, refactoring.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1378
diff changeset
487 spinnerItem.addChangedHandler(
1438
432180235caf Minor refactoring and fix initial settings when creating ui.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1436
diff changeset
488 createSpinnerHandler(feedService, facetRecord));
858
9f07f67f60a5 Subclassed ChartThemePanel, trigger redraws of Chart when interaction with
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
489
9f07f67f60a5 Subclassed ChartThemePanel, trigger redraws of Chart when interaction with
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
490 DynamicForm formWrap = new DynamicForm();
9f07f67f60a5 Subclassed ChartThemePanel, trigger redraws of Chart when interaction with
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
491 formWrap.setFields(spinnerItem);
9f07f67f60a5 Subclassed ChartThemePanel, trigger redraws of Chart when interaction with
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
492 formWrap.setTitlePrefix("");
9f07f67f60a5 Subclassed ChartThemePanel, trigger redraws of Chart when interaction with
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
493 formWrap.setTitleSuffix("");
9f07f67f60a5 Subclassed ChartThemePanel, trigger redraws of Chart when interaction with
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
494 recordCanvas.addMember(formWrap);
9f07f67f60a5 Subclassed ChartThemePanel, trigger redraws of Chart when interaction with
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
495 return recordCanvas;
9f07f67f60a5 Subclassed ChartThemePanel, trigger redraws of Chart when interaction with
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
496 }
9f07f67f60a5 Subclassed ChartThemePanel, trigger redraws of Chart when interaction with
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
497 else {
9f07f67f60a5 Subclassed ChartThemePanel, trigger redraws of Chart when interaction with
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
498 return null;
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 }
9f07f67f60a5 Subclassed ChartThemePanel, trigger redraws of Chart when interaction with
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
501 };
9f07f67f60a5 Subclassed ChartThemePanel, trigger redraws of Chart when interaction with
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
502 list.setCanResizeFields(true);
9f07f67f60a5 Subclassed ChartThemePanel, trigger redraws of Chart when interaction with
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
503 list.setShowRecordComponents(true);
9f07f67f60a5 Subclassed ChartThemePanel, trigger redraws of Chart when interaction with
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
504 list.setShowRecordComponentsByCell(true);
9f07f67f60a5 Subclassed ChartThemePanel, trigger redraws of Chart when interaction with
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
505 list.setShowAllRecords(true);
1378
ebba8a8618e6 Fix flys/issue306 (CrossSections: Remove table header context menu).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 891
diff changeset
506 list.setShowHeaderContextMenu(false);
858
9f07f67f60a5 Subclassed ChartThemePanel, trigger redraws of Chart when interaction with
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
507 return list;
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
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 * 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
513 */
9f07f67f60a5 Subclassed ChartThemePanel, trigger redraws of Chart when interaction with
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
514 @Override
9f07f67f60a5 Subclassed ChartThemePanel, trigger redraws of Chart when interaction with
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
515 protected void initGrid() {
9f07f67f60a5 Subclassed ChartThemePanel, trigger redraws of Chart when interaction with
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
516 list.setCanEdit(true);
9f07f67f60a5 Subclassed ChartThemePanel, trigger redraws of Chart when interaction with
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
517 list.setCanSort(false);
9f07f67f60a5 Subclassed ChartThemePanel, trigger redraws of Chart when interaction with
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
518 list.setShowRecordComponents(true);
9f07f67f60a5 Subclassed ChartThemePanel, trigger redraws of Chart when interaction with
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
519 list.setShowRecordComponentsByCell(true);
9f07f67f60a5 Subclassed ChartThemePanel, trigger redraws of Chart when interaction with
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
520 list.setShowHeader(true);
9f07f67f60a5 Subclassed ChartThemePanel, trigger redraws of Chart when interaction with
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
521 list.setWidth100();
9f07f67f60a5 Subclassed ChartThemePanel, trigger redraws of Chart when interaction with
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
522 list.setHeight100();
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 list.addEditCompleteHandler(this);
9f07f67f60a5 Subclassed ChartThemePanel, trigger redraws of Chart when interaction with
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
525
9f07f67f60a5 Subclassed ChartThemePanel, trigger redraws of Chart when interaction with
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
526 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
527 active.setType(ListGridFieldType.BOOLEAN);
9f07f67f60a5 Subclassed ChartThemePanel, trigger redraws of Chart when interaction with
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
528
9f07f67f60a5 Subclassed ChartThemePanel, trigger redraws of Chart when interaction with
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
529 ListGridField name = new ListGridField(
9f07f67f60a5 Subclassed ChartThemePanel, trigger redraws of Chart when interaction with
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
530 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
531 name.setType(ListGridFieldType.TEXT);
9f07f67f60a5 Subclassed ChartThemePanel, trigger redraws of Chart when interaction with
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
532
9f07f67f60a5 Subclassed ChartThemePanel, trigger redraws of Chart when interaction with
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
533 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
534 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
535
9f07f67f60a5 Subclassed ChartThemePanel, trigger redraws of Chart when interaction with
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
536 list.setFields(active, name, actions);
9f07f67f60a5 Subclassed ChartThemePanel, trigger redraws of Chart when interaction with
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
537 }
1436
29fc2d1dfe9b Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1425
diff changeset
538
29fc2d1dfe9b Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1425
diff changeset
539
29fc2d1dfe9b Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1425
diff changeset
540 /** Get Current Cross-section Masters uuid. */
29fc2d1dfe9b Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1425
diff changeset
541 public String getCurrentMaster() {
29fc2d1dfe9b Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1425
diff changeset
542 return currentMasterUUID;
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
29fc2d1dfe9b Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1425
diff changeset
545
29fc2d1dfe9b Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1425
diff changeset
546 /** Set Current Cross-section Masters uuid. */
29fc2d1dfe9b Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1425
diff changeset
547 public void setCurrentMaster(String currentMasterUuid) {
29fc2d1dfe9b Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1425
diff changeset
548 this.currentMasterUUID = currentMasterUuid;
29fc2d1dfe9b Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1425
diff changeset
549 }
1444
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
bdac8a72f7e6 Area creation UI update.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1438
diff changeset
552 /**
bdac8a72f7e6 Area creation UI update.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1438
diff changeset
553 * 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
554 * @param under
df7ebcbff984 Bugfixing and feature-adding for cross-sections/areas.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1444
diff changeset
555 * @param over if null, something.
1444
bdac8a72f7e6 Area creation UI update.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1438
diff changeset
556 */
bdac8a72f7e6 Area creation UI update.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1438
diff changeset
557 public void createAreaArtifact(final Theme under, final Theme over) {
bdac8a72f7e6 Area creation UI update.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1438
diff changeset
558 Config config = Config.getInstance();
bdac8a72f7e6 Area creation UI update.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1438
diff changeset
559 String locale = config.getLocale();
bdac8a72f7e6 Area creation UI update.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1438
diff changeset
560
bdac8a72f7e6 Area creation UI update.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1438
diff changeset
561 Recommendation area = new Recommendation(
bdac8a72f7e6 Area creation UI update.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1438
diff changeset
562 "area",
bdac8a72f7e6 Area creation UI update.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1438
diff changeset
563 "",
bdac8a72f7e6 Area creation UI update.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1438
diff changeset
564 "",
bdac8a72f7e6 Area creation UI update.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1438
diff changeset
565 null);
bdac8a72f7e6 Area creation UI update.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1438
diff changeset
566 Recommendation[] recommendations = new Recommendation[] {area};
bdac8a72f7e6 Area creation UI update.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1438
diff changeset
567
bdac8a72f7e6 Area creation UI update.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1438
diff changeset
568 loadService.loadMany(
bdac8a72f7e6 Area creation UI update.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1438
diff changeset
569 this.collection,
bdac8a72f7e6 Area creation UI update.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1438
diff changeset
570 recommendations,
bdac8a72f7e6 Area creation UI update.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1438
diff changeset
571 null, //use individual factories.
bdac8a72f7e6 Area creation UI update.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1438
diff changeset
572 locale,
bdac8a72f7e6 Area creation UI update.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1438
diff changeset
573 new AsyncCallback<Artifact[]>() {
bdac8a72f7e6 Area creation UI update.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1438
diff changeset
574 public void onFailure(Throwable caught) {
bdac8a72f7e6 Area creation UI update.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1438
diff changeset
575 GWT.log("Failed, no area artifact: " + caught.getMessage());
bdac8a72f7e6 Area creation UI update.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1438
diff changeset
576 enable();
bdac8a72f7e6 Area creation UI update.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1438
diff changeset
577 // TODO SC.warn
bdac8a72f7e6 Area creation UI update.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1438
diff changeset
578 }
bdac8a72f7e6 Area creation UI update.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1438
diff changeset
579 public void onSuccess(Artifact[] artifacts) {
bdac8a72f7e6 Area creation UI update.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1438
diff changeset
580 GWT.log("Success, created area artifact: "
bdac8a72f7e6 Area creation UI update.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1438
diff changeset
581 + artifacts[0].getUuid());
bdac8a72f7e6 Area creation UI update.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1438
diff changeset
582 // Now, feed the artifact with the relevant data.
bdac8a72f7e6 Area creation UI update.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1438
diff changeset
583 feedTellArea(artifacts[0].getUuid(), under, over);
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
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 * Include area specific menu items.
bdac8a72f7e6 Area creation UI update.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1438
diff changeset
591 */
bdac8a72f7e6 Area creation UI update.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1438
diff changeset
592 protected Menu getSingleContextMenu(final ListGridRecord[] records) {
bdac8a72f7e6 Area creation UI update.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1438
diff changeset
593 Menu menu = super.getSingleContextMenu(records);
bdac8a72f7e6 Area creation UI update.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1438
diff changeset
594
bdac8a72f7e6 Area creation UI update.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1438
diff changeset
595 final Theme facetTheme = ((FacetRecord)records[0]).getTheme();
bdac8a72f7e6 Area creation UI update.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1438
diff changeset
596 String thisItem = facetTheme.getDescription();
bdac8a72f7e6 Area creation UI update.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1438
diff changeset
597 if (facetTheme.getFacet().equals("area")) {
bdac8a72f7e6 Area creation UI update.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1438
diff changeset
598 return menu;
bdac8a72f7e6 Area creation UI update.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1438
diff changeset
599 }
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 menu.addItem(createSeparator());
bdac8a72f7e6 Area creation UI update.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1438
diff changeset
602
bdac8a72f7e6 Area creation UI update.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1438
diff changeset
603 // TODO i18n
bdac8a72f7e6 Area creation UI update.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1438
diff changeset
604 //MenuItem properties = new MenuItem(MSG.properties());
bdac8a72f7e6 Area creation UI update.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1438
diff changeset
605 MenuItem areaMenuItem = new MenuItem("New Area...");
bdac8a72f7e6 Area creation UI update.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1438
diff changeset
606 Menu areaMenu = new Menu();
bdac8a72f7e6 Area creation UI update.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1438
diff changeset
607
bdac8a72f7e6 Area creation UI update.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1438
diff changeset
608 ThemeList themes = getThemeList();
bdac8a72f7e6 Area creation UI update.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1438
diff changeset
609 int nThemes = themes.getThemeCount();
bdac8a72f7e6 Area creation UI update.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1438
diff changeset
610 for (int i = 0; i < nThemes; i++) {
bdac8a72f7e6 Area creation UI update.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1438
diff changeset
611 final Theme theme = themes.getThemeAt(i+1);
bdac8a72f7e6 Area creation UI update.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1438
diff changeset
612 if (theme.getDescription().equals(thisItem)
bdac8a72f7e6 Area creation UI update.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1438
diff changeset
613 || theme.getFacet().equals("area")) {
bdac8a72f7e6 Area creation UI update.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1438
diff changeset
614 continue;
bdac8a72f7e6 Area creation UI update.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1438
diff changeset
615 }
bdac8a72f7e6 Area creation UI update.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1438
diff changeset
616 MenuItem againster = new MenuItem(theme.getDescription());
bdac8a72f7e6 Area creation UI update.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1438
diff changeset
617 areaMenu.addItem(againster);
bdac8a72f7e6 Area creation UI update.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1438
diff changeset
618
bdac8a72f7e6 Area creation UI update.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1438
diff changeset
619 againster.addClickHandler(new ClickHandler() {
bdac8a72f7e6 Area creation UI update.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1438
diff changeset
620 public void onClick(MenuItemClickEvent evt) {
bdac8a72f7e6 Area creation UI update.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1438
diff changeset
621 disable();
bdac8a72f7e6 Area creation UI update.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1438
diff changeset
622 createAreaArtifact(facetTheme, theme);
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 }
bdac8a72f7e6 Area creation UI update.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1438
diff changeset
626
bdac8a72f7e6 Area creation UI update.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1438
diff changeset
627 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
628 underMenuItem.addClickHandler(new ClickHandler() {
df7ebcbff984 Bugfixing and feature-adding for cross-sections/areas.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1444
diff changeset
629 public void onClick(MenuItemClickEvent evt) {
df7ebcbff984 Bugfixing and feature-adding for cross-sections/areas.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1444
diff changeset
630 disable();
df7ebcbff984 Bugfixing and feature-adding for cross-sections/areas.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1444
diff changeset
631 createAreaArtifact(facetTheme, null);
df7ebcbff984 Bugfixing and feature-adding for cross-sections/areas.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1444
diff changeset
632 }
df7ebcbff984 Bugfixing and feature-adding for cross-sections/areas.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1444
diff changeset
633 });
1444
bdac8a72f7e6 Area creation UI update.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1438
diff changeset
634 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
635 overMenuItem.addClickHandler(new ClickHandler() {
df7ebcbff984 Bugfixing and feature-adding for cross-sections/areas.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1444
diff changeset
636 public void onClick(MenuItemClickEvent evt) {
df7ebcbff984 Bugfixing and feature-adding for cross-sections/areas.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1444
diff changeset
637 disable();
df7ebcbff984 Bugfixing and feature-adding for cross-sections/areas.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1444
diff changeset
638 createAreaArtifact(facetTheme, null);
df7ebcbff984 Bugfixing and feature-adding for cross-sections/areas.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1444
diff changeset
639 }
df7ebcbff984 Bugfixing and feature-adding for cross-sections/areas.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1444
diff changeset
640 });
1444
bdac8a72f7e6 Area creation UI update.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1438
diff changeset
641 areaMenu.addItem(createSeparator());
bdac8a72f7e6 Area creation UI update.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1438
diff changeset
642 areaMenu.addItem(underMenuItem);
bdac8a72f7e6 Area creation UI update.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1438
diff changeset
643 areaMenu.addItem(overMenuItem);
bdac8a72f7e6 Area creation UI update.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1438
diff changeset
644
bdac8a72f7e6 Area creation UI update.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1438
diff changeset
645 areaMenuItem.setSubmenu(areaMenu);
bdac8a72f7e6 Area creation UI update.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1438
diff changeset
646 menu.addItem(areaMenuItem);
bdac8a72f7e6 Area creation UI update.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1438
diff changeset
647
bdac8a72f7e6 Area creation UI update.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1438
diff changeset
648 return menu;
bdac8a72f7e6 Area creation UI update.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1438
diff changeset
649 }
858
9f07f67f60a5 Subclassed ChartThemePanel, trigger redraws of Chart when interaction with
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
650 }
9f07f67f60a5 Subclassed ChartThemePanel, trigger redraws of Chart when interaction with
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
651 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :

http://dive4elements.wald.intevation.org