Mercurial > dive4elements > river
annotate flys-client/src/main/java/de/intevation/flys/client/client/ui/chart/CrossSectionChartThemePanel.java @ 1476:edf18a9dfd8b
Uncommented some code paths to avoid unwanted side effects, cosmetics.
flys-client/trunk@3521 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Felix Wolfsteller <felix.wolfsteller@intevation.de> |
---|---|
date | Thu, 22 Dec 2011 09:23:42 +0000 |
parents | fb2fefe0325f |
children | a882297ce63d |
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; |
858
9f07f67f60a5
Subclassed ChartThemePanel, trigger redraws of Chart when interaction with
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
22 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
|
23 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
|
24 |
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
25 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
|
26 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
|
27 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
|
28 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
|
29 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
|
30 |
9f07f67f60a5
Subclassed ChartThemePanel, trigger redraws of Chart when interaction with
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
31 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
|
32 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
|
33 import de.intevation.flys.client.shared.model.Collection; |
9f07f67f60a5
Subclassed ChartThemePanel, trigger redraws of Chart when interaction with
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
34 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
|
35 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
|
36 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
|
37 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
|
38 import de.intevation.flys.client.shared.model.OutputMode; |
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
39 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
|
40 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
|
41 |
1444
bdac8a72f7e6
Area creation UI update.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1438
diff
changeset
|
42 import de.intevation.flys.client.client.services.CrossSectionKMServiceAsync; |
1379
546f7f890ffa
Cosmetics, refactoring.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1378
diff
changeset
|
43 import de.intevation.flys.client.client.services.FeedServiceAsync; |
1444
bdac8a72f7e6
Area creation UI update.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1438
diff
changeset
|
44 import de.intevation.flys.client.client.services.LoadArtifactService; |
bdac8a72f7e6
Area creation UI update.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1438
diff
changeset
|
45 import de.intevation.flys.client.client.services.LoadArtifactServiceAsync; |
bdac8a72f7e6
Area creation UI update.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1438
diff
changeset
|
46 |
1472
a2b0b2af529f
Tell master-artifact of collection when cross-section-master changed kilometer.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1470
diff
changeset
|
47 import de.intevation.flys.client.client.ui.CollectionView; |
a2b0b2af529f
Tell master-artifact of collection when cross-section-master changed kilometer.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1470
diff
changeset
|
48 |
1444
bdac8a72f7e6
Area creation UI update.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1438
diff
changeset
|
49 |
858
9f07f67f60a5
Subclassed ChartThemePanel, trigger redraws of Chart when interaction with
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
50 |
9f07f67f60a5
Subclassed ChartThemePanel, trigger redraws of Chart when interaction with
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
51 /** |
9f07f67f60a5
Subclassed ChartThemePanel, trigger redraws of Chart when interaction with
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
52 * ThemePanel much like ChartThemePanel, but shows an "Actions" column, |
1457
3d9f81c3f00d
Refactored to use existing code.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1452
diff
changeset
|
53 * needed for interaction in the CrossSection Charts and a selector to |
1436
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
54 * declare which cross section profile is "master". |
1457
3d9f81c3f00d
Refactored to use existing code.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1452
diff
changeset
|
55 * Also can show 'area creation' context menus. |
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 public class CrossSectionChartThemePanel |
9f07f67f60a5
Subclassed ChartThemePanel, trigger redraws of Chart when interaction with
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
58 extends ChartThemePanel { |
1444
bdac8a72f7e6
Area creation UI update.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1438
diff
changeset
|
59 /** Artifact Clone/Creation service. */ |
bdac8a72f7e6
Area creation UI update.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1438
diff
changeset
|
60 protected LoadArtifactServiceAsync loadService = |
bdac8a72f7e6
Area creation UI update.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1438
diff
changeset
|
61 GWT.create(LoadArtifactService.class); |
858
9f07f67f60a5
Subclassed ChartThemePanel, trigger redraws of Chart when interaction with
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
62 |
1436
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
63 /** 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
|
64 CrossSectionKMServiceAsync kmService = GWT.create( |
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
65 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
|
66 |
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
67 /** UUID of the current "master" cross section. */ |
1470
eef55d18f424
Cosmetics, refactoring, renamed Master to CSMaster to avoid confusion.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1458
diff
changeset
|
68 protected String currentCSMasterUUID; |
1436
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
69 |
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
70 /** 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
|
71 protected VLayout layout; |
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
72 |
1475
fb2fefe0325f
Improvements in CrossSectionChartThemePanel.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1472
diff
changeset
|
73 /** Data item name for CrossSections selected km. */ |
1476
edf18a9dfd8b
Uncommented some code paths to avoid unwanted side effects, cosmetics.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1475
diff
changeset
|
74 protected static String CS_KM = "cross_section.km"; |
edf18a9dfd8b
Uncommented some code paths to avoid unwanted side effects, cosmetics.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1475
diff
changeset
|
75 |
edf18a9dfd8b
Uncommented some code paths to avoid unwanted side effects, cosmetics.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1475
diff
changeset
|
76 /** Data item name for CrossSections selected km. */ |
edf18a9dfd8b
Uncommented some code paths to avoid unwanted side effects, cosmetics.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1475
diff
changeset
|
77 protected static String CS_IS_MASTER = "cross_section.master?"; |
1475
fb2fefe0325f
Improvements in CrossSectionChartThemePanel.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1472
diff
changeset
|
78 |
fb2fefe0325f
Improvements in CrossSectionChartThemePanel.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1472
diff
changeset
|
79 |
858
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 * Trivial constructor. |
9f07f67f60a5
Subclassed ChartThemePanel, trigger redraws of Chart when interaction with
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
82 */ |
9f07f67f60a5
Subclassed ChartThemePanel, trigger redraws of Chart when interaction with
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
83 public CrossSectionChartThemePanel( |
1436
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
84 Collection collection, |
1475
fb2fefe0325f
Improvements in CrossSectionChartThemePanel.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1472
diff
changeset
|
85 OutputMode mode, |
fb2fefe0325f
Improvements in CrossSectionChartThemePanel.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1472
diff
changeset
|
86 CollectionView view) |
858
9f07f67f60a5
Subclassed ChartThemePanel, trigger redraws of Chart when interaction with
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
87 { |
1475
fb2fefe0325f
Improvements in CrossSectionChartThemePanel.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1472
diff
changeset
|
88 super(collection, mode, view); |
fb2fefe0325f
Improvements in CrossSectionChartThemePanel.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1472
diff
changeset
|
89 } |
fb2fefe0325f
Improvements in CrossSectionChartThemePanel.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1472
diff
changeset
|
90 |
fb2fefe0325f
Improvements in CrossSectionChartThemePanel.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1472
diff
changeset
|
91 |
fb2fefe0325f
Improvements in CrossSectionChartThemePanel.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1472
diff
changeset
|
92 /** Create DefaultArtifact. */ |
fb2fefe0325f
Improvements in CrossSectionChartThemePanel.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1472
diff
changeset
|
93 public static DefaultArtifact artifactReference(String uuid) { |
fb2fefe0325f
Improvements in CrossSectionChartThemePanel.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1472
diff
changeset
|
94 return new DefaultArtifact(uuid, "TODO:hash"); |
fb2fefe0325f
Improvements in CrossSectionChartThemePanel.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1472
diff
changeset
|
95 } |
fb2fefe0325f
Improvements in CrossSectionChartThemePanel.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1472
diff
changeset
|
96 |
fb2fefe0325f
Improvements in CrossSectionChartThemePanel.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1472
diff
changeset
|
97 |
fb2fefe0325f
Improvements in CrossSectionChartThemePanel.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1472
diff
changeset
|
98 /** Access data of collection item of theme. */ |
fb2fefe0325f
Improvements in CrossSectionChartThemePanel.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1472
diff
changeset
|
99 public static String dataOf(Theme theme, String dataItemName) { |
fb2fefe0325f
Improvements in CrossSectionChartThemePanel.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1472
diff
changeset
|
100 return theme.getCollectionItem().getData().get(dataItemName); |
858
9f07f67f60a5
Subclassed ChartThemePanel, trigger redraws of Chart when interaction with
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
101 } |
9f07f67f60a5
Subclassed ChartThemePanel, trigger redraws of Chart when interaction with
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
102 |
9f07f67f60a5
Subclassed ChartThemePanel, trigger redraws of Chart when interaction with
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
103 |
9f07f67f60a5
Subclassed ChartThemePanel, trigger redraws of Chart when interaction with
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
104 /** |
1436
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
105 * 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
|
106 * @param artifact uuid of an artifact. |
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 feedTellMaster(final String artifact) { |
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
109 Data[] feedData = DefaultData.createSimpleStringDataArray( |
1476
edf18a9dfd8b
Uncommented some code paths to avoid unwanted side effects, cosmetics.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1475
diff
changeset
|
110 CS_IS_MASTER, "1"); |
1436
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
111 |
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
112 feedService.feed( |
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
113 Config.getInstance().getLocale(), |
1475
fb2fefe0325f
Improvements in CrossSectionChartThemePanel.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1472
diff
changeset
|
114 artifactReference(artifact), |
1436
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
115 feedData, |
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
116 new AsyncCallback<Artifact>() { |
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
117 public void onFailure(Throwable caught) { |
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
118 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
|
119 + ") with master marker: " + caught.getMessage()); |
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
120 SC.warn(MSG.getString(caught.getMessage())); |
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
121 enable(); |
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
122 } |
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
123 public void onSuccess(Artifact artifact) { |
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
124 GWT.log("Successfully injected master mark to " + artifact); |
1470
eef55d18f424
Cosmetics, refactoring, renamed Master to CSMaster to avoid confusion.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1458
diff
changeset
|
125 setCurrentCSMaster(artifact.getUuid()); |
1436
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
126 requestRedraw(); |
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
127 enable(); |
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
128 } |
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
129 }); |
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
130 } |
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
131 |
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
132 |
1444
bdac8a72f7e6
Area creation UI update.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1438
diff
changeset
|
133 |
bdac8a72f7e6
Area creation UI update.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1438
diff
changeset
|
134 /** |
1470
eef55d18f424
Cosmetics, refactoring, renamed Master to CSMaster to avoid confusion.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1458
diff
changeset
|
135 * Sets currentCSMasterUUID. |
1438
432180235caf
Minor refactoring and fix initial settings when creating ui.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1436
diff
changeset
|
136 */ |
1470
eef55d18f424
Cosmetics, refactoring, renamed Master to CSMaster to avoid confusion.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1458
diff
changeset
|
137 public String findCurrentCSMaster() { |
1438
432180235caf
Minor refactoring and fix initial settings when creating ui.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1436
diff
changeset
|
138 ThemeList themeList = getThemeList(); |
432180235caf
Minor refactoring and fix initial settings when creating ui.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1436
diff
changeset
|
139 int count = getThemeList().getThemeCount(); |
1445
df7ebcbff984
Bugfixing and feature-adding for cross-sections/areas.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1444
diff
changeset
|
140 String firstCSUuid = null; |
1475
fb2fefe0325f
Improvements in CrossSectionChartThemePanel.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1472
diff
changeset
|
141 Theme firstCS = null; |
1438
432180235caf
Minor refactoring and fix initial settings when creating ui.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1436
diff
changeset
|
142 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
|
143 Theme theme = themeList.getThemeAt(i); |
1476
edf18a9dfd8b
Uncommented some code paths to avoid unwanted side effects, cosmetics.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1475
diff
changeset
|
144 String value = dataOf(theme, CS_IS_MASTER); |
1438
432180235caf
Minor refactoring and fix initial settings when creating ui.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1436
diff
changeset
|
145 |
1445
df7ebcbff984
Bugfixing and feature-adding for cross-sections/areas.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1444
diff
changeset
|
146 if (value != null) { |
df7ebcbff984
Bugfixing and feature-adding for cross-sections/areas.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1444
diff
changeset
|
147 if (firstCSUuid == null) { |
df7ebcbff984
Bugfixing and feature-adding for cross-sections/areas.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1444
diff
changeset
|
148 firstCSUuid = theme.getArtifact(); |
1475
fb2fefe0325f
Improvements in CrossSectionChartThemePanel.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1472
diff
changeset
|
149 firstCS = theme; |
1445
df7ebcbff984
Bugfixing and feature-adding for cross-sections/areas.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1444
diff
changeset
|
150 } |
df7ebcbff984
Bugfixing and feature-adding for cross-sections/areas.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1444
diff
changeset
|
151 if (!value.equals("0")) { |
1470
eef55d18f424
Cosmetics, refactoring, renamed Master to CSMaster to avoid confusion.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1458
diff
changeset
|
152 setCurrentCSMaster(theme.getArtifact()); |
1472
a2b0b2af529f
Tell master-artifact of collection when cross-section-master changed kilometer.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1470
diff
changeset
|
153 GWT.log("found a master: " + currentCSMasterUUID |
a2b0b2af529f
Tell master-artifact of collection when cross-section-master changed kilometer.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1470
diff
changeset
|
154 + "/" + theme.getDescription()); |
1475
fb2fefe0325f
Improvements in CrossSectionChartThemePanel.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1472
diff
changeset
|
155 Theme collectionMaster = getThemeList().getTheme( |
fb2fefe0325f
Improvements in CrossSectionChartThemePanel.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1472
diff
changeset
|
156 view.getArtifact().getUuid()); |
1476
edf18a9dfd8b
Uncommented some code paths to avoid unwanted side effects, cosmetics.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1475
diff
changeset
|
157 if (!dataOf(theme, CS_KM) |
edf18a9dfd8b
Uncommented some code paths to avoid unwanted side effects, cosmetics.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1475
diff
changeset
|
158 .equals(dataOf(collectionMaster, CS_KM)) |
1475
fb2fefe0325f
Improvements in CrossSectionChartThemePanel.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1472
diff
changeset
|
159 ) { |
fb2fefe0325f
Improvements in CrossSectionChartThemePanel.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1472
diff
changeset
|
160 // Tell Collection Master which kilometer the Cross- |
fb2fefe0325f
Improvements in CrossSectionChartThemePanel.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1472
diff
changeset
|
161 // Section Master is at, to have consistent subtitle |
fb2fefe0325f
Improvements in CrossSectionChartThemePanel.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1472
diff
changeset
|
162 // in diagram. |
1476
edf18a9dfd8b
Uncommented some code paths to avoid unwanted side effects, cosmetics.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1475
diff
changeset
|
163 // TODO fix |
1475
fb2fefe0325f
Improvements in CrossSectionChartThemePanel.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1472
diff
changeset
|
164 //sendFeed(view.getArtifact().getUuid(), |
1476
edf18a9dfd8b
Uncommented some code paths to avoid unwanted side effects, cosmetics.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1475
diff
changeset
|
165 // Double.valueOf(dataOf(theme, CS_KM))); |
1475
fb2fefe0325f
Improvements in CrossSectionChartThemePanel.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1472
diff
changeset
|
166 } |
fb2fefe0325f
Improvements in CrossSectionChartThemePanel.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1472
diff
changeset
|
167 |
1445
df7ebcbff984
Bugfixing and feature-adding for cross-sections/areas.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1444
diff
changeset
|
168 return theme.getDescription(); |
df7ebcbff984
Bugfixing and feature-adding for cross-sections/areas.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1444
diff
changeset
|
169 } |
1438
432180235caf
Minor refactoring and fix initial settings when creating ui.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1436
diff
changeset
|
170 } |
432180235caf
Minor refactoring and fix initial settings when creating ui.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1436
diff
changeset
|
171 } |
1445
df7ebcbff984
Bugfixing and feature-adding for cross-sections/areas.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1444
diff
changeset
|
172 // 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
|
173 if (firstCSUuid != null) { |
1470
eef55d18f424
Cosmetics, refactoring, renamed Master to CSMaster to avoid confusion.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1458
diff
changeset
|
174 setCurrentCSMaster(firstCSUuid); |
1445
df7ebcbff984
Bugfixing and feature-adding for cross-sections/areas.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1444
diff
changeset
|
175 feedTellMaster(firstCSUuid); |
1475
fb2fefe0325f
Improvements in CrossSectionChartThemePanel.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1472
diff
changeset
|
176 // Tell Collection Master which kilometer the Cross- |
fb2fefe0325f
Improvements in CrossSectionChartThemePanel.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1472
diff
changeset
|
177 // Section Master is at, to have consistent subtitle |
fb2fefe0325f
Improvements in CrossSectionChartThemePanel.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1472
diff
changeset
|
178 // in diagram. |
1476
edf18a9dfd8b
Uncommented some code paths to avoid unwanted side effects, cosmetics.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1475
diff
changeset
|
179 // TODO fix |
edf18a9dfd8b
Uncommented some code paths to avoid unwanted side effects, cosmetics.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1475
diff
changeset
|
180 //sendFeed(view.getArtifact().getUuid(), |
edf18a9dfd8b
Uncommented some code paths to avoid unwanted side effects, cosmetics.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1475
diff
changeset
|
181 // Double.valueOf(dataOf(firstCS, CS_KM))); |
1445
df7ebcbff984
Bugfixing and feature-adding for cross-sections/areas.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1444
diff
changeset
|
182 } |
1438
432180235caf
Minor refactoring and fix initial settings when creating ui.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1436
diff
changeset
|
183 return null; |
432180235caf
Minor refactoring and fix initial settings when creating ui.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1436
diff
changeset
|
184 } |
432180235caf
Minor refactoring and fix initial settings when creating ui.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1436
diff
changeset
|
185 |
1444
bdac8a72f7e6
Area creation UI update.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1438
diff
changeset
|
186 |
1438
432180235caf
Minor refactoring and fix initial settings when creating ui.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1436
diff
changeset
|
187 /** |
1436
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
188 * 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
|
189 */ |
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
190 @Override |
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
191 protected VLayout createLayout() { |
1438
432180235caf
Minor refactoring and fix initial settings when creating ui.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1436
diff
changeset
|
192 layout = super.createLayout(); |
1436
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
193 |
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
194 // Create "set master" combobox. |
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
195 SelectItem cbItem = new SelectItem(); |
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
196 |
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
197 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
|
198 cbItem.setType("comboBox"); |
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
199 final LinkedHashMap<String, String> valueMap = |
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
200 getThemeList().toMapArtifactUUIDDescription("cross_section"); |
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
201 cbItem.setValueMap(valueMap); |
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
202 |
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
203 final DynamicForm form = new DynamicForm(); |
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
204 form.setWidth(200); |
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
205 form.setFields(cbItem); |
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
206 layout.addMember(form); |
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
207 |
1438
432180235caf
Minor refactoring and fix initial settings when creating ui.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1436
diff
changeset
|
208 Config config = Config.getInstance(); |
432180235caf
Minor refactoring and fix initial settings when creating ui.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1436
diff
changeset
|
209 final String locale = config.getLocale(); |
1470
eef55d18f424
Cosmetics, refactoring, renamed Master to CSMaster to avoid confusion.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1458
diff
changeset
|
210 findCurrentCSMaster(); |
eef55d18f424
Cosmetics, refactoring, renamed Master to CSMaster to avoid confusion.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1458
diff
changeset
|
211 cbItem.setValue(getCurrentCSMaster()); |
1436
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 // 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
|
214 // new master. |
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
215 cbItem.addChangeHandler(new ChangeHandler() { |
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
216 public void onChange(ChangeEvent event) { |
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
217 String selectedItem = (String) event.getValue(); |
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
218 final String artifact = selectedItem; |
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
219 |
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
220 disable(); |
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
221 |
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
222 // Tell current master that he is not master anymore. |
1470
eef55d18f424
Cosmetics, refactoring, renamed Master to CSMaster to avoid confusion.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1458
diff
changeset
|
223 if (getCurrentCSMaster() != null) { |
1436
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
224 Data[] feedData = DefaultData.createSimpleStringDataArray( |
1476
edf18a9dfd8b
Uncommented some code paths to avoid unwanted side effects, cosmetics.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1475
diff
changeset
|
225 CS_IS_MASTER, "0"); |
1436
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
226 feedService.feed( |
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
227 locale, |
1475
fb2fefe0325f
Improvements in CrossSectionChartThemePanel.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1472
diff
changeset
|
228 artifactReference(getCurrentCSMaster()), |
1436
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
229 feedData, |
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
230 new AsyncCallback<Artifact>() { |
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
231 public void onFailure(Throwable caught) { |
1470
eef55d18f424
Cosmetics, refactoring, renamed Master to CSMaster to avoid confusion.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1458
diff
changeset
|
232 GWT.log("Could not un-master artifact ("+getCurrentCSMaster()+"): " + |
1436
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
233 caught.getMessage()); |
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
234 SC.warn(MSG.getString(caught.getMessage())); |
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
235 enable(); |
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
236 } |
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
237 public void onSuccess(Artifact oldMaster) { |
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
238 GWT.log("Successfully un-mastered artifact."); |
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
239 feedTellMaster(artifact); |
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
240 } |
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
241 }); |
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
242 } |
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
243 else { |
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
244 feedTellMaster(artifact); |
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
245 } |
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 }); |
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
248 |
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
249 return layout; |
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 /** 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
|
254 public void disable() { |
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
255 this.layout.setDisabled(true); |
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 /** 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
|
260 public void enable() { |
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
261 this.layout.setDisabled(false); |
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 |
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
264 |
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
265 /** |
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
266 * 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
|
267 * 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
|
268 * the last one is taken. |
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
269 * @param in possible return values. |
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
270 * @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
|
271 * @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
|
272 */ |
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
273 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
|
274 if (in == null || in.length == 0) { |
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
275 return -1; |
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
276 } |
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
277 if (in[0] == to) { |
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
278 return to; |
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
279 } |
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
280 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
|
281 double bestMatch = in[0]; |
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
282 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
|
283 if (in[i] == to) { |
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
284 return to; |
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
285 } |
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
286 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
|
287 if (diff < minDiff) { |
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
288 minDiff = diff; |
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
289 bestMatch = in[i]; |
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
290 } |
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
291 } |
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
292 return bestMatch; |
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
293 } |
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
294 |
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
295 |
1475
fb2fefe0325f
Improvements in CrossSectionChartThemePanel.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1472
diff
changeset
|
296 /** Feed a single artifact with the km of the crosssection to display. |
fb2fefe0325f
Improvements in CrossSectionChartThemePanel.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1472
diff
changeset
|
297 * If its the selected master, also feed the collectionmaster. */ |
1472
a2b0b2af529f
Tell master-artifact of collection when cross-section-master changed kilometer.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1470
diff
changeset
|
298 public void sendFeed(final String artUUID, final double kmD) { |
a2b0b2af529f
Tell master-artifact of collection when cross-section-master changed kilometer.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1470
diff
changeset
|
299 Config config = Config.getInstance(); |
a2b0b2af529f
Tell master-artifact of collection when cross-section-master changed kilometer.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1470
diff
changeset
|
300 final String locale = config.getLocale(); |
1436
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 Data[] feedData = |
1476
edf18a9dfd8b
Uncommented some code paths to avoid unwanted side effects, cosmetics.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1475
diff
changeset
|
303 DefaultData.createSimpleStringDataArray(CS_KM, |
1436
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
304 Double.valueOf(kmD).toString()); |
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 disable(); |
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
307 feedService.feed( |
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
308 locale, |
1475
fb2fefe0325f
Improvements in CrossSectionChartThemePanel.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1472
diff
changeset
|
309 artifactReference(artUUID), |
1436
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
310 feedData, |
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
311 new AsyncCallback<Artifact>() { |
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
312 @Override |
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
313 public void onFailure(Throwable caught) { |
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
314 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
|
315 SC.warn(MSG.getString(caught.getMessage())); |
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
316 enable(); |
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
317 } |
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
318 @Override |
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
319 public void onSuccess(Artifact artifact) { |
1472
a2b0b2af529f
Tell master-artifact of collection when cross-section-master changed kilometer.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1470
diff
changeset
|
320 GWT.log("Successfully fed with km"); |
1436
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
321 requestRedraw(); |
1472
a2b0b2af529f
Tell master-artifact of collection when cross-section-master changed kilometer.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1470
diff
changeset
|
322 // Also feed the winfo/masterartifact (for plot subtitle) |
a2b0b2af529f
Tell master-artifact of collection when cross-section-master changed kilometer.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1470
diff
changeset
|
323 if (artUUID.equals(getCurrentCSMaster()) |
a2b0b2af529f
Tell master-artifact of collection when cross-section-master changed kilometer.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1470
diff
changeset
|
324 && !artUUID.equals(view.getArtifact().getUuid())) { |
a2b0b2af529f
Tell master-artifact of collection when cross-section-master changed kilometer.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1470
diff
changeset
|
325 sendFeed(view.getArtifact().getUuid(), kmD); |
a2b0b2af529f
Tell master-artifact of collection when cross-section-master changed kilometer.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1470
diff
changeset
|
326 } |
a2b0b2af529f
Tell master-artifact of collection when cross-section-master changed kilometer.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1470
diff
changeset
|
327 else { |
a2b0b2af529f
Tell master-artifact of collection when cross-section-master changed kilometer.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1470
diff
changeset
|
328 enable(); |
a2b0b2af529f
Tell master-artifact of collection when cross-section-master changed kilometer.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1470
diff
changeset
|
329 } |
1436
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
330 } |
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
331 }); |
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
332 } |
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
333 |
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
334 |
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
335 /** |
1379
546f7f890ffa
Cosmetics, refactoring.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1378
diff
changeset
|
336 * Create the handler for ChangeEvents on the Spinner in the |
546f7f890ffa
Cosmetics, refactoring.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1378
diff
changeset
|
337 * facets that control km of cross section. |
546f7f890ffa
Cosmetics, refactoring.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1378
diff
changeset
|
338 * |
546f7f890ffa
Cosmetics, refactoring.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1378
diff
changeset
|
339 * @param feedService The FeedService to send (changed) data to. |
546f7f890ffa
Cosmetics, refactoring.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1378
diff
changeset
|
340 * @param facetRecord The FacetRecord (~row in table) where this |
546f7f890ffa
Cosmetics, refactoring.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1378
diff
changeset
|
341 * handler is added to (to a child, to be exact). |
546f7f890ffa
Cosmetics, refactoring.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1378
diff
changeset
|
342 */ |
546f7f890ffa
Cosmetics, refactoring.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1378
diff
changeset
|
343 public final ChangedHandler createSpinnerHandler( |
546f7f890ffa
Cosmetics, refactoring.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1378
diff
changeset
|
344 final FeedServiceAsync feedService, |
546f7f890ffa
Cosmetics, refactoring.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1378
diff
changeset
|
345 final FacetRecord facetRecord) |
546f7f890ffa
Cosmetics, refactoring.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1378
diff
changeset
|
346 { |
546f7f890ffa
Cosmetics, refactoring.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1378
diff
changeset
|
347 Config config = Config.getInstance(); |
546f7f890ffa
Cosmetics, refactoring.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1378
diff
changeset
|
348 final String locale = config.getLocale(); |
546f7f890ffa
Cosmetics, refactoring.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1378
diff
changeset
|
349 |
546f7f890ffa
Cosmetics, refactoring.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1378
diff
changeset
|
350 ChangedHandler handler = new ChangedHandler() |
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 @Override |
1436
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
353 public void onChanged(final ChangedEvent ce) { |
1379
546f7f890ffa
Cosmetics, refactoring.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1378
diff
changeset
|
354 if (ce.getValue() == null) { |
546f7f890ffa
Cosmetics, refactoring.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1378
diff
changeset
|
355 return; |
546f7f890ffa
Cosmetics, refactoring.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1378
diff
changeset
|
356 } |
1436
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
357 |
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
358 // 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
|
359 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
|
360 final double selected_km = |
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
361 Double.parseDouble(ce.getValue().toString()); |
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 int _dbid = -1; |
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
364 try { |
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
365 _dbid = Integer.valueOf(facetRecord.getTheme() |
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
366 .getCollectionItem() |
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
367 .getData().get("cross_section.dbid")); |
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
368 } |
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
369 catch (NumberFormatException nfe) { |
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
370 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
|
371 } |
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
372 final int dbid = _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 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
|
375 |
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
376 disable(); |
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
377 |
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
378 kmService.getCrossSectionKMs(locale, map, 2, |
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
379 new AsyncCallback<Map<Integer, Double[]>>() { |
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
380 @Override |
1379
546f7f890ffa
Cosmetics, refactoring.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1378
diff
changeset
|
381 public void onFailure(Throwable caught) { |
1436
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
382 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
|
383 + dbid + ": "+ caught.getMessage()); |
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
384 SC.warn(MSG.getString(caught.getMessage())); |
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
385 updateCollection(); |
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
386 updateGrid(); |
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
387 enable(); |
1379
546f7f890ffa
Cosmetics, refactoring.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1378
diff
changeset
|
388 } |
1436
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
389 @Override |
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
390 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
|
391 Double[] kms = obj.get(dbid); |
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
392 double closest = |
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
393 CrossSectionChartThemePanel.closest(kms, |
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
394 selected_km); |
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
395 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
|
396 + closest); |
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
397 SpinnerItem item = (SpinnerItem) ce.getItem(); |
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
398 item.setValue(closest); |
1472
a2b0b2af529f
Tell master-artifact of collection when cross-section-master changed kilometer.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1470
diff
changeset
|
399 sendFeed(facetRecord.getTheme().getArtifact(), |
a2b0b2af529f
Tell master-artifact of collection when cross-section-master changed kilometer.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1470
diff
changeset
|
400 closest); |
1379
546f7f890ffa
Cosmetics, refactoring.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1378
diff
changeset
|
401 } |
1436
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
402 }); |
1379
546f7f890ffa
Cosmetics, refactoring.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1378
diff
changeset
|
403 } |
546f7f890ffa
Cosmetics, refactoring.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1378
diff
changeset
|
404 }; |
546f7f890ffa
Cosmetics, refactoring.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1378
diff
changeset
|
405 return handler; |
546f7f890ffa
Cosmetics, refactoring.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1378
diff
changeset
|
406 } |
546f7f890ffa
Cosmetics, refactoring.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1378
diff
changeset
|
407 |
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 /** |
1438
432180235caf
Minor refactoring and fix initial settings when creating ui.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1436
diff
changeset
|
410 * 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
|
411 * @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
|
412 * @return label, intialized SpinnerItem. |
432180235caf
Minor refactoring and fix initial settings when creating ui.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1436
diff
changeset
|
413 */ |
432180235caf
Minor refactoring and fix initial settings when creating ui.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1436
diff
changeset
|
414 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
|
415 SpinnerItem spinnerItem = new SpinnerItem(); |
432180235caf
Minor refactoring and fix initial settings when creating ui.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1436
diff
changeset
|
416 spinnerItem.setShowTitle(false); |
432180235caf
Minor refactoring and fix initial settings when creating ui.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1436
diff
changeset
|
417 spinnerItem.setTitle("Waterlevel-Spinner"); |
432180235caf
Minor refactoring and fix initial settings when creating ui.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1436
diff
changeset
|
418 spinnerItem.setWidth(45); |
432180235caf
Minor refactoring and fix initial settings when creating ui.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1436
diff
changeset
|
419 spinnerItem.setDefaultValue(facetRecord.getTheme() |
432180235caf
Minor refactoring and fix initial settings when creating ui.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1436
diff
changeset
|
420 .getCollectionItem() |
1476
edf18a9dfd8b
Uncommented some code paths to avoid unwanted side effects, cosmetics.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1475
diff
changeset
|
421 .getData().get(CS_KM)); |
1438
432180235caf
Minor refactoring and fix initial settings when creating ui.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1436
diff
changeset
|
422 |
432180235caf
Minor refactoring and fix initial settings when creating ui.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1436
diff
changeset
|
423 spinnerItem.setMin(0); |
1475
fb2fefe0325f
Improvements in CrossSectionChartThemePanel.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1472
diff
changeset
|
424 spinnerItem.setMax(2000); |
1445
df7ebcbff984
Bugfixing and feature-adding for cross-sections/areas.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1444
diff
changeset
|
425 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
|
426 spinnerItem.setChangeOnKeypress(true); |
432180235caf
Minor refactoring and fix initial settings when creating ui.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1436
diff
changeset
|
427 return spinnerItem; |
432180235caf
Minor refactoring and fix initial settings when creating ui.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1436
diff
changeset
|
428 } |
432180235caf
Minor refactoring and fix initial settings when creating ui.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1436
diff
changeset
|
429 |
432180235caf
Minor refactoring and fix initial settings when creating ui.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1436
diff
changeset
|
430 |
432180235caf
Minor refactoring and fix initial settings when creating ui.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1436
diff
changeset
|
431 /** |
858
9f07f67f60a5
Subclassed ChartThemePanel, trigger redraws of Chart when interaction with
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
432 * 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
|
433 * @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
|
434 */ |
9f07f67f60a5
Subclassed ChartThemePanel, trigger redraws of Chart when interaction with
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
435 @Override |
9f07f67f60a5
Subclassed ChartThemePanel, trigger redraws of Chart when interaction with
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
436 protected ListGrid createGrid() { |
9f07f67f60a5
Subclassed ChartThemePanel, trigger redraws of Chart when interaction with
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
437 ListGrid list = new ListGrid() { |
9f07f67f60a5
Subclassed ChartThemePanel, trigger redraws of Chart when interaction with
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
438 @Override |
1379
546f7f890ffa
Cosmetics, refactoring.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1378
diff
changeset
|
439 protected Canvas createRecordComponent( |
546f7f890ffa
Cosmetics, refactoring.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1378
diff
changeset
|
440 final ListGridRecord record, |
546f7f890ffa
Cosmetics, refactoring.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1378
diff
changeset
|
441 Integer colNum) |
546f7f890ffa
Cosmetics, refactoring.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1378
diff
changeset
|
442 { |
861
65204f30877b
Display Action Widget only for cross_section theme/facet.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
858
diff
changeset
|
443 // 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
|
444 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
|
445 if (!facetRecord.getTheme().getFacet().equals( |
1379
546f7f890ffa
Cosmetics, refactoring.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1378
diff
changeset
|
446 "cross_section")) |
546f7f890ffa
Cosmetics, refactoring.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1378
diff
changeset
|
447 { |
861
65204f30877b
Display Action Widget only for cross_section theme/facet.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
858
diff
changeset
|
448 return null; |
65204f30877b
Display Action Widget only for cross_section theme/facet.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
858
diff
changeset
|
449 } |
858
9f07f67f60a5
Subclassed ChartThemePanel, trigger redraws of Chart when interaction with
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
450 |
9f07f67f60a5
Subclassed ChartThemePanel, trigger redraws of Chart when interaction with
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
451 String fieldName = this.getFieldName(colNum); |
9f07f67f60a5
Subclassed ChartThemePanel, trigger redraws of Chart when interaction with
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
452 |
888
d6b88f8f88dd
Fix issue flys/issue311 (i18n crossection).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
861
diff
changeset
|
453 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
|
454 HLayout recordCanvas = new HLayout(3); |
9f07f67f60a5
Subclassed ChartThemePanel, trigger redraws of Chart when interaction with
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
455 recordCanvas.setHeight(22); |
9f07f67f60a5
Subclassed ChartThemePanel, trigger redraws of Chart when interaction with
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
456 recordCanvas.setAlign(Alignment.CENTER); |
1438
432180235caf
Minor refactoring and fix initial settings when creating ui.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1436
diff
changeset
|
457 SpinnerItem spinnerItem = createSpinnerItem(facetRecord); |
1379
546f7f890ffa
Cosmetics, refactoring.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1378
diff
changeset
|
458 spinnerItem.addChangedHandler( |
1438
432180235caf
Minor refactoring and fix initial settings when creating ui.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1436
diff
changeset
|
459 createSpinnerHandler(feedService, facetRecord)); |
858
9f07f67f60a5
Subclassed ChartThemePanel, trigger redraws of Chart when interaction with
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
460 |
9f07f67f60a5
Subclassed ChartThemePanel, trigger redraws of Chart when interaction with
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
461 DynamicForm formWrap = new DynamicForm(); |
9f07f67f60a5
Subclassed ChartThemePanel, trigger redraws of Chart when interaction with
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
462 formWrap.setFields(spinnerItem); |
9f07f67f60a5
Subclassed ChartThemePanel, trigger redraws of Chart when interaction with
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
463 formWrap.setTitlePrefix(""); |
9f07f67f60a5
Subclassed ChartThemePanel, trigger redraws of Chart when interaction with
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
464 formWrap.setTitleSuffix(""); |
9f07f67f60a5
Subclassed ChartThemePanel, trigger redraws of Chart when interaction with
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
465 recordCanvas.addMember(formWrap); |
9f07f67f60a5
Subclassed ChartThemePanel, trigger redraws of Chart when interaction with
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
466 return recordCanvas; |
9f07f67f60a5
Subclassed ChartThemePanel, trigger redraws of Chart when interaction with
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
467 } |
9f07f67f60a5
Subclassed ChartThemePanel, trigger redraws of Chart when interaction with
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
468 else { |
9f07f67f60a5
Subclassed ChartThemePanel, trigger redraws of Chart when interaction with
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
469 return null; |
9f07f67f60a5
Subclassed ChartThemePanel, trigger redraws of Chart when interaction with
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
470 } |
9f07f67f60a5
Subclassed ChartThemePanel, trigger redraws of Chart when interaction with
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
471 } |
9f07f67f60a5
Subclassed ChartThemePanel, trigger redraws of Chart when interaction with
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
472 }; |
9f07f67f60a5
Subclassed ChartThemePanel, trigger redraws of Chart when interaction with
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
473 list.setCanResizeFields(true); |
9f07f67f60a5
Subclassed ChartThemePanel, trigger redraws of Chart when interaction with
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
474 list.setShowRecordComponents(true); |
9f07f67f60a5
Subclassed ChartThemePanel, trigger redraws of Chart when interaction with
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
475 list.setShowRecordComponentsByCell(true); |
9f07f67f60a5
Subclassed ChartThemePanel, trigger redraws of Chart when interaction with
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
476 list.setShowAllRecords(true); |
1378
ebba8a8618e6
Fix flys/issue306 (CrossSections: Remove table header context menu).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
891
diff
changeset
|
477 list.setShowHeaderContextMenu(false); |
858
9f07f67f60a5
Subclassed ChartThemePanel, trigger redraws of Chart when interaction with
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
478 return list; |
9f07f67f60a5
Subclassed ChartThemePanel, trigger redraws of Chart when interaction with
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
479 } |
9f07f67f60a5
Subclassed ChartThemePanel, trigger redraws of Chart when interaction with
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
480 |
9f07f67f60a5
Subclassed ChartThemePanel, trigger redraws of Chart when interaction with
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
481 |
9f07f67f60a5
Subclassed ChartThemePanel, trigger redraws of Chart when interaction with
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
482 /** |
9f07f67f60a5
Subclassed ChartThemePanel, trigger redraws of Chart when interaction with
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
483 * 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
|
484 */ |
9f07f67f60a5
Subclassed ChartThemePanel, trigger redraws of Chart when interaction with
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
485 @Override |
9f07f67f60a5
Subclassed ChartThemePanel, trigger redraws of Chart when interaction with
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
486 protected void initGrid() { |
9f07f67f60a5
Subclassed ChartThemePanel, trigger redraws of Chart when interaction with
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
487 list.setCanEdit(true); |
9f07f67f60a5
Subclassed ChartThemePanel, trigger redraws of Chart when interaction with
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
488 list.setCanSort(false); |
9f07f67f60a5
Subclassed ChartThemePanel, trigger redraws of Chart when interaction with
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
489 list.setShowRecordComponents(true); |
9f07f67f60a5
Subclassed ChartThemePanel, trigger redraws of Chart when interaction with
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
490 list.setShowRecordComponentsByCell(true); |
9f07f67f60a5
Subclassed ChartThemePanel, trigger redraws of Chart when interaction with
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
491 list.setShowHeader(true); |
9f07f67f60a5
Subclassed ChartThemePanel, trigger redraws of Chart when interaction with
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
492 list.setWidth100(); |
9f07f67f60a5
Subclassed ChartThemePanel, trigger redraws of Chart when interaction with
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
493 list.setHeight100(); |
9f07f67f60a5
Subclassed ChartThemePanel, trigger redraws of Chart when interaction with
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
494 |
9f07f67f60a5
Subclassed ChartThemePanel, trigger redraws of Chart when interaction with
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
495 list.addEditCompleteHandler(this); |
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 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
|
498 active.setType(ListGridFieldType.BOOLEAN); |
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 ListGridField name = new ListGridField( |
9f07f67f60a5
Subclassed ChartThemePanel, trigger redraws of Chart when interaction with
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
501 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
|
502 name.setType(ListGridFieldType.TEXT); |
9f07f67f60a5
Subclassed ChartThemePanel, trigger redraws of Chart when interaction with
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
503 |
9f07f67f60a5
Subclassed ChartThemePanel, trigger redraws of Chart when interaction with
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
504 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
|
505 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
|
506 |
9f07f67f60a5
Subclassed ChartThemePanel, trigger redraws of Chart when interaction with
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
507 list.setFields(active, name, actions); |
9f07f67f60a5
Subclassed ChartThemePanel, trigger redraws of Chart when interaction with
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
508 } |
1436
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
509 |
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
510 |
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
511 /** Get Current Cross-section Masters uuid. */ |
1470
eef55d18f424
Cosmetics, refactoring, renamed Master to CSMaster to avoid confusion.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1458
diff
changeset
|
512 public String getCurrentCSMaster() { |
eef55d18f424
Cosmetics, refactoring, renamed Master to CSMaster to avoid confusion.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1458
diff
changeset
|
513 return currentCSMasterUUID; |
1436
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
514 } |
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
515 |
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
516 |
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
517 /** Set Current Cross-section Masters uuid. */ |
1470
eef55d18f424
Cosmetics, refactoring, renamed Master to CSMaster to avoid confusion.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1458
diff
changeset
|
518 public void setCurrentCSMaster(String currentMasterUuid) { |
eef55d18f424
Cosmetics, refactoring, renamed Master to CSMaster to avoid confusion.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1458
diff
changeset
|
519 this.currentCSMasterUUID = currentMasterUuid; |
1436
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
520 } |
1444
bdac8a72f7e6
Area creation UI update.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1438
diff
changeset
|
521 |
bdac8a72f7e6
Area creation UI update.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1438
diff
changeset
|
522 |
1457
3d9f81c3f00d
Refactored to use existing code.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1452
diff
changeset
|
523 /** Returns name of cross section area facets. */ |
3d9f81c3f00d
Refactored to use existing code.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1452
diff
changeset
|
524 protected String getAreaFacetName() { |
3d9f81c3f00d
Refactored to use existing code.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1452
diff
changeset
|
525 return "cross_section.area"; |
3d9f81c3f00d
Refactored to use existing code.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1452
diff
changeset
|
526 } |
1444
bdac8a72f7e6
Area creation UI update.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1438
diff
changeset
|
527 |
bdac8a72f7e6
Area creation UI update.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1438
diff
changeset
|
528 |
bdac8a72f7e6
Area creation UI update.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1438
diff
changeset
|
529 /** |
1457
3d9f81c3f00d
Refactored to use existing code.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1452
diff
changeset
|
530 * Return true if two themes are canditates for an area being |
3d9f81c3f00d
Refactored to use existing code.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1452
diff
changeset
|
531 * rendered between them. |
3d9f81c3f00d
Refactored to use existing code.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1452
diff
changeset
|
532 * TODO join with canArea, generalize to allow easier modification |
3d9f81c3f00d
Refactored to use existing code.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1452
diff
changeset
|
533 * in subclasses. |
1444
bdac8a72f7e6
Area creation UI update.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1438
diff
changeset
|
534 */ |
1457
3d9f81c3f00d
Refactored to use existing code.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1452
diff
changeset
|
535 protected boolean areAreaCompatible(Theme a, Theme b) { |
3d9f81c3f00d
Refactored to use existing code.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1452
diff
changeset
|
536 if (a.equals(b)) { |
3d9f81c3f00d
Refactored to use existing code.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1452
diff
changeset
|
537 return false; |
1444
bdac8a72f7e6
Area creation UI update.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1438
diff
changeset
|
538 } |
1457
3d9f81c3f00d
Refactored to use existing code.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1452
diff
changeset
|
539 return (a.getFacet().equals("cross_section") |
3d9f81c3f00d
Refactored to use existing code.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1452
diff
changeset
|
540 || a.getFacet().equals("cross_section_water_line")) |
3d9f81c3f00d
Refactored to use existing code.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1452
diff
changeset
|
541 && (b.getFacet().equals("cross_section") |
3d9f81c3f00d
Refactored to use existing code.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1452
diff
changeset
|
542 || b.getFacet().equals("cross_section_water_line")); |
3d9f81c3f00d
Refactored to use existing code.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1452
diff
changeset
|
543 } |
1444
bdac8a72f7e6
Area creation UI update.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1438
diff
changeset
|
544 |
1452
fa63366ba115
Improved area creation GUI.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1449
diff
changeset
|
545 |
1457
3d9f81c3f00d
Refactored to use existing code.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1452
diff
changeset
|
546 /** |
3d9f81c3f00d
Refactored to use existing code.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1452
diff
changeset
|
547 * True if context menu should contain 'create area' submenu on |
3d9f81c3f00d
Refactored to use existing code.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1452
diff
changeset
|
548 * this theme. |
3d9f81c3f00d
Refactored to use existing code.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1452
diff
changeset
|
549 */ |
3d9f81c3f00d
Refactored to use existing code.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1452
diff
changeset
|
550 protected boolean canArea(Theme a) { |
3d9f81c3f00d
Refactored to use existing code.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1452
diff
changeset
|
551 return a.getFacet().equals("cross_section") |
3d9f81c3f00d
Refactored to use existing code.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1452
diff
changeset
|
552 || a.getFacet().equals("cross_section_water_line"); |
1444
bdac8a72f7e6
Area creation UI update.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1438
diff
changeset
|
553 } |
858
9f07f67f60a5
Subclassed ChartThemePanel, trigger redraws of Chart when interaction with
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
554 } |
9f07f67f60a5
Subclassed ChartThemePanel, trigger redraws of Chart when interaction with
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
555 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : |