Mercurial > dive4elements > river
annotate flys-client/src/main/java/de/intevation/flys/client/client/ui/chart/CrossSectionChartThemePanel.java @ 1578:df11c4c8c578
Avoid certain npes.
flys-client/trunk@3847 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Felix Wolfsteller <felix.wolfsteller@intevation.de> |
---|---|
date | Wed, 01 Feb 2012 08:51:30 +0000 |
parents | 465f72f68cee |
children | e0d665661a1d |
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; |
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
5 import java.util.Map; |
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
6 import java.util.LinkedHashMap; |
1519
a6f6c61b18be
Implemented synchronous navigation through cross section profiles.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1496
diff
changeset
|
7 import java.util.List; |
1436
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
8 |
858
9f07f67f60a5
Subclassed ChartThemePanel, trigger redraws of Chart when interaction with
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
9 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
|
10 |
1436
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
11 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
|
12 |
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
13 import com.smartgwt.client.util.SC; |
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
14 |
858
9f07f67f60a5
Subclassed ChartThemePanel, trigger redraws of Chart when interaction with
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
15 import com.smartgwt.client.types.Alignment; |
1436
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
16 import com.smartgwt.client.types.ListGridFieldType; |
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
17 |
858
9f07f67f60a5
Subclassed ChartThemePanel, trigger redraws of Chart when interaction with
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
18 import com.smartgwt.client.widgets.Canvas; |
9f07f67f60a5
Subclassed ChartThemePanel, trigger redraws of Chart when interaction with
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
19 import com.smartgwt.client.widgets.grid.ListGrid; |
9f07f67f60a5
Subclassed ChartThemePanel, trigger redraws of Chart when interaction with
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
20 import com.smartgwt.client.widgets.grid.ListGridField; |
9f07f67f60a5
Subclassed ChartThemePanel, trigger redraws of Chart when interaction with
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
21 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
|
22 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
|
23 import com.smartgwt.client.widgets.layout.VLayout; |
858
9f07f67f60a5
Subclassed ChartThemePanel, trigger redraws of Chart when interaction with
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
24 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
|
25 import com.smartgwt.client.widgets.form.DynamicForm; |
1436
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
26 |
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
27 import com.smartgwt.client.widgets.form.fields.SelectItem; |
1572
60f8edc7a6f0
Slightly improved Spinner- behaviour in CrossSectionControl, but regress in other case.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1555
diff
changeset
|
28 import com.smartgwt.client.widgets.form.fields.events.BlurEvent; |
60f8edc7a6f0
Slightly improved Spinner- behaviour in CrossSectionControl, but regress in other case.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1555
diff
changeset
|
29 import com.smartgwt.client.widgets.form.fields.events.BlurHandler; |
1436
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
30 import com.smartgwt.client.widgets.form.fields.events.ChangeEvent; |
858
9f07f67f60a5
Subclassed ChartThemePanel, trigger redraws of Chart when interaction with
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
31 import com.smartgwt.client.widgets.form.fields.events.ChangedEvent; |
9f07f67f60a5
Subclassed ChartThemePanel, trigger redraws of Chart when interaction with
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
32 import com.smartgwt.client.widgets.form.fields.events.ChangedHandler; |
1436
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
33 import com.smartgwt.client.widgets.form.fields.events.ChangeHandler; |
1572
60f8edc7a6f0
Slightly improved Spinner- behaviour in CrossSectionControl, but regress in other case.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1555
diff
changeset
|
34 import com.smartgwt.client.widgets.form.fields.events.ChangeHandler; |
1573
0fbbcec35462
Improved spinner-behaviour in cross section km control.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1572
diff
changeset
|
35 import com.smartgwt.client.widgets.form.fields.events.KeyPressEvent; |
0fbbcec35462
Improved spinner-behaviour in cross section km control.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1572
diff
changeset
|
36 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
|
37 |
1519
a6f6c61b18be
Implemented synchronous navigation through cross section profiles.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1496
diff
changeset
|
38 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
|
39 import com.smartgwt.client.widgets.menu.MenuItem; |
a6f6c61b18be
Implemented synchronous navigation through cross section profiles.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1496
diff
changeset
|
40 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
|
41 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
|
42 |
858
9f07f67f60a5
Subclassed ChartThemePanel, trigger redraws of Chart when interaction with
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
43 import de.intevation.flys.client.client.Config; |
9f07f67f60a5
Subclassed ChartThemePanel, trigger redraws of Chart when interaction with
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
44 import de.intevation.flys.client.shared.model.Artifact; |
9f07f67f60a5
Subclassed ChartThemePanel, trigger redraws of Chart when interaction with
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
45 import de.intevation.flys.client.shared.model.Collection; |
9f07f67f60a5
Subclassed ChartThemePanel, trigger redraws of Chart when interaction with
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
46 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
|
47 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
|
48 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
|
49 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
|
50 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
|
51 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
|
52 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
|
53 |
1444
bdac8a72f7e6
Area creation UI update.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1438
diff
changeset
|
54 import de.intevation.flys.client.client.services.CrossSectionKMServiceAsync; |
1379
546f7f890ffa
Cosmetics, refactoring.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1378
diff
changeset
|
55 import de.intevation.flys.client.client.services.FeedServiceAsync; |
1444
bdac8a72f7e6
Area creation UI update.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1438
diff
changeset
|
56 import de.intevation.flys.client.client.services.LoadArtifactService; |
bdac8a72f7e6
Area creation UI update.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1438
diff
changeset
|
57 import de.intevation.flys.client.client.services.LoadArtifactServiceAsync; |
bdac8a72f7e6
Area creation UI update.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1438
diff
changeset
|
58 |
1472
a2b0b2af529f
Tell master-artifact of collection when cross-section-master changed kilometer.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1470
diff
changeset
|
59 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
|
60 |
1444
bdac8a72f7e6
Area creation UI update.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1438
diff
changeset
|
61 |
858
9f07f67f60a5
Subclassed ChartThemePanel, trigger redraws of Chart when interaction with
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
62 /** |
9f07f67f60a5
Subclassed ChartThemePanel, trigger redraws of Chart when interaction with
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
63 * 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
|
64 * needed for interaction in the CrossSection Charts and a selector to |
1436
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
65 * declare which cross section profile is "master". |
1457
3d9f81c3f00d
Refactored to use existing code.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1452
diff
changeset
|
66 * 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
|
67 */ |
9f07f67f60a5
Subclassed ChartThemePanel, trigger redraws of Chart when interaction with
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
68 public class CrossSectionChartThemePanel |
9f07f67f60a5
Subclassed ChartThemePanel, trigger redraws of Chart when interaction with
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
69 extends ChartThemePanel { |
1444
bdac8a72f7e6
Area creation UI update.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1438
diff
changeset
|
70 /** Artifact Clone/Creation service. */ |
bdac8a72f7e6
Area creation UI update.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1438
diff
changeset
|
71 protected LoadArtifactServiceAsync loadService = |
bdac8a72f7e6
Area creation UI update.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1438
diff
changeset
|
72 GWT.create(LoadArtifactService.class); |
858
9f07f67f60a5
Subclassed ChartThemePanel, trigger redraws of Chart when interaction with
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
73 |
1436
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
74 /** 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
|
75 CrossSectionKMServiceAsync kmService = GWT.create( |
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
76 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
|
77 |
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
78 /** 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
|
79 protected String currentCSMasterUUID; |
1436
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
80 |
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
81 /** 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
|
82 protected VLayout layout; |
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
83 |
1475
fb2fefe0325f
Improvements in CrossSectionChartThemePanel.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1472
diff
changeset
|
84 /** 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
|
85 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
|
86 |
edf18a9dfd8b
Uncommented some code paths to avoid unwanted side effects, cosmetics.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1475
diff
changeset
|
87 /** 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
|
88 protected static String CS_IS_MASTER = "cross_section.master?"; |
1475
fb2fefe0325f
Improvements in CrossSectionChartThemePanel.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1472
diff
changeset
|
89 |
1519
a6f6c61b18be
Implemented synchronous navigation through cross section profiles.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1496
diff
changeset
|
90 /** Whether or not to move through all cross sections synchronously. */ |
a6f6c61b18be
Implemented synchronous navigation through cross section profiles.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1496
diff
changeset
|
91 protected boolean synchronNavigation; |
a6f6c61b18be
Implemented synchronous navigation through cross section profiles.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1496
diff
changeset
|
92 |
1533
7fcec57c2f2c
Add cross sections loaded from datacage to the master artifacts list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1519
diff
changeset
|
93 /** 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
|
94 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
|
95 |
7fcec57c2f2c
Add cross sections loaded from datacage to the master artifacts list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1519
diff
changeset
|
96 /** 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
|
97 protected SelectItem masterCb; |
1475
fb2fefe0325f
Improvements in CrossSectionChartThemePanel.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1472
diff
changeset
|
98 |
1573
0fbbcec35462
Improved spinner-behaviour in cross section km control.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1572
diff
changeset
|
99 |
858
9f07f67f60a5
Subclassed ChartThemePanel, trigger redraws of Chart when interaction with
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
100 /** |
9f07f67f60a5
Subclassed ChartThemePanel, trigger redraws of Chart when interaction with
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
101 * Trivial constructor. |
9f07f67f60a5
Subclassed ChartThemePanel, trigger redraws of Chart when interaction with
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
102 */ |
9f07f67f60a5
Subclassed ChartThemePanel, trigger redraws of Chart when interaction with
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
103 public CrossSectionChartThemePanel( |
1475
fb2fefe0325f
Improvements in CrossSectionChartThemePanel.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1472
diff
changeset
|
104 OutputMode mode, |
fb2fefe0325f
Improvements in CrossSectionChartThemePanel.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1472
diff
changeset
|
105 CollectionView view) |
858
9f07f67f60a5
Subclassed ChartThemePanel, trigger redraws of Chart when interaction with
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
106 { |
1555
c057ef91b268
Refactored Collection reference out of Panels.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1533
diff
changeset
|
107 super(mode, view); |
1475
fb2fefe0325f
Improvements in CrossSectionChartThemePanel.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1472
diff
changeset
|
108 } |
fb2fefe0325f
Improvements in CrossSectionChartThemePanel.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1472
diff
changeset
|
109 |
fb2fefe0325f
Improvements in CrossSectionChartThemePanel.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1472
diff
changeset
|
110 |
fb2fefe0325f
Improvements in CrossSectionChartThemePanel.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1472
diff
changeset
|
111 /** Create DefaultArtifact. */ |
fb2fefe0325f
Improvements in CrossSectionChartThemePanel.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1472
diff
changeset
|
112 public static DefaultArtifact artifactReference(String uuid) { |
fb2fefe0325f
Improvements in CrossSectionChartThemePanel.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1472
diff
changeset
|
113 return new DefaultArtifact(uuid, "TODO:hash"); |
fb2fefe0325f
Improvements in CrossSectionChartThemePanel.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1472
diff
changeset
|
114 } |
fb2fefe0325f
Improvements in CrossSectionChartThemePanel.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1472
diff
changeset
|
115 |
fb2fefe0325f
Improvements in CrossSectionChartThemePanel.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1472
diff
changeset
|
116 |
fb2fefe0325f
Improvements in CrossSectionChartThemePanel.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1472
diff
changeset
|
117 /** Access data of collection item of theme. */ |
fb2fefe0325f
Improvements in CrossSectionChartThemePanel.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1472
diff
changeset
|
118 public static String dataOf(Theme theme, String dataItemName) { |
1578
df11c4c8c578
Avoid certain npes.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1574
diff
changeset
|
119 if (theme != null && theme.getCollectionItem() != null |
df11c4c8c578
Avoid certain npes.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1574
diff
changeset
|
120 && theme.getCollectionItem().getData() != null |
df11c4c8c578
Avoid certain npes.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1574
diff
changeset
|
121 ) { |
df11c4c8c578
Avoid certain npes.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1574
diff
changeset
|
122 return theme.getCollectionItem().getData().get(dataItemName); |
df11c4c8c578
Avoid certain npes.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1574
diff
changeset
|
123 } |
df11c4c8c578
Avoid certain npes.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1574
diff
changeset
|
124 |
df11c4c8c578
Avoid certain npes.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1574
diff
changeset
|
125 return null; |
858
9f07f67f60a5
Subclassed ChartThemePanel, trigger redraws of Chart when interaction with
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
126 } |
9f07f67f60a5
Subclassed ChartThemePanel, trigger redraws of Chart when interaction with
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
127 |
9f07f67f60a5
Subclassed ChartThemePanel, trigger redraws of Chart when interaction with
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
128 |
9f07f67f60a5
Subclassed ChartThemePanel, trigger redraws of Chart when interaction with
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
129 /** |
1436
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
130 * 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
|
131 * @param artifact uuid of an artifact. |
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
132 */ |
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
133 public void feedTellMaster(final String artifact) { |
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
134 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
|
135 CS_IS_MASTER, "1"); |
1436
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
136 |
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
137 feedService.feed( |
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
138 Config.getInstance().getLocale(), |
1475
fb2fefe0325f
Improvements in CrossSectionChartThemePanel.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1472
diff
changeset
|
139 artifactReference(artifact), |
1436
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
140 feedData, |
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
141 new AsyncCallback<Artifact>() { |
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
142 public void onFailure(Throwable caught) { |
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
143 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
|
144 + ") with master marker: " + caught.getMessage()); |
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
145 SC.warn(MSG.getString(caught.getMessage())); |
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
146 enable(); |
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
147 } |
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
148 public void onSuccess(Artifact artifact) { |
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
149 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
|
150 setCurrentCSMaster(artifact.getUuid()); |
1436
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
151 requestRedraw(); |
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
152 enable(); |
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
153 } |
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
154 }); |
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
155 } |
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 |
1444
bdac8a72f7e6
Area creation UI update.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1438
diff
changeset
|
158 |
bdac8a72f7e6
Area creation UI update.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1438
diff
changeset
|
159 /** |
1470
eef55d18f424
Cosmetics, refactoring, renamed Master to CSMaster to avoid confusion.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1458
diff
changeset
|
160 * Sets currentCSMasterUUID. |
1438
432180235caf
Minor refactoring and fix initial settings when creating ui.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1436
diff
changeset
|
161 */ |
1470
eef55d18f424
Cosmetics, refactoring, renamed Master to CSMaster to avoid confusion.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1458
diff
changeset
|
162 public String findCurrentCSMaster() { |
1438
432180235caf
Minor refactoring and fix initial settings when creating ui.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1436
diff
changeset
|
163 ThemeList themeList = getThemeList(); |
432180235caf
Minor refactoring and fix initial settings when creating ui.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1436
diff
changeset
|
164 int count = getThemeList().getThemeCount(); |
1445
df7ebcbff984
Bugfixing and feature-adding for cross-sections/areas.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1444
diff
changeset
|
165 String firstCSUuid = null; |
1475
fb2fefe0325f
Improvements in CrossSectionChartThemePanel.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1472
diff
changeset
|
166 Theme firstCS = null; |
1438
432180235caf
Minor refactoring and fix initial settings when creating ui.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1436
diff
changeset
|
167 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
|
168 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
|
169 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
|
170 |
1445
df7ebcbff984
Bugfixing and feature-adding for cross-sections/areas.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1444
diff
changeset
|
171 if (value != null) { |
df7ebcbff984
Bugfixing and feature-adding for cross-sections/areas.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1444
diff
changeset
|
172 if (firstCSUuid == null) { |
df7ebcbff984
Bugfixing and feature-adding for cross-sections/areas.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1444
diff
changeset
|
173 firstCSUuid = theme.getArtifact(); |
1475
fb2fefe0325f
Improvements in CrossSectionChartThemePanel.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1472
diff
changeset
|
174 firstCS = theme; |
1445
df7ebcbff984
Bugfixing and feature-adding for cross-sections/areas.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1444
diff
changeset
|
175 } |
df7ebcbff984
Bugfixing and feature-adding for cross-sections/areas.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1444
diff
changeset
|
176 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
|
177 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
|
178 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
|
179 + "/" + theme.getDescription()); |
1445
df7ebcbff984
Bugfixing and feature-adding for cross-sections/areas.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1444
diff
changeset
|
180 return theme.getDescription(); |
df7ebcbff984
Bugfixing and feature-adding for cross-sections/areas.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1444
diff
changeset
|
181 } |
1438
432180235caf
Minor refactoring and fix initial settings when creating ui.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1436
diff
changeset
|
182 } |
432180235caf
Minor refactoring and fix initial settings when creating ui.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1436
diff
changeset
|
183 } |
1445
df7ebcbff984
Bugfixing and feature-adding for cross-sections/areas.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1444
diff
changeset
|
184 // 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
|
185 if (firstCSUuid != null) { |
1470
eef55d18f424
Cosmetics, refactoring, renamed Master to CSMaster to avoid confusion.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1458
diff
changeset
|
186 setCurrentCSMaster(firstCSUuid); |
1445
df7ebcbff984
Bugfixing and feature-adding for cross-sections/areas.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1444
diff
changeset
|
187 feedTellMaster(firstCSUuid); |
df7ebcbff984
Bugfixing and feature-adding for cross-sections/areas.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1444
diff
changeset
|
188 } |
1438
432180235caf
Minor refactoring and fix initial settings when creating ui.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1436
diff
changeset
|
189 return null; |
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 |
1444
bdac8a72f7e6
Area creation UI update.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1438
diff
changeset
|
192 |
1438
432180235caf
Minor refactoring and fix initial settings when creating ui.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1436
diff
changeset
|
193 /** |
1436
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
194 * 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
|
195 */ |
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
196 @Override |
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
197 protected VLayout createLayout() { |
1438
432180235caf
Minor refactoring and fix initial settings when creating ui.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1436
diff
changeset
|
198 layout = super.createLayout(); |
1436
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
199 |
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
200 // 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
|
201 masterCb = new SelectItem(); |
1436
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
202 |
1533
7fcec57c2f2c
Add cross sections loaded from datacage to the master artifacts list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1519
diff
changeset
|
203 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
|
204 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
|
205 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
|
206 masterCb.setValueMap(masters); |
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 final DynamicForm form = new DynamicForm(); |
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
209 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
|
210 form.setFields(masterCb); |
1436
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
211 layout.addMember(form); |
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
212 |
1438
432180235caf
Minor refactoring and fix initial settings when creating ui.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1436
diff
changeset
|
213 Config config = Config.getInstance(); |
432180235caf
Minor refactoring and fix initial settings when creating ui.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1436
diff
changeset
|
214 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
|
215 findCurrentCSMaster(); |
1533
7fcec57c2f2c
Add cross sections loaded from datacage to the master artifacts list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1519
diff
changeset
|
216 masterCb.setValue(getCurrentCSMaster()); |
1436
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
217 |
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
218 // 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
|
219 // 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
|
220 masterCb.addChangeHandler(new ChangeHandler() { |
1436
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
221 public void onChange(ChangeEvent event) { |
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
222 String selectedItem = (String) event.getValue(); |
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
223 final String artifact = selectedItem; |
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
224 |
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
225 disable(); |
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
226 |
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
227 // 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
|
228 if (getCurrentCSMaster() != null) { |
1436
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
229 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
|
230 CS_IS_MASTER, "0"); |
1436
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
231 feedService.feed( |
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
232 locale, |
1475
fb2fefe0325f
Improvements in CrossSectionChartThemePanel.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1472
diff
changeset
|
233 artifactReference(getCurrentCSMaster()), |
1436
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
234 feedData, |
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
235 new AsyncCallback<Artifact>() { |
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
236 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
|
237 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
|
238 + getCurrentCSMaster() + "): " + |
1436
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
239 caught.getMessage()); |
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
240 SC.warn(MSG.getString(caught.getMessage())); |
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
241 enable(); |
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
242 } |
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
243 public void onSuccess(Artifact oldMaster) { |
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
244 GWT.log("Successfully un-mastered artifact."); |
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
245 feedTellMaster(artifact); |
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
246 } |
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
247 }); |
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
248 } |
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
249 else { |
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
250 feedTellMaster(artifact); |
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
251 } |
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
252 } |
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
253 }); |
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
254 |
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
255 return layout; |
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
256 } |
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
257 |
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
258 |
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
259 /** 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
|
260 public void disable() { |
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
261 this.layout.setDisabled(true); |
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
262 } |
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
263 |
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
264 |
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
265 /** 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
|
266 public void enable() { |
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
267 this.layout.setDisabled(false); |
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
268 } |
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
269 |
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 * 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
|
273 * 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
|
274 * the last one is taken. |
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
275 * @param in possible return values. |
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
276 * @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
|
277 * @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
|
278 */ |
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
279 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
|
280 if (in == null || in.length == 0) { |
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
281 return -1; |
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
282 } |
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
283 if (in[0] == to) { |
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
284 return to; |
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
285 } |
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
286 double minDiff = Math.abs(to - in[0]); |
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
287 double bestMatch = in[0]; |
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
288 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
|
289 if (in[i] == to) { |
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
290 return to; |
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
291 } |
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
292 double diff = Math.abs(to - in[0]); |
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
293 if (diff < minDiff) { |
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
294 minDiff = diff; |
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
295 bestMatch = in[i]; |
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
296 } |
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
297 } |
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
298 return bestMatch; |
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
299 } |
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
300 |
1573
0fbbcec35462
Improved spinner-behaviour in cross section km control.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1572
diff
changeset
|
301 |
0fbbcec35462
Improved spinner-behaviour in cross section km control.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1572
diff
changeset
|
302 /** |
0fbbcec35462
Improved spinner-behaviour in cross section km control.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1572
diff
changeset
|
303 * 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
|
304 * 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
|
305 * |
0fbbcec35462
Improved spinner-behaviour in cross section km control.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1572
diff
changeset
|
306 * @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
|
307 * @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
|
308 */ |
1519
a6f6c61b18be
Implemented synchronous navigation through cross section profiles.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1496
diff
changeset
|
309 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
|
310 Config config = Config.getInstance(); |
a6f6c61b18be
Implemented synchronous navigation through cross section profiles.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1496
diff
changeset
|
311 final String locale = config.getLocale(); |
a6f6c61b18be
Implemented synchronous navigation through cross section profiles.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1496
diff
changeset
|
312 |
a6f6c61b18be
Implemented synchronous navigation through cross section profiles.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1496
diff
changeset
|
313 Data[] feedData = |
a6f6c61b18be
Implemented synchronous navigation through cross section profiles.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1496
diff
changeset
|
314 DefaultData.createSimpleStringDataArray(CS_KM, |
a6f6c61b18be
Implemented synchronous navigation through cross section profiles.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1496
diff
changeset
|
315 Double.valueOf(kmD).toString()); |
a6f6c61b18be
Implemented synchronous navigation through cross section profiles.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1496
diff
changeset
|
316 |
a6f6c61b18be
Implemented synchronous navigation through cross section profiles.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1496
diff
changeset
|
317 disable(); |
a6f6c61b18be
Implemented synchronous navigation through cross section profiles.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1496
diff
changeset
|
318 feedService.feedMany( |
a6f6c61b18be
Implemented synchronous navigation through cross section profiles.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1496
diff
changeset
|
319 locale, |
a6f6c61b18be
Implemented synchronous navigation through cross section profiles.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1496
diff
changeset
|
320 artifacts, |
a6f6c61b18be
Implemented synchronous navigation through cross section profiles.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1496
diff
changeset
|
321 feedData, |
a6f6c61b18be
Implemented synchronous navigation through cross section profiles.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1496
diff
changeset
|
322 new AsyncCallback<List<Artifact>>() { |
a6f6c61b18be
Implemented synchronous navigation through cross section profiles.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1496
diff
changeset
|
323 @Override |
a6f6c61b18be
Implemented synchronous navigation through cross section profiles.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1496
diff
changeset
|
324 public void onFailure(Throwable caught) { |
a6f6c61b18be
Implemented synchronous navigation through cross section profiles.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1496
diff
changeset
|
325 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
|
326 SC.warn(MSG.getString(caught.getMessage())); |
a6f6c61b18be
Implemented synchronous navigation through cross section profiles.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1496
diff
changeset
|
327 enable(); |
a6f6c61b18be
Implemented synchronous navigation through cross section profiles.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1496
diff
changeset
|
328 } |
a6f6c61b18be
Implemented synchronous navigation through cross section profiles.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1496
diff
changeset
|
329 @Override |
a6f6c61b18be
Implemented synchronous navigation through cross section profiles.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1496
diff
changeset
|
330 public void onSuccess(List<Artifact> artifact) { |
a6f6c61b18be
Implemented synchronous navigation through cross section profiles.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1496
diff
changeset
|
331 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
|
332 requestRedraw(); |
a6f6c61b18be
Implemented synchronous navigation through cross section profiles.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1496
diff
changeset
|
333 enable(); |
a6f6c61b18be
Implemented synchronous navigation through cross section profiles.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1496
diff
changeset
|
334 } |
a6f6c61b18be
Implemented synchronous navigation through cross section profiles.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1496
diff
changeset
|
335 }); |
a6f6c61b18be
Implemented synchronous navigation through cross section profiles.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1496
diff
changeset
|
336 } |
1436
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
337 |
1573
0fbbcec35462
Improved spinner-behaviour in cross section km control.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1572
diff
changeset
|
338 |
0fbbcec35462
Improved spinner-behaviour in cross section km control.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1572
diff
changeset
|
339 /** |
0fbbcec35462
Improved spinner-behaviour in cross section km control.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1572
diff
changeset
|
340 * 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
|
341 * 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
|
342 * @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
|
343 * @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
|
344 */ |
1472
a2b0b2af529f
Tell master-artifact of collection when cross-section-master changed kilometer.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1470
diff
changeset
|
345 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
|
346 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
|
347 final String locale = config.getLocale(); |
1436
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
348 |
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
349 Data[] feedData = |
1476
edf18a9dfd8b
Uncommented some code paths to avoid unwanted side effects, cosmetics.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1475
diff
changeset
|
350 DefaultData.createSimpleStringDataArray(CS_KM, |
1436
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
351 Double.valueOf(kmD).toString()); |
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
352 |
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
353 disable(); |
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
354 feedService.feed( |
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
355 locale, |
1475
fb2fefe0325f
Improvements in CrossSectionChartThemePanel.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1472
diff
changeset
|
356 artifactReference(artUUID), |
1436
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
357 feedData, |
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
358 new AsyncCallback<Artifact>() { |
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
359 @Override |
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
360 public void onFailure(Throwable caught) { |
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
361 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
|
362 SC.warn(MSG.getString(caught.getMessage())); |
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
363 enable(); |
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
364 } |
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
365 @Override |
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
366 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
|
367 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
|
368 requestRedraw(); |
1496
a882297ce63d
Changed CrossSection spinner-stepsize, adjusted km- and mastersetting.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1476
diff
changeset
|
369 enable(); |
1436
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
370 } |
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
371 }); |
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
372 } |
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
373 |
1573
0fbbcec35462
Improved spinner-behaviour in cross section km control.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1572
diff
changeset
|
374 |
1572
60f8edc7a6f0
Slightly improved Spinner- behaviour in CrossSectionControl, but regress in other case.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1555
diff
changeset
|
375 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
|
376 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
|
377 ) { |
1573
0fbbcec35462
Improved spinner-behaviour in cross section km control.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1572
diff
changeset
|
378 disable(); |
1572
60f8edc7a6f0
Slightly improved Spinner- behaviour in CrossSectionControl, but regress in other case.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1555
diff
changeset
|
379 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
|
380 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
|
381 |
60f8edc7a6f0
Slightly improved Spinner- behaviour in CrossSectionControl, but regress in other case.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1555
diff
changeset
|
382 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
|
383 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
|
384 try { |
60f8edc7a6f0
Slightly improved Spinner- behaviour in CrossSectionControl, but regress in other case.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1555
diff
changeset
|
385 _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
|
386 .getCollectionItem() |
60f8edc7a6f0
Slightly improved Spinner- behaviour in CrossSectionControl, but regress in other case.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1555
diff
changeset
|
387 .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
|
388 } |
60f8edc7a6f0
Slightly improved Spinner- behaviour in CrossSectionControl, but regress in other case.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1555
diff
changeset
|
389 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
|
390 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
|
391 } |
60f8edc7a6f0
Slightly improved Spinner- behaviour in CrossSectionControl, but regress in other case.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1555
diff
changeset
|
392 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
|
393 |
60f8edc7a6f0
Slightly improved Spinner- behaviour in CrossSectionControl, but regress in other case.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1555
diff
changeset
|
394 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
|
395 |
60f8edc7a6f0
Slightly improved Spinner- behaviour in CrossSectionControl, but regress in other case.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1555
diff
changeset
|
396 |
60f8edc7a6f0
Slightly improved Spinner- behaviour in CrossSectionControl, but regress in other case.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1555
diff
changeset
|
397 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
|
398 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
|
399 @Override |
60f8edc7a6f0
Slightly improved Spinner- behaviour in CrossSectionControl, but regress in other case.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1555
diff
changeset
|
400 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
|
401 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
|
402 + 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
|
403 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
|
404 updateCollection(); |
1573
0fbbcec35462
Improved spinner-behaviour in cross section km control.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1572
diff
changeset
|
405 //updateGrid(); |
1572
60f8edc7a6f0
Slightly improved Spinner- behaviour in CrossSectionControl, but regress in other case.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1555
diff
changeset
|
406 enable(); |
60f8edc7a6f0
Slightly improved Spinner- behaviour in CrossSectionControl, but regress in other case.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1555
diff
changeset
|
407 } |
60f8edc7a6f0
Slightly improved Spinner- behaviour in CrossSectionControl, but regress in other case.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1555
diff
changeset
|
408 @Override |
60f8edc7a6f0
Slightly improved Spinner- behaviour in CrossSectionControl, but regress in other case.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1555
diff
changeset
|
409 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
|
410 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
|
411 double closest = |
1574
465f72f68cee
Fix strange javascript side effects.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1573
diff
changeset
|
412 CrossSectionChartThemePanel.closest(kms, enteredKm); |
1572
60f8edc7a6f0
Slightly improved Spinner- behaviour in CrossSectionControl, but regress in other case.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1555
diff
changeset
|
413 GWT.log("Got single km for " + dbid + ", it is " |
60f8edc7a6f0
Slightly improved Spinner- behaviour in CrossSectionControl, but regress in other case.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1555
diff
changeset
|
414 + closest); |
1574
465f72f68cee
Fix strange javascript side effects.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1573
diff
changeset
|
415 |
465f72f68cee
Fix strange javascript side effects.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1573
diff
changeset
|
416 // Do not set value, as it will trigger strange |
465f72f68cee
Fix strange javascript side effects.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1573
diff
changeset
|
417 // "javascript" bugs. |
465f72f68cee
Fix strange javascript side effects.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1573
diff
changeset
|
418 //item.setValue(closest); |
1572
60f8edc7a6f0
Slightly improved Spinner- behaviour in CrossSectionControl, but regress in other case.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1555
diff
changeset
|
419 if (synchronNavigation) { |
60f8edc7a6f0
Slightly improved Spinner- behaviour in CrossSectionControl, but regress in other case.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1555
diff
changeset
|
420 // Feed many ... |
60f8edc7a6f0
Slightly improved Spinner- behaviour in CrossSectionControl, but regress in other case.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1555
diff
changeset
|
421 // Find all activated cross section themes |
60f8edc7a6f0
Slightly improved Spinner- behaviour in CrossSectionControl, but regress in other case.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1555
diff
changeset
|
422 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
|
423 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
|
424 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
|
425 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
|
426 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
|
427 if (theme.getFacet().equals("cross_section") && |
60f8edc7a6f0
Slightly improved Spinner- behaviour in CrossSectionControl, but regress in other case.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1555
diff
changeset
|
428 theme.getActive() == 1) { |
60f8edc7a6f0
Slightly improved Spinner- behaviour in CrossSectionControl, but regress in other case.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1555
diff
changeset
|
429 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
|
430 } |
60f8edc7a6f0
Slightly improved Spinner- behaviour in CrossSectionControl, but regress in other case.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1555
diff
changeset
|
431 } |
1574
465f72f68cee
Fix strange javascript side effects.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1573
diff
changeset
|
432 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
|
433 } |
60f8edc7a6f0
Slightly improved Spinner- behaviour in CrossSectionControl, but regress in other case.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1555
diff
changeset
|
434 else { |
60f8edc7a6f0
Slightly improved Spinner- behaviour in CrossSectionControl, but regress in other case.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1555
diff
changeset
|
435 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
|
436 closest); |
60f8edc7a6f0
Slightly improved Spinner- behaviour in CrossSectionControl, but regress in other case.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1555
diff
changeset
|
437 } |
60f8edc7a6f0
Slightly improved Spinner- behaviour in CrossSectionControl, but regress in other case.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1555
diff
changeset
|
438 } |
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 } |
60f8edc7a6f0
Slightly improved Spinner- behaviour in CrossSectionControl, but regress in other case.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1555
diff
changeset
|
441 |
1436
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
442 |
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
443 /** |
1379
546f7f890ffa
Cosmetics, refactoring.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1378
diff
changeset
|
444 * Create the handler for ChangeEvents on the Spinner in the |
546f7f890ffa
Cosmetics, refactoring.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1378
diff
changeset
|
445 * facets that control km of cross section. |
546f7f890ffa
Cosmetics, refactoring.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1378
diff
changeset
|
446 * |
546f7f890ffa
Cosmetics, refactoring.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1378
diff
changeset
|
447 * @param facetRecord The FacetRecord (~row in table) where this |
546f7f890ffa
Cosmetics, refactoring.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1378
diff
changeset
|
448 * handler is added to (to a child, to be exact). |
546f7f890ffa
Cosmetics, refactoring.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1378
diff
changeset
|
449 */ |
546f7f890ffa
Cosmetics, refactoring.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1378
diff
changeset
|
450 public final ChangedHandler createSpinnerHandler( |
546f7f890ffa
Cosmetics, refactoring.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1378
diff
changeset
|
451 final FacetRecord facetRecord) |
546f7f890ffa
Cosmetics, refactoring.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1378
diff
changeset
|
452 { |
546f7f890ffa
Cosmetics, refactoring.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1378
diff
changeset
|
453 ChangedHandler handler = new ChangedHandler() |
546f7f890ffa
Cosmetics, refactoring.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1378
diff
changeset
|
454 { |
546f7f890ffa
Cosmetics, refactoring.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1378
diff
changeset
|
455 @Override |
1436
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
456 public void onChanged(final ChangedEvent ce) { |
1379
546f7f890ffa
Cosmetics, refactoring.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1378
diff
changeset
|
457 if (ce.getValue() == null) { |
546f7f890ffa
Cosmetics, refactoring.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1378
diff
changeset
|
458 return; |
546f7f890ffa
Cosmetics, refactoring.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1378
diff
changeset
|
459 } |
1572
60f8edc7a6f0
Slightly improved Spinner- behaviour in CrossSectionControl, but regress in other case.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1555
diff
changeset
|
460 String value = ce.getValue().toString(); |
1436
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
461 |
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
462 // 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
|
463 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
|
464 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
|
465 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
|
466 |
1572
60f8edc7a6f0
Slightly improved Spinner- behaviour in CrossSectionControl, but regress in other case.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1555
diff
changeset
|
467 spinnerValueEntered(item, selected_km, facetRecord); |
1379
546f7f890ffa
Cosmetics, refactoring.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1378
diff
changeset
|
468 } |
546f7f890ffa
Cosmetics, refactoring.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1378
diff
changeset
|
469 }; |
546f7f890ffa
Cosmetics, refactoring.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1378
diff
changeset
|
470 return handler; |
546f7f890ffa
Cosmetics, refactoring.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1378
diff
changeset
|
471 } |
546f7f890ffa
Cosmetics, refactoring.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1378
diff
changeset
|
472 |
546f7f890ffa
Cosmetics, refactoring.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1378
diff
changeset
|
473 |
546f7f890ffa
Cosmetics, refactoring.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1378
diff
changeset
|
474 /** |
1438
432180235caf
Minor refactoring and fix initial settings when creating ui.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1436
diff
changeset
|
475 * 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
|
476 * @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
|
477 * @return label, intialized SpinnerItem. |
432180235caf
Minor refactoring and fix initial settings when creating ui.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1436
diff
changeset
|
478 */ |
432180235caf
Minor refactoring and fix initial settings when creating ui.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1436
diff
changeset
|
479 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
|
480 SpinnerItem spinnerItem = new SpinnerItem(); |
432180235caf
Minor refactoring and fix initial settings when creating ui.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1436
diff
changeset
|
481 spinnerItem.setShowTitle(false); |
432180235caf
Minor refactoring and fix initial settings when creating ui.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1436
diff
changeset
|
482 spinnerItem.setTitle("Waterlevel-Spinner"); |
432180235caf
Minor refactoring and fix initial settings when creating ui.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1436
diff
changeset
|
483 spinnerItem.setWidth(45); |
1496
a882297ce63d
Changed CrossSection spinner-stepsize, adjusted km- and mastersetting.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1476
diff
changeset
|
484 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
|
485 .getCollectionItem() |
1496
a882297ce63d
Changed CrossSection spinner-stepsize, adjusted km- and mastersetting.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1476
diff
changeset
|
486 .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
|
487 |
432180235caf
Minor refactoring and fix initial settings when creating ui.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1436
diff
changeset
|
488 spinnerItem.setMin(0); |
1475
fb2fefe0325f
Improvements in CrossSectionChartThemePanel.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1472
diff
changeset
|
489 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
|
490 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
|
491 spinnerItem.setChangeOnKeypress(true); |
432180235caf
Minor refactoring and fix initial settings when creating ui.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1436
diff
changeset
|
492 return spinnerItem; |
432180235caf
Minor refactoring and fix initial settings when creating ui.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1436
diff
changeset
|
493 } |
432180235caf
Minor refactoring and fix initial settings when creating ui.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1436
diff
changeset
|
494 |
432180235caf
Minor refactoring and fix initial settings when creating ui.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1436
diff
changeset
|
495 |
432180235caf
Minor refactoring and fix initial settings when creating ui.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1436
diff
changeset
|
496 /** |
858
9f07f67f60a5
Subclassed ChartThemePanel, trigger redraws of Chart when interaction with
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
497 * 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
|
498 * @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
|
499 */ |
9f07f67f60a5
Subclassed ChartThemePanel, trigger redraws of Chart when interaction with
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
500 @Override |
9f07f67f60a5
Subclassed ChartThemePanel, trigger redraws of Chart when interaction with
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
501 protected ListGrid createGrid() { |
9f07f67f60a5
Subclassed ChartThemePanel, trigger redraws of Chart when interaction with
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
502 ListGrid list = new ListGrid() { |
9f07f67f60a5
Subclassed ChartThemePanel, trigger redraws of Chart when interaction with
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
503 @Override |
1379
546f7f890ffa
Cosmetics, refactoring.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1378
diff
changeset
|
504 protected Canvas createRecordComponent( |
546f7f890ffa
Cosmetics, refactoring.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1378
diff
changeset
|
505 final ListGridRecord record, |
546f7f890ffa
Cosmetics, refactoring.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1378
diff
changeset
|
506 Integer colNum) |
546f7f890ffa
Cosmetics, refactoring.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1378
diff
changeset
|
507 { |
861
65204f30877b
Display Action Widget only for cross_section theme/facet.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
858
diff
changeset
|
508 // 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
|
509 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
|
510 if (!facetRecord.getTheme().getFacet().equals( |
1379
546f7f890ffa
Cosmetics, refactoring.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1378
diff
changeset
|
511 "cross_section")) |
546f7f890ffa
Cosmetics, refactoring.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1378
diff
changeset
|
512 { |
861
65204f30877b
Display Action Widget only for cross_section theme/facet.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
858
diff
changeset
|
513 return null; |
65204f30877b
Display Action Widget only for cross_section theme/facet.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
858
diff
changeset
|
514 } |
858
9f07f67f60a5
Subclassed ChartThemePanel, trigger redraws of Chart when interaction with
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
515 |
9f07f67f60a5
Subclassed ChartThemePanel, trigger redraws of Chart when interaction with
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
516 String fieldName = this.getFieldName(colNum); |
9f07f67f60a5
Subclassed ChartThemePanel, trigger redraws of Chart when interaction with
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
517 |
888
d6b88f8f88dd
Fix issue flys/issue311 (i18n crossection).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
861
diff
changeset
|
518 if (fieldName.equals(GRID_FIELD_ACTIONS)) { |
858
9f07f67f60a5
Subclassed ChartThemePanel, trigger redraws of Chart when interaction with
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
519 HLayout recordCanvas = new HLayout(3); |
9f07f67f60a5
Subclassed ChartThemePanel, trigger redraws of Chart when interaction with
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
520 recordCanvas.setHeight(22); |
9f07f67f60a5
Subclassed ChartThemePanel, trigger redraws of Chart when interaction with
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
521 recordCanvas.setAlign(Alignment.CENTER); |
1573
0fbbcec35462
Improved spinner-behaviour in cross section km control.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1572
diff
changeset
|
522 |
0fbbcec35462
Improved spinner-behaviour in cross section km control.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1572
diff
changeset
|
523 // When losing focus, update values. |
1572
60f8edc7a6f0
Slightly improved Spinner- behaviour in CrossSectionControl, but regress in other case.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1555
diff
changeset
|
524 final SpinnerItem spinnerItem = createSpinnerItem(facetRecord); |
60f8edc7a6f0
Slightly improved Spinner- behaviour in CrossSectionControl, but regress in other case.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1555
diff
changeset
|
525 spinnerItem.addBlurHandler(new BlurHandler() { |
60f8edc7a6f0
Slightly improved Spinner- behaviour in CrossSectionControl, but regress in other case.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1555
diff
changeset
|
526 @Override |
60f8edc7a6f0
Slightly improved Spinner- behaviour in CrossSectionControl, but regress in other case.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1555
diff
changeset
|
527 public void onBlur (BlurEvent be) { |
60f8edc7a6f0
Slightly improved Spinner- behaviour in CrossSectionControl, but regress in other case.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1555
diff
changeset
|
528 spinnerValueEntered(spinnerItem, |
60f8edc7a6f0
Slightly improved Spinner- behaviour in CrossSectionControl, but regress in other case.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1555
diff
changeset
|
529 Double.parseDouble(spinnerItem.getValue().toString()), |
60f8edc7a6f0
Slightly improved Spinner- behaviour in CrossSectionControl, but regress in other case.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1555
diff
changeset
|
530 facetRecord); |
60f8edc7a6f0
Slightly improved Spinner- behaviour in CrossSectionControl, but regress in other case.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1555
diff
changeset
|
531 } |
60f8edc7a6f0
Slightly improved Spinner- behaviour in CrossSectionControl, but regress in other case.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1555
diff
changeset
|
532 }); |
858
9f07f67f60a5
Subclassed ChartThemePanel, trigger redraws of Chart when interaction with
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
533 |
1573
0fbbcec35462
Improved spinner-behaviour in cross section km control.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1572
diff
changeset
|
534 // Add KeyPressHandler to lose focus when Enter key is pressed. |
0fbbcec35462
Improved spinner-behaviour in cross section km control.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1572
diff
changeset
|
535 spinnerItem.addKeyPressHandler(new KeyPressHandler(){ |
0fbbcec35462
Improved spinner-behaviour in cross section km control.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1572
diff
changeset
|
536 public void onKeyPress(KeyPressEvent kpe) { |
0fbbcec35462
Improved spinner-behaviour in cross section km control.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1572
diff
changeset
|
537 if (kpe.getKeyName().equals("Enter")) { |
0fbbcec35462
Improved spinner-behaviour in cross section km control.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1572
diff
changeset
|
538 spinnerItem.blurItem(); |
0fbbcec35462
Improved spinner-behaviour in cross section km control.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1572
diff
changeset
|
539 } |
0fbbcec35462
Improved spinner-behaviour in cross section km control.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1572
diff
changeset
|
540 } |
0fbbcec35462
Improved spinner-behaviour in cross section km control.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1572
diff
changeset
|
541 }); |
0fbbcec35462
Improved spinner-behaviour in cross section km control.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1572
diff
changeset
|
542 |
858
9f07f67f60a5
Subclassed ChartThemePanel, trigger redraws of Chart when interaction with
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
543 DynamicForm formWrap = new DynamicForm(); |
9f07f67f60a5
Subclassed ChartThemePanel, trigger redraws of Chart when interaction with
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
544 formWrap.setFields(spinnerItem); |
9f07f67f60a5
Subclassed ChartThemePanel, trigger redraws of Chart when interaction with
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
545 formWrap.setTitlePrefix(""); |
9f07f67f60a5
Subclassed ChartThemePanel, trigger redraws of Chart when interaction with
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
546 formWrap.setTitleSuffix(""); |
9f07f67f60a5
Subclassed ChartThemePanel, trigger redraws of Chart when interaction with
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
547 recordCanvas.addMember(formWrap); |
9f07f67f60a5
Subclassed ChartThemePanel, trigger redraws of Chart when interaction with
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
548 return recordCanvas; |
9f07f67f60a5
Subclassed ChartThemePanel, trigger redraws of Chart when interaction with
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
549 } |
9f07f67f60a5
Subclassed ChartThemePanel, trigger redraws of Chart when interaction with
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
550 else { |
9f07f67f60a5
Subclassed ChartThemePanel, trigger redraws of Chart when interaction with
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
551 return null; |
9f07f67f60a5
Subclassed ChartThemePanel, trigger redraws of Chart when interaction with
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
552 } |
9f07f67f60a5
Subclassed ChartThemePanel, trigger redraws of Chart when interaction with
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
553 } |
9f07f67f60a5
Subclassed ChartThemePanel, trigger redraws of Chart when interaction with
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
554 }; |
9f07f67f60a5
Subclassed ChartThemePanel, trigger redraws of Chart when interaction with
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
555 list.setCanResizeFields(true); |
9f07f67f60a5
Subclassed ChartThemePanel, trigger redraws of Chart when interaction with
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
556 list.setShowRecordComponents(true); |
9f07f67f60a5
Subclassed ChartThemePanel, trigger redraws of Chart when interaction with
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
557 list.setShowRecordComponentsByCell(true); |
9f07f67f60a5
Subclassed ChartThemePanel, trigger redraws of Chart when interaction with
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
558 list.setShowAllRecords(true); |
1378
ebba8a8618e6
Fix flys/issue306 (CrossSections: Remove table header context menu).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
891
diff
changeset
|
559 list.setShowHeaderContextMenu(false); |
858
9f07f67f60a5
Subclassed ChartThemePanel, trigger redraws of Chart when interaction with
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
560 return list; |
9f07f67f60a5
Subclassed ChartThemePanel, trigger redraws of Chart when interaction with
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
561 } |
9f07f67f60a5
Subclassed ChartThemePanel, trigger redraws of Chart when interaction with
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
562 |
9f07f67f60a5
Subclassed ChartThemePanel, trigger redraws of Chart when interaction with
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
563 |
9f07f67f60a5
Subclassed ChartThemePanel, trigger redraws of Chart when interaction with
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
564 /** |
9f07f67f60a5
Subclassed ChartThemePanel, trigger redraws of Chart when interaction with
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
565 * 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
|
566 */ |
9f07f67f60a5
Subclassed ChartThemePanel, trigger redraws of Chart when interaction with
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
567 @Override |
9f07f67f60a5
Subclassed ChartThemePanel, trigger redraws of Chart when interaction with
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
568 protected void initGrid() { |
9f07f67f60a5
Subclassed ChartThemePanel, trigger redraws of Chart when interaction with
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
569 list.setCanEdit(true); |
9f07f67f60a5
Subclassed ChartThemePanel, trigger redraws of Chart when interaction with
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
570 list.setCanSort(false); |
9f07f67f60a5
Subclassed ChartThemePanel, trigger redraws of Chart when interaction with
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
571 list.setShowRecordComponents(true); |
9f07f67f60a5
Subclassed ChartThemePanel, trigger redraws of Chart when interaction with
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
572 list.setShowRecordComponentsByCell(true); |
9f07f67f60a5
Subclassed ChartThemePanel, trigger redraws of Chart when interaction with
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
573 list.setShowHeader(true); |
9f07f67f60a5
Subclassed ChartThemePanel, trigger redraws of Chart when interaction with
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
574 list.setWidth100(); |
9f07f67f60a5
Subclassed ChartThemePanel, trigger redraws of Chart when interaction with
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
575 list.setHeight100(); |
9f07f67f60a5
Subclassed ChartThemePanel, trigger redraws of Chart when interaction with
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
576 |
9f07f67f60a5
Subclassed ChartThemePanel, trigger redraws of Chart when interaction with
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
577 list.addEditCompleteHandler(this); |
9f07f67f60a5
Subclassed ChartThemePanel, trigger redraws of Chart when interaction with
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
578 |
9f07f67f60a5
Subclassed ChartThemePanel, trigger redraws of Chart when interaction with
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
579 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
|
580 active.setType(ListGridFieldType.BOOLEAN); |
9f07f67f60a5
Subclassed ChartThemePanel, trigger redraws of Chart when interaction with
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
581 |
9f07f67f60a5
Subclassed ChartThemePanel, trigger redraws of Chart when interaction with
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
582 ListGridField name = new ListGridField( |
9f07f67f60a5
Subclassed ChartThemePanel, trigger redraws of Chart when interaction with
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
583 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
|
584 name.setType(ListGridFieldType.TEXT); |
9f07f67f60a5
Subclassed ChartThemePanel, trigger redraws of Chart when interaction with
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
585 |
9f07f67f60a5
Subclassed ChartThemePanel, trigger redraws of Chart when interaction with
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
586 ListGridField actions = new ListGridField(GRID_FIELD_ACTIONS, |
891
f6c14ffdfd07
Rest for fix for flys/issue311 .
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
890
diff
changeset
|
587 MSG.chart_themepanel_header_actions(), 50); |
858
9f07f67f60a5
Subclassed ChartThemePanel, trigger redraws of Chart when interaction with
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
588 |
9f07f67f60a5
Subclassed ChartThemePanel, trigger redraws of Chart when interaction with
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
589 list.setFields(active, name, actions); |
9f07f67f60a5
Subclassed ChartThemePanel, trigger redraws of Chart when interaction with
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
590 } |
1436
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
591 |
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
592 |
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
593 /** 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
|
594 public String getCurrentCSMaster() { |
eef55d18f424
Cosmetics, refactoring, renamed Master to CSMaster to avoid confusion.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1458
diff
changeset
|
595 return currentCSMasterUUID; |
1436
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
596 } |
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
597 |
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
598 |
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
599 /** 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
|
600 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
|
601 this.currentCSMasterUUID = currentMasterUuid; |
1436
29fc2d1dfe9b
Client side of interactive cross section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
602 } |
1444
bdac8a72f7e6
Area creation UI update.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1438
diff
changeset
|
603 |
bdac8a72f7e6
Area creation UI update.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1438
diff
changeset
|
604 |
1457
3d9f81c3f00d
Refactored to use existing code.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1452
diff
changeset
|
605 /** Returns name of cross section area facets. */ |
3d9f81c3f00d
Refactored to use existing code.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1452
diff
changeset
|
606 protected String getAreaFacetName() { |
3d9f81c3f00d
Refactored to use existing code.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1452
diff
changeset
|
607 return "cross_section.area"; |
3d9f81c3f00d
Refactored to use existing code.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1452
diff
changeset
|
608 } |
1444
bdac8a72f7e6
Area creation UI update.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1438
diff
changeset
|
609 |
bdac8a72f7e6
Area creation UI update.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1438
diff
changeset
|
610 |
bdac8a72f7e6
Area creation UI update.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1438
diff
changeset
|
611 /** |
1457
3d9f81c3f00d
Refactored to use existing code.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1452
diff
changeset
|
612 * 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
|
613 * rendered between them. |
3d9f81c3f00d
Refactored to use existing code.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1452
diff
changeset
|
614 * 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
|
615 * in subclasses. |
1444
bdac8a72f7e6
Area creation UI update.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1438
diff
changeset
|
616 */ |
1457
3d9f81c3f00d
Refactored to use existing code.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1452
diff
changeset
|
617 protected boolean areAreaCompatible(Theme a, Theme b) { |
3d9f81c3f00d
Refactored to use existing code.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1452
diff
changeset
|
618 if (a.equals(b)) { |
3d9f81c3f00d
Refactored to use existing code.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1452
diff
changeset
|
619 return false; |
1444
bdac8a72f7e6
Area creation UI update.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1438
diff
changeset
|
620 } |
1457
3d9f81c3f00d
Refactored to use existing code.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1452
diff
changeset
|
621 return (a.getFacet().equals("cross_section") |
3d9f81c3f00d
Refactored to use existing code.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1452
diff
changeset
|
622 || a.getFacet().equals("cross_section_water_line")) |
3d9f81c3f00d
Refactored to use existing code.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1452
diff
changeset
|
623 && (b.getFacet().equals("cross_section") |
3d9f81c3f00d
Refactored to use existing code.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1452
diff
changeset
|
624 || b.getFacet().equals("cross_section_water_line")); |
3d9f81c3f00d
Refactored to use existing code.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1452
diff
changeset
|
625 } |
1444
bdac8a72f7e6
Area creation UI update.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1438
diff
changeset
|
626 |
1452
fa63366ba115
Improved area creation GUI.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1449
diff
changeset
|
627 |
1457
3d9f81c3f00d
Refactored to use existing code.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1452
diff
changeset
|
628 /** |
3d9f81c3f00d
Refactored to use existing code.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1452
diff
changeset
|
629 * 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
|
630 * this theme. |
3d9f81c3f00d
Refactored to use existing code.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1452
diff
changeset
|
631 */ |
3d9f81c3f00d
Refactored to use existing code.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1452
diff
changeset
|
632 protected boolean canArea(Theme a) { |
3d9f81c3f00d
Refactored to use existing code.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1452
diff
changeset
|
633 return a.getFacet().equals("cross_section") |
3d9f81c3f00d
Refactored to use existing code.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1452
diff
changeset
|
634 || a.getFacet().equals("cross_section_water_line"); |
1444
bdac8a72f7e6
Area creation UI update.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1438
diff
changeset
|
635 } |
1519
a6f6c61b18be
Implemented synchronous navigation through cross section profiles.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1496
diff
changeset
|
636 |
a6f6c61b18be
Implemented synchronous navigation through cross section profiles.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1496
diff
changeset
|
637 |
a6f6c61b18be
Implemented synchronous navigation through cross section profiles.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1496
diff
changeset
|
638 /** |
a6f6c61b18be
Implemented synchronous navigation through cross section profiles.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1496
diff
changeset
|
639 * Include synchron navigation item. |
a6f6c61b18be
Implemented synchronous navigation through cross section profiles.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1496
diff
changeset
|
640 */ |
a6f6c61b18be
Implemented synchronous navigation through cross section profiles.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1496
diff
changeset
|
641 @Override |
a6f6c61b18be
Implemented synchronous navigation through cross section profiles.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1496
diff
changeset
|
642 protected Menu getSingleContextMenu(final ListGridRecord[] records) { |
a6f6c61b18be
Implemented synchronous navigation through cross section profiles.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1496
diff
changeset
|
643 Menu contextMenu = super.getSingleContextMenu(records); |
a6f6c61b18be
Implemented synchronous navigation through cross section profiles.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1496
diff
changeset
|
644 |
a6f6c61b18be
Implemented synchronous navigation through cross section profiles.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1496
diff
changeset
|
645 // Synchron checking. |
a6f6c61b18be
Implemented synchronous navigation through cross section profiles.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1496
diff
changeset
|
646 MenuItem synchronNavigationMenuItem = new MenuItem(); |
a6f6c61b18be
Implemented synchronous navigation through cross section profiles.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1496
diff
changeset
|
647 if (synchronNavigation == true) { |
a6f6c61b18be
Implemented synchronous navigation through cross section profiles.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1496
diff
changeset
|
648 synchronNavigationMenuItem.setTitle("Einzeln navigieren"); |
a6f6c61b18be
Implemented synchronous navigation through cross section profiles.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1496
diff
changeset
|
649 } |
a6f6c61b18be
Implemented synchronous navigation through cross section profiles.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1496
diff
changeset
|
650 else { |
a6f6c61b18be
Implemented synchronous navigation through cross section profiles.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1496
diff
changeset
|
651 synchronNavigationMenuItem.setTitle("Synchron navigieren"); |
a6f6c61b18be
Implemented synchronous navigation through cross section profiles.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1496
diff
changeset
|
652 } |
a6f6c61b18be
Implemented synchronous navigation through cross section profiles.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1496
diff
changeset
|
653 synchronNavigationMenuItem.addClickHandler(new ClickHandler() { |
a6f6c61b18be
Implemented synchronous navigation through cross section profiles.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1496
diff
changeset
|
654 public void onClick(MenuItemClickEvent evt) { |
a6f6c61b18be
Implemented synchronous navigation through cross section profiles.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1496
diff
changeset
|
655 synchronNavigation = !synchronNavigation; |
a6f6c61b18be
Implemented synchronous navigation through cross section profiles.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1496
diff
changeset
|
656 } |
a6f6c61b18be
Implemented synchronous navigation through cross section profiles.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1496
diff
changeset
|
657 }); |
a6f6c61b18be
Implemented synchronous navigation through cross section profiles.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1496
diff
changeset
|
658 contextMenu.addItem(synchronNavigationMenuItem); |
a6f6c61b18be
Implemented synchronous navigation through cross section profiles.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1496
diff
changeset
|
659 |
a6f6c61b18be
Implemented synchronous navigation through cross section profiles.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1496
diff
changeset
|
660 return contextMenu; |
a6f6c61b18be
Implemented synchronous navigation through cross section profiles.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1496
diff
changeset
|
661 } |
1533
7fcec57c2f2c
Add cross sections loaded from datacage to the master artifacts list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1519
diff
changeset
|
662 |
7fcec57c2f2c
Add cross sections loaded from datacage to the master artifacts list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1519
diff
changeset
|
663 |
7fcec57c2f2c
Add cross sections loaded from datacage to the master artifacts list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1519
diff
changeset
|
664 /** |
7fcec57c2f2c
Add cross sections loaded from datacage to the master artifacts list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1519
diff
changeset
|
665 * 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
|
666 * data. |
7fcec57c2f2c
Add cross sections loaded from datacage to the master artifacts list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1519
diff
changeset
|
667 */ |
7fcec57c2f2c
Add cross sections loaded from datacage to the master artifacts list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1519
diff
changeset
|
668 @Override |
7fcec57c2f2c
Add cross sections loaded from datacage to the master artifacts list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1519
diff
changeset
|
669 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
|
670 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
|
671 |
7fcec57c2f2c
Add cross sections loaded from datacage to the master artifacts list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1519
diff
changeset
|
672 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
|
673 |
7fcec57c2f2c
Add cross sections loaded from datacage to the master artifacts list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1519
diff
changeset
|
674 clearGrid(); |
7fcec57c2f2c
Add cross sections loaded from datacage to the master artifacts list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1519
diff
changeset
|
675 |
7fcec57c2f2c
Add cross sections loaded from datacage to the master artifacts list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1519
diff
changeset
|
676 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
|
677 |
7fcec57c2f2c
Add cross sections loaded from datacage to the master artifacts list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1519
diff
changeset
|
678 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
|
679 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
|
680 return; |
7fcec57c2f2c
Add cross sections loaded from datacage to the master artifacts list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1519
diff
changeset
|
681 } |
7fcec57c2f2c
Add cross sections loaded from datacage to the master artifacts list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1519
diff
changeset
|
682 |
7fcec57c2f2c
Add cross sections loaded from datacage to the master artifacts list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1519
diff
changeset
|
683 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
|
684 |
7fcec57c2f2c
Add cross sections loaded from datacage to the master artifacts list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1519
diff
changeset
|
685 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
|
686 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
|
687 |
1578
df11c4c8c578
Avoid certain npes.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1574
diff
changeset
|
688 if (theme == null) { |
df11c4c8c578
Avoid certain npes.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1574
diff
changeset
|
689 continue; |
df11c4c8c578
Avoid certain npes.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1574
diff
changeset
|
690 } |
df11c4c8c578
Avoid certain npes.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1574
diff
changeset
|
691 |
df11c4c8c578
Avoid certain npes.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1574
diff
changeset
|
692 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
|
693 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
|
694 } |
7fcec57c2f2c
Add cross sections loaded from datacage to the master artifacts list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1519
diff
changeset
|
695 |
1578
df11c4c8c578
Avoid certain npes.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1574
diff
changeset
|
696 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
|
697 continue; |
7fcec57c2f2c
Add cross sections loaded from datacage to the master artifacts list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1519
diff
changeset
|
698 } |
7fcec57c2f2c
Add cross sections loaded from datacage to the master artifacts list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1519
diff
changeset
|
699 |
7fcec57c2f2c
Add cross sections loaded from datacage to the master artifacts list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1519
diff
changeset
|
700 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
|
701 addToReferences(theme); |
7fcec57c2f2c
Add cross sections loaded from datacage to the master artifacts list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1519
diff
changeset
|
702 } |
7fcec57c2f2c
Add cross sections loaded from datacage to the master artifacts list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1519
diff
changeset
|
703 |
7fcec57c2f2c
Add cross sections loaded from datacage to the master artifacts list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1519
diff
changeset
|
704 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
|
705 addFacetRecord(newRecord); |
7fcec57c2f2c
Add cross sections loaded from datacage to the master artifacts list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1519
diff
changeset
|
706 |
7fcec57c2f2c
Add cross sections loaded from datacage to the master artifacts list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1519
diff
changeset
|
707 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
|
708 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
|
709 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
|
710 |
7fcec57c2f2c
Add cross sections loaded from datacage to the master artifacts list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1519
diff
changeset
|
711 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
|
712 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
|
713 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
|
714 |
7fcec57c2f2c
Add cross sections loaded from datacage to the master artifacts list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1519
diff
changeset
|
715 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
|
716 && 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
|
717 && 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
|
718 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
|
719 } |
7fcec57c2f2c
Add cross sections loaded from datacage to the master artifacts list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1519
diff
changeset
|
720 } |
7fcec57c2f2c
Add cross sections loaded from datacage to the master artifacts list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1519
diff
changeset
|
721 } |
7fcec57c2f2c
Add cross sections loaded from datacage to the master artifacts list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1519
diff
changeset
|
722 |
7fcec57c2f2c
Add cross sections loaded from datacage to the master artifacts list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1519
diff
changeset
|
723 fireOutputParameterChanged(); |
7fcec57c2f2c
Add cross sections loaded from datacage to the master artifacts list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1519
diff
changeset
|
724 |
7fcec57c2f2c
Add cross sections loaded from datacage to the master artifacts list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1519
diff
changeset
|
725 } |
7fcec57c2f2c
Add cross sections loaded from datacage to the master artifacts list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1519
diff
changeset
|
726 |
7fcec57c2f2c
Add cross sections loaded from datacage to the master artifacts list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1519
diff
changeset
|
727 |
7fcec57c2f2c
Add cross sections loaded from datacage to the master artifacts list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1519
diff
changeset
|
728 /** |
7fcec57c2f2c
Add cross sections loaded from datacage to the master artifacts list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1519
diff
changeset
|
729 * 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
|
730 * 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
|
731 * |
7fcec57c2f2c
Add cross sections loaded from datacage to the master artifacts list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1519
diff
changeset
|
732 * @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
|
733 */ |
7fcec57c2f2c
Add cross sections loaded from datacage to the master artifacts list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1519
diff
changeset
|
734 protected void addToReferences(Theme theme) { |
7fcec57c2f2c
Add cross sections loaded from datacage to the master artifacts list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1519
diff
changeset
|
735 masters.put(theme.getArtifact(), theme.getDescription()); |
7fcec57c2f2c
Add cross sections loaded from datacage to the master artifacts list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1519
diff
changeset
|
736 masterCb.setValueMap(masters); |
7fcec57c2f2c
Add cross sections loaded from datacage to the master artifacts list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1519
diff
changeset
|
737 findCurrentCSMaster(); |
7fcec57c2f2c
Add cross sections loaded from datacage to the master artifacts list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1519
diff
changeset
|
738 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
|
739 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
|
740 } |
7fcec57c2f2c
Add cross sections loaded from datacage to the master artifacts list.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1519
diff
changeset
|
741 } |
858
9f07f67f60a5
Subclassed ChartThemePanel, trigger redraws of Chart when interaction with
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
742 } |
9f07f67f60a5
Subclassed ChartThemePanel, trigger redraws of Chart when interaction with
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
743 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : |