Mercurial > dive4elements > river
annotate flys-client/src/main/java/de/intevation/flys/client/client/ui/chart/CrossSectionChartThemePanel.java @ 1496:a882297ce63d
Changed CrossSection spinner-stepsize, adjusted km- and mastersetting.
flys-client/trunk@3594 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Felix Wolfsteller <felix.wolfsteller@intevation.de> |
---|---|
date | Thu, 05 Jan 2012 12:01:11 +0000 |
parents | edf18a9dfd8b |
children | a6f6c61b18be |
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()); |
1445
df7ebcbff984
Bugfixing and feature-adding for cross-sections/areas.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1444
diff
changeset
|
155 return theme.getDescription(); |
df7ebcbff984
Bugfixing and feature-adding for cross-sections/areas.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1444
diff
changeset
|
156 } |
1438
432180235caf
Minor refactoring and fix initial settings when creating ui.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1436
diff
changeset
|
157 } |
432180235caf
Minor refactoring and fix initial settings when creating ui.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1436
diff
changeset
|
158 } |
1445
df7ebcbff984
Bugfixing and feature-adding for cross-sections/areas.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1444
diff
changeset
|
159 // 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
|
160 if (firstCSUuid != null) { |
1470
eef55d18f424
Cosmetics, refactoring, renamed Master to CSMaster to avoid confusion.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1458
diff
changeset
|
161 setCurrentCSMaster(firstCSUuid); |
1445
df7ebcbff984
Bugfixing and feature-adding for cross-sections/areas.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1444
diff
changeset
|
162 feedTellMaster(firstCSUuid); |
df7ebcbff984
Bugfixing and feature-adding for cross-sections/areas.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1444
diff
changeset
|
163 } |
1438
432180235caf
Minor refactoring and fix initial settings when creating ui.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1436
diff
changeset
|
164 return null; |
432180235caf
Minor refactoring and fix initial settings when creating ui.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1436
diff
changeset
|
165 } |
432180235caf
Minor refactoring and fix initial settings when creating ui.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1436
diff
changeset
|
166 |
1444
bdac8a72f7e6
Area creation UI update.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1438
diff
changeset
|
167 |
1438
432180235caf
Minor refactoring and fix initial settings when creating ui.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1436
diff
changeset
|
168 /** |
1436
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
169 * 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
|
170 */ |
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
171 @Override |
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
172 protected VLayout createLayout() { |
1438
432180235caf
Minor refactoring and fix initial settings when creating ui.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1436
diff
changeset
|
173 layout = super.createLayout(); |
1436
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
174 |
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
175 // Create "set master" combobox. |
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
176 SelectItem cbItem = new SelectItem(); |
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
177 |
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
178 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
|
179 cbItem.setType("comboBox"); |
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
180 final LinkedHashMap<String, String> valueMap = |
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
181 getThemeList().toMapArtifactUUIDDescription("cross_section"); |
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
182 cbItem.setValueMap(valueMap); |
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
183 |
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
184 final DynamicForm form = new DynamicForm(); |
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
185 form.setWidth(200); |
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
186 form.setFields(cbItem); |
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
187 layout.addMember(form); |
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
188 |
1438
432180235caf
Minor refactoring and fix initial settings when creating ui.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1436
diff
changeset
|
189 Config config = Config.getInstance(); |
432180235caf
Minor refactoring and fix initial settings when creating ui.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1436
diff
changeset
|
190 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
|
191 findCurrentCSMaster(); |
eef55d18f424
Cosmetics, refactoring, renamed Master to CSMaster to avoid confusion.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1458
diff
changeset
|
192 cbItem.setValue(getCurrentCSMaster()); |
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 // 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
|
195 // new master. |
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
196 cbItem.addChangeHandler(new ChangeHandler() { |
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
197 public void onChange(ChangeEvent event) { |
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
198 String selectedItem = (String) event.getValue(); |
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
199 final String artifact = selectedItem; |
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
200 |
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
201 disable(); |
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 // 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
|
204 if (getCurrentCSMaster() != null) { |
1436
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
205 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
|
206 CS_IS_MASTER, "0"); |
1436
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
207 feedService.feed( |
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
208 locale, |
1475
fb2fefe0325f
Improvements in CrossSectionChartThemePanel.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1472
diff
changeset
|
209 artifactReference(getCurrentCSMaster()), |
1436
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
210 feedData, |
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
211 new AsyncCallback<Artifact>() { |
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
212 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
|
213 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
|
214 caught.getMessage()); |
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
215 SC.warn(MSG.getString(caught.getMessage())); |
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
216 enable(); |
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
217 } |
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
218 public void onSuccess(Artifact oldMaster) { |
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
219 GWT.log("Successfully un-mastered artifact."); |
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
220 feedTellMaster(artifact); |
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 }); |
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
223 } |
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
224 else { |
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
225 feedTellMaster(artifact); |
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
226 } |
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
227 } |
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
228 }); |
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
229 |
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
230 return layout; |
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
231 } |
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
232 |
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
233 |
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
234 /** 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
|
235 public void disable() { |
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
236 this.layout.setDisabled(true); |
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
237 } |
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
238 |
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
239 |
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
240 /** 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
|
241 public void enable() { |
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
242 this.layout.setDisabled(false); |
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
243 } |
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
244 |
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
245 |
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 * 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
|
248 * 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
|
249 * the last one is taken. |
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
250 * @param in possible return values. |
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
251 * @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
|
252 * @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
|
253 */ |
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
254 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
|
255 if (in == null || in.length == 0) { |
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
256 return -1; |
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 if (in[0] == to) { |
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
259 return to; |
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
260 } |
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
261 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
|
262 double bestMatch = in[0]; |
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
263 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
|
264 if (in[i] == to) { |
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
265 return to; |
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
266 } |
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
267 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
|
268 if (diff < minDiff) { |
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
269 minDiff = diff; |
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
270 bestMatch = in[i]; |
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
271 } |
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
272 } |
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
273 return bestMatch; |
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
274 } |
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
275 |
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
276 |
1475
fb2fefe0325f
Improvements in CrossSectionChartThemePanel.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1472
diff
changeset
|
277 /** 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
|
278 * 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
|
279 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
|
280 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
|
281 final String locale = config.getLocale(); |
1436
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
282 |
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
283 Data[] feedData = |
1476
edf18a9dfd8b
Uncommented some code paths to avoid unwanted side effects, cosmetics.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1475
diff
changeset
|
284 DefaultData.createSimpleStringDataArray(CS_KM, |
1436
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
285 Double.valueOf(kmD).toString()); |
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
286 |
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
287 disable(); |
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
288 feedService.feed( |
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
289 locale, |
1475
fb2fefe0325f
Improvements in CrossSectionChartThemePanel.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1472
diff
changeset
|
290 artifactReference(artUUID), |
1436
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
291 feedData, |
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
292 new AsyncCallback<Artifact>() { |
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
293 @Override |
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
294 public void onFailure(Throwable caught) { |
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
295 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
|
296 SC.warn(MSG.getString(caught.getMessage())); |
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
297 enable(); |
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
298 } |
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
299 @Override |
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
300 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
|
301 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
|
302 requestRedraw(); |
1496
a882297ce63d
Changed CrossSection spinner-stepsize, adjusted km- and mastersetting.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1476
diff
changeset
|
303 enable(); |
1436
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
304 } |
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
305 }); |
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
306 } |
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
307 |
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
308 |
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
309 /** |
1379
546f7f890ffa
Cosmetics, refactoring.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1378
diff
changeset
|
310 * Create the handler for ChangeEvents on the Spinner in the |
546f7f890ffa
Cosmetics, refactoring.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1378
diff
changeset
|
311 * facets that control km of cross section. |
546f7f890ffa
Cosmetics, refactoring.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1378
diff
changeset
|
312 * |
546f7f890ffa
Cosmetics, refactoring.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1378
diff
changeset
|
313 * @param feedService The FeedService to send (changed) data to. |
546f7f890ffa
Cosmetics, refactoring.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1378
diff
changeset
|
314 * @param facetRecord The FacetRecord (~row in table) where this |
546f7f890ffa
Cosmetics, refactoring.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1378
diff
changeset
|
315 * handler is added to (to a child, to be exact). |
546f7f890ffa
Cosmetics, refactoring.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1378
diff
changeset
|
316 */ |
546f7f890ffa
Cosmetics, refactoring.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1378
diff
changeset
|
317 public final ChangedHandler createSpinnerHandler( |
546f7f890ffa
Cosmetics, refactoring.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1378
diff
changeset
|
318 final FeedServiceAsync feedService, |
546f7f890ffa
Cosmetics, refactoring.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1378
diff
changeset
|
319 final FacetRecord facetRecord) |
546f7f890ffa
Cosmetics, refactoring.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1378
diff
changeset
|
320 { |
1496
a882297ce63d
Changed CrossSection spinner-stepsize, adjusted km- and mastersetting.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1476
diff
changeset
|
321 Config config = Config.getInstance(); |
a882297ce63d
Changed CrossSection spinner-stepsize, adjusted km- and mastersetting.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1476
diff
changeset
|
322 final String locale = config.getLocale(); |
1379
546f7f890ffa
Cosmetics, refactoring.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1378
diff
changeset
|
323 |
546f7f890ffa
Cosmetics, refactoring.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1378
diff
changeset
|
324 ChangedHandler handler = new ChangedHandler() |
546f7f890ffa
Cosmetics, refactoring.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1378
diff
changeset
|
325 { |
546f7f890ffa
Cosmetics, refactoring.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1378
diff
changeset
|
326 @Override |
1436
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
327 public void onChanged(final ChangedEvent ce) { |
1379
546f7f890ffa
Cosmetics, refactoring.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1378
diff
changeset
|
328 if (ce.getValue() == null) { |
546f7f890ffa
Cosmetics, refactoring.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1378
diff
changeset
|
329 return; |
546f7f890ffa
Cosmetics, refactoring.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1378
diff
changeset
|
330 } |
1436
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 // 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
|
333 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
|
334 final double selected_km = |
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
335 Double.parseDouble(ce.getValue().toString()); |
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
336 |
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
337 int _dbid = -1; |
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
338 try { |
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
339 _dbid = Integer.valueOf(facetRecord.getTheme() |
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
340 .getCollectionItem() |
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
341 .getData().get("cross_section.dbid")); |
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
342 } |
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
343 catch (NumberFormatException nfe) { |
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
344 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
|
345 } |
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
346 final int dbid = _dbid; |
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
347 |
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
348 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
|
349 |
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
350 disable(); |
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
351 |
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
352 kmService.getCrossSectionKMs(locale, map, 2, |
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
353 new AsyncCallback<Map<Integer, Double[]>>() { |
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
354 @Override |
1379
546f7f890ffa
Cosmetics, refactoring.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1378
diff
changeset
|
355 public void onFailure(Throwable caught) { |
1436
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
356 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
|
357 + dbid + ": "+ caught.getMessage()); |
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
358 SC.warn(MSG.getString(caught.getMessage())); |
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
359 updateCollection(); |
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
360 updateGrid(); |
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
361 enable(); |
1379
546f7f890ffa
Cosmetics, refactoring.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1378
diff
changeset
|
362 } |
1436
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
363 @Override |
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
364 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
|
365 Double[] kms = obj.get(dbid); |
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
366 double closest = |
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
367 CrossSectionChartThemePanel.closest(kms, |
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
368 selected_km); |
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
369 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
|
370 + closest); |
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
371 SpinnerItem item = (SpinnerItem) ce.getItem(); |
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
372 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
|
373 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
|
374 closest); |
1379
546f7f890ffa
Cosmetics, refactoring.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1378
diff
changeset
|
375 } |
1436
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
376 }); |
1379
546f7f890ffa
Cosmetics, refactoring.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1378
diff
changeset
|
377 } |
546f7f890ffa
Cosmetics, refactoring.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1378
diff
changeset
|
378 }; |
546f7f890ffa
Cosmetics, refactoring.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1378
diff
changeset
|
379 return handler; |
546f7f890ffa
Cosmetics, refactoring.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1378
diff
changeset
|
380 } |
546f7f890ffa
Cosmetics, refactoring.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1378
diff
changeset
|
381 |
546f7f890ffa
Cosmetics, refactoring.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1378
diff
changeset
|
382 |
546f7f890ffa
Cosmetics, refactoring.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1378
diff
changeset
|
383 /** |
1438
432180235caf
Minor refactoring and fix initial settings when creating ui.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1436
diff
changeset
|
384 * 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
|
385 * @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
|
386 * @return label, intialized SpinnerItem. |
432180235caf
Minor refactoring and fix initial settings when creating ui.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1436
diff
changeset
|
387 */ |
432180235caf
Minor refactoring and fix initial settings when creating ui.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1436
diff
changeset
|
388 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
|
389 SpinnerItem spinnerItem = new SpinnerItem(); |
432180235caf
Minor refactoring and fix initial settings when creating ui.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1436
diff
changeset
|
390 spinnerItem.setShowTitle(false); |
432180235caf
Minor refactoring and fix initial settings when creating ui.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1436
diff
changeset
|
391 spinnerItem.setTitle("Waterlevel-Spinner"); |
432180235caf
Minor refactoring and fix initial settings when creating ui.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1436
diff
changeset
|
392 spinnerItem.setWidth(45); |
1496
a882297ce63d
Changed CrossSection spinner-stepsize, adjusted km- and mastersetting.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1476
diff
changeset
|
393 spinnerItem.setDefaultValue(Double.valueOf(facetRecord.getTheme() |
1438
432180235caf
Minor refactoring and fix initial settings when creating ui.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1436
diff
changeset
|
394 .getCollectionItem() |
1496
a882297ce63d
Changed CrossSection spinner-stepsize, adjusted km- and mastersetting.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1476
diff
changeset
|
395 .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
|
396 |
432180235caf
Minor refactoring and fix initial settings when creating ui.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1436
diff
changeset
|
397 spinnerItem.setMin(0); |
1475
fb2fefe0325f
Improvements in CrossSectionChartThemePanel.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1472
diff
changeset
|
398 spinnerItem.setMax(2000); |
1496
a882297ce63d
Changed CrossSection spinner-stepsize, adjusted km- and mastersetting.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1476
diff
changeset
|
399 spinnerItem.setStep(0.1f); |
1438
432180235caf
Minor refactoring and fix initial settings when creating ui.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1436
diff
changeset
|
400 spinnerItem.setChangeOnKeypress(true); |
432180235caf
Minor refactoring and fix initial settings when creating ui.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1436
diff
changeset
|
401 return spinnerItem; |
432180235caf
Minor refactoring and fix initial settings when creating ui.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1436
diff
changeset
|
402 } |
432180235caf
Minor refactoring and fix initial settings when creating ui.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1436
diff
changeset
|
403 |
432180235caf
Minor refactoring and fix initial settings when creating ui.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1436
diff
changeset
|
404 |
432180235caf
Minor refactoring and fix initial settings when creating ui.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1436
diff
changeset
|
405 /** |
858
9f07f67f60a5
Subclassed ChartThemePanel, trigger redraws of Chart when interaction with
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
406 * 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
|
407 * @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
|
408 */ |
9f07f67f60a5
Subclassed ChartThemePanel, trigger redraws of Chart when interaction with
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
409 @Override |
9f07f67f60a5
Subclassed ChartThemePanel, trigger redraws of Chart when interaction with
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
410 protected ListGrid createGrid() { |
9f07f67f60a5
Subclassed ChartThemePanel, trigger redraws of Chart when interaction with
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
411 ListGrid list = new ListGrid() { |
9f07f67f60a5
Subclassed ChartThemePanel, trigger redraws of Chart when interaction with
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
412 @Override |
1379
546f7f890ffa
Cosmetics, refactoring.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1378
diff
changeset
|
413 protected Canvas createRecordComponent( |
546f7f890ffa
Cosmetics, refactoring.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1378
diff
changeset
|
414 final ListGridRecord record, |
546f7f890ffa
Cosmetics, refactoring.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1378
diff
changeset
|
415 Integer colNum) |
546f7f890ffa
Cosmetics, refactoring.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1378
diff
changeset
|
416 { |
861
65204f30877b
Display Action Widget only for cross_section theme/facet.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
858
diff
changeset
|
417 // 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
|
418 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
|
419 if (!facetRecord.getTheme().getFacet().equals( |
1379
546f7f890ffa
Cosmetics, refactoring.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1378
diff
changeset
|
420 "cross_section")) |
546f7f890ffa
Cosmetics, refactoring.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1378
diff
changeset
|
421 { |
861
65204f30877b
Display Action Widget only for cross_section theme/facet.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
858
diff
changeset
|
422 return null; |
65204f30877b
Display Action Widget only for cross_section theme/facet.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
858
diff
changeset
|
423 } |
858
9f07f67f60a5
Subclassed ChartThemePanel, trigger redraws of Chart when interaction with
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
424 |
9f07f67f60a5
Subclassed ChartThemePanel, trigger redraws of Chart when interaction with
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
425 String fieldName = this.getFieldName(colNum); |
9f07f67f60a5
Subclassed ChartThemePanel, trigger redraws of Chart when interaction with
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
426 |
888
d6b88f8f88dd
Fix issue flys/issue311 (i18n crossection).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
861
diff
changeset
|
427 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
|
428 HLayout recordCanvas = new HLayout(3); |
9f07f67f60a5
Subclassed ChartThemePanel, trigger redraws of Chart when interaction with
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
429 recordCanvas.setHeight(22); |
9f07f67f60a5
Subclassed ChartThemePanel, trigger redraws of Chart when interaction with
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
430 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
|
431 SpinnerItem spinnerItem = createSpinnerItem(facetRecord); |
1379
546f7f890ffa
Cosmetics, refactoring.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1378
diff
changeset
|
432 spinnerItem.addChangedHandler( |
1438
432180235caf
Minor refactoring and fix initial settings when creating ui.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1436
diff
changeset
|
433 createSpinnerHandler(feedService, facetRecord)); |
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 DynamicForm formWrap = new DynamicForm(); |
9f07f67f60a5
Subclassed ChartThemePanel, trigger redraws of Chart when interaction with
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
436 formWrap.setFields(spinnerItem); |
9f07f67f60a5
Subclassed ChartThemePanel, trigger redraws of Chart when interaction with
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
437 formWrap.setTitlePrefix(""); |
9f07f67f60a5
Subclassed ChartThemePanel, trigger redraws of Chart when interaction with
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
438 formWrap.setTitleSuffix(""); |
9f07f67f60a5
Subclassed ChartThemePanel, trigger redraws of Chart when interaction with
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
439 recordCanvas.addMember(formWrap); |
9f07f67f60a5
Subclassed ChartThemePanel, trigger redraws of Chart when interaction with
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
440 return recordCanvas; |
9f07f67f60a5
Subclassed ChartThemePanel, trigger redraws of Chart when interaction with
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
441 } |
9f07f67f60a5
Subclassed ChartThemePanel, trigger redraws of Chart when interaction with
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
442 else { |
9f07f67f60a5
Subclassed ChartThemePanel, trigger redraws of Chart when interaction with
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
443 return null; |
9f07f67f60a5
Subclassed ChartThemePanel, trigger redraws of Chart when interaction with
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
444 } |
9f07f67f60a5
Subclassed ChartThemePanel, trigger redraws of Chart when interaction with
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
445 } |
9f07f67f60a5
Subclassed ChartThemePanel, trigger redraws of Chart when interaction with
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
446 }; |
9f07f67f60a5
Subclassed ChartThemePanel, trigger redraws of Chart when interaction with
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
447 list.setCanResizeFields(true); |
9f07f67f60a5
Subclassed ChartThemePanel, trigger redraws of Chart when interaction with
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
448 list.setShowRecordComponents(true); |
9f07f67f60a5
Subclassed ChartThemePanel, trigger redraws of Chart when interaction with
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
449 list.setShowRecordComponentsByCell(true); |
9f07f67f60a5
Subclassed ChartThemePanel, trigger redraws of Chart when interaction with
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
450 list.setShowAllRecords(true); |
1378
ebba8a8618e6
Fix flys/issue306 (CrossSections: Remove table header context menu).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
891
diff
changeset
|
451 list.setShowHeaderContextMenu(false); |
858
9f07f67f60a5
Subclassed ChartThemePanel, trigger redraws of Chart when interaction with
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
452 return list; |
9f07f67f60a5
Subclassed ChartThemePanel, trigger redraws of Chart when interaction with
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
453 } |
9f07f67f60a5
Subclassed ChartThemePanel, trigger redraws of Chart when interaction with
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
454 |
9f07f67f60a5
Subclassed ChartThemePanel, trigger redraws of Chart when interaction with
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
455 |
9f07f67f60a5
Subclassed ChartThemePanel, trigger redraws of Chart when interaction with
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
456 /** |
9f07f67f60a5
Subclassed ChartThemePanel, trigger redraws of Chart when interaction with
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
457 * 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
|
458 */ |
9f07f67f60a5
Subclassed ChartThemePanel, trigger redraws of Chart when interaction with
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
459 @Override |
9f07f67f60a5
Subclassed ChartThemePanel, trigger redraws of Chart when interaction with
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
460 protected void initGrid() { |
9f07f67f60a5
Subclassed ChartThemePanel, trigger redraws of Chart when interaction with
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
461 list.setCanEdit(true); |
9f07f67f60a5
Subclassed ChartThemePanel, trigger redraws of Chart when interaction with
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
462 list.setCanSort(false); |
9f07f67f60a5
Subclassed ChartThemePanel, trigger redraws of Chart when interaction with
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
463 list.setShowRecordComponents(true); |
9f07f67f60a5
Subclassed ChartThemePanel, trigger redraws of Chart when interaction with
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
464 list.setShowRecordComponentsByCell(true); |
9f07f67f60a5
Subclassed ChartThemePanel, trigger redraws of Chart when interaction with
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
465 list.setShowHeader(true); |
9f07f67f60a5
Subclassed ChartThemePanel, trigger redraws of Chart when interaction with
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
466 list.setWidth100(); |
9f07f67f60a5
Subclassed ChartThemePanel, trigger redraws of Chart when interaction with
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
467 list.setHeight100(); |
9f07f67f60a5
Subclassed ChartThemePanel, trigger redraws of Chart when interaction with
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
468 |
9f07f67f60a5
Subclassed ChartThemePanel, trigger redraws of Chart when interaction with
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
469 list.addEditCompleteHandler(this); |
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 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
|
472 active.setType(ListGridFieldType.BOOLEAN); |
9f07f67f60a5
Subclassed ChartThemePanel, trigger redraws of Chart when interaction with
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
473 |
9f07f67f60a5
Subclassed ChartThemePanel, trigger redraws of Chart when interaction with
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
474 ListGridField name = new ListGridField( |
9f07f67f60a5
Subclassed ChartThemePanel, trigger redraws of Chart when interaction with
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
475 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
|
476 name.setType(ListGridFieldType.TEXT); |
9f07f67f60a5
Subclassed ChartThemePanel, trigger redraws of Chart when interaction with
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
477 |
9f07f67f60a5
Subclassed ChartThemePanel, trigger redraws of Chart when interaction with
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
478 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
|
479 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
|
480 |
9f07f67f60a5
Subclassed ChartThemePanel, trigger redraws of Chart when interaction with
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
481 list.setFields(active, name, actions); |
9f07f67f60a5
Subclassed ChartThemePanel, trigger redraws of Chart when interaction with
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
482 } |
1436
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
483 |
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
484 |
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
485 /** 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
|
486 public String getCurrentCSMaster() { |
eef55d18f424
Cosmetics, refactoring, renamed Master to CSMaster to avoid confusion.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1458
diff
changeset
|
487 return currentCSMasterUUID; |
1436
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
488 } |
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
489 |
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
490 |
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
491 /** 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
|
492 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
|
493 this.currentCSMasterUUID = currentMasterUuid; |
1436
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
494 } |
1444
bdac8a72f7e6
Area creation UI update.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1438
diff
changeset
|
495 |
bdac8a72f7e6
Area creation UI update.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1438
diff
changeset
|
496 |
1457
3d9f81c3f00d
Refactored to use existing code.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1452
diff
changeset
|
497 /** Returns name of cross section area facets. */ |
3d9f81c3f00d
Refactored to use existing code.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1452
diff
changeset
|
498 protected String getAreaFacetName() { |
3d9f81c3f00d
Refactored to use existing code.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1452
diff
changeset
|
499 return "cross_section.area"; |
3d9f81c3f00d
Refactored to use existing code.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1452
diff
changeset
|
500 } |
1444
bdac8a72f7e6
Area creation UI update.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1438
diff
changeset
|
501 |
bdac8a72f7e6
Area creation UI update.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1438
diff
changeset
|
502 |
bdac8a72f7e6
Area creation UI update.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1438
diff
changeset
|
503 /** |
1457
3d9f81c3f00d
Refactored to use existing code.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1452
diff
changeset
|
504 * 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
|
505 * rendered between them. |
3d9f81c3f00d
Refactored to use existing code.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1452
diff
changeset
|
506 * 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
|
507 * in subclasses. |
1444
bdac8a72f7e6
Area creation UI update.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1438
diff
changeset
|
508 */ |
1457
3d9f81c3f00d
Refactored to use existing code.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1452
diff
changeset
|
509 protected boolean areAreaCompatible(Theme a, Theme b) { |
3d9f81c3f00d
Refactored to use existing code.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1452
diff
changeset
|
510 if (a.equals(b)) { |
3d9f81c3f00d
Refactored to use existing code.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1452
diff
changeset
|
511 return false; |
1444
bdac8a72f7e6
Area creation UI update.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1438
diff
changeset
|
512 } |
1457
3d9f81c3f00d
Refactored to use existing code.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1452
diff
changeset
|
513 return (a.getFacet().equals("cross_section") |
3d9f81c3f00d
Refactored to use existing code.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1452
diff
changeset
|
514 || a.getFacet().equals("cross_section_water_line")) |
3d9f81c3f00d
Refactored to use existing code.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1452
diff
changeset
|
515 && (b.getFacet().equals("cross_section") |
3d9f81c3f00d
Refactored to use existing code.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1452
diff
changeset
|
516 || b.getFacet().equals("cross_section_water_line")); |
3d9f81c3f00d
Refactored to use existing code.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1452
diff
changeset
|
517 } |
1444
bdac8a72f7e6
Area creation UI update.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1438
diff
changeset
|
518 |
1452
fa63366ba115
Improved area creation GUI.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1449
diff
changeset
|
519 |
1457
3d9f81c3f00d
Refactored to use existing code.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1452
diff
changeset
|
520 /** |
3d9f81c3f00d
Refactored to use existing code.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1452
diff
changeset
|
521 * 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
|
522 * this theme. |
3d9f81c3f00d
Refactored to use existing code.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1452
diff
changeset
|
523 */ |
3d9f81c3f00d
Refactored to use existing code.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1452
diff
changeset
|
524 protected boolean canArea(Theme a) { |
3d9f81c3f00d
Refactored to use existing code.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1452
diff
changeset
|
525 return a.getFacet().equals("cross_section") |
3d9f81c3f00d
Refactored to use existing code.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1452
diff
changeset
|
526 || a.getFacet().equals("cross_section_water_line"); |
1444
bdac8a72f7e6
Area creation UI update.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1438
diff
changeset
|
527 } |
858
9f07f67f60a5
Subclassed ChartThemePanel, trigger redraws of Chart when interaction with
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
528 } |
9f07f67f60a5
Subclassed ChartThemePanel, trigger redraws of Chart when interaction with
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
529 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : |