Mercurial > dive4elements > river
annotate flys-client/src/main/java/de/intevation/flys/client/client/ui/chart/CrossSectionChartThemePanel.java @ 2544:04bd9f1611a1
Resized the km spinner for cross section themes.
flys-client/trunk@4502 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Raimund Renkert <raimund.renkert@intevation.de> |
---|---|
date | Thu, 24 May 2012 11:16:01 +0000 |
parents | b3bf9e5ce9e6 |
children | 51ed89b754ae |
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 |
1519
a6f6c61b18be
Implemented synchronous navigation through cross section profiles.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1496
diff
changeset
|
3 import java.util.ArrayList; |
1436
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
4 import java.util.HashMap; |
2463
0eeceffd50e3
Make synchron navigation of CrossSections a per-theme option, not global one.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2462
diff
changeset
|
5 import java.util.HashSet; |
1436
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
6 import java.util.Map; |
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
7 import java.util.LinkedHashMap; |
1519
a6f6c61b18be
Implemented synchronous navigation through cross section profiles.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1496
diff
changeset
|
8 import java.util.List; |
1436
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
9 |
858
9f07f67f60a5
Subclassed ChartThemePanel, trigger redraws of Chart when interaction with
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
10 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
|
11 |
2513
89814cc6e922
Fix issue652: spinner input.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2491
diff
changeset
|
12 import com.google.gwt.i18n.client.NumberFormat; |
89814cc6e922
Fix issue652: spinner input.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2491
diff
changeset
|
13 |
1436
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
14 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
|
15 |
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
16 import com.smartgwt.client.util.SC; |
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
17 |
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
18 import com.smartgwt.client.types.ListGridFieldType; |
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
19 |
2513
89814cc6e922
Fix issue652: spinner input.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2491
diff
changeset
|
20 import com.smartgwt.client.data.Record; |
2484
6f30bbd98618
Small fix for retrieving closest km.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2482
diff
changeset
|
21 import com.smartgwt.client.widgets.Button; |
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.Canvas; |
2484
6f30bbd98618
Small fix for retrieving closest km.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2482
diff
changeset
|
23 import com.smartgwt.client.widgets.Label; |
858
9f07f67f60a5
Subclassed ChartThemePanel, trigger redraws of Chart when interaction with
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
24 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
|
25 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
|
26 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
|
27 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
|
28 import com.smartgwt.client.widgets.layout.VLayout; |
2513
89814cc6e922
Fix issue652: spinner input.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2491
diff
changeset
|
29 import com.smartgwt.client.widgets.form.fields.FormItem; |
858
9f07f67f60a5
Subclassed ChartThemePanel, trigger redraws of Chart when interaction with
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
30 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
|
31 import com.smartgwt.client.widgets.form.DynamicForm; |
2513
89814cc6e922
Fix issue652: spinner input.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2491
diff
changeset
|
32 import com.smartgwt.client.widgets.form.FormItemValueFormatter; |
89814cc6e922
Fix issue652: spinner input.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2491
diff
changeset
|
33 import com.smartgwt.client.widgets.form.FormItemValueParser; |
1436
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
34 |
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
35 import com.smartgwt.client.widgets.form.fields.SelectItem; |
2490
4d93f9255caa
Improve km-Spinner behaviour, allow text input (alpha).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2486
diff
changeset
|
36 import com.smartgwt.client.widgets.form.fields.TextItem; |
1436
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
37 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
|
38 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
|
39 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
|
40 import com.smartgwt.client.widgets.form.fields.events.ChangeHandler; |
2491
18e59b0b4a71
Fix imports.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2490
diff
changeset
|
41 import com.smartgwt.client.widgets.form.fields.events.KeyPressEvent; |
18e59b0b4a71
Fix imports.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2490
diff
changeset
|
42 import com.smartgwt.client.widgets.form.fields.events.KeyPressHandler; |
858
9f07f67f60a5
Subclassed ChartThemePanel, trigger redraws of Chart when interaction with
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
43 |
1519
a6f6c61b18be
Implemented synchronous navigation through cross section profiles.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1496
diff
changeset
|
44 import com.smartgwt.client.widgets.menu.Menu; |
a6f6c61b18be
Implemented synchronous navigation through cross section profiles.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1496
diff
changeset
|
45 import com.smartgwt.client.widgets.menu.MenuItem; |
2484
6f30bbd98618
Small fix for retrieving closest km.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2482
diff
changeset
|
46 |
2491
18e59b0b4a71
Fix imports.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2490
diff
changeset
|
47 import com.smartgwt.client.widgets.form.fields.events.BlurEvent; |
18e59b0b4a71
Fix imports.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2490
diff
changeset
|
48 import com.smartgwt.client.widgets.form.fields.events.BlurHandler; |
2484
6f30bbd98618
Small fix for retrieving closest km.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2482
diff
changeset
|
49 import com.smartgwt.client.widgets.events.ClickEvent; |
1519
a6f6c61b18be
Implemented synchronous navigation through cross section profiles.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1496
diff
changeset
|
50 import com.smartgwt.client.widgets.menu.events.ClickHandler; |
a6f6c61b18be
Implemented synchronous navigation through cross section profiles.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1496
diff
changeset
|
51 import com.smartgwt.client.widgets.menu.events.MenuItemClickEvent; |
a6f6c61b18be
Implemented synchronous navigation through cross section profiles.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1496
diff
changeset
|
52 |
858
9f07f67f60a5
Subclassed ChartThemePanel, trigger redraws of Chart when interaction with
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
53 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
|
54 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
|
55 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
|
56 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
|
57 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
|
58 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
|
59 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
|
60 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
|
61 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
|
62 |
1444
bdac8a72f7e6
Area creation UI update.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1438
diff
changeset
|
63 import de.intevation.flys.client.client.services.CrossSectionKMServiceAsync; |
bdac8a72f7e6
Area creation UI update.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1438
diff
changeset
|
64 import de.intevation.flys.client.client.services.LoadArtifactService; |
bdac8a72f7e6
Area creation UI update.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1438
diff
changeset
|
65 import de.intevation.flys.client.client.services.LoadArtifactServiceAsync; |
bdac8a72f7e6
Area creation UI update.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1438
diff
changeset
|
66 |
1472
a2b0b2af529f
Tell master-artifact of collection when cross-section-master changed kilometer.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1470
diff
changeset
|
67 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
|
68 |
1444
bdac8a72f7e6
Area creation UI update.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1438
diff
changeset
|
69 |
858
9f07f67f60a5
Subclassed ChartThemePanel, trigger redraws of Chart when interaction with
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
70 /** |
9f07f67f60a5
Subclassed ChartThemePanel, trigger redraws of Chart when interaction with
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
71 * 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
|
72 * needed for interaction in the CrossSection Charts and a selector to |
2481
37438d7228b4
Cosmetics.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2464
diff
changeset
|
73 * declare which cross section profile is "master" (waterlevels refer to the |
37438d7228b4
Cosmetics.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2464
diff
changeset
|
74 * chosen kilometer of that cross section profile). |
1457
3d9f81c3f00d
Refactored to use existing code.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1452
diff
changeset
|
75 * 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
|
76 */ |
9f07f67f60a5
Subclassed ChartThemePanel, trigger redraws of Chart when interaction with
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
77 public class CrossSectionChartThemePanel |
9f07f67f60a5
Subclassed ChartThemePanel, trigger redraws of Chart when interaction with
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
78 extends ChartThemePanel { |
1444
bdac8a72f7e6
Area creation UI update.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1438
diff
changeset
|
79 /** Artifact Clone/Creation service. */ |
bdac8a72f7e6
Area creation UI update.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1438
diff
changeset
|
80 protected LoadArtifactServiceAsync loadService = |
bdac8a72f7e6
Area creation UI update.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1438
diff
changeset
|
81 GWT.create(LoadArtifactService.class); |
858
9f07f67f60a5
Subclassed ChartThemePanel, trigger redraws of Chart when interaction with
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
82 |
1436
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
83 /** 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
|
84 CrossSectionKMServiceAsync kmService = GWT.create( |
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
85 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
|
86 |
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
87 /** 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
|
88 protected String currentCSMasterUUID; |
1436
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
89 |
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
90 /** 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
|
91 protected VLayout layout; |
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
92 |
1475
fb2fefe0325f
Improvements in CrossSectionChartThemePanel.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1472
diff
changeset
|
93 /** Data item name for CrossSections selected km. */ |
1476
edf18a9dfd8b
Uncommented some code paths to avoid unwanted side effects, cosmetics.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1475
diff
changeset
|
94 protected static String CS_KM = "cross_section.km"; |
edf18a9dfd8b
Uncommented some code paths to avoid unwanted side effects, cosmetics.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1475
diff
changeset
|
95 |
edf18a9dfd8b
Uncommented some code paths to avoid unwanted side effects, cosmetics.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1475
diff
changeset
|
96 /** Data item name for CrossSections selected km. */ |
edf18a9dfd8b
Uncommented some code paths to avoid unwanted side effects, cosmetics.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1475
diff
changeset
|
97 protected static String CS_IS_MASTER = "cross_section.master?"; |
1475
fb2fefe0325f
Improvements in CrossSectionChartThemePanel.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1472
diff
changeset
|
98 |
2463
0eeceffd50e3
Make synchron navigation of CrossSections a per-theme option, not global one.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2462
diff
changeset
|
99 /** List of cross-section themes through which is moved through synchronously. */ |
0eeceffd50e3
Make synchron navigation of CrossSections a per-theme option, not global one.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2462
diff
changeset
|
100 protected HashSet synchronCrossSectionThemes = new HashSet(); |
1519
a6f6c61b18be
Implemented synchronous navigation through cross section profiles.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1496
diff
changeset
|
101 |
1533
7fcec57c2f2c
Add cross sections loaded from datacage to the master artifacts list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1519
diff
changeset
|
102 /** Data for master artifact combobox.*/ |
7fcec57c2f2c
Add cross sections loaded from datacage to the master artifacts list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1519
diff
changeset
|
103 protected LinkedHashMap<String, String> masters; |
7fcec57c2f2c
Add cross sections loaded from datacage to the master artifacts list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1519
diff
changeset
|
104 |
7fcec57c2f2c
Add cross sections loaded from datacage to the master artifacts list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1519
diff
changeset
|
105 /** Combobox for master artifacts.*/ |
7fcec57c2f2c
Add cross sections loaded from datacage to the master artifacts list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1519
diff
changeset
|
106 protected SelectItem masterCb; |
1475
fb2fefe0325f
Improvements in CrossSectionChartThemePanel.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1472
diff
changeset
|
107 |
1573
0fbbcec35462
Improved spinner-behaviour in cross section km control.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1572
diff
changeset
|
108 |
858
9f07f67f60a5
Subclassed ChartThemePanel, trigger redraws of Chart when interaction with
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
109 /** |
9f07f67f60a5
Subclassed ChartThemePanel, trigger redraws of Chart when interaction with
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
110 * Trivial constructor. |
9f07f67f60a5
Subclassed ChartThemePanel, trigger redraws of Chart when interaction with
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
111 */ |
9f07f67f60a5
Subclassed ChartThemePanel, trigger redraws of Chart when interaction with
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
112 public CrossSectionChartThemePanel( |
1475
fb2fefe0325f
Improvements in CrossSectionChartThemePanel.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1472
diff
changeset
|
113 OutputMode mode, |
fb2fefe0325f
Improvements in CrossSectionChartThemePanel.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1472
diff
changeset
|
114 CollectionView view) |
858
9f07f67f60a5
Subclassed ChartThemePanel, trigger redraws of Chart when interaction with
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
115 { |
1555
c057ef91b268
Refactored Collection reference out of Panels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1533
diff
changeset
|
116 super(mode, view); |
1475
fb2fefe0325f
Improvements in CrossSectionChartThemePanel.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1472
diff
changeset
|
117 } |
fb2fefe0325f
Improvements in CrossSectionChartThemePanel.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1472
diff
changeset
|
118 |
fb2fefe0325f
Improvements in CrossSectionChartThemePanel.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1472
diff
changeset
|
119 |
fb2fefe0325f
Improvements in CrossSectionChartThemePanel.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1472
diff
changeset
|
120 /** Create DefaultArtifact. */ |
fb2fefe0325f
Improvements in CrossSectionChartThemePanel.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1472
diff
changeset
|
121 public static DefaultArtifact artifactReference(String uuid) { |
fb2fefe0325f
Improvements in CrossSectionChartThemePanel.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1472
diff
changeset
|
122 return new DefaultArtifact(uuid, "TODO:hash"); |
fb2fefe0325f
Improvements in CrossSectionChartThemePanel.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1472
diff
changeset
|
123 } |
fb2fefe0325f
Improvements in CrossSectionChartThemePanel.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1472
diff
changeset
|
124 |
fb2fefe0325f
Improvements in CrossSectionChartThemePanel.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1472
diff
changeset
|
125 |
fb2fefe0325f
Improvements in CrossSectionChartThemePanel.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1472
diff
changeset
|
126 /** Access data of collection item of theme. */ |
fb2fefe0325f
Improvements in CrossSectionChartThemePanel.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1472
diff
changeset
|
127 public static String dataOf(Theme theme, String dataItemName) { |
1578
df11c4c8c578
Avoid certain npes.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1574
diff
changeset
|
128 if (theme != null && theme.getCollectionItem() != null |
df11c4c8c578
Avoid certain npes.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1574
diff
changeset
|
129 && theme.getCollectionItem().getData() != null |
df11c4c8c578
Avoid certain npes.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1574
diff
changeset
|
130 ) { |
df11c4c8c578
Avoid certain npes.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1574
diff
changeset
|
131 return theme.getCollectionItem().getData().get(dataItemName); |
df11c4c8c578
Avoid certain npes.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1574
diff
changeset
|
132 } |
df11c4c8c578
Avoid certain npes.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1574
diff
changeset
|
133 |
df11c4c8c578
Avoid certain npes.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1574
diff
changeset
|
134 return null; |
858
9f07f67f60a5
Subclassed ChartThemePanel, trigger redraws of Chart when interaction with
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
135 } |
9f07f67f60a5
Subclassed ChartThemePanel, trigger redraws of Chart when interaction with
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
136 |
9f07f67f60a5
Subclassed ChartThemePanel, trigger redraws of Chart when interaction with
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
137 |
9f07f67f60a5
Subclassed ChartThemePanel, trigger redraws of Chart when interaction with
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
138 /** |
1436
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
139 * 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
|
140 * @param artifact uuid of an artifact. |
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
141 */ |
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
142 public void feedTellMaster(final String artifact) { |
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
143 Data[] feedData = DefaultData.createSimpleStringDataArray( |
1476
edf18a9dfd8b
Uncommented some code paths to avoid unwanted side effects, cosmetics.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1475
diff
changeset
|
144 CS_IS_MASTER, "1"); |
1436
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
145 |
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
146 feedService.feed( |
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
147 Config.getInstance().getLocale(), |
1475
fb2fefe0325f
Improvements in CrossSectionChartThemePanel.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1472
diff
changeset
|
148 artifactReference(artifact), |
1436
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
149 feedData, |
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
150 new AsyncCallback<Artifact>() { |
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
151 public void onFailure(Throwable caught) { |
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
152 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
|
153 + ") with master marker: " + caught.getMessage()); |
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
154 SC.warn(MSG.getString(caught.getMessage())); |
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
155 enable(); |
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
156 } |
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
157 public void onSuccess(Artifact artifact) { |
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
158 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
|
159 setCurrentCSMaster(artifact.getUuid()); |
1436
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
160 requestRedraw(); |
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
161 enable(); |
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
162 } |
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
163 }); |
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
164 } |
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
165 |
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
166 |
1444
bdac8a72f7e6
Area creation UI update.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1438
diff
changeset
|
167 /** |
1470
eef55d18f424
Cosmetics, refactoring, renamed Master to CSMaster to avoid confusion.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1458
diff
changeset
|
168 * Sets currentCSMasterUUID. |
1438
432180235caf
Minor refactoring and fix initial settings when creating ui.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1436
diff
changeset
|
169 */ |
1470
eef55d18f424
Cosmetics, refactoring, renamed Master to CSMaster to avoid confusion.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1458
diff
changeset
|
170 public String findCurrentCSMaster() { |
1438
432180235caf
Minor refactoring and fix initial settings when creating ui.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1436
diff
changeset
|
171 ThemeList themeList = getThemeList(); |
432180235caf
Minor refactoring and fix initial settings when creating ui.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1436
diff
changeset
|
172 int count = getThemeList().getThemeCount(); |
1445
df7ebcbff984
Bugfixing and feature-adding for cross-sections/areas.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1444
diff
changeset
|
173 String firstCSUuid = null; |
1475
fb2fefe0325f
Improvements in CrossSectionChartThemePanel.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1472
diff
changeset
|
174 Theme firstCS = null; |
1438
432180235caf
Minor refactoring and fix initial settings when creating ui.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1436
diff
changeset
|
175 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
|
176 Theme theme = themeList.getThemeAt(i); |
1476
edf18a9dfd8b
Uncommented some code paths to avoid unwanted side effects, cosmetics.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1475
diff
changeset
|
177 String value = dataOf(theme, CS_IS_MASTER); |
1438
432180235caf
Minor refactoring and fix initial settings when creating ui.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1436
diff
changeset
|
178 |
1445
df7ebcbff984
Bugfixing and feature-adding for cross-sections/areas.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1444
diff
changeset
|
179 if (value != null) { |
df7ebcbff984
Bugfixing and feature-adding for cross-sections/areas.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1444
diff
changeset
|
180 if (firstCSUuid == null) { |
df7ebcbff984
Bugfixing and feature-adding for cross-sections/areas.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1444
diff
changeset
|
181 firstCSUuid = theme.getArtifact(); |
1475
fb2fefe0325f
Improvements in CrossSectionChartThemePanel.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1472
diff
changeset
|
182 firstCS = theme; |
1445
df7ebcbff984
Bugfixing and feature-adding for cross-sections/areas.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1444
diff
changeset
|
183 } |
df7ebcbff984
Bugfixing and feature-adding for cross-sections/areas.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1444
diff
changeset
|
184 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
|
185 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
|
186 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
|
187 + "/" + theme.getDescription()); |
1445
df7ebcbff984
Bugfixing and feature-adding for cross-sections/areas.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1444
diff
changeset
|
188 return theme.getDescription(); |
df7ebcbff984
Bugfixing and feature-adding for cross-sections/areas.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1444
diff
changeset
|
189 } |
1438
432180235caf
Minor refactoring and fix initial settings when creating ui.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1436
diff
changeset
|
190 } |
432180235caf
Minor refactoring and fix initial settings when creating ui.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1436
diff
changeset
|
191 } |
1445
df7ebcbff984
Bugfixing and feature-adding for cross-sections/areas.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1444
diff
changeset
|
192 // 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
|
193 if (firstCSUuid != null) { |
1470
eef55d18f424
Cosmetics, refactoring, renamed Master to CSMaster to avoid confusion.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1458
diff
changeset
|
194 setCurrentCSMaster(firstCSUuid); |
1445
df7ebcbff984
Bugfixing and feature-adding for cross-sections/areas.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1444
diff
changeset
|
195 feedTellMaster(firstCSUuid); |
df7ebcbff984
Bugfixing and feature-adding for cross-sections/areas.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1444
diff
changeset
|
196 } |
1438
432180235caf
Minor refactoring and fix initial settings when creating ui.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1436
diff
changeset
|
197 return null; |
432180235caf
Minor refactoring and fix initial settings when creating ui.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1436
diff
changeset
|
198 } |
432180235caf
Minor refactoring and fix initial settings when creating ui.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1436
diff
changeset
|
199 |
1444
bdac8a72f7e6
Area creation UI update.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1438
diff
changeset
|
200 |
1438
432180235caf
Minor refactoring and fix initial settings when creating ui.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1436
diff
changeset
|
201 /** |
1436
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
202 * 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
|
203 */ |
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
204 @Override |
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
205 protected VLayout createLayout() { |
1438
432180235caf
Minor refactoring and fix initial settings when creating ui.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1436
diff
changeset
|
206 layout = super.createLayout(); |
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 // Create "set master" combobox. |
1533
7fcec57c2f2c
Add cross sections loaded from datacage to the master artifacts list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1519
diff
changeset
|
209 masterCb = new SelectItem(); |
1436
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
210 |
1533
7fcec57c2f2c
Add cross sections loaded from datacage to the master artifacts list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1519
diff
changeset
|
211 masterCb.setTitle(MSG.chart_themepanel_set_master()); |
7fcec57c2f2c
Add cross sections loaded from datacage to the master artifacts list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1519
diff
changeset
|
212 masterCb.setType("comboBox"); |
7fcec57c2f2c
Add cross sections loaded from datacage to the master artifacts list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1519
diff
changeset
|
213 masters = getThemeList().toMapArtifactUUIDDescription("cross_section"); |
7fcec57c2f2c
Add cross sections loaded from datacage to the master artifacts list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1519
diff
changeset
|
214 masterCb.setValueMap(masters); |
1436
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
215 |
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
216 final DynamicForm form = new DynamicForm(); |
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
217 form.setWidth(200); |
1533
7fcec57c2f2c
Add cross sections loaded from datacage to the master artifacts list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1519
diff
changeset
|
218 form.setFields(masterCb); |
2462
d45059aa8507
i18n and moved reference selectbox for cross section master to top.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2453
diff
changeset
|
219 layout.addMember(form, 0); |
1436
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
220 |
1438
432180235caf
Minor refactoring and fix initial settings when creating ui.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1436
diff
changeset
|
221 Config config = Config.getInstance(); |
432180235caf
Minor refactoring and fix initial settings when creating ui.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1436
diff
changeset
|
222 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
|
223 findCurrentCSMaster(); |
1533
7fcec57c2f2c
Add cross sections loaded from datacage to the master artifacts list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1519
diff
changeset
|
224 masterCb.setValue(getCurrentCSMaster()); |
1436
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
225 |
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
226 // 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
|
227 // new master. |
1533
7fcec57c2f2c
Add cross sections loaded from datacage to the master artifacts list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1519
diff
changeset
|
228 masterCb.addChangeHandler(new ChangeHandler() { |
1436
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
229 public void onChange(ChangeEvent event) { |
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
230 String selectedItem = (String) event.getValue(); |
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
231 final String artifact = selectedItem; |
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
232 |
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
233 disable(); |
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
234 |
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
235 // 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
|
236 if (getCurrentCSMaster() != null) { |
1436
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
237 Data[] feedData = DefaultData.createSimpleStringDataArray( |
1476
edf18a9dfd8b
Uncommented some code paths to avoid unwanted side effects, cosmetics.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1475
diff
changeset
|
238 CS_IS_MASTER, "0"); |
1436
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
239 feedService.feed( |
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
240 locale, |
1475
fb2fefe0325f
Improvements in CrossSectionChartThemePanel.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1472
diff
changeset
|
241 artifactReference(getCurrentCSMaster()), |
1436
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
242 feedData, |
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
243 new AsyncCallback<Artifact>() { |
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
244 public void onFailure(Throwable caught) { |
1573
0fbbcec35462
Improved spinner-behaviour in cross section km control.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1572
diff
changeset
|
245 GWT.log("Could not un-master artifact (" |
0fbbcec35462
Improved spinner-behaviour in cross section km control.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1572
diff
changeset
|
246 + getCurrentCSMaster() + "): " + |
1436
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
247 caught.getMessage()); |
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
248 SC.warn(MSG.getString(caught.getMessage())); |
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
249 enable(); |
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
250 } |
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
251 public void onSuccess(Artifact oldMaster) { |
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
252 GWT.log("Successfully un-mastered artifact."); |
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
253 feedTellMaster(artifact); |
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
254 } |
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
255 }); |
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
256 } |
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
257 else { |
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
258 feedTellMaster(artifact); |
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 }); |
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
262 |
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
263 return layout; |
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
264 } |
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
265 |
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
266 |
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
267 /** 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
|
268 public void disable() { |
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
269 this.layout.setDisabled(true); |
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
270 } |
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
271 |
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
272 |
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
273 /** 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
|
274 public void enable() { |
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
275 this.layout.setDisabled(false); |
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
276 } |
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
277 |
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
278 |
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
279 /** |
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
280 * 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
|
281 * 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
|
282 * the last one is taken. |
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
283 * @param in possible return values. |
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
284 * @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
|
285 * @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
|
286 */ |
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
287 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
|
288 if (in == null || in.length == 0) { |
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
289 return -1; |
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
290 } |
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
291 if (in[0] == to) { |
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
292 return to; |
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
293 } |
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
294 double minDiff = Math.abs(to - in[0]); |
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
295 double bestMatch = in[0]; |
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
296 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
|
297 if (in[i] == to) { |
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
298 return to; |
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
299 } |
2484
6f30bbd98618
Small fix for retrieving closest km.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2482
diff
changeset
|
300 double diff = Math.abs(to - in[i]); |
1436
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
301 if (diff < minDiff) { |
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
302 minDiff = diff; |
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
303 bestMatch = in[i]; |
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
304 } |
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
305 } |
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
306 return bestMatch; |
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
307 } |
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
308 |
1573
0fbbcec35462
Improved spinner-behaviour in cross section km control.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1572
diff
changeset
|
309 |
0fbbcec35462
Improved spinner-behaviour in cross section km control.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1572
diff
changeset
|
310 /** |
0fbbcec35462
Improved spinner-behaviour in cross section km control.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1572
diff
changeset
|
311 * Feed a single artifact with the km of the crosssection to display. |
0fbbcec35462
Improved spinner-behaviour in cross section km control.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1572
diff
changeset
|
312 * If its the selected master, also feed the collectionmaster. |
0fbbcec35462
Improved spinner-behaviour in cross section km control.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1572
diff
changeset
|
313 * |
0fbbcec35462
Improved spinner-behaviour in cross section km control.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1572
diff
changeset
|
314 * @param artifacts List of artifacts to feed. |
0fbbcec35462
Improved spinner-behaviour in cross section km control.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1572
diff
changeset
|
315 * @param kmD The km to set. |
0fbbcec35462
Improved spinner-behaviour in cross section km control.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1572
diff
changeset
|
316 */ |
1519
a6f6c61b18be
Implemented synchronous navigation through cross section profiles.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1496
diff
changeset
|
317 public void sendFeed(final List<Artifact> artifacts, final double kmD) { |
a6f6c61b18be
Implemented synchronous navigation through cross section profiles.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1496
diff
changeset
|
318 Config config = Config.getInstance(); |
a6f6c61b18be
Implemented synchronous navigation through cross section profiles.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1496
diff
changeset
|
319 final String locale = config.getLocale(); |
a6f6c61b18be
Implemented synchronous navigation through cross section profiles.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1496
diff
changeset
|
320 |
a6f6c61b18be
Implemented synchronous navigation through cross section profiles.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1496
diff
changeset
|
321 Data[] feedData = |
a6f6c61b18be
Implemented synchronous navigation through cross section profiles.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1496
diff
changeset
|
322 DefaultData.createSimpleStringDataArray(CS_KM, |
a6f6c61b18be
Implemented synchronous navigation through cross section profiles.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1496
diff
changeset
|
323 Double.valueOf(kmD).toString()); |
a6f6c61b18be
Implemented synchronous navigation through cross section profiles.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1496
diff
changeset
|
324 |
a6f6c61b18be
Implemented synchronous navigation through cross section profiles.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1496
diff
changeset
|
325 disable(); |
2518
b3bf9e5ce9e6
i18n for datacage/computed discharge curves.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2514
diff
changeset
|
326 // TODO |
b3bf9e5ce9e6
i18n for datacage/computed discharge curves.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2514
diff
changeset
|
327 // The ones who do not have data for this km should not show line! |
1519
a6f6c61b18be
Implemented synchronous navigation through cross section profiles.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1496
diff
changeset
|
328 feedService.feedMany( |
a6f6c61b18be
Implemented synchronous navigation through cross section profiles.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1496
diff
changeset
|
329 locale, |
a6f6c61b18be
Implemented synchronous navigation through cross section profiles.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1496
diff
changeset
|
330 artifacts, |
a6f6c61b18be
Implemented synchronous navigation through cross section profiles.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1496
diff
changeset
|
331 feedData, |
a6f6c61b18be
Implemented synchronous navigation through cross section profiles.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1496
diff
changeset
|
332 new AsyncCallback<List<Artifact>>() { |
a6f6c61b18be
Implemented synchronous navigation through cross section profiles.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1496
diff
changeset
|
333 @Override |
a6f6c61b18be
Implemented synchronous navigation through cross section profiles.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1496
diff
changeset
|
334 public void onFailure(Throwable caught) { |
a6f6c61b18be
Implemented synchronous navigation through cross section profiles.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1496
diff
changeset
|
335 GWT.log("Could not feed many artifacts " + caught.getMessage()); |
a6f6c61b18be
Implemented synchronous navigation through cross section profiles.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1496
diff
changeset
|
336 SC.warn(MSG.getString(caught.getMessage())); |
a6f6c61b18be
Implemented synchronous navigation through cross section profiles.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1496
diff
changeset
|
337 enable(); |
a6f6c61b18be
Implemented synchronous navigation through cross section profiles.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1496
diff
changeset
|
338 } |
a6f6c61b18be
Implemented synchronous navigation through cross section profiles.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1496
diff
changeset
|
339 @Override |
a6f6c61b18be
Implemented synchronous navigation through cross section profiles.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1496
diff
changeset
|
340 public void onSuccess(List<Artifact> artifact) { |
a6f6c61b18be
Implemented synchronous navigation through cross section profiles.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1496
diff
changeset
|
341 GWT.log("Successfully fed many with km"); |
a6f6c61b18be
Implemented synchronous navigation through cross section profiles.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1496
diff
changeset
|
342 requestRedraw(); |
a6f6c61b18be
Implemented synchronous navigation through cross section profiles.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1496
diff
changeset
|
343 enable(); |
a6f6c61b18be
Implemented synchronous navigation through cross section profiles.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1496
diff
changeset
|
344 } |
a6f6c61b18be
Implemented synchronous navigation through cross section profiles.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1496
diff
changeset
|
345 }); |
a6f6c61b18be
Implemented synchronous navigation through cross section profiles.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1496
diff
changeset
|
346 } |
1436
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
347 |
1573
0fbbcec35462
Improved spinner-behaviour in cross section km control.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1572
diff
changeset
|
348 |
0fbbcec35462
Improved spinner-behaviour in cross section km control.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1572
diff
changeset
|
349 /** |
0fbbcec35462
Improved spinner-behaviour in cross section km control.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1572
diff
changeset
|
350 * Feed a single artifact with the km of the crosssection to display. |
0fbbcec35462
Improved spinner-behaviour in cross section km control.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1572
diff
changeset
|
351 * If its the selected master, also feed the collectionmaster. |
0fbbcec35462
Improved spinner-behaviour in cross section km control.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1572
diff
changeset
|
352 * @param artUUID The UUID of the artifact to feed. |
0fbbcec35462
Improved spinner-behaviour in cross section km control.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1572
diff
changeset
|
353 * @param kmD The km to set. |
0fbbcec35462
Improved spinner-behaviour in cross section km control.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1572
diff
changeset
|
354 */ |
1472
a2b0b2af529f
Tell master-artifact of collection when cross-section-master changed kilometer.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1470
diff
changeset
|
355 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
|
356 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
|
357 final String locale = config.getLocale(); |
1436
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
358 |
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
359 Data[] feedData = |
1476
edf18a9dfd8b
Uncommented some code paths to avoid unwanted side effects, cosmetics.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1475
diff
changeset
|
360 DefaultData.createSimpleStringDataArray(CS_KM, |
1436
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
361 Double.valueOf(kmD).toString()); |
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
362 |
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
363 disable(); |
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
364 feedService.feed( |
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
365 locale, |
1475
fb2fefe0325f
Improvements in CrossSectionChartThemePanel.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1472
diff
changeset
|
366 artifactReference(artUUID), |
1436
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
367 feedData, |
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
368 new AsyncCallback<Artifact>() { |
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
369 @Override |
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
370 public void onFailure(Throwable caught) { |
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
371 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
|
372 SC.warn(MSG.getString(caught.getMessage())); |
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
373 enable(); |
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
374 } |
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
375 @Override |
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
376 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
|
377 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
|
378 requestRedraw(); |
1496
a882297ce63d
Changed CrossSection spinner-stepsize, adjusted km- and mastersetting.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1476
diff
changeset
|
379 enable(); |
1436
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
380 } |
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
381 }); |
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
382 } |
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
383 |
1573
0fbbcec35462
Improved spinner-behaviour in cross section km control.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1572
diff
changeset
|
384 |
2443
993871f8e2f2
Partial fix flys/issue624 (removing cross section).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1588
diff
changeset
|
385 /** Remove the themes, also from the master (reference) select box. */ |
993871f8e2f2
Partial fix flys/issue624 (removing cross section).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1588
diff
changeset
|
386 @Override |
993871f8e2f2
Partial fix flys/issue624 (removing cross section).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1588
diff
changeset
|
387 protected void removeThemes(final ListGridRecord[] records) { |
993871f8e2f2
Partial fix flys/issue624 (removing cross section).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1588
diff
changeset
|
388 // TODO take care of what happens if that was the last |
993871f8e2f2
Partial fix flys/issue624 (removing cross section).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1588
diff
changeset
|
389 // cross section and/or the cross section currently selected as master. |
993871f8e2f2
Partial fix flys/issue624 (removing cross section).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1588
diff
changeset
|
390 for (ListGridRecord record: records) { |
993871f8e2f2
Partial fix flys/issue624 (removing cross section).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1588
diff
changeset
|
391 FacetRecord facet = (FacetRecord) record; |
993871f8e2f2
Partial fix flys/issue624 (removing cross section).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1588
diff
changeset
|
392 Theme theme = facet.getTheme(); |
993871f8e2f2
Partial fix flys/issue624 (removing cross section).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1588
diff
changeset
|
393 masters.remove(theme.getArtifact()); |
993871f8e2f2
Partial fix flys/issue624 (removing cross section).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1588
diff
changeset
|
394 } |
993871f8e2f2
Partial fix flys/issue624 (removing cross section).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1588
diff
changeset
|
395 masterCb.setValueMap(masters); |
993871f8e2f2
Partial fix flys/issue624 (removing cross section).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1588
diff
changeset
|
396 super.removeThemes(records); |
993871f8e2f2
Partial fix flys/issue624 (removing cross section).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1588
diff
changeset
|
397 } |
993871f8e2f2
Partial fix flys/issue624 (removing cross section).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1588
diff
changeset
|
398 |
993871f8e2f2
Partial fix flys/issue624 (removing cross section).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1588
diff
changeset
|
399 |
2482
cef4c624c68c
Cosmetics.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2481
diff
changeset
|
400 /** |
cef4c624c68c
Cosmetics.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2481
diff
changeset
|
401 * Callback for when a value has been accepted in the km-spinner |
cef4c624c68c
Cosmetics.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2481
diff
changeset
|
402 * of a Cross-Section Profile theme. |
cef4c624c68c
Cosmetics.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2481
diff
changeset
|
403 * @param item The SpinnerItem which was manipulated. |
cef4c624c68c
Cosmetics.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2481
diff
changeset
|
404 * @param enteredKm The double-parsed value that has been entered. |
cef4c624c68c
Cosmetics.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2481
diff
changeset
|
405 * @param facetRecord The underlying datastores record. |
cef4c624c68c
Cosmetics.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2481
diff
changeset
|
406 */ |
1572
60f8edc7a6f0
Slightly improved Spinner- behaviour in CrossSectionControl, but regress in other case.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1555
diff
changeset
|
407 public void spinnerValueEntered(final SpinnerItem item, |
60f8edc7a6f0
Slightly improved Spinner- behaviour in CrossSectionControl, but regress in other case.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1555
diff
changeset
|
408 final double enteredKm, final FacetRecord facetRecord |
60f8edc7a6f0
Slightly improved Spinner- behaviour in CrossSectionControl, but regress in other case.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1555
diff
changeset
|
409 ) { |
1573
0fbbcec35462
Improved spinner-behaviour in cross section km control.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1572
diff
changeset
|
410 disable(); |
1572
60f8edc7a6f0
Slightly improved Spinner- behaviour in CrossSectionControl, but regress in other case.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1555
diff
changeset
|
411 Config config = Config.getInstance(); |
60f8edc7a6f0
Slightly improved Spinner- behaviour in CrossSectionControl, but regress in other case.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1555
diff
changeset
|
412 final String locale = config.getLocale(); |
60f8edc7a6f0
Slightly improved Spinner- behaviour in CrossSectionControl, but regress in other case.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1555
diff
changeset
|
413 |
60f8edc7a6f0
Slightly improved Spinner- behaviour in CrossSectionControl, but regress in other case.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1555
diff
changeset
|
414 Map<Integer, Double> map = new HashMap<Integer,Double>(); |
60f8edc7a6f0
Slightly improved Spinner- behaviour in CrossSectionControl, but regress in other case.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1555
diff
changeset
|
415 int _dbid = -1; |
60f8edc7a6f0
Slightly improved Spinner- behaviour in CrossSectionControl, but regress in other case.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1555
diff
changeset
|
416 try { |
60f8edc7a6f0
Slightly improved Spinner- behaviour in CrossSectionControl, but regress in other case.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1555
diff
changeset
|
417 _dbid = Integer.valueOf(facetRecord.getTheme() |
60f8edc7a6f0
Slightly improved Spinner- behaviour in CrossSectionControl, but regress in other case.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1555
diff
changeset
|
418 .getCollectionItem() |
60f8edc7a6f0
Slightly improved Spinner- behaviour in CrossSectionControl, but regress in other case.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1555
diff
changeset
|
419 .getData().get("cross_section.dbid")); |
60f8edc7a6f0
Slightly improved Spinner- behaviour in CrossSectionControl, but regress in other case.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1555
diff
changeset
|
420 } |
60f8edc7a6f0
Slightly improved Spinner- behaviour in CrossSectionControl, but regress in other case.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1555
diff
changeset
|
421 catch (NumberFormatException nfe) { |
60f8edc7a6f0
Slightly improved Spinner- behaviour in CrossSectionControl, but regress in other case.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1555
diff
changeset
|
422 GWT.log("Could not extract cross-section db id from data."); |
60f8edc7a6f0
Slightly improved Spinner- behaviour in CrossSectionControl, but regress in other case.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1555
diff
changeset
|
423 } |
60f8edc7a6f0
Slightly improved Spinner- behaviour in CrossSectionControl, but regress in other case.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1555
diff
changeset
|
424 final int dbid = _dbid; |
60f8edc7a6f0
Slightly improved Spinner- behaviour in CrossSectionControl, but regress in other case.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1555
diff
changeset
|
425 |
60f8edc7a6f0
Slightly improved Spinner- behaviour in CrossSectionControl, but regress in other case.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1555
diff
changeset
|
426 map.put(dbid, enteredKm); |
60f8edc7a6f0
Slightly improved Spinner- behaviour in CrossSectionControl, but regress in other case.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1555
diff
changeset
|
427 |
2482
cef4c624c68c
Cosmetics.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2481
diff
changeset
|
428 // Query the available cross section measurements. |
1572
60f8edc7a6f0
Slightly improved Spinner- behaviour in CrossSectionControl, but regress in other case.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1555
diff
changeset
|
429 kmService.getCrossSectionKMs(locale, map, 2, |
60f8edc7a6f0
Slightly improved Spinner- behaviour in CrossSectionControl, but regress in other case.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1555
diff
changeset
|
430 new AsyncCallback<Map<Integer, Double[]>>() { |
60f8edc7a6f0
Slightly improved Spinner- behaviour in CrossSectionControl, but regress in other case.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1555
diff
changeset
|
431 @Override |
60f8edc7a6f0
Slightly improved Spinner- behaviour in CrossSectionControl, but regress in other case.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1555
diff
changeset
|
432 public void onFailure(Throwable caught) { |
60f8edc7a6f0
Slightly improved Spinner- behaviour in CrossSectionControl, but regress in other case.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1555
diff
changeset
|
433 GWT.log("Could not get single km for " |
60f8edc7a6f0
Slightly improved Spinner- behaviour in CrossSectionControl, but regress in other case.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1555
diff
changeset
|
434 + dbid + ": "+ caught.getMessage()); |
60f8edc7a6f0
Slightly improved Spinner- behaviour in CrossSectionControl, but regress in other case.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1555
diff
changeset
|
435 SC.warn(MSG.getString(caught.getMessage())); |
60f8edc7a6f0
Slightly improved Spinner- behaviour in CrossSectionControl, but regress in other case.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1555
diff
changeset
|
436 updateCollection(); |
1573
0fbbcec35462
Improved spinner-behaviour in cross section km control.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1572
diff
changeset
|
437 //updateGrid(); |
1572
60f8edc7a6f0
Slightly improved Spinner- behaviour in CrossSectionControl, but regress in other case.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1555
diff
changeset
|
438 enable(); |
60f8edc7a6f0
Slightly improved Spinner- behaviour in CrossSectionControl, but regress in other case.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1555
diff
changeset
|
439 } |
60f8edc7a6f0
Slightly improved Spinner- behaviour in CrossSectionControl, but regress in other case.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1555
diff
changeset
|
440 @Override |
60f8edc7a6f0
Slightly improved Spinner- behaviour in CrossSectionControl, but regress in other case.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1555
diff
changeset
|
441 public void onSuccess(Map<Integer, Double[]> obj) { |
60f8edc7a6f0
Slightly improved Spinner- behaviour in CrossSectionControl, but regress in other case.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1555
diff
changeset
|
442 Double[] kms = obj.get(dbid); |
60f8edc7a6f0
Slightly improved Spinner- behaviour in CrossSectionControl, but regress in other case.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1555
diff
changeset
|
443 double closest = |
1574
465f72f68cee
Fix strange javascript side effects.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1573
diff
changeset
|
444 CrossSectionChartThemePanel.closest(kms, enteredKm); |
2484
6f30bbd98618
Small fix for retrieving closest km.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2482
diff
changeset
|
445 GWT.log("Got single km close to " + enteredKm + " for " + dbid + ", it is " |
1572
60f8edc7a6f0
Slightly improved Spinner- behaviour in CrossSectionControl, but regress in other case.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1555
diff
changeset
|
446 + closest); |
1574
465f72f68cee
Fix strange javascript side effects.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1573
diff
changeset
|
447 |
465f72f68cee
Fix strange javascript side effects.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1573
diff
changeset
|
448 // Do not set value, as it will trigger strange |
2463
0eeceffd50e3
Make synchron navigation of CrossSections a per-theme option, not global one.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2462
diff
changeset
|
449 // "javascript" bugs. /*item.setValue(closest);*/ |
0eeceffd50e3
Make synchron navigation of CrossSections a per-theme option, not global one.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2462
diff
changeset
|
450 if (synchronCrossSectionThemes.contains (themeHash |
0eeceffd50e3
Make synchron navigation of CrossSections a per-theme option, not global one.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2462
diff
changeset
|
451 (facetRecord.getTheme()))) { |
0eeceffd50e3
Make synchron navigation of CrossSections a per-theme option, not global one.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2462
diff
changeset
|
452 // Move all other synchrons |
1572
60f8edc7a6f0
Slightly improved Spinner- behaviour in CrossSectionControl, but regress in other case.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1555
diff
changeset
|
453 ThemeList themes = getThemeList(); |
60f8edc7a6f0
Slightly improved Spinner- behaviour in CrossSectionControl, but regress in other case.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1555
diff
changeset
|
454 int nThemes = themes.getThemeCount(); |
60f8edc7a6f0
Slightly improved Spinner- behaviour in CrossSectionControl, but regress in other case.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1555
diff
changeset
|
455 List<Artifact> artifacts = new ArrayList<Artifact>(); |
60f8edc7a6f0
Slightly improved Spinner- behaviour in CrossSectionControl, but regress in other case.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1555
diff
changeset
|
456 for (int i = 0; i < nThemes; i++) { |
60f8edc7a6f0
Slightly improved Spinner- behaviour in CrossSectionControl, but regress in other case.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1555
diff
changeset
|
457 final Theme theme = themes.getThemeAt(i+1); |
60f8edc7a6f0
Slightly improved Spinner- behaviour in CrossSectionControl, but regress in other case.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1555
diff
changeset
|
458 if (theme.getFacet().equals("cross_section") && |
2463
0eeceffd50e3
Make synchron navigation of CrossSections a per-theme option, not global one.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2462
diff
changeset
|
459 theme.getActive() == 1 && |
0eeceffd50e3
Make synchron navigation of CrossSections a per-theme option, not global one.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2462
diff
changeset
|
460 synchronCrossSectionThemes.contains(themeHash(theme)) |
0eeceffd50e3
Make synchron navigation of CrossSections a per-theme option, not global one.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2462
diff
changeset
|
461 ) { |
1572
60f8edc7a6f0
Slightly improved Spinner- behaviour in CrossSectionControl, but regress in other case.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1555
diff
changeset
|
462 artifacts.add(artifactReference(theme.getArtifact())); |
60f8edc7a6f0
Slightly improved Spinner- behaviour in CrossSectionControl, but regress in other case.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1555
diff
changeset
|
463 } |
60f8edc7a6f0
Slightly improved Spinner- behaviour in CrossSectionControl, but regress in other case.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1555
diff
changeset
|
464 } |
1574
465f72f68cee
Fix strange javascript side effects.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1573
diff
changeset
|
465 sendFeed(artifacts, closest); |
1572
60f8edc7a6f0
Slightly improved Spinner- behaviour in CrossSectionControl, but regress in other case.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1555
diff
changeset
|
466 } |
60f8edc7a6f0
Slightly improved Spinner- behaviour in CrossSectionControl, but regress in other case.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1555
diff
changeset
|
467 else { |
60f8edc7a6f0
Slightly improved Spinner- behaviour in CrossSectionControl, but regress in other case.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1555
diff
changeset
|
468 sendFeed(facetRecord.getTheme().getArtifact(), |
60f8edc7a6f0
Slightly improved Spinner- behaviour in CrossSectionControl, but regress in other case.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1555
diff
changeset
|
469 closest); |
60f8edc7a6f0
Slightly improved Spinner- behaviour in CrossSectionControl, but regress in other case.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1555
diff
changeset
|
470 } |
60f8edc7a6f0
Slightly improved Spinner- behaviour in CrossSectionControl, but regress in other case.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1555
diff
changeset
|
471 } |
60f8edc7a6f0
Slightly improved Spinner- behaviour in CrossSectionControl, but regress in other case.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1555
diff
changeset
|
472 }); |
60f8edc7a6f0
Slightly improved Spinner- behaviour in CrossSectionControl, but regress in other case.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1555
diff
changeset
|
473 } |
60f8edc7a6f0
Slightly improved Spinner- behaviour in CrossSectionControl, but regress in other case.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1555
diff
changeset
|
474 |
1436
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
475 |
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
476 /** |
1379
546f7f890ffa
Cosmetics, refactoring.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1378
diff
changeset
|
477 * Create the handler for ChangeEvents on the Spinner in the |
546f7f890ffa
Cosmetics, refactoring.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1378
diff
changeset
|
478 * facets that control km of cross section. |
546f7f890ffa
Cosmetics, refactoring.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1378
diff
changeset
|
479 * |
546f7f890ffa
Cosmetics, refactoring.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1378
diff
changeset
|
480 * @param facetRecord The FacetRecord (~row in table) where this |
546f7f890ffa
Cosmetics, refactoring.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1378
diff
changeset
|
481 * handler is added to (to a child, to be exact). |
546f7f890ffa
Cosmetics, refactoring.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1378
diff
changeset
|
482 */ |
2463
0eeceffd50e3
Make synchron navigation of CrossSections a per-theme option, not global one.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2462
diff
changeset
|
483 // TODO obsolete? |
1379
546f7f890ffa
Cosmetics, refactoring.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1378
diff
changeset
|
484 public final ChangedHandler createSpinnerHandler( |
2463
0eeceffd50e3
Make synchron navigation of CrossSections a per-theme option, not global one.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2462
diff
changeset
|
485 final FacetRecord facetRecord) |
1379
546f7f890ffa
Cosmetics, refactoring.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1378
diff
changeset
|
486 { |
546f7f890ffa
Cosmetics, refactoring.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1378
diff
changeset
|
487 ChangedHandler handler = new ChangedHandler() |
546f7f890ffa
Cosmetics, refactoring.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1378
diff
changeset
|
488 { |
546f7f890ffa
Cosmetics, refactoring.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1378
diff
changeset
|
489 @Override |
1436
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
490 public void onChanged(final ChangedEvent ce) { |
1379
546f7f890ffa
Cosmetics, refactoring.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1378
diff
changeset
|
491 if (ce.getValue() == null) { |
546f7f890ffa
Cosmetics, refactoring.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1378
diff
changeset
|
492 return; |
546f7f890ffa
Cosmetics, refactoring.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1378
diff
changeset
|
493 } |
1572
60f8edc7a6f0
Slightly improved Spinner- behaviour in CrossSectionControl, but regress in other case.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1555
diff
changeset
|
494 String value = ce.getValue().toString(); |
1436
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
495 |
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
496 // 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
|
497 final double selected_km = |
1572
60f8edc7a6f0
Slightly improved Spinner- behaviour in CrossSectionControl, but regress in other case.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1555
diff
changeset
|
498 Double.parseDouble(value); |
60f8edc7a6f0
Slightly improved Spinner- behaviour in CrossSectionControl, but regress in other case.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1555
diff
changeset
|
499 final SpinnerItem item = (SpinnerItem) ce.getItem(); |
1436
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
500 |
1572
60f8edc7a6f0
Slightly improved Spinner- behaviour in CrossSectionControl, but regress in other case.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1555
diff
changeset
|
501 spinnerValueEntered(item, selected_km, facetRecord); |
1379
546f7f890ffa
Cosmetics, refactoring.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1378
diff
changeset
|
502 } |
546f7f890ffa
Cosmetics, refactoring.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1378
diff
changeset
|
503 }; |
546f7f890ffa
Cosmetics, refactoring.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1378
diff
changeset
|
504 return handler; |
546f7f890ffa
Cosmetics, refactoring.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1378
diff
changeset
|
505 } |
546f7f890ffa
Cosmetics, refactoring.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1378
diff
changeset
|
506 |
546f7f890ffa
Cosmetics, refactoring.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1378
diff
changeset
|
507 |
546f7f890ffa
Cosmetics, refactoring.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1378
diff
changeset
|
508 /** |
1438
432180235caf
Minor refactoring and fix initial settings when creating ui.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1436
diff
changeset
|
509 * 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
|
510 * @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
|
511 * @return label, intialized SpinnerItem. |
432180235caf
Minor refactoring and fix initial settings when creating ui.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1436
diff
changeset
|
512 */ |
432180235caf
Minor refactoring and fix initial settings when creating ui.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1436
diff
changeset
|
513 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
|
514 SpinnerItem spinnerItem = new SpinnerItem(); |
432180235caf
Minor refactoring and fix initial settings when creating ui.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1436
diff
changeset
|
515 spinnerItem.setShowTitle(false); |
432180235caf
Minor refactoring and fix initial settings when creating ui.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1436
diff
changeset
|
516 spinnerItem.setTitle("Waterlevel-Spinner"); |
432180235caf
Minor refactoring and fix initial settings when creating ui.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1436
diff
changeset
|
517 spinnerItem.setWidth(45); |
1496
a882297ce63d
Changed CrossSection spinner-stepsize, adjusted km- and mastersetting.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1476
diff
changeset
|
518 spinnerItem.setDefaultValue(Double.valueOf(facetRecord.getTheme() |
1438
432180235caf
Minor refactoring and fix initial settings when creating ui.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1436
diff
changeset
|
519 .getCollectionItem() |
1496
a882297ce63d
Changed CrossSection spinner-stepsize, adjusted km- and mastersetting.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1476
diff
changeset
|
520 .getData().get(CS_KM))); |
1438
432180235caf
Minor refactoring and fix initial settings when creating ui.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1436
diff
changeset
|
521 |
432180235caf
Minor refactoring and fix initial settings when creating ui.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1436
diff
changeset
|
522 spinnerItem.setMin(0); |
1475
fb2fefe0325f
Improvements in CrossSectionChartThemePanel.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1472
diff
changeset
|
523 spinnerItem.setMax(2000); |
1572
60f8edc7a6f0
Slightly improved Spinner- behaviour in CrossSectionControl, but regress in other case.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1555
diff
changeset
|
524 spinnerItem.setStep(0.1d); |
1438
432180235caf
Minor refactoring and fix initial settings when creating ui.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1436
diff
changeset
|
525 spinnerItem.setChangeOnKeypress(true); |
432180235caf
Minor refactoring and fix initial settings when creating ui.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1436
diff
changeset
|
526 return spinnerItem; |
432180235caf
Minor refactoring and fix initial settings when creating ui.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1436
diff
changeset
|
527 } |
432180235caf
Minor refactoring and fix initial settings when creating ui.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1436
diff
changeset
|
528 |
432180235caf
Minor refactoring and fix initial settings when creating ui.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1436
diff
changeset
|
529 |
432180235caf
Minor refactoring and fix initial settings when creating ui.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1436
diff
changeset
|
530 /** |
2485
26fc6163643d
Replace spinnerItem by custom implementation to switch km in cross sections, but regress.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2484
diff
changeset
|
531 * SpinnerItem-like element with text label and up/down buttons. |
26fc6163643d
Replace spinnerItem by custom implementation to switch km in cross sections, but regress.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2484
diff
changeset
|
532 */ |
26fc6163643d
Replace spinnerItem by custom implementation to switch km in cross sections, but regress.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2484
diff
changeset
|
533 public class KmSpinner extends HLayout { |
26fc6163643d
Replace spinnerItem by custom implementation to switch km in cross sections, but regress.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2484
diff
changeset
|
534 protected Label label; |
26fc6163643d
Replace spinnerItem by custom implementation to switch km in cross sections, but regress.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2484
diff
changeset
|
535 |
26fc6163643d
Replace spinnerItem by custom implementation to switch km in cross sections, but regress.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2484
diff
changeset
|
536 protected FacetRecord facetRecord; |
26fc6163643d
Replace spinnerItem by custom implementation to switch km in cross sections, but regress.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2484
diff
changeset
|
537 |
26fc6163643d
Replace spinnerItem by custom implementation to switch km in cross sections, but regress.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2484
diff
changeset
|
538 protected double currentValue; |
26fc6163643d
Replace spinnerItem by custom implementation to switch km in cross sections, but regress.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2484
diff
changeset
|
539 |
26fc6163643d
Replace spinnerItem by custom implementation to switch km in cross sections, but regress.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2484
diff
changeset
|
540 public KmSpinner(FacetRecord facetRecord) { |
26fc6163643d
Replace spinnerItem by custom implementation to switch km in cross sections, but regress.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2484
diff
changeset
|
541 super(2); |
26fc6163643d
Replace spinnerItem by custom implementation to switch km in cross sections, but regress.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2484
diff
changeset
|
542 this.facetRecord = facetRecord; |
26fc6163643d
Replace spinnerItem by custom implementation to switch km in cross sections, but regress.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2484
diff
changeset
|
543 final FacetRecord _facetRecord = facetRecord; |
26fc6163643d
Replace spinnerItem by custom implementation to switch km in cross sections, but regress.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2484
diff
changeset
|
544 currentValue = Double.valueOf(facetRecord.getTheme() |
26fc6163643d
Replace spinnerItem by custom implementation to switch km in cross sections, but regress.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2484
diff
changeset
|
545 .getCollectionItem().getData().get(CS_KM)); |
26fc6163643d
Replace spinnerItem by custom implementation to switch km in cross sections, but regress.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2484
diff
changeset
|
546 // Buttons and labels. |
2490
4d93f9255caa
Improve km-Spinner behaviour, allow text input (alpha).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2486
diff
changeset
|
547 int height = 18; |
4d93f9255caa
Improve km-Spinner behaviour, allow text input (alpha).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2486
diff
changeset
|
548 // minusButton shall ask service for previous available cs. |
2485
26fc6163643d
Replace spinnerItem by custom implementation to switch km in cross sections, but regress.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2484
diff
changeset
|
549 Button minusButton = new Button("-"); |
26fc6163643d
Replace spinnerItem by custom implementation to switch km in cross sections, but regress.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2484
diff
changeset
|
550 minusButton.setWidth(10); |
26fc6163643d
Replace spinnerItem by custom implementation to switch km in cross sections, but regress.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2484
diff
changeset
|
551 minusButton.setHeight(height); |
26fc6163643d
Replace spinnerItem by custom implementation to switch km in cross sections, but regress.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2484
diff
changeset
|
552 minusButton.addClickHandler(new com.smartgwt.client.widgets.events.ClickHandler() { |
26fc6163643d
Replace spinnerItem by custom implementation to switch km in cross sections, but regress.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2484
diff
changeset
|
553 public void onClick(ClickEvent evt) { |
26fc6163643d
Replace spinnerItem by custom implementation to switch km in cross sections, but regress.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2484
diff
changeset
|
554 spinnerValueEntered(null, currentValue - 0.1d, _facetRecord); |
26fc6163643d
Replace spinnerItem by custom implementation to switch km in cross sections, but regress.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2484
diff
changeset
|
555 } |
26fc6163643d
Replace spinnerItem by custom implementation to switch km in cross sections, but regress.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2484
diff
changeset
|
556 }); |
2513
89814cc6e922
Fix issue652: spinner input.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2491
diff
changeset
|
557 |
2490
4d93f9255caa
Improve km-Spinner behaviour, allow text input (alpha).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2486
diff
changeset
|
558 DynamicForm form = new DynamicForm(); |
4d93f9255caa
Improve km-Spinner behaviour, allow text input (alpha).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2486
diff
changeset
|
559 final TextItem kmField = new TextItem(); |
4d93f9255caa
Improve km-Spinner behaviour, allow text input (alpha).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2486
diff
changeset
|
560 kmField.setValue(currentValue); |
4d93f9255caa
Improve km-Spinner behaviour, allow text input (alpha).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2486
diff
changeset
|
561 kmField.setWidth(35); |
4d93f9255caa
Improve km-Spinner behaviour, allow text input (alpha).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2486
diff
changeset
|
562 kmField.setTitle(""); |
4d93f9255caa
Improve km-Spinner behaviour, allow text input (alpha).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2486
diff
changeset
|
563 kmField.setHeight(height); |
2513
89814cc6e922
Fix issue652: spinner input.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2491
diff
changeset
|
564 |
89814cc6e922
Fix issue652: spinner input.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2491
diff
changeset
|
565 FormItemValueFormatter doubleFormat = new FormItemValueFormatter() { |
89814cc6e922
Fix issue652: spinner input.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2491
diff
changeset
|
566 public String formatValue(Object value, Record record, |
89814cc6e922
Fix issue652: spinner input.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2491
diff
changeset
|
567 DynamicForm form, FormItem item) { |
89814cc6e922
Fix issue652: spinner input.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2491
diff
changeset
|
568 if (value != null) { |
89814cc6e922
Fix issue652: spinner input.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2491
diff
changeset
|
569 NumberFormat nf = NumberFormat.getDecimalFormat(); |
89814cc6e922
Fix issue652: spinner input.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2491
diff
changeset
|
570 try { |
89814cc6e922
Fix issue652: spinner input.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2491
diff
changeset
|
571 double d = Double.valueOf(value.toString()).doubleValue(); |
89814cc6e922
Fix issue652: spinner input.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2491
diff
changeset
|
572 return nf.format(d); |
89814cc6e922
Fix issue652: spinner input.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2491
diff
changeset
|
573 } catch (Exception e) { |
89814cc6e922
Fix issue652: spinner input.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2491
diff
changeset
|
574 return value.toString(); |
89814cc6e922
Fix issue652: spinner input.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2491
diff
changeset
|
575 } |
89814cc6e922
Fix issue652: spinner input.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2491
diff
changeset
|
576 } |
89814cc6e922
Fix issue652: spinner input.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2491
diff
changeset
|
577 else { |
89814cc6e922
Fix issue652: spinner input.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2491
diff
changeset
|
578 return null; |
89814cc6e922
Fix issue652: spinner input.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2491
diff
changeset
|
579 } |
89814cc6e922
Fix issue652: spinner input.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2491
diff
changeset
|
580 } |
89814cc6e922
Fix issue652: spinner input.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2491
diff
changeset
|
581 }; |
89814cc6e922
Fix issue652: spinner input.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2491
diff
changeset
|
582 kmField.setEditorValueFormatter(doubleFormat); |
89814cc6e922
Fix issue652: spinner input.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2491
diff
changeset
|
583 |
89814cc6e922
Fix issue652: spinner input.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2491
diff
changeset
|
584 FormItemValueParser doubleParser = new FormItemValueParser() { |
89814cc6e922
Fix issue652: spinner input.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2491
diff
changeset
|
585 public Object parseValue(String value, |
89814cc6e922
Fix issue652: spinner input.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2491
diff
changeset
|
586 DynamicForm form, |
89814cc6e922
Fix issue652: spinner input.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2491
diff
changeset
|
587 FormItem item) { |
89814cc6e922
Fix issue652: spinner input.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2491
diff
changeset
|
588 if (value == null) |
89814cc6e922
Fix issue652: spinner input.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2491
diff
changeset
|
589 return null; |
89814cc6e922
Fix issue652: spinner input.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2491
diff
changeset
|
590 try { |
89814cc6e922
Fix issue652: spinner input.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2491
diff
changeset
|
591 NumberFormat nf = NumberFormat.getDecimalFormat(); |
89814cc6e922
Fix issue652: spinner input.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2491
diff
changeset
|
592 double d = nf.parse(value.toString()); |
89814cc6e922
Fix issue652: spinner input.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2491
diff
changeset
|
593 return (new Double(d)).toString(); |
89814cc6e922
Fix issue652: spinner input.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2491
diff
changeset
|
594 } |
89814cc6e922
Fix issue652: spinner input.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2491
diff
changeset
|
595 catch(NumberFormatException nfe) { |
89814cc6e922
Fix issue652: spinner input.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2491
diff
changeset
|
596 return value; |
89814cc6e922
Fix issue652: spinner input.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2491
diff
changeset
|
597 } |
89814cc6e922
Fix issue652: spinner input.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2491
diff
changeset
|
598 } |
89814cc6e922
Fix issue652: spinner input.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2491
diff
changeset
|
599 }; |
89814cc6e922
Fix issue652: spinner input.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2491
diff
changeset
|
600 kmField.setEditorValueParser(doubleParser); |
89814cc6e922
Fix issue652: spinner input.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2491
diff
changeset
|
601 |
2490
4d93f9255caa
Improve km-Spinner behaviour, allow text input (alpha).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2486
diff
changeset
|
602 // Update on focus lost and enter-pressed. |
4d93f9255caa
Improve km-Spinner behaviour, allow text input (alpha).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2486
diff
changeset
|
603 kmField.addBlurHandler(new BlurHandler() { |
4d93f9255caa
Improve km-Spinner behaviour, allow text input (alpha).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2486
diff
changeset
|
604 @Override |
4d93f9255caa
Improve km-Spinner behaviour, allow text input (alpha).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2486
diff
changeset
|
605 public void onBlur(BlurEvent be) { |
2514
902526c9efd4
More input checks with kmspinner.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2513
diff
changeset
|
606 if (kmField.getValue() != null) { |
902526c9efd4
More input checks with kmspinner.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2513
diff
changeset
|
607 try { |
902526c9efd4
More input checks with kmspinner.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2513
diff
changeset
|
608 spinnerValueEntered(null, |
902526c9efd4
More input checks with kmspinner.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2513
diff
changeset
|
609 Double.parseDouble(kmField.getValue().toString()), |
902526c9efd4
More input checks with kmspinner.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2513
diff
changeset
|
610 _facetRecord); |
902526c9efd4
More input checks with kmspinner.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2513
diff
changeset
|
611 } |
902526c9efd4
More input checks with kmspinner.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2513
diff
changeset
|
612 catch(NumberFormatException nfe) { |
902526c9efd4
More input checks with kmspinner.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2513
diff
changeset
|
613 GWT.log("entered string cannot be parsed to double."); |
902526c9efd4
More input checks with kmspinner.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2513
diff
changeset
|
614 } |
902526c9efd4
More input checks with kmspinner.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2513
diff
changeset
|
615 } |
2490
4d93f9255caa
Improve km-Spinner behaviour, allow text input (alpha).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2486
diff
changeset
|
616 } |
4d93f9255caa
Improve km-Spinner behaviour, allow text input (alpha).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2486
diff
changeset
|
617 }); |
4d93f9255caa
Improve km-Spinner behaviour, allow text input (alpha).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2486
diff
changeset
|
618 kmField.addKeyPressHandler(new KeyPressHandler(){ |
4d93f9255caa
Improve km-Spinner behaviour, allow text input (alpha).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2486
diff
changeset
|
619 @Override |
4d93f9255caa
Improve km-Spinner behaviour, allow text input (alpha).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2486
diff
changeset
|
620 public void onKeyPress(KeyPressEvent kpe) { |
4d93f9255caa
Improve km-Spinner behaviour, allow text input (alpha).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2486
diff
changeset
|
621 if (kpe.getKeyName().equals("Enter")) { |
4d93f9255caa
Improve km-Spinner behaviour, allow text input (alpha).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2486
diff
changeset
|
622 kmField.blurItem(); |
4d93f9255caa
Improve km-Spinner behaviour, allow text input (alpha).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2486
diff
changeset
|
623 } |
4d93f9255caa
Improve km-Spinner behaviour, allow text input (alpha).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2486
diff
changeset
|
624 } |
4d93f9255caa
Improve km-Spinner behaviour, allow text input (alpha).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2486
diff
changeset
|
625 }); |
4d93f9255caa
Improve km-Spinner behaviour, allow text input (alpha).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2486
diff
changeset
|
626 // TODO: i18n Now add all the validators, formatters, editors/parsers etc. |
4d93f9255caa
Improve km-Spinner behaviour, allow text input (alpha).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2486
diff
changeset
|
627 form.setFields(kmField); |
4d93f9255caa
Improve km-Spinner behaviour, allow text input (alpha).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2486
diff
changeset
|
628 form.setTitle(""); |
4d93f9255caa
Improve km-Spinner behaviour, allow text input (alpha).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2486
diff
changeset
|
629 form.setTitlePrefix(""); |
4d93f9255caa
Improve km-Spinner behaviour, allow text input (alpha).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2486
diff
changeset
|
630 form.setTitleSuffix(""); |
4d93f9255caa
Improve km-Spinner behaviour, allow text input (alpha).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2486
diff
changeset
|
631 form.setTitleWidth(0); |
4d93f9255caa
Improve km-Spinner behaviour, allow text input (alpha).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2486
diff
changeset
|
632 form.setWidth(40); |
4d93f9255caa
Improve km-Spinner behaviour, allow text input (alpha).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2486
diff
changeset
|
633 form.setHeight(height); |
2485
26fc6163643d
Replace spinnerItem by custom implementation to switch km in cross sections, but regress.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2484
diff
changeset
|
634 // PlusButton shall ask service for next available cs. |
26fc6163643d
Replace spinnerItem by custom implementation to switch km in cross sections, but regress.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2484
diff
changeset
|
635 Button plusButton = new Button("+"); |
26fc6163643d
Replace spinnerItem by custom implementation to switch km in cross sections, but regress.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2484
diff
changeset
|
636 plusButton.setWidth(10); |
26fc6163643d
Replace spinnerItem by custom implementation to switch km in cross sections, but regress.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2484
diff
changeset
|
637 plusButton.setHeight(height); |
26fc6163643d
Replace spinnerItem by custom implementation to switch km in cross sections, but regress.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2484
diff
changeset
|
638 plusButton.addClickHandler(new com.smartgwt.client.widgets.events.ClickHandler() { |
26fc6163643d
Replace spinnerItem by custom implementation to switch km in cross sections, but regress.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2484
diff
changeset
|
639 public void onClick(ClickEvent evt) { |
26fc6163643d
Replace spinnerItem by custom implementation to switch km in cross sections, but regress.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2484
diff
changeset
|
640 spinnerValueEntered(null, currentValue + 0.1d, _facetRecord); |
26fc6163643d
Replace spinnerItem by custom implementation to switch km in cross sections, but regress.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2484
diff
changeset
|
641 } |
26fc6163643d
Replace spinnerItem by custom implementation to switch km in cross sections, but regress.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2484
diff
changeset
|
642 }); |
26fc6163643d
Replace spinnerItem by custom implementation to switch km in cross sections, but regress.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2484
diff
changeset
|
643 this.addMember(minusButton); |
2490
4d93f9255caa
Improve km-Spinner behaviour, allow text input (alpha).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2486
diff
changeset
|
644 this.addMember(form); |
2485
26fc6163643d
Replace spinnerItem by custom implementation to switch km in cross sections, but regress.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2484
diff
changeset
|
645 this.addMember(plusButton); |
26fc6163643d
Replace spinnerItem by custom implementation to switch km in cross sections, but regress.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2484
diff
changeset
|
646 |
26fc6163643d
Replace spinnerItem by custom implementation to switch km in cross sections, but regress.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2484
diff
changeset
|
647 this.setHeight(height*2); |
2544
04bd9f1611a1
Resized the km spinner for cross section themes.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2518
diff
changeset
|
648 this.setWidth(60); |
2485
26fc6163643d
Replace spinnerItem by custom implementation to switch km in cross sections, but regress.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2484
diff
changeset
|
649 } |
26fc6163643d
Replace spinnerItem by custom implementation to switch km in cross sections, but regress.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2484
diff
changeset
|
650 } |
26fc6163643d
Replace spinnerItem by custom implementation to switch km in cross sections, but regress.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2484
diff
changeset
|
651 |
26fc6163643d
Replace spinnerItem by custom implementation to switch km in cross sections, but regress.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2484
diff
changeset
|
652 |
26fc6163643d
Replace spinnerItem by custom implementation to switch km in cross sections, but regress.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2484
diff
changeset
|
653 /** |
858
9f07f67f60a5
Subclassed ChartThemePanel, trigger redraws of Chart when interaction with
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
654 * 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
|
655 * @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
|
656 */ |
9f07f67f60a5
Subclassed ChartThemePanel, trigger redraws of Chart when interaction with
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
657 @Override |
9f07f67f60a5
Subclassed ChartThemePanel, trigger redraws of Chart when interaction with
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
658 protected ListGrid createGrid() { |
9f07f67f60a5
Subclassed ChartThemePanel, trigger redraws of Chart when interaction with
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
659 ListGrid list = new ListGrid() { |
9f07f67f60a5
Subclassed ChartThemePanel, trigger redraws of Chart when interaction with
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
660 @Override |
1379
546f7f890ffa
Cosmetics, refactoring.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1378
diff
changeset
|
661 protected Canvas createRecordComponent( |
546f7f890ffa
Cosmetics, refactoring.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1378
diff
changeset
|
662 final ListGridRecord record, |
546f7f890ffa
Cosmetics, refactoring.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1378
diff
changeset
|
663 Integer colNum) |
546f7f890ffa
Cosmetics, refactoring.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1378
diff
changeset
|
664 { |
861
65204f30877b
Display Action Widget only for cross_section theme/facet.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
858
diff
changeset
|
665 // 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
|
666 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
|
667 if (!facetRecord.getTheme().getFacet().equals( |
1379
546f7f890ffa
Cosmetics, refactoring.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1378
diff
changeset
|
668 "cross_section")) |
546f7f890ffa
Cosmetics, refactoring.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1378
diff
changeset
|
669 { |
861
65204f30877b
Display Action Widget only for cross_section theme/facet.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
858
diff
changeset
|
670 return null; |
65204f30877b
Display Action Widget only for cross_section theme/facet.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
858
diff
changeset
|
671 } |
858
9f07f67f60a5
Subclassed ChartThemePanel, trigger redraws of Chart when interaction with
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
672 |
9f07f67f60a5
Subclassed ChartThemePanel, trigger redraws of Chart when interaction with
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
673 String fieldName = this.getFieldName(colNum); |
9f07f67f60a5
Subclassed ChartThemePanel, trigger redraws of Chart when interaction with
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
674 |
888
d6b88f8f88dd
Fix issue flys/issue311 (i18n crossection).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
861
diff
changeset
|
675 if (fieldName.equals(GRID_FIELD_ACTIONS)) { |
2485
26fc6163643d
Replace spinnerItem by custom implementation to switch km in cross sections, but regress.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2484
diff
changeset
|
676 /* |
2490
4d93f9255caa
Improve km-Spinner behaviour, allow text input (alpha).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2486
diff
changeset
|
677 TODO: |
2464
7568d97d74ce
Disable spinnerbox if theme is disabled.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2463
diff
changeset
|
678 if (facetRecord.getTheme().getActive() != 1) { |
7568d97d74ce
Disable spinnerbox if theme is disabled.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2463
diff
changeset
|
679 spinnerItem.disable(); |
7568d97d74ce
Disable spinnerbox if theme is disabled.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2463
diff
changeset
|
680 } |
2485
26fc6163643d
Replace spinnerItem by custom implementation to switch km in cross sections, but regress.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2484
diff
changeset
|
681 */ |
2464
7568d97d74ce
Disable spinnerbox if theme is disabled.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2463
diff
changeset
|
682 |
7568d97d74ce
Disable spinnerbox if theme is disabled.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2463
diff
changeset
|
683 /* |
7568d97d74ce
Disable spinnerbox if theme is disabled.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2463
diff
changeset
|
684 // To have visual representation of synchronous |
7568d97d74ce
Disable spinnerbox if theme is disabled.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2463
diff
changeset
|
685 // navigation or not per theme, snip: |
7568d97d74ce
Disable spinnerbox if theme is disabled.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2463
diff
changeset
|
686 if (synchronCrossSectionThemes.contains (themeHash |
7568d97d74ce
Disable spinnerbox if theme is disabled.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2463
diff
changeset
|
687 (facetRecord.getTheme()))) { |
7568d97d74ce
Disable spinnerbox if theme is disabled.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2463
diff
changeset
|
688 spinnerItem.setTextBoxStyle("bgBlueDark"); |
7568d97d74ce
Disable spinnerbox if theme is disabled.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2463
diff
changeset
|
689 } |
7568d97d74ce
Disable spinnerbox if theme is disabled.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2463
diff
changeset
|
690 */ |
7568d97d74ce
Disable spinnerbox if theme is disabled.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2463
diff
changeset
|
691 |
2485
26fc6163643d
Replace spinnerItem by custom implementation to switch km in cross sections, but regress.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2484
diff
changeset
|
692 return new KmSpinner(facetRecord); |
858
9f07f67f60a5
Subclassed ChartThemePanel, trigger redraws of Chart when interaction with
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
693 } |
9f07f67f60a5
Subclassed ChartThemePanel, trigger redraws of Chart when interaction with
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
694 else { |
9f07f67f60a5
Subclassed ChartThemePanel, trigger redraws of Chart when interaction with
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
695 return null; |
9f07f67f60a5
Subclassed ChartThemePanel, trigger redraws of Chart when interaction with
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
696 } |
9f07f67f60a5
Subclassed ChartThemePanel, trigger redraws of Chart when interaction with
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
697 } |
9f07f67f60a5
Subclassed ChartThemePanel, trigger redraws of Chart when interaction with
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
698 }; |
9f07f67f60a5
Subclassed ChartThemePanel, trigger redraws of Chart when interaction with
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
699 list.setCanResizeFields(true); |
9f07f67f60a5
Subclassed ChartThemePanel, trigger redraws of Chart when interaction with
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
700 list.setShowRecordComponents(true); |
9f07f67f60a5
Subclassed ChartThemePanel, trigger redraws of Chart when interaction with
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
701 list.setShowRecordComponentsByCell(true); |
9f07f67f60a5
Subclassed ChartThemePanel, trigger redraws of Chart when interaction with
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
702 list.setShowAllRecords(true); |
1378
ebba8a8618e6
Fix flys/issue306 (CrossSections: Remove table header context menu).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
891
diff
changeset
|
703 list.setShowHeaderContextMenu(false); |
2445
1de15a7bfc59
Removed the scrollbar gap in the theme panels.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2443
diff
changeset
|
704 list.setLeaveScrollbarGap(false); |
858
9f07f67f60a5
Subclassed ChartThemePanel, trigger redraws of Chart when interaction with
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
705 return list; |
9f07f67f60a5
Subclassed ChartThemePanel, trigger redraws of Chart when interaction with
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
706 } |
9f07f67f60a5
Subclassed ChartThemePanel, trigger redraws of Chart when interaction with
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
707 |
9f07f67f60a5
Subclassed ChartThemePanel, trigger redraws of Chart when interaction with
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
708 |
9f07f67f60a5
Subclassed ChartThemePanel, trigger redraws of Chart when interaction with
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
709 /** |
9f07f67f60a5
Subclassed ChartThemePanel, trigger redraws of Chart when interaction with
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
710 * 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
|
711 */ |
9f07f67f60a5
Subclassed ChartThemePanel, trigger redraws of Chart when interaction with
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
712 @Override |
9f07f67f60a5
Subclassed ChartThemePanel, trigger redraws of Chart when interaction with
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
713 protected void initGrid() { |
9f07f67f60a5
Subclassed ChartThemePanel, trigger redraws of Chart when interaction with
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
714 list.setCanEdit(true); |
9f07f67f60a5
Subclassed ChartThemePanel, trigger redraws of Chart when interaction with
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
715 list.setCanSort(false); |
9f07f67f60a5
Subclassed ChartThemePanel, trigger redraws of Chart when interaction with
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
716 list.setShowRecordComponents(true); |
9f07f67f60a5
Subclassed ChartThemePanel, trigger redraws of Chart when interaction with
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
717 list.setShowRecordComponentsByCell(true); |
9f07f67f60a5
Subclassed ChartThemePanel, trigger redraws of Chart when interaction with
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
718 list.setShowHeader(true); |
9f07f67f60a5
Subclassed ChartThemePanel, trigger redraws of Chart when interaction with
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
719 list.setWidth100(); |
9f07f67f60a5
Subclassed ChartThemePanel, trigger redraws of Chart when interaction with
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
720 list.setHeight100(); |
9f07f67f60a5
Subclassed ChartThemePanel, trigger redraws of Chart when interaction with
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
721 |
9f07f67f60a5
Subclassed ChartThemePanel, trigger redraws of Chart when interaction with
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
722 list.addEditCompleteHandler(this); |
9f07f67f60a5
Subclassed ChartThemePanel, trigger redraws of Chart when interaction with
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
723 |
9f07f67f60a5
Subclassed ChartThemePanel, trigger redraws of Chart when interaction with
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
724 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
|
725 active.setType(ListGridFieldType.BOOLEAN); |
9f07f67f60a5
Subclassed ChartThemePanel, trigger redraws of Chart when interaction with
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
726 |
9f07f67f60a5
Subclassed ChartThemePanel, trigger redraws of Chart when interaction with
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
727 ListGridField name = new ListGridField( |
9f07f67f60a5
Subclassed ChartThemePanel, trigger redraws of Chart when interaction with
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
728 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
|
729 name.setType(ListGridFieldType.TEXT); |
9f07f67f60a5
Subclassed ChartThemePanel, trigger redraws of Chart when interaction with
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
730 |
9f07f67f60a5
Subclassed ChartThemePanel, trigger redraws of Chart when interaction with
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
731 ListGridField actions = new ListGridField(GRID_FIELD_ACTIONS, |
2544
04bd9f1611a1
Resized the km spinner for cross section themes.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2518
diff
changeset
|
732 MSG.chart_themepanel_header_actions(), 65); |
858
9f07f67f60a5
Subclassed ChartThemePanel, trigger redraws of Chart when interaction with
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
733 |
9f07f67f60a5
Subclassed ChartThemePanel, trigger redraws of Chart when interaction with
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
734 list.setFields(active, name, actions); |
9f07f67f60a5
Subclassed ChartThemePanel, trigger redraws of Chart when interaction with
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
735 } |
1436
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
736 |
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
737 |
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
738 /** 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
|
739 public String getCurrentCSMaster() { |
eef55d18f424
Cosmetics, refactoring, renamed Master to CSMaster to avoid confusion.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1458
diff
changeset
|
740 return currentCSMasterUUID; |
1436
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
741 } |
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
742 |
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
743 |
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
744 /** 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
|
745 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
|
746 this.currentCSMasterUUID = currentMasterUuid; |
1436
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
747 } |
1444
bdac8a72f7e6
Area creation UI update.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1438
diff
changeset
|
748 |
bdac8a72f7e6
Area creation UI update.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1438
diff
changeset
|
749 |
1457
3d9f81c3f00d
Refactored to use existing code.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1452
diff
changeset
|
750 /** Returns name of cross section area facets. */ |
3d9f81c3f00d
Refactored to use existing code.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1452
diff
changeset
|
751 protected String getAreaFacetName() { |
3d9f81c3f00d
Refactored to use existing code.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1452
diff
changeset
|
752 return "cross_section.area"; |
3d9f81c3f00d
Refactored to use existing code.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1452
diff
changeset
|
753 } |
1444
bdac8a72f7e6
Area creation UI update.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1438
diff
changeset
|
754 |
bdac8a72f7e6
Area creation UI update.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1438
diff
changeset
|
755 |
bdac8a72f7e6
Area creation UI update.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1438
diff
changeset
|
756 /** |
1457
3d9f81c3f00d
Refactored to use existing code.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1452
diff
changeset
|
757 * 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
|
758 * rendered between them. |
3d9f81c3f00d
Refactored to use existing code.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1452
diff
changeset
|
759 * 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
|
760 * in subclasses. |
1444
bdac8a72f7e6
Area creation UI update.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1438
diff
changeset
|
761 */ |
1457
3d9f81c3f00d
Refactored to use existing code.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1452
diff
changeset
|
762 protected boolean areAreaCompatible(Theme a, Theme b) { |
3d9f81c3f00d
Refactored to use existing code.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1452
diff
changeset
|
763 if (a.equals(b)) { |
3d9f81c3f00d
Refactored to use existing code.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1452
diff
changeset
|
764 return false; |
1444
bdac8a72f7e6
Area creation UI update.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1438
diff
changeset
|
765 } |
1457
3d9f81c3f00d
Refactored to use existing code.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1452
diff
changeset
|
766 return (a.getFacet().equals("cross_section") |
3d9f81c3f00d
Refactored to use existing code.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1452
diff
changeset
|
767 || a.getFacet().equals("cross_section_water_line")) |
3d9f81c3f00d
Refactored to use existing code.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1452
diff
changeset
|
768 && (b.getFacet().equals("cross_section") |
3d9f81c3f00d
Refactored to use existing code.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1452
diff
changeset
|
769 || b.getFacet().equals("cross_section_water_line")); |
3d9f81c3f00d
Refactored to use existing code.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1452
diff
changeset
|
770 } |
1444
bdac8a72f7e6
Area creation UI update.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1438
diff
changeset
|
771 |
1452
fa63366ba115
Improved area creation GUI.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1449
diff
changeset
|
772 |
1457
3d9f81c3f00d
Refactored to use existing code.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1452
diff
changeset
|
773 /** |
3d9f81c3f00d
Refactored to use existing code.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1452
diff
changeset
|
774 * 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
|
775 * this theme. |
3d9f81c3f00d
Refactored to use existing code.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1452
diff
changeset
|
776 */ |
3d9f81c3f00d
Refactored to use existing code.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1452
diff
changeset
|
777 protected boolean canArea(Theme a) { |
3d9f81c3f00d
Refactored to use existing code.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1452
diff
changeset
|
778 return a.getFacet().equals("cross_section") |
3d9f81c3f00d
Refactored to use existing code.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1452
diff
changeset
|
779 || a.getFacet().equals("cross_section_water_line"); |
1444
bdac8a72f7e6
Area creation UI update.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1438
diff
changeset
|
780 } |
1519
a6f6c61b18be
Implemented synchronous navigation through cross section profiles.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1496
diff
changeset
|
781 |
a6f6c61b18be
Implemented synchronous navigation through cross section profiles.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1496
diff
changeset
|
782 |
2463
0eeceffd50e3
Make synchron navigation of CrossSections a per-theme option, not global one.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2462
diff
changeset
|
783 protected String themeHash(Theme theme) { |
0eeceffd50e3
Make synchron navigation of CrossSections a per-theme option, not global one.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2462
diff
changeset
|
784 return theme.getArtifact() + theme.getFacet() + theme.getIndex(); |
0eeceffd50e3
Make synchron navigation of CrossSections a per-theme option, not global one.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2462
diff
changeset
|
785 } |
0eeceffd50e3
Make synchron navigation of CrossSections a per-theme option, not global one.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2462
diff
changeset
|
786 |
0eeceffd50e3
Make synchron navigation of CrossSections a per-theme option, not global one.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2462
diff
changeset
|
787 |
1519
a6f6c61b18be
Implemented synchronous navigation through cross section profiles.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1496
diff
changeset
|
788 /** |
a6f6c61b18be
Implemented synchronous navigation through cross section profiles.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1496
diff
changeset
|
789 * Include synchron navigation item. |
a6f6c61b18be
Implemented synchronous navigation through cross section profiles.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1496
diff
changeset
|
790 */ |
a6f6c61b18be
Implemented synchronous navigation through cross section profiles.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1496
diff
changeset
|
791 @Override |
a6f6c61b18be
Implemented synchronous navigation through cross section profiles.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1496
diff
changeset
|
792 protected Menu getSingleContextMenu(final ListGridRecord[] records) { |
a6f6c61b18be
Implemented synchronous navigation through cross section profiles.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1496
diff
changeset
|
793 Menu contextMenu = super.getSingleContextMenu(records); |
a6f6c61b18be
Implemented synchronous navigation through cross section profiles.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1496
diff
changeset
|
794 |
2453
ec120dc6279b
Issue 616.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2445
diff
changeset
|
795 Theme facetTheme = ((FacetRecord)records[0]).getTheme(); |
ec120dc6279b
Issue 616.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2445
diff
changeset
|
796 String item = facetTheme.getFacet(); |
ec120dc6279b
Issue 616.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2445
diff
changeset
|
797 |
2482
cef4c624c68c
Cosmetics.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2481
diff
changeset
|
798 if (item.equals("cross_section")) { |
2453
ec120dc6279b
Issue 616.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2445
diff
changeset
|
799 // Synchron checking. |
ec120dc6279b
Issue 616.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2445
diff
changeset
|
800 MenuItem synchronNavigationMenuItem = new MenuItem(); |
2463
0eeceffd50e3
Make synchron navigation of CrossSections a per-theme option, not global one.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2462
diff
changeset
|
801 final String themeHash = themeHash(facetTheme); |
0eeceffd50e3
Make synchron navigation of CrossSections a per-theme option, not global one.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2462
diff
changeset
|
802 if (synchronCrossSectionThemes.contains(themeHash)) { |
2462
d45059aa8507
i18n and moved reference selectbox for cross section master to top.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2453
diff
changeset
|
803 synchronNavigationMenuItem.setTitle(MSG.chart_themepanel_asynchron()); |
2463
0eeceffd50e3
Make synchron navigation of CrossSections a per-theme option, not global one.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2462
diff
changeset
|
804 synchronNavigationMenuItem.addClickHandler(new ClickHandler() { |
0eeceffd50e3
Make synchron navigation of CrossSections a per-theme option, not global one.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2462
diff
changeset
|
805 public void onClick(MenuItemClickEvent evt) { |
0eeceffd50e3
Make synchron navigation of CrossSections a per-theme option, not global one.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2462
diff
changeset
|
806 synchronCrossSectionThemes.remove (themeHash); |
0eeceffd50e3
Make synchron navigation of CrossSections a per-theme option, not global one.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2462
diff
changeset
|
807 } |
0eeceffd50e3
Make synchron navigation of CrossSections a per-theme option, not global one.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2462
diff
changeset
|
808 }); |
2453
ec120dc6279b
Issue 616.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2445
diff
changeset
|
809 } |
ec120dc6279b
Issue 616.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2445
diff
changeset
|
810 else { |
2462
d45059aa8507
i18n and moved reference selectbox for cross section master to top.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2453
diff
changeset
|
811 synchronNavigationMenuItem.setTitle(MSG.chart_themepanel_synchron()); |
2463
0eeceffd50e3
Make synchron navigation of CrossSections a per-theme option, not global one.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2462
diff
changeset
|
812 synchronNavigationMenuItem.addClickHandler(new ClickHandler() { |
0eeceffd50e3
Make synchron navigation of CrossSections a per-theme option, not global one.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2462
diff
changeset
|
813 public void onClick(MenuItemClickEvent evt) { |
0eeceffd50e3
Make synchron navigation of CrossSections a per-theme option, not global one.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2462
diff
changeset
|
814 synchronCrossSectionThemes.add (themeHash); |
0eeceffd50e3
Make synchron navigation of CrossSections a per-theme option, not global one.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2462
diff
changeset
|
815 } |
0eeceffd50e3
Make synchron navigation of CrossSections a per-theme option, not global one.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2462
diff
changeset
|
816 }); |
2453
ec120dc6279b
Issue 616.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2445
diff
changeset
|
817 } |
ec120dc6279b
Issue 616.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2445
diff
changeset
|
818 contextMenu.addItem(synchronNavigationMenuItem); |
1519
a6f6c61b18be
Implemented synchronous navigation through cross section profiles.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1496
diff
changeset
|
819 } |
a6f6c61b18be
Implemented synchronous navigation through cross section profiles.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1496
diff
changeset
|
820 |
a6f6c61b18be
Implemented synchronous navigation through cross section profiles.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1496
diff
changeset
|
821 return contextMenu; |
a6f6c61b18be
Implemented synchronous navigation through cross section profiles.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1496
diff
changeset
|
822 } |
1533
7fcec57c2f2c
Add cross sections loaded from datacage to the master artifacts list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1519
diff
changeset
|
823 |
7fcec57c2f2c
Add cross sections loaded from datacage to the master artifacts list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1519
diff
changeset
|
824 |
7fcec57c2f2c
Add cross sections loaded from datacage to the master artifacts list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1519
diff
changeset
|
825 /** |
7fcec57c2f2c
Add cross sections loaded from datacage to the master artifacts list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1519
diff
changeset
|
826 * This method is used to clear the current theme grid and add new updated |
7fcec57c2f2c
Add cross sections loaded from datacage to the master artifacts list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1519
diff
changeset
|
827 * data. |
7fcec57c2f2c
Add cross sections loaded from datacage to the master artifacts list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1519
diff
changeset
|
828 */ |
7fcec57c2f2c
Add cross sections loaded from datacage to the master artifacts list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1519
diff
changeset
|
829 @Override |
7fcec57c2f2c
Add cross sections loaded from datacage to the master artifacts list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1519
diff
changeset
|
830 protected void updateGrid() { |
7fcec57c2f2c
Add cross sections loaded from datacage to the master artifacts list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1519
diff
changeset
|
831 GWT.log("CrossSectionChartThemePanel.updateGrid"); |
7fcec57c2f2c
Add cross sections loaded from datacage to the master artifacts list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1519
diff
changeset
|
832 |
7fcec57c2f2c
Add cross sections loaded from datacage to the master artifacts list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1519
diff
changeset
|
833 ListGridRecord[] selected = list.getSelectedRecords(); |
7fcec57c2f2c
Add cross sections loaded from datacage to the master artifacts list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1519
diff
changeset
|
834 |
7fcec57c2f2c
Add cross sections loaded from datacage to the master artifacts list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1519
diff
changeset
|
835 clearGrid(); |
7fcec57c2f2c
Add cross sections loaded from datacage to the master artifacts list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1519
diff
changeset
|
836 |
7fcec57c2f2c
Add cross sections loaded from datacage to the master artifacts list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1519
diff
changeset
|
837 ThemeList themeList = getThemeList(); |
7fcec57c2f2c
Add cross sections loaded from datacage to the master artifacts list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1519
diff
changeset
|
838 |
7fcec57c2f2c
Add cross sections loaded from datacage to the master artifacts list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1519
diff
changeset
|
839 if (themeList == null) { |
7fcec57c2f2c
Add cross sections loaded from datacage to the master artifacts list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1519
diff
changeset
|
840 GWT.log("ERROR: No theme list."); |
7fcec57c2f2c
Add cross sections loaded from datacage to the master artifacts list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1519
diff
changeset
|
841 return; |
7fcec57c2f2c
Add cross sections loaded from datacage to the master artifacts list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1519
diff
changeset
|
842 } |
7fcec57c2f2c
Add cross sections loaded from datacage to the master artifacts list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1519
diff
changeset
|
843 |
7fcec57c2f2c
Add cross sections loaded from datacage to the master artifacts list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1519
diff
changeset
|
844 int count = themeList.getThemeCount(); |
7fcec57c2f2c
Add cross sections loaded from datacage to the master artifacts list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1519
diff
changeset
|
845 |
7fcec57c2f2c
Add cross sections loaded from datacage to the master artifacts list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1519
diff
changeset
|
846 for (int i = 1; i <= count; i++) { |
7fcec57c2f2c
Add cross sections loaded from datacage to the master artifacts list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1519
diff
changeset
|
847 Theme theme = themeList.getThemeAt(i); |
7fcec57c2f2c
Add cross sections loaded from datacage to the master artifacts list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1519
diff
changeset
|
848 |
1578
df11c4c8c578
Avoid certain npes.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1574
diff
changeset
|
849 if (theme == null) { |
df11c4c8c578
Avoid certain npes.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1574
diff
changeset
|
850 continue; |
df11c4c8c578
Avoid certain npes.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1574
diff
changeset
|
851 } |
df11c4c8c578
Avoid certain npes.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1574
diff
changeset
|
852 |
df11c4c8c578
Avoid certain npes.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1574
diff
changeset
|
853 if (theme.getFacet().equals("empty.facet")) { |
1533
7fcec57c2f2c
Add cross sections loaded from datacage to the master artifacts list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1519
diff
changeset
|
854 theme.setVisible(0); |
7fcec57c2f2c
Add cross sections loaded from datacage to the master artifacts list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1519
diff
changeset
|
855 } |
7fcec57c2f2c
Add cross sections loaded from datacage to the master artifacts list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1519
diff
changeset
|
856 |
1578
df11c4c8c578
Avoid certain npes.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1574
diff
changeset
|
857 if (theme.getVisible() == 0) { |
1533
7fcec57c2f2c
Add cross sections loaded from datacage to the master artifacts list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1519
diff
changeset
|
858 continue; |
7fcec57c2f2c
Add cross sections loaded from datacage to the master artifacts list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1519
diff
changeset
|
859 } |
7fcec57c2f2c
Add cross sections loaded from datacage to the master artifacts list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1519
diff
changeset
|
860 |
7fcec57c2f2c
Add cross sections loaded from datacage to the master artifacts list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1519
diff
changeset
|
861 if (theme.getFacet().equals("cross_section")) { |
7fcec57c2f2c
Add cross sections loaded from datacage to the master artifacts list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1519
diff
changeset
|
862 addToReferences(theme); |
7fcec57c2f2c
Add cross sections loaded from datacage to the master artifacts list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1519
diff
changeset
|
863 } |
7fcec57c2f2c
Add cross sections loaded from datacage to the master artifacts list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1519
diff
changeset
|
864 |
7fcec57c2f2c
Add cross sections loaded from datacage to the master artifacts list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1519
diff
changeset
|
865 FacetRecord newRecord = createRecord(theme); |
7fcec57c2f2c
Add cross sections loaded from datacage to the master artifacts list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1519
diff
changeset
|
866 addFacetRecord(newRecord); |
7fcec57c2f2c
Add cross sections loaded from datacage to the master artifacts list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1519
diff
changeset
|
867 |
7fcec57c2f2c
Add cross sections loaded from datacage to the master artifacts list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1519
diff
changeset
|
868 String newArtifact = theme.getArtifact(); |
7fcec57c2f2c
Add cross sections loaded from datacage to the master artifacts list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1519
diff
changeset
|
869 String newFacet = theme.getFacet(); |
7fcec57c2f2c
Add cross sections loaded from datacage to the master artifacts list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1519
diff
changeset
|
870 int newIndex = theme.getIndex(); |
7fcec57c2f2c
Add cross sections loaded from datacage to the master artifacts list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1519
diff
changeset
|
871 |
7fcec57c2f2c
Add cross sections loaded from datacage to the master artifacts list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1519
diff
changeset
|
872 for (ListGridRecord r: selected) { |
7fcec57c2f2c
Add cross sections loaded from datacage to the master artifacts list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1519
diff
changeset
|
873 FacetRecord sel = (FacetRecord) r; |
7fcec57c2f2c
Add cross sections loaded from datacage to the master artifacts list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1519
diff
changeset
|
874 Theme oldTheme = sel.getTheme(); |
7fcec57c2f2c
Add cross sections loaded from datacage to the master artifacts list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1519
diff
changeset
|
875 |
7fcec57c2f2c
Add cross sections loaded from datacage to the master artifacts list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1519
diff
changeset
|
876 if (oldTheme.getArtifact().equals(newArtifact) |
7fcec57c2f2c
Add cross sections loaded from datacage to the master artifacts list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1519
diff
changeset
|
877 && oldTheme.getFacet().equals(newFacet) |
7fcec57c2f2c
Add cross sections loaded from datacage to the master artifacts list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1519
diff
changeset
|
878 && oldTheme.getIndex() == newIndex) { |
7fcec57c2f2c
Add cross sections loaded from datacage to the master artifacts list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1519
diff
changeset
|
879 list.selectRecord(newRecord); |
7fcec57c2f2c
Add cross sections loaded from datacage to the master artifacts list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1519
diff
changeset
|
880 } |
7fcec57c2f2c
Add cross sections loaded from datacage to the master artifacts list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1519
diff
changeset
|
881 } |
7fcec57c2f2c
Add cross sections loaded from datacage to the master artifacts list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1519
diff
changeset
|
882 } |
7fcec57c2f2c
Add cross sections loaded from datacage to the master artifacts list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1519
diff
changeset
|
883 |
7fcec57c2f2c
Add cross sections loaded from datacage to the master artifacts list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1519
diff
changeset
|
884 fireOutputParameterChanged(); |
7fcec57c2f2c
Add cross sections loaded from datacage to the master artifacts list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1519
diff
changeset
|
885 |
7fcec57c2f2c
Add cross sections loaded from datacage to the master artifacts list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1519
diff
changeset
|
886 } |
7fcec57c2f2c
Add cross sections loaded from datacage to the master artifacts list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1519
diff
changeset
|
887 |
7fcec57c2f2c
Add cross sections loaded from datacage to the master artifacts list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1519
diff
changeset
|
888 |
7fcec57c2f2c
Add cross sections loaded from datacage to the master artifacts list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1519
diff
changeset
|
889 /** |
7fcec57c2f2c
Add cross sections loaded from datacage to the master artifacts list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1519
diff
changeset
|
890 * Adds a cross section theme to the master artifacts combobox and finds |
7fcec57c2f2c
Add cross sections loaded from datacage to the master artifacts list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1519
diff
changeset
|
891 * a new master if necessary. |
7fcec57c2f2c
Add cross sections loaded from datacage to the master artifacts list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1519
diff
changeset
|
892 * |
7fcec57c2f2c
Add cross sections loaded from datacage to the master artifacts list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1519
diff
changeset
|
893 * @param theme The cross section theme. |
7fcec57c2f2c
Add cross sections loaded from datacage to the master artifacts list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1519
diff
changeset
|
894 */ |
7fcec57c2f2c
Add cross sections loaded from datacage to the master artifacts list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1519
diff
changeset
|
895 protected void addToReferences(Theme theme) { |
2443
993871f8e2f2
Partial fix flys/issue624 (removing cross section).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1588
diff
changeset
|
896 if (theme.getVisible() != 0) { |
993871f8e2f2
Partial fix flys/issue624 (removing cross section).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1588
diff
changeset
|
897 masters.put(theme.getArtifact(), theme.getDescription()); |
993871f8e2f2
Partial fix flys/issue624 (removing cross section).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1588
diff
changeset
|
898 masterCb.setValueMap(masters); |
993871f8e2f2
Partial fix flys/issue624 (removing cross section).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1588
diff
changeset
|
899 } |
1533
7fcec57c2f2c
Add cross sections loaded from datacage to the master artifacts list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1519
diff
changeset
|
900 findCurrentCSMaster(); |
7fcec57c2f2c
Add cross sections loaded from datacage to the master artifacts list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1519
diff
changeset
|
901 if (masterCb.getSelectedRecord() == null) { |
7fcec57c2f2c
Add cross sections loaded from datacage to the master artifacts list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1519
diff
changeset
|
902 masterCb.setValue(getCurrentCSMaster()); |
7fcec57c2f2c
Add cross sections loaded from datacage to the master artifacts list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1519
diff
changeset
|
903 } |
7fcec57c2f2c
Add cross sections loaded from datacage to the master artifacts list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1519
diff
changeset
|
904 } |
858
9f07f67f60a5
Subclassed ChartThemePanel, trigger redraws of Chart when interaction with
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
905 } |
9f07f67f60a5
Subclassed ChartThemePanel, trigger redraws of Chart when interaction with
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
906 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : |