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