Mercurial > dive4elements > river
annotate flys-client/src/main/java/de/intevation/flys/client/client/ui/chart/ChartPropertiesEditor.java @ 2499:8f36d4b5890c
Define order for linelabel theme properties.
flys-client/trunk@4332 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Felix Wolfsteller <felix.wolfsteller@intevation.de> |
---|---|
date | Wed, 02 May 2012 19:07:23 +0000 |
parents | d77b1e489df7 |
children | 2867a0192aed |
rev | line source |
---|---|
1429
16b7adc66330
Added stub for chart property editor.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
1 package de.intevation.flys.client.client.ui.chart; |
16b7adc66330
Added stub for chart property editor.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
2 |
1465
d0bcf5ba7adf
Create the properties dialog content dynamically based on the properties read
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1449
diff
changeset
|
3 import java.util.List; |
1506
339f8aa641b5
Issue 358.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1505
diff
changeset
|
4 import java.util.Map; |
1429
16b7adc66330
Added stub for chart property editor.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
5 |
16b7adc66330
Added stub for chart property editor.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
6 import com.google.gwt.core.client.GWT; |
1478
237e7450ae2e
Save output settings in chart properties dialog.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1465
diff
changeset
|
7 import com.google.gwt.user.client.rpc.AsyncCallback; |
1429
16b7adc66330
Added stub for chart property editor.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
8 |
1478
237e7450ae2e
Save output settings in chart properties dialog.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1465
diff
changeset
|
9 import com.smartgwt.client.util.SC; |
1429
16b7adc66330
Added stub for chart property editor.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
10 import com.smartgwt.client.widgets.Window; |
16b7adc66330
Added stub for chart property editor.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
11 import com.smartgwt.client.widgets.tab.TabSet; |
16b7adc66330
Added stub for chart property editor.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
12 import com.smartgwt.client.widgets.tab.Tab; |
16b7adc66330
Added stub for chart property editor.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
13 import com.smartgwt.client.widgets.layout.VLayout; |
16b7adc66330
Added stub for chart property editor.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
14 import com.smartgwt.client.widgets.layout.HLayout; |
16b7adc66330
Added stub for chart property editor.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
15 import com.smartgwt.client.widgets.Button; |
1431
987f95ceb623
Added property fields to the chart properties editor dialog.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1429
diff
changeset
|
16 import com.smartgwt.client.widgets.Label; |
1465
d0bcf5ba7adf
Create the properties dialog content dynamically based on the properties read
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1449
diff
changeset
|
17 import com.smartgwt.client.widgets.Canvas; |
d0bcf5ba7adf
Create the properties dialog content dynamically based on the properties read
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1449
diff
changeset
|
18 |
1429
16b7adc66330
Added stub for chart property editor.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
19 import com.smartgwt.client.widgets.form.DynamicForm; |
16b7adc66330
Added stub for chart property editor.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
20 import com.smartgwt.client.widgets.form.fields.FormItem; |
16b7adc66330
Added stub for chart property editor.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
21 import com.smartgwt.client.widgets.form.fields.CheckboxItem; |
1431
987f95ceb623
Added property fields to the chart properties editor dialog.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1429
diff
changeset
|
22 import com.smartgwt.client.widgets.form.fields.TextItem; |
1429
16b7adc66330
Added stub for chart property editor.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
23 |
16b7adc66330
Added stub for chart property editor.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
24 import com.smartgwt.client.widgets.events.ClickEvent; |
16b7adc66330
Added stub for chart property editor.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
25 import com.smartgwt.client.widgets.events.ClickHandler; |
1465
d0bcf5ba7adf
Create the properties dialog content dynamically based on the properties read
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1449
diff
changeset
|
26 import com.smartgwt.client.widgets.form.fields.events.ChangedHandler; |
d0bcf5ba7adf
Create the properties dialog content dynamically based on the properties read
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1449
diff
changeset
|
27 import com.smartgwt.client.widgets.form.fields.events.ChangedEvent; |
1507
c21d14e48040
Improved validation and property handling.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1506
diff
changeset
|
28 import com.smartgwt.client.widgets.form.fields.events.BlurHandler; |
c21d14e48040
Improved validation and property handling.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1506
diff
changeset
|
29 import com.smartgwt.client.widgets.form.fields.events.BlurEvent; |
1500
2a8b5dcbe8ca
Issue 358.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1482
diff
changeset
|
30 |
1429
16b7adc66330
Added stub for chart property editor.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
31 import com.smartgwt.client.types.Alignment; |
16b7adc66330
Added stub for chart property editor.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
32 |
1478
237e7450ae2e
Save output settings in chart properties dialog.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1465
diff
changeset
|
33 import de.intevation.flys.client.client.Config; |
1429
16b7adc66330
Added stub for chart property editor.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
34 import de.intevation.flys.client.client.FLYSConstants; |
1465
d0bcf5ba7adf
Create the properties dialog content dynamically based on the properties read
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1449
diff
changeset
|
35 import de.intevation.flys.client.shared.model.Property; |
d0bcf5ba7adf
Create the properties dialog content dynamically based on the properties read
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1449
diff
changeset
|
36 import de.intevation.flys.client.shared.model.PropertyGroup; |
d0bcf5ba7adf
Create the properties dialog content dynamically based on the properties read
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1449
diff
changeset
|
37 import de.intevation.flys.client.shared.model.PropertySetting; |
d0bcf5ba7adf
Create the properties dialog content dynamically based on the properties read
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1449
diff
changeset
|
38 import de.intevation.flys.client.shared.model.BooleanProperty; |
d0bcf5ba7adf
Create the properties dialog content dynamically based on the properties read
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1449
diff
changeset
|
39 import de.intevation.flys.client.shared.model.DoubleProperty; |
d0bcf5ba7adf
Create the properties dialog content dynamically based on the properties read
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1449
diff
changeset
|
40 import de.intevation.flys.client.shared.model.IntegerProperty; |
d0bcf5ba7adf
Create the properties dialog content dynamically based on the properties read
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1449
diff
changeset
|
41 import de.intevation.flys.client.shared.model.StringProperty; |
1503
3304608baf35
Issue 433.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1502
diff
changeset
|
42 import de.intevation.flys.client.shared.model.Settings; |
1478
237e7450ae2e
Save output settings in chart properties dialog.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1465
diff
changeset
|
43 import de.intevation.flys.client.shared.model.OutputSettings; |
237e7450ae2e
Save output settings in chart properties dialog.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1465
diff
changeset
|
44 import de.intevation.flys.client.shared.model.Collection; |
1504
02a9104c0451
Implemented the validators more object oriented.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1503
diff
changeset
|
45 import de.intevation.flys.client.client.utils.IntegerValidator; |
02a9104c0451
Implemented the validators more object oriented.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1503
diff
changeset
|
46 import de.intevation.flys.client.client.utils.DoubleValidator; |
1429
16b7adc66330
Added stub for chart property editor.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
47 |
1478
237e7450ae2e
Save output settings in chart properties dialog.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1465
diff
changeset
|
48 import de.intevation.flys.client.client.services.CollectionAttributeService; |
237e7450ae2e
Save output settings in chart properties dialog.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1465
diff
changeset
|
49 import de.intevation.flys.client.client.services.CollectionAttributeServiceAsync; |
237e7450ae2e
Save output settings in chart properties dialog.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1465
diff
changeset
|
50 |
1429
16b7adc66330
Added stub for chart property editor.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
51 /** |
16b7adc66330
Added stub for chart property editor.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
52 * @author <a href="mailto:raimund.renkert@intevation.de">Raimund Renkert</a> |
16b7adc66330
Added stub for chart property editor.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
53 */ |
16b7adc66330
Added stub for chart property editor.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
54 public class ChartPropertiesEditor |
1550
9bf1ffd53dfb
Cosmetics, docs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1543
diff
changeset
|
55 extends Window |
9bf1ffd53dfb
Cosmetics, docs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1543
diff
changeset
|
56 implements ClickHandler |
1429
16b7adc66330
Added stub for chart property editor.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
57 { |
16b7adc66330
Added stub for chart property editor.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
58 /** The interface that provides i18n messages. */ |
16b7adc66330
Added stub for chart property editor.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
59 protected FLYSConstants MSG = GWT.create(FLYSConstants.class); |
16b7adc66330
Added stub for chart property editor.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
60 |
1478
237e7450ae2e
Save output settings in chart properties dialog.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1465
diff
changeset
|
61 protected CollectionAttributeServiceAsync updater = |
237e7450ae2e
Save output settings in chart properties dialog.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1465
diff
changeset
|
62 GWT.create(CollectionAttributeService.class); |
237e7450ae2e
Save output settings in chart properties dialog.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1465
diff
changeset
|
63 |
1429
16b7adc66330
Added stub for chart property editor.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
64 /** The tab called the editor window. */ |
1482
cd8a146d29cd
Update chart if properties are changed successfully.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1478
diff
changeset
|
65 protected ChartOutputTab tab; |
1429
16b7adc66330
Added stub for chart property editor.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
66 |
1543
0b79630e3bcb
Cosmetics, doc.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1508
diff
changeset
|
67 /** The tabset for chart properties. */ |
1429
16b7adc66330
Added stub for chart property editor.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
68 protected TabSet tabs; |
16b7adc66330
Added stub for chart property editor.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
69 |
1543
0b79630e3bcb
Cosmetics, doc.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1508
diff
changeset
|
70 /** The collection. */ |
1478
237e7450ae2e
Save output settings in chart properties dialog.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1465
diff
changeset
|
71 protected Collection collection; |
237e7450ae2e
Save output settings in chart properties dialog.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1465
diff
changeset
|
72 |
1543
0b79630e3bcb
Cosmetics, doc.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1508
diff
changeset
|
73 /** The cloned output settings. */ |
1478
237e7450ae2e
Save output settings in chart properties dialog.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1465
diff
changeset
|
74 protected OutputSettings settings; |
237e7450ae2e
Save output settings in chart properties dialog.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1465
diff
changeset
|
75 |
1543
0b79630e3bcb
Cosmetics, doc.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1508
diff
changeset
|
76 /** The original output settings. */ |
1503
3304608baf35
Issue 433.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1502
diff
changeset
|
77 protected OutputSettings origSettings; |
3304608baf35
Issue 433.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1502
diff
changeset
|
78 |
1478
237e7450ae2e
Save output settings in chart properties dialog.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1465
diff
changeset
|
79 |
1429
16b7adc66330
Added stub for chart property editor.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
80 /** |
16b7adc66330
Added stub for chart property editor.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
81 * Setup editor dialog. |
1560
1c47de6ccfb1
Cosmetics.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1550
diff
changeset
|
82 * @param callerTab The tab called the editor window. |
1429
16b7adc66330
Added stub for chart property editor.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
83 */ |
1482
cd8a146d29cd
Update chart if properties are changed successfully.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1478
diff
changeset
|
84 public ChartPropertiesEditor(ChartOutputTab callerTab) { |
1429
16b7adc66330
Added stub for chart property editor.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
85 this.tab = callerTab; |
16b7adc66330
Added stub for chart property editor.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
86 this.tabs = new TabSet(); |
16b7adc66330
Added stub for chart property editor.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
87 |
16b7adc66330
Added stub for chart property editor.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
88 init(); |
16b7adc66330
Added stub for chart property editor.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
89 } |
16b7adc66330
Added stub for chart property editor.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
90 |
16b7adc66330
Added stub for chart property editor.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
91 /** |
16b7adc66330
Added stub for chart property editor.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
92 * Initialize the editor window and its components. |
16b7adc66330
Added stub for chart property editor.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
93 */ |
16b7adc66330
Added stub for chart property editor.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
94 protected void init() { |
16b7adc66330
Added stub for chart property editor.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
95 setTitle(MSG.properties()); |
16b7adc66330
Added stub for chart property editor.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
96 setCanDragReposition(true); |
16b7adc66330
Added stub for chart property editor.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
97 setCanDragResize(true); |
16b7adc66330
Added stub for chart property editor.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
98 |
1500
2a8b5dcbe8ca
Issue 358.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1482
diff
changeset
|
99 Config config = Config.getInstance(); |
1478
237e7450ae2e
Save output settings in chart properties dialog.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1465
diff
changeset
|
100 collection = tab.getCollectionView().getCollection(); |
1465
d0bcf5ba7adf
Create the properties dialog content dynamically based on the properties read
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1449
diff
changeset
|
101 String outputName = tab.getOutputName(); |
1503
3304608baf35
Issue 433.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1502
diff
changeset
|
102 origSettings = (OutputSettings)collection.getSettings(outputName); |
1465
d0bcf5ba7adf
Create the properties dialog content dynamically based on the properties read
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1449
diff
changeset
|
103 |
1503
3304608baf35
Issue 433.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1502
diff
changeset
|
104 settings = (OutputSettings)origSettings.clone(); |
1465
d0bcf5ba7adf
Create the properties dialog content dynamically based on the properties read
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1449
diff
changeset
|
105 if (settings == null) { |
d0bcf5ba7adf
Create the properties dialog content dynamically based on the properties read
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1449
diff
changeset
|
106 return; |
d0bcf5ba7adf
Create the properties dialog content dynamically based on the properties read
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1449
diff
changeset
|
107 } |
d0bcf5ba7adf
Create the properties dialog content dynamically based on the properties read
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1449
diff
changeset
|
108 List<String> list = settings.getCategories(); |
d0bcf5ba7adf
Create the properties dialog content dynamically based on the properties read
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1449
diff
changeset
|
109 |
d0bcf5ba7adf
Create the properties dialog content dynamically based on the properties read
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1449
diff
changeset
|
110 for (int i = 0; i < list.size(); i++) { |
d0bcf5ba7adf
Create the properties dialog content dynamically based on the properties read
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1449
diff
changeset
|
111 Tab t = new Tab(MSG.getString(list.get(i))); |
d0bcf5ba7adf
Create the properties dialog content dynamically based on the properties read
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1449
diff
changeset
|
112 List<Property> props = settings.getSettings(list.get(i)); |
1503
3304608baf35
Issue 433.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1502
diff
changeset
|
113 List<Property> origProps = origSettings.getSettings(list.get(i)); |
1465
d0bcf5ba7adf
Create the properties dialog content dynamically based on the properties read
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1449
diff
changeset
|
114 VLayout layout = new VLayout(); |
d0bcf5ba7adf
Create the properties dialog content dynamically based on the properties read
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1449
diff
changeset
|
115 for (int j = 0; j < props.size(); j++) { |
d0bcf5ba7adf
Create the properties dialog content dynamically based on the properties read
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1449
diff
changeset
|
116 if (props.get(j) instanceof PropertyGroup) { |
1503
3304608baf35
Issue 433.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1502
diff
changeset
|
117 layout.addMember(generatePropertyGroup(props.get(j), |
3304608baf35
Issue 433.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1502
diff
changeset
|
118 origProps.get(j))); |
1465
d0bcf5ba7adf
Create the properties dialog content dynamically based on the properties read
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1449
diff
changeset
|
119 } |
d0bcf5ba7adf
Create the properties dialog content dynamically based on the properties read
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1449
diff
changeset
|
120 else if (props.get(j) instanceof PropertySetting) { |
d0bcf5ba7adf
Create the properties dialog content dynamically based on the properties read
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1449
diff
changeset
|
121 PropertySetting p = (PropertySetting)props.get(j); |
d0bcf5ba7adf
Create the properties dialog content dynamically based on the properties read
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1449
diff
changeset
|
122 if (p.getAttribute("display").equals("false")) { |
d0bcf5ba7adf
Create the properties dialog content dynamically based on the properties read
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1449
diff
changeset
|
123 continue; |
d0bcf5ba7adf
Create the properties dialog content dynamically based on the properties read
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1449
diff
changeset
|
124 } |
1503
3304608baf35
Issue 433.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1502
diff
changeset
|
125 layout.addMember(generatePropertySetting(props.get(j), |
3304608baf35
Issue 433.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1502
diff
changeset
|
126 origProps.get(j))); |
1465
d0bcf5ba7adf
Create the properties dialog content dynamically based on the properties read
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1449
diff
changeset
|
127 } |
d0bcf5ba7adf
Create the properties dialog content dynamically based on the properties read
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1449
diff
changeset
|
128 } |
d0bcf5ba7adf
Create the properties dialog content dynamically based on the properties read
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1449
diff
changeset
|
129 t.setPane(layout); |
d0bcf5ba7adf
Create the properties dialog content dynamically based on the properties read
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1449
diff
changeset
|
130 tabs.addTab(t); |
d0bcf5ba7adf
Create the properties dialog content dynamically based on the properties read
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1449
diff
changeset
|
131 } |
1429
16b7adc66330
Added stub for chart property editor.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
132 |
16b7adc66330
Added stub for chart property editor.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
133 Button accept = new Button(MSG.label_ok()); |
16b7adc66330
Added stub for chart property editor.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
134 Button cancel = new Button(MSG.label_cancel()); |
16b7adc66330
Added stub for chart property editor.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
135 cancel.addClickHandler(this); |
16b7adc66330
Added stub for chart property editor.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
136 accept.addClickHandler(new ClickHandler() { |
16b7adc66330
Added stub for chart property editor.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
137 public void onClick(ClickEvent e) { |
1502
d1223d93dd68
Issue 358.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1501
diff
changeset
|
138 if(isDialogValid()) { |
d1223d93dd68
Issue 358.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1501
diff
changeset
|
139 updateCollection(); |
d1223d93dd68
Issue 358.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1501
diff
changeset
|
140 } |
d1223d93dd68
Issue 358.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1501
diff
changeset
|
141 else { |
d1223d93dd68
Issue 358.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1501
diff
changeset
|
142 GWT.log("Dialog not valid"); |
d1223d93dd68
Issue 358.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1501
diff
changeset
|
143 SC.warn(MSG.error_dialog_not_valid()); |
d1223d93dd68
Issue 358.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1501
diff
changeset
|
144 } |
1429
16b7adc66330
Added stub for chart property editor.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
145 } |
16b7adc66330
Added stub for chart property editor.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
146 }); |
16b7adc66330
Added stub for chart property editor.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
147 |
16b7adc66330
Added stub for chart property editor.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
148 HLayout buttons = new HLayout(); |
16b7adc66330
Added stub for chart property editor.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
149 buttons.addMember(accept); |
16b7adc66330
Added stub for chart property editor.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
150 buttons.addMember(cancel); |
16b7adc66330
Added stub for chart property editor.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
151 buttons.setAlign(Alignment.CENTER); |
16b7adc66330
Added stub for chart property editor.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
152 buttons.setHeight(30); |
16b7adc66330
Added stub for chart property editor.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
153 |
16b7adc66330
Added stub for chart property editor.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
154 addItem(tabs); |
16b7adc66330
Added stub for chart property editor.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
155 addItem(buttons); |
1500
2a8b5dcbe8ca
Issue 358.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1482
diff
changeset
|
156 setWidth(380); |
1431
987f95ceb623
Added property fields to the chart properties editor dialog.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1429
diff
changeset
|
157 setHeight(470); |
1429
16b7adc66330
Added stub for chart property editor.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
158 centerInPage(); |
16b7adc66330
Added stub for chart property editor.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
159 } |
16b7adc66330
Added stub for chart property editor.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
160 |
16b7adc66330
Added stub for chart property editor.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
161 /** |
16b7adc66330
Added stub for chart property editor.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
162 * This method is called when the user aborts theming. |
16b7adc66330
Added stub for chart property editor.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
163 * @param event The event. |
16b7adc66330
Added stub for chart property editor.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
164 */ |
16b7adc66330
Added stub for chart property editor.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
165 public void onClick(ClickEvent event) { |
1503
3304608baf35
Issue 433.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1502
diff
changeset
|
166 this.destroy(); |
1429
16b7adc66330
Added stub for chart property editor.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
167 } |
1431
987f95ceb623
Added property fields to the chart properties editor dialog.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1429
diff
changeset
|
168 |
987f95ceb623
Added property fields to the chart properties editor dialog.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1429
diff
changeset
|
169 |
987f95ceb623
Added property fields to the chart properties editor dialog.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1429
diff
changeset
|
170 /** |
1465
d0bcf5ba7adf
Create the properties dialog content dynamically based on the properties read
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1449
diff
changeset
|
171 * |
1431
987f95ceb623
Added property fields to the chart properties editor dialog.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1429
diff
changeset
|
172 */ |
1503
3304608baf35
Issue 433.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1502
diff
changeset
|
173 protected Canvas generatePropertyGroup(Property group, Property orig) { |
1506
339f8aa641b5
Issue 358.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1505
diff
changeset
|
174 Config config = Config.getInstance(); |
339f8aa641b5
Issue 358.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1505
diff
changeset
|
175 String locale = config.getLocale(); |
1465
d0bcf5ba7adf
Create the properties dialog content dynamically based on the properties read
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1449
diff
changeset
|
176 PropertyGroup pg = (PropertyGroup)group; |
1503
3304608baf35
Issue 433.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1502
diff
changeset
|
177 PropertyGroup origPg = (PropertyGroup)orig; |
1431
987f95ceb623
Added property fields to the chart properties editor dialog.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1429
diff
changeset
|
178 |
1465
d0bcf5ba7adf
Create the properties dialog content dynamically based on the properties read
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1449
diff
changeset
|
179 if (pg.getName().equals("axis")) { |
d0bcf5ba7adf
Create the properties dialog content dynamically based on the properties read
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1449
diff
changeset
|
180 Label scale = new Label(MSG.scale() + " :"); |
d0bcf5ba7adf
Create the properties dialog content dynamically based on the properties read
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1449
diff
changeset
|
181 scale.setHeight(25); |
d0bcf5ba7adf
Create the properties dialog content dynamically based on the properties read
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1449
diff
changeset
|
182 scale.setMargin(2); |
1431
987f95ceb623
Added property fields to the chart properties editor dialog.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1429
diff
changeset
|
183 |
1465
d0bcf5ba7adf
Create the properties dialog content dynamically based on the properties read
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1449
diff
changeset
|
184 DynamicForm form1 = new DynamicForm(); |
d0bcf5ba7adf
Create the properties dialog content dynamically based on the properties read
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1449
diff
changeset
|
185 DynamicForm form2 = new DynamicForm(); |
d0bcf5ba7adf
Create the properties dialog content dynamically based on the properties read
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1449
diff
changeset
|
186 form2.setNumCols(6); |
1431
987f95ceb623
Added property fields to the chart properties editor dialog.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1429
diff
changeset
|
187 |
1465
d0bcf5ba7adf
Create the properties dialog content dynamically based on the properties read
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1449
diff
changeset
|
188 StringProperty label = |
d0bcf5ba7adf
Create the properties dialog content dynamically based on the properties read
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1449
diff
changeset
|
189 (StringProperty)pg.getPropertyByName("label"); |
d0bcf5ba7adf
Create the properties dialog content dynamically based on the properties read
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1449
diff
changeset
|
190 FormItem title = createStringProperty(label); |
1503
3304608baf35
Issue 433.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1502
diff
changeset
|
191 title.setValue( |
3304608baf35
Issue 433.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1502
diff
changeset
|
192 ((StringProperty)origPg.getPropertyByName("label")).getValue()); |
1431
987f95ceb623
Added property fields to the chart properties editor dialog.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1429
diff
changeset
|
193 |
1465
d0bcf5ba7adf
Create the properties dialog content dynamically based on the properties read
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1449
diff
changeset
|
194 IntegerProperty fontsize = |
d0bcf5ba7adf
Create the properties dialog content dynamically based on the properties read
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1449
diff
changeset
|
195 (IntegerProperty)pg.getPropertyByName("font-size"); |
d0bcf5ba7adf
Create the properties dialog content dynamically based on the properties read
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1449
diff
changeset
|
196 FormItem fs = createIntegerProperty(fontsize); |
1503
3304608baf35
Issue 433.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1502
diff
changeset
|
197 fs.setValue( |
3304608baf35
Issue 433.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1502
diff
changeset
|
198 ((IntegerProperty) |
3304608baf35
Issue 433.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1502
diff
changeset
|
199 origPg.getPropertyByName("font-size")).getValue()); |
1465
d0bcf5ba7adf
Create the properties dialog content dynamically based on the properties read
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1449
diff
changeset
|
200 |
d0bcf5ba7adf
Create the properties dialog content dynamically based on the properties read
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1449
diff
changeset
|
201 DoubleProperty upper = |
d0bcf5ba7adf
Create the properties dialog content dynamically based on the properties read
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1449
diff
changeset
|
202 (DoubleProperty)pg.getPropertyByName("upper"); |
d0bcf5ba7adf
Create the properties dialog content dynamically based on the properties read
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1449
diff
changeset
|
203 final FormItem range1 = createDoubleProperty(upper); |
2475
d77b1e489df7
Issue 492.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1560
diff
changeset
|
204 range1.setName("rangeupper"); |
1500
2a8b5dcbe8ca
Issue 358.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1482
diff
changeset
|
205 range1.setWidth(70); |
1507
c21d14e48040
Improved validation and property handling.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1506
diff
changeset
|
206 range1.setValue( |
c21d14e48040
Improved validation and property handling.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1506
diff
changeset
|
207 ((DoubleProperty) |
c21d14e48040
Improved validation and property handling.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1506
diff
changeset
|
208 origPg.getPropertyByName("upper")).toUIString()); |
c21d14e48040
Improved validation and property handling.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1506
diff
changeset
|
209 |
1465
d0bcf5ba7adf
Create the properties dialog content dynamically based on the properties read
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1449
diff
changeset
|
210 DoubleProperty lower = |
d0bcf5ba7adf
Create the properties dialog content dynamically based on the properties read
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1449
diff
changeset
|
211 (DoubleProperty)pg.getPropertyByName("lower"); |
d0bcf5ba7adf
Create the properties dialog content dynamically based on the properties read
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1449
diff
changeset
|
212 final FormItem range2 = createDoubleProperty(lower); |
2475
d77b1e489df7
Issue 492.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1560
diff
changeset
|
213 range2.setName("rangelower"); |
1500
2a8b5dcbe8ca
Issue 358.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1482
diff
changeset
|
214 range2.setWidth(70); |
1507
c21d14e48040
Improved validation and property handling.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1506
diff
changeset
|
215 range2.setValue( |
c21d14e48040
Improved validation and property handling.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1506
diff
changeset
|
216 ((DoubleProperty) |
c21d14e48040
Improved validation and property handling.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1506
diff
changeset
|
217 origPg.getPropertyByName("lower")).toUIString()); |
1465
d0bcf5ba7adf
Create the properties dialog content dynamically based on the properties read
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1449
diff
changeset
|
218 |
d0bcf5ba7adf
Create the properties dialog content dynamically based on the properties read
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1449
diff
changeset
|
219 BooleanProperty fixation = |
d0bcf5ba7adf
Create the properties dialog content dynamically based on the properties read
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1449
diff
changeset
|
220 (BooleanProperty)pg.getPropertyByName("fixation"); |
d0bcf5ba7adf
Create the properties dialog content dynamically based on the properties read
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1449
diff
changeset
|
221 FormItem fix = createBooleanProperty(fixation); |
1507
c21d14e48040
Improved validation and property handling.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1506
diff
changeset
|
222 fix.setValue(((BooleanProperty) |
c21d14e48040
Improved validation and property handling.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1506
diff
changeset
|
223 origPg.getPropertyByName("fixation")).getValue().booleanValue()); |
c21d14e48040
Improved validation and property handling.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1506
diff
changeset
|
224 |
1465
d0bcf5ba7adf
Create the properties dialog content dynamically based on the properties read
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1449
diff
changeset
|
225 fix.addChangedHandler(new ChangedHandler() { |
d0bcf5ba7adf
Create the properties dialog content dynamically based on the properties read
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1449
diff
changeset
|
226 public void onChanged(ChangedEvent e) { |
d0bcf5ba7adf
Create the properties dialog content dynamically based on the properties read
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1449
diff
changeset
|
227 if ((Boolean)e.getValue()) { |
d0bcf5ba7adf
Create the properties dialog content dynamically based on the properties read
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1449
diff
changeset
|
228 range1.enable(); |
d0bcf5ba7adf
Create the properties dialog content dynamically based on the properties read
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1449
diff
changeset
|
229 range2.enable(); |
d0bcf5ba7adf
Create the properties dialog content dynamically based on the properties read
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1449
diff
changeset
|
230 } |
d0bcf5ba7adf
Create the properties dialog content dynamically based on the properties read
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1449
diff
changeset
|
231 else { |
d0bcf5ba7adf
Create the properties dialog content dynamically based on the properties read
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1449
diff
changeset
|
232 range1.disable(); |
d0bcf5ba7adf
Create the properties dialog content dynamically based on the properties read
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1449
diff
changeset
|
233 range2.disable(); |
d0bcf5ba7adf
Create the properties dialog content dynamically based on the properties read
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1449
diff
changeset
|
234 } |
d0bcf5ba7adf
Create the properties dialog content dynamically based on the properties read
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1449
diff
changeset
|
235 } |
d0bcf5ba7adf
Create the properties dialog content dynamically based on the properties read
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1449
diff
changeset
|
236 }); |
1507
c21d14e48040
Improved validation and property handling.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1506
diff
changeset
|
237 if (fix.getValue().toString().equals("true")) { |
1465
d0bcf5ba7adf
Create the properties dialog content dynamically based on the properties read
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1449
diff
changeset
|
238 range1.enable(); |
d0bcf5ba7adf
Create the properties dialog content dynamically based on the properties read
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1449
diff
changeset
|
239 range2.enable(); |
d0bcf5ba7adf
Create the properties dialog content dynamically based on the properties read
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1449
diff
changeset
|
240 } |
d0bcf5ba7adf
Create the properties dialog content dynamically based on the properties read
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1449
diff
changeset
|
241 else { |
d0bcf5ba7adf
Create the properties dialog content dynamically based on the properties read
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1449
diff
changeset
|
242 range1.disable(); |
d0bcf5ba7adf
Create the properties dialog content dynamically based on the properties read
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1449
diff
changeset
|
243 range2.disable(); |
d0bcf5ba7adf
Create the properties dialog content dynamically based on the properties read
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1449
diff
changeset
|
244 } |
d0bcf5ba7adf
Create the properties dialog content dynamically based on the properties read
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1449
diff
changeset
|
245 |
d0bcf5ba7adf
Create the properties dialog content dynamically based on the properties read
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1449
diff
changeset
|
246 form1.setFields(title, fs); |
1501
d12cb71965cf
Issue 358.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1500
diff
changeset
|
247 form2.setFields(fix, range2, range1); |
1465
d0bcf5ba7adf
Create the properties dialog content dynamically based on the properties read
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1449
diff
changeset
|
248 |
d0bcf5ba7adf
Create the properties dialog content dynamically based on the properties read
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1449
diff
changeset
|
249 HLayout scaleLayout = new HLayout(); |
d0bcf5ba7adf
Create the properties dialog content dynamically based on the properties read
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1449
diff
changeset
|
250 scaleLayout.setHeight(30); |
d0bcf5ba7adf
Create the properties dialog content dynamically based on the properties read
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1449
diff
changeset
|
251 scaleLayout.addMember(scale); |
d0bcf5ba7adf
Create the properties dialog content dynamically based on the properties read
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1449
diff
changeset
|
252 scaleLayout.addMember(form2); |
1503
3304608baf35
Issue 433.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1502
diff
changeset
|
253 scaleLayout.setStyleName("property-dialog-axis"); |
1465
d0bcf5ba7adf
Create the properties dialog content dynamically based on the properties read
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1449
diff
changeset
|
254 |
d0bcf5ba7adf
Create the properties dialog content dynamically based on the properties read
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1449
diff
changeset
|
255 VLayout root = new VLayout(); |
d0bcf5ba7adf
Create the properties dialog content dynamically based on the properties read
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1449
diff
changeset
|
256 root.addMember(form1); |
d0bcf5ba7adf
Create the properties dialog content dynamically based on the properties read
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1449
diff
changeset
|
257 root.addMember(scaleLayout); |
d0bcf5ba7adf
Create the properties dialog content dynamically based on the properties read
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1449
diff
changeset
|
258 root.setHeight(90); |
d0bcf5ba7adf
Create the properties dialog content dynamically based on the properties read
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1449
diff
changeset
|
259 |
d0bcf5ba7adf
Create the properties dialog content dynamically based on the properties read
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1449
diff
changeset
|
260 return root; |
d0bcf5ba7adf
Create the properties dialog content dynamically based on the properties read
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1449
diff
changeset
|
261 } |
d0bcf5ba7adf
Create the properties dialog content dynamically based on the properties read
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1449
diff
changeset
|
262 return null; |
d0bcf5ba7adf
Create the properties dialog content dynamically based on the properties read
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1449
diff
changeset
|
263 } |
1431
987f95ceb623
Added property fields to the chart properties editor dialog.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1429
diff
changeset
|
264 |
987f95ceb623
Added property fields to the chart properties editor dialog.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1429
diff
changeset
|
265 |
1465
d0bcf5ba7adf
Create the properties dialog content dynamically based on the properties read
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1449
diff
changeset
|
266 /** |
d0bcf5ba7adf
Create the properties dialog content dynamically based on the properties read
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1449
diff
changeset
|
267 * |
d0bcf5ba7adf
Create the properties dialog content dynamically based on the properties read
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1449
diff
changeset
|
268 */ |
1503
3304608baf35
Issue 433.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1502
diff
changeset
|
269 protected DynamicForm generatePropertySetting( |
3304608baf35
Issue 433.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1502
diff
changeset
|
270 Property setting, |
3304608baf35
Issue 433.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1502
diff
changeset
|
271 Property orig) |
3304608baf35
Issue 433.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1502
diff
changeset
|
272 { |
1500
2a8b5dcbe8ca
Issue 358.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1482
diff
changeset
|
273 PropertySetting s = (PropertySetting)setting; |
1465
d0bcf5ba7adf
Create the properties dialog content dynamically based on the properties read
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1449
diff
changeset
|
274 DynamicForm form = new DynamicForm(); |
1478
237e7450ae2e
Save output settings in chart properties dialog.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1465
diff
changeset
|
275 FormItem item = new FormItem(); |
1465
d0bcf5ba7adf
Create the properties dialog content dynamically based on the properties read
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1449
diff
changeset
|
276 if (setting instanceof BooleanProperty) { |
1478
237e7450ae2e
Save output settings in chart properties dialog.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1465
diff
changeset
|
277 item = createBooleanProperty((BooleanProperty)setting); |
1508
8ac57bbc270c
Fixed initial boolean value setting.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1507
diff
changeset
|
278 item.setValue(((BooleanProperty)orig).getValue().booleanValue()); |
1465
d0bcf5ba7adf
Create the properties dialog content dynamically based on the properties read
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1449
diff
changeset
|
279 } |
d0bcf5ba7adf
Create the properties dialog content dynamically based on the properties read
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1449
diff
changeset
|
280 else if (setting instanceof DoubleProperty) { |
1478
237e7450ae2e
Save output settings in chart properties dialog.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1465
diff
changeset
|
281 item = createDoubleProperty((DoubleProperty)setting); |
1507
c21d14e48040
Improved validation and property handling.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1506
diff
changeset
|
282 item.setValue(((DoubleProperty)orig).toUIString()); |
1465
d0bcf5ba7adf
Create the properties dialog content dynamically based on the properties read
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1449
diff
changeset
|
283 } |
d0bcf5ba7adf
Create the properties dialog content dynamically based on the properties read
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1449
diff
changeset
|
284 else if (setting instanceof IntegerProperty) { |
1478
237e7450ae2e
Save output settings in chart properties dialog.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1465
diff
changeset
|
285 item = createIntegerProperty((IntegerProperty)setting); |
1503
3304608baf35
Issue 433.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1502
diff
changeset
|
286 item.setValue(((IntegerProperty)orig).getValue()); |
1465
d0bcf5ba7adf
Create the properties dialog content dynamically based on the properties read
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1449
diff
changeset
|
287 } |
d0bcf5ba7adf
Create the properties dialog content dynamically based on the properties read
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1449
diff
changeset
|
288 else if (setting instanceof StringProperty) { |
1478
237e7450ae2e
Save output settings in chart properties dialog.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1465
diff
changeset
|
289 item = createStringProperty((StringProperty)setting); |
1503
3304608baf35
Issue 433.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1502
diff
changeset
|
290 item.setValue(((StringProperty)orig).getValue()); |
1465
d0bcf5ba7adf
Create the properties dialog content dynamically based on the properties read
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1449
diff
changeset
|
291 } |
1478
237e7450ae2e
Save output settings in chart properties dialog.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1465
diff
changeset
|
292 form.setFields(item); |
1465
d0bcf5ba7adf
Create the properties dialog content dynamically based on the properties read
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1449
diff
changeset
|
293 return form; |
d0bcf5ba7adf
Create the properties dialog content dynamically based on the properties read
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1449
diff
changeset
|
294 } |
1431
987f95ceb623
Added property fields to the chart properties editor dialog.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1429
diff
changeset
|
295 |
987f95ceb623
Added property fields to the chart properties editor dialog.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1429
diff
changeset
|
296 |
1465
d0bcf5ba7adf
Create the properties dialog content dynamically based on the properties read
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1449
diff
changeset
|
297 /** |
d0bcf5ba7adf
Create the properties dialog content dynamically based on the properties read
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1449
diff
changeset
|
298 * |
d0bcf5ba7adf
Create the properties dialog content dynamically based on the properties read
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1449
diff
changeset
|
299 */ |
1478
237e7450ae2e
Save output settings in chart properties dialog.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1465
diff
changeset
|
300 protected FormItem createStringProperty(final StringProperty sp) { |
1465
d0bcf5ba7adf
Create the properties dialog content dynamically based on the properties read
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1449
diff
changeset
|
301 String name = sp.getName(); |
d0bcf5ba7adf
Create the properties dialog content dynamically based on the properties read
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1449
diff
changeset
|
302 if (name.contains("-")) { |
d0bcf5ba7adf
Create the properties dialog content dynamically based on the properties read
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1449
diff
changeset
|
303 name = name.replace("-", "_"); |
d0bcf5ba7adf
Create the properties dialog content dynamically based on the properties read
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1449
diff
changeset
|
304 } |
d0bcf5ba7adf
Create the properties dialog content dynamically based on the properties read
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1449
diff
changeset
|
305 TextItem item = new TextItem(); |
d0bcf5ba7adf
Create the properties dialog content dynamically based on the properties read
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1449
diff
changeset
|
306 item.setTitle(MSG.getString(name)); |
d0bcf5ba7adf
Create the properties dialog content dynamically based on the properties read
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1449
diff
changeset
|
307 item.setTitleAlign(Alignment.LEFT); |
1507
c21d14e48040
Improved validation and property handling.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1506
diff
changeset
|
308 item.addBlurHandler(new BlurHandler() { |
c21d14e48040
Improved validation and property handling.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1506
diff
changeset
|
309 public void onBlur(BlurEvent e) { |
1478
237e7450ae2e
Save output settings in chart properties dialog.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1465
diff
changeset
|
310 String val; |
1507
c21d14e48040
Improved validation and property handling.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1506
diff
changeset
|
311 if (e.getItem().getValue() == null) { |
1478
237e7450ae2e
Save output settings in chart properties dialog.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1465
diff
changeset
|
312 val = ""; |
237e7450ae2e
Save output settings in chart properties dialog.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1465
diff
changeset
|
313 } |
237e7450ae2e
Save output settings in chart properties dialog.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1465
diff
changeset
|
314 else { |
1507
c21d14e48040
Improved validation and property handling.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1506
diff
changeset
|
315 val = e.getItem().getValue().toString(); |
1478
237e7450ae2e
Save output settings in chart properties dialog.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1465
diff
changeset
|
316 } |
237e7450ae2e
Save output settings in chart properties dialog.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1465
diff
changeset
|
317 sp.setValue(val); |
237e7450ae2e
Save output settings in chart properties dialog.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1465
diff
changeset
|
318 } |
237e7450ae2e
Save output settings in chart properties dialog.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1465
diff
changeset
|
319 }); |
1465
d0bcf5ba7adf
Create the properties dialog content dynamically based on the properties read
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1449
diff
changeset
|
320 return item; |
d0bcf5ba7adf
Create the properties dialog content dynamically based on the properties read
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1449
diff
changeset
|
321 } |
1431
987f95ceb623
Added property fields to the chart properties editor dialog.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1429
diff
changeset
|
322 |
987f95ceb623
Added property fields to the chart properties editor dialog.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1429
diff
changeset
|
323 |
1465
d0bcf5ba7adf
Create the properties dialog content dynamically based on the properties read
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1449
diff
changeset
|
324 /** |
d0bcf5ba7adf
Create the properties dialog content dynamically based on the properties read
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1449
diff
changeset
|
325 * |
d0bcf5ba7adf
Create the properties dialog content dynamically based on the properties read
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1449
diff
changeset
|
326 */ |
1478
237e7450ae2e
Save output settings in chart properties dialog.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1465
diff
changeset
|
327 protected FormItem createBooleanProperty(final BooleanProperty bp) { |
1465
d0bcf5ba7adf
Create the properties dialog content dynamically based on the properties read
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1449
diff
changeset
|
328 String name = bp.getName(); |
d0bcf5ba7adf
Create the properties dialog content dynamically based on the properties read
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1449
diff
changeset
|
329 if (name.contains("-")) { |
d0bcf5ba7adf
Create the properties dialog content dynamically based on the properties read
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1449
diff
changeset
|
330 name = name.replace("-", "_"); |
d0bcf5ba7adf
Create the properties dialog content dynamically based on the properties read
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1449
diff
changeset
|
331 } |
1431
987f95ceb623
Added property fields to the chart properties editor dialog.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1429
diff
changeset
|
332 |
1465
d0bcf5ba7adf
Create the properties dialog content dynamically based on the properties read
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1449
diff
changeset
|
333 CheckboxItem item = new CheckboxItem("item", MSG.getString(name)); |
d0bcf5ba7adf
Create the properties dialog content dynamically based on the properties read
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1449
diff
changeset
|
334 item.setLabelAsTitle(true); |
d0bcf5ba7adf
Create the properties dialog content dynamically based on the properties read
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1449
diff
changeset
|
335 item.setTitleStyle("color:#000;"); |
d0bcf5ba7adf
Create the properties dialog content dynamically based on the properties read
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1449
diff
changeset
|
336 item.setTitleAlign(Alignment.LEFT); |
1507
c21d14e48040
Improved validation and property handling.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1506
diff
changeset
|
337 item.addBlurHandler(new BlurHandler() { |
c21d14e48040
Improved validation and property handling.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1506
diff
changeset
|
338 public void onBlur(BlurEvent e) { |
1478
237e7450ae2e
Save output settings in chart properties dialog.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1465
diff
changeset
|
339 String val; |
1507
c21d14e48040
Improved validation and property handling.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1506
diff
changeset
|
340 if (e.getItem().getValue() == null) { |
1478
237e7450ae2e
Save output settings in chart properties dialog.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1465
diff
changeset
|
341 val = ""; |
237e7450ae2e
Save output settings in chart properties dialog.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1465
diff
changeset
|
342 } |
237e7450ae2e
Save output settings in chart properties dialog.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1465
diff
changeset
|
343 else { |
1507
c21d14e48040
Improved validation and property handling.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1506
diff
changeset
|
344 val = e.getItem().getValue().toString(); |
1478
237e7450ae2e
Save output settings in chart properties dialog.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1465
diff
changeset
|
345 } |
237e7450ae2e
Save output settings in chart properties dialog.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1465
diff
changeset
|
346 bp.setValue(val); |
237e7450ae2e
Save output settings in chart properties dialog.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1465
diff
changeset
|
347 } |
237e7450ae2e
Save output settings in chart properties dialog.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1465
diff
changeset
|
348 }); |
1465
d0bcf5ba7adf
Create the properties dialog content dynamically based on the properties read
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1449
diff
changeset
|
349 return item; |
1431
987f95ceb623
Added property fields to the chart properties editor dialog.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1429
diff
changeset
|
350 } |
987f95ceb623
Added property fields to the chart properties editor dialog.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1429
diff
changeset
|
351 |
1465
d0bcf5ba7adf
Create the properties dialog content dynamically based on the properties read
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1449
diff
changeset
|
352 |
1431
987f95ceb623
Added property fields to the chart properties editor dialog.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1429
diff
changeset
|
353 /** |
1465
d0bcf5ba7adf
Create the properties dialog content dynamically based on the properties read
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1449
diff
changeset
|
354 * |
1431
987f95ceb623
Added property fields to the chart properties editor dialog.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1429
diff
changeset
|
355 */ |
1478
237e7450ae2e
Save output settings in chart properties dialog.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1465
diff
changeset
|
356 protected FormItem createDoubleProperty(final DoubleProperty dp) { |
1465
d0bcf5ba7adf
Create the properties dialog content dynamically based on the properties read
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1449
diff
changeset
|
357 String name = dp.getName(); |
d0bcf5ba7adf
Create the properties dialog content dynamically based on the properties read
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1449
diff
changeset
|
358 if (name.contains("-")) { |
d0bcf5ba7adf
Create the properties dialog content dynamically based on the properties read
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1449
diff
changeset
|
359 name = name.replace("-", "_"); |
d0bcf5ba7adf
Create the properties dialog content dynamically based on the properties read
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1449
diff
changeset
|
360 } |
1431
987f95ceb623
Added property fields to the chart properties editor dialog.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1429
diff
changeset
|
361 |
1465
d0bcf5ba7adf
Create the properties dialog content dynamically based on the properties read
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1449
diff
changeset
|
362 TextItem item = new TextItem(); |
d0bcf5ba7adf
Create the properties dialog content dynamically based on the properties read
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1449
diff
changeset
|
363 item.setTitle(MSG.getString(name)); |
d0bcf5ba7adf
Create the properties dialog content dynamically based on the properties read
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1449
diff
changeset
|
364 item.setTitleAlign(Alignment.LEFT); |
1507
c21d14e48040
Improved validation and property handling.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1506
diff
changeset
|
365 item.addBlurHandler(new BlurHandler() { |
c21d14e48040
Improved validation and property handling.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1506
diff
changeset
|
366 public void onBlur(BlurEvent e) { |
c21d14e48040
Improved validation and property handling.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1506
diff
changeset
|
367 DoubleValidator validator = new DoubleValidator(); |
c21d14e48040
Improved validation and property handling.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1506
diff
changeset
|
368 Map errors = e.getForm().getErrors(); |
c21d14e48040
Improved validation and property handling.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1506
diff
changeset
|
369 if(validator.validate(e.getItem(), errors)) { |
c21d14e48040
Improved validation and property handling.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1506
diff
changeset
|
370 dp.setValueFromUI(e.getItem().getValue().toString()); |
c21d14e48040
Improved validation and property handling.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1506
diff
changeset
|
371 e.getForm().setErrors(errors, true); |
c21d14e48040
Improved validation and property handling.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1506
diff
changeset
|
372 } |
c21d14e48040
Improved validation and property handling.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1506
diff
changeset
|
373 else { |
c21d14e48040
Improved validation and property handling.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1506
diff
changeset
|
374 e.getForm().setErrors(errors, true); |
c21d14e48040
Improved validation and property handling.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1506
diff
changeset
|
375 } |
1478
237e7450ae2e
Save output settings in chart properties dialog.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1465
diff
changeset
|
376 } |
237e7450ae2e
Save output settings in chart properties dialog.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1465
diff
changeset
|
377 }); |
1465
d0bcf5ba7adf
Create the properties dialog content dynamically based on the properties read
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1449
diff
changeset
|
378 return item; |
1431
987f95ceb623
Added property fields to the chart properties editor dialog.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1429
diff
changeset
|
379 } |
987f95ceb623
Added property fields to the chart properties editor dialog.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1429
diff
changeset
|
380 |
1465
d0bcf5ba7adf
Create the properties dialog content dynamically based on the properties read
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1449
diff
changeset
|
381 |
d0bcf5ba7adf
Create the properties dialog content dynamically based on the properties read
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1449
diff
changeset
|
382 /** |
d0bcf5ba7adf
Create the properties dialog content dynamically based on the properties read
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1449
diff
changeset
|
383 * |
d0bcf5ba7adf
Create the properties dialog content dynamically based on the properties read
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1449
diff
changeset
|
384 */ |
1478
237e7450ae2e
Save output settings in chart properties dialog.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1465
diff
changeset
|
385 protected FormItem createIntegerProperty(final IntegerProperty ip) { |
1465
d0bcf5ba7adf
Create the properties dialog content dynamically based on the properties read
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1449
diff
changeset
|
386 String name = ip.getName(); |
d0bcf5ba7adf
Create the properties dialog content dynamically based on the properties read
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1449
diff
changeset
|
387 if (name.contains("-")) { |
d0bcf5ba7adf
Create the properties dialog content dynamically based on the properties read
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1449
diff
changeset
|
388 name = name.replace("-", "_"); |
d0bcf5ba7adf
Create the properties dialog content dynamically based on the properties read
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1449
diff
changeset
|
389 } |
d0bcf5ba7adf
Create the properties dialog content dynamically based on the properties read
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1449
diff
changeset
|
390 |
d0bcf5ba7adf
Create the properties dialog content dynamically based on the properties read
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1449
diff
changeset
|
391 TextItem item = new TextItem(); |
d0bcf5ba7adf
Create the properties dialog content dynamically based on the properties read
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1449
diff
changeset
|
392 item.setTitle(MSG.getString(name)); |
d0bcf5ba7adf
Create the properties dialog content dynamically based on the properties read
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1449
diff
changeset
|
393 item.setTitleAlign(Alignment.LEFT); |
1507
c21d14e48040
Improved validation and property handling.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1506
diff
changeset
|
394 item.addBlurHandler(new BlurHandler() { |
c21d14e48040
Improved validation and property handling.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1506
diff
changeset
|
395 public void onBlur(BlurEvent e) { |
c21d14e48040
Improved validation and property handling.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1506
diff
changeset
|
396 IntegerValidator validator = new IntegerValidator(); |
c21d14e48040
Improved validation and property handling.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1506
diff
changeset
|
397 Map errors = e.getForm().getErrors(); |
c21d14e48040
Improved validation and property handling.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1506
diff
changeset
|
398 if(validator.validate(e.getItem(), errors)) { |
c21d14e48040
Improved validation and property handling.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1506
diff
changeset
|
399 ip.setValue(e.getItem().getValue().toString()); |
c21d14e48040
Improved validation and property handling.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1506
diff
changeset
|
400 e.getForm().setErrors(errors, true); |
1478
237e7450ae2e
Save output settings in chart properties dialog.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1465
diff
changeset
|
401 } |
237e7450ae2e
Save output settings in chart properties dialog.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1465
diff
changeset
|
402 else { |
1507
c21d14e48040
Improved validation and property handling.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1506
diff
changeset
|
403 e.getForm().setErrors(errors, true); |
1478
237e7450ae2e
Save output settings in chart properties dialog.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1465
diff
changeset
|
404 } |
237e7450ae2e
Save output settings in chart properties dialog.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1465
diff
changeset
|
405 } |
237e7450ae2e
Save output settings in chart properties dialog.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1465
diff
changeset
|
406 }); |
1465
d0bcf5ba7adf
Create the properties dialog content dynamically based on the properties read
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1449
diff
changeset
|
407 return item; |
d0bcf5ba7adf
Create the properties dialog content dynamically based on the properties read
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1449
diff
changeset
|
408 } |
1478
237e7450ae2e
Save output settings in chart properties dialog.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1465
diff
changeset
|
409 |
237e7450ae2e
Save output settings in chart properties dialog.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1465
diff
changeset
|
410 |
237e7450ae2e
Save output settings in chart properties dialog.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1465
diff
changeset
|
411 protected void updateCollection() { |
237e7450ae2e
Save output settings in chart properties dialog.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1465
diff
changeset
|
412 final Config config = Config.getInstance(); |
237e7450ae2e
Save output settings in chart properties dialog.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1465
diff
changeset
|
413 final String loc = config.getLocale(); |
237e7450ae2e
Save output settings in chart properties dialog.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1465
diff
changeset
|
414 |
237e7450ae2e
Save output settings in chart properties dialog.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1465
diff
changeset
|
415 GWT.log("PropertiesEditor.updateCollection via RPC now"); |
237e7450ae2e
Save output settings in chart properties dialog.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1465
diff
changeset
|
416 |
1503
3304608baf35
Issue 433.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1502
diff
changeset
|
417 Settings s = settings; |
3304608baf35
Issue 433.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1502
diff
changeset
|
418 collection.addSettings(this.tab.getOutputName(), s); |
1478
237e7450ae2e
Save output settings in chart properties dialog.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1465
diff
changeset
|
419 updater.update(collection, loc, new AsyncCallback<Collection>() { |
237e7450ae2e
Save output settings in chart properties dialog.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1465
diff
changeset
|
420 public void onFailure(Throwable caught) { |
237e7450ae2e
Save output settings in chart properties dialog.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1465
diff
changeset
|
421 GWT.log("Could not update collection attributes."); |
237e7450ae2e
Save output settings in chart properties dialog.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1465
diff
changeset
|
422 SC.warn(MSG.getString(caught.getMessage())); |
237e7450ae2e
Save output settings in chart properties dialog.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1465
diff
changeset
|
423 } |
237e7450ae2e
Save output settings in chart properties dialog.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1465
diff
changeset
|
424 public void onSuccess(Collection collection) { |
1482
cd8a146d29cd
Update chart if properties are changed successfully.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1478
diff
changeset
|
425 updateChartTab(); |
1478
237e7450ae2e
Save output settings in chart properties dialog.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1465
diff
changeset
|
426 } |
237e7450ae2e
Save output settings in chart properties dialog.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1465
diff
changeset
|
427 }); |
237e7450ae2e
Save output settings in chart properties dialog.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1465
diff
changeset
|
428 } |
237e7450ae2e
Save output settings in chart properties dialog.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1465
diff
changeset
|
429 |
1482
cd8a146d29cd
Update chart if properties are changed successfully.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1478
diff
changeset
|
430 protected void updateChartTab() { |
cd8a146d29cd
Update chart if properties are changed successfully.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1478
diff
changeset
|
431 this.tab.updateChartInfo(); |
cd8a146d29cd
Update chart if properties are changed successfully.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1478
diff
changeset
|
432 this.tab.updateChartPanel(); |
1503
3304608baf35
Issue 433.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1502
diff
changeset
|
433 this.destroy(); |
1482
cd8a146d29cd
Update chart if properties are changed successfully.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1478
diff
changeset
|
434 } |
1502
d1223d93dd68
Issue 358.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1501
diff
changeset
|
435 |
d1223d93dd68
Issue 358.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1501
diff
changeset
|
436 |
d1223d93dd68
Issue 358.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1501
diff
changeset
|
437 protected boolean isDialogValid() { |
d1223d93dd68
Issue 358.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1501
diff
changeset
|
438 boolean valid = true; |
d1223d93dd68
Issue 358.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1501
diff
changeset
|
439 for (int i = 0; i < tabs.getNumTabs(); i++) { |
d1223d93dd68
Issue 358.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1501
diff
changeset
|
440 Tab t = tabs.getTab(i); |
d1223d93dd68
Issue 358.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1501
diff
changeset
|
441 Canvas container = t.getPane(); |
d1223d93dd68
Issue 358.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1501
diff
changeset
|
442 Canvas[] children = container.getChildren(); |
d1223d93dd68
Issue 358.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1501
diff
changeset
|
443 for (Canvas c: children) { |
d1223d93dd68
Issue 358.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1501
diff
changeset
|
444 valid = validateCanvas(c); |
d1223d93dd68
Issue 358.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1501
diff
changeset
|
445 if(!valid) { |
d1223d93dd68
Issue 358.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1501
diff
changeset
|
446 return valid; |
d1223d93dd68
Issue 358.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1501
diff
changeset
|
447 } |
d1223d93dd68
Issue 358.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1501
diff
changeset
|
448 } |
d1223d93dd68
Issue 358.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1501
diff
changeset
|
449 } |
d1223d93dd68
Issue 358.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1501
diff
changeset
|
450 return valid; |
d1223d93dd68
Issue 358.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1501
diff
changeset
|
451 } |
d1223d93dd68
Issue 358.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1501
diff
changeset
|
452 |
d1223d93dd68
Issue 358.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1501
diff
changeset
|
453 |
d1223d93dd68
Issue 358.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1501
diff
changeset
|
454 protected boolean validateCanvas(Canvas c) { |
d1223d93dd68
Issue 358.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1501
diff
changeset
|
455 boolean valid = true; |
d1223d93dd68
Issue 358.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1501
diff
changeset
|
456 if(c instanceof DynamicForm) { |
d1223d93dd68
Issue 358.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1501
diff
changeset
|
457 DynamicForm f = (DynamicForm) c; |
2475
d77b1e489df7
Issue 492.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1560
diff
changeset
|
458 FormItem up = f.getItem("rangeupper"); |
d77b1e489df7
Issue 492.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1560
diff
changeset
|
459 FormItem lo = f.getItem("rangelower"); |
d77b1e489df7
Issue 492.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1560
diff
changeset
|
460 |
d77b1e489df7
Issue 492.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1560
diff
changeset
|
461 if(up != null && lo != null && |
d77b1e489df7
Issue 492.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1560
diff
changeset
|
462 !up.isDisabled() && !lo.isDisabled()) |
d77b1e489df7
Issue 492.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1560
diff
changeset
|
463 { |
d77b1e489df7
Issue 492.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1560
diff
changeset
|
464 validateRange(f); |
d77b1e489df7
Issue 492.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1560
diff
changeset
|
465 } |
1502
d1223d93dd68
Issue 358.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1501
diff
changeset
|
466 return !f.hasErrors(); |
d1223d93dd68
Issue 358.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1501
diff
changeset
|
467 } |
d1223d93dd68
Issue 358.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1501
diff
changeset
|
468 else if(c.getChildren().length > 0) { |
d1223d93dd68
Issue 358.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1501
diff
changeset
|
469 for (Canvas child: c.getChildren()) { |
d1223d93dd68
Issue 358.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1501
diff
changeset
|
470 valid = validateCanvas(child); |
d1223d93dd68
Issue 358.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1501
diff
changeset
|
471 if(!valid) { |
d1223d93dd68
Issue 358.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1501
diff
changeset
|
472 return valid; |
d1223d93dd68
Issue 358.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1501
diff
changeset
|
473 } |
d1223d93dd68
Issue 358.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1501
diff
changeset
|
474 } |
d1223d93dd68
Issue 358.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1501
diff
changeset
|
475 } |
d1223d93dd68
Issue 358.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1501
diff
changeset
|
476 return valid; |
d1223d93dd68
Issue 358.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1501
diff
changeset
|
477 } |
2475
d77b1e489df7
Issue 492.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1560
diff
changeset
|
478 |
d77b1e489df7
Issue 492.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1560
diff
changeset
|
479 protected boolean validateRange(DynamicForm form) { |
d77b1e489df7
Issue 492.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1560
diff
changeset
|
480 Map errors = form.getErrors(); |
d77b1e489df7
Issue 492.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1560
diff
changeset
|
481 FormItem up = form.getItem("rangeupper"); |
d77b1e489df7
Issue 492.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1560
diff
changeset
|
482 FormItem lo = form.getItem("rangelower"); |
d77b1e489df7
Issue 492.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1560
diff
changeset
|
483 |
d77b1e489df7
Issue 492.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1560
diff
changeset
|
484 String v1 = up.getValue().toString(); |
d77b1e489df7
Issue 492.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1560
diff
changeset
|
485 String v2 = lo.getValue().toString(); |
d77b1e489df7
Issue 492.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1560
diff
changeset
|
486 |
d77b1e489df7
Issue 492.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1560
diff
changeset
|
487 if(v1.equals(v2)) { |
d77b1e489df7
Issue 492.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1560
diff
changeset
|
488 errors.put(up.getFieldName(), MSG.wrongFormat()); |
d77b1e489df7
Issue 492.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1560
diff
changeset
|
489 errors.put(lo.getFieldName(), MSG.wrongFormat()); |
d77b1e489df7
Issue 492.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1560
diff
changeset
|
490 form.setErrors(errors, true); |
d77b1e489df7
Issue 492.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1560
diff
changeset
|
491 return false; |
d77b1e489df7
Issue 492.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1560
diff
changeset
|
492 } |
d77b1e489df7
Issue 492.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1560
diff
changeset
|
493 return true; |
d77b1e489df7
Issue 492.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1560
diff
changeset
|
494 } |
1429
16b7adc66330
Added stub for chart property editor.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
495 } |
1550
9bf1ffd53dfb
Cosmetics, docs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1543
diff
changeset
|
496 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : |