annotate gwt-client/src/main/java/org/dive4elements/river/client/client/ui/chart/ChartPropertiesEditor.java @ 7982:b1ff606f01ee

Fixed some smartgwt 4.1 related issues.
author Raimund Renkert <rrenkert@intevation.de>
date Tue, 01 Jul 2014 13:11:43 +0200
parents 8580f222dfb2
children 7003cf5c19ed
rev   line source
5861
172338b1407f GWT client: Added copyright header.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5838
diff changeset
1 /* Copyright (C) 2011, 2012, 2013 by Bundesanstalt für Gewässerkunde
172338b1407f GWT client: Added copyright header.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5838
diff changeset
2 * Software engineering by Intevation GmbH
172338b1407f GWT client: Added copyright header.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5838
diff changeset
3 *
5993
ea9eef426962 Removed trailing whitespace.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5861
diff changeset
4 * This file is Free Software under the GNU AGPL (>=v3)
5861
172338b1407f GWT client: Added copyright header.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5838
diff changeset
5 * and comes with ABSOLUTELY NO WARRANTY! Check out the
5993
ea9eef426962 Removed trailing whitespace.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5861
diff changeset
6 * documentation coming with Dive4Elements River for details.
5861
172338b1407f GWT client: Added copyright header.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5838
diff changeset
7 */
172338b1407f GWT client: Added copyright header.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5838
diff changeset
8
5835
821a02bbfb4e Fixed internal java dependencies
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5834
diff changeset
9 package org.dive4elements.river.client.client.ui.chart;
1429
16b7adc66330 Added stub for chart property editor.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
10
16b7adc66330 Added stub for chart property editor.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
11 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
12 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
13
4568
bbd82bd8e541 flys-client: Cosmetics and warnings.
Christian Lins <christian.lins@intevation.de>
parents: 3537
diff changeset
14 import com.smartgwt.client.types.Alignment;
1478
237e7450ae2e Save output settings in chart properties dialog.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1465
diff changeset
15 import com.smartgwt.client.util.SC;
4568
bbd82bd8e541 flys-client: Cosmetics and warnings.
Christian Lins <christian.lins@intevation.de>
parents: 3537
diff changeset
16 import com.smartgwt.client.widgets.Button;
bbd82bd8e541 flys-client: Cosmetics and warnings.
Christian Lins <christian.lins@intevation.de>
parents: 3537
diff changeset
17 import com.smartgwt.client.widgets.Canvas;
bbd82bd8e541 flys-client: Cosmetics and warnings.
Christian Lins <christian.lins@intevation.de>
parents: 3537
diff changeset
18 import com.smartgwt.client.widgets.Label;
1429
16b7adc66330 Added stub for chart property editor.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
19 import com.smartgwt.client.widgets.Window;
4568
bbd82bd8e541 flys-client: Cosmetics and warnings.
Christian Lins <christian.lins@intevation.de>
parents: 3537
diff changeset
20 import com.smartgwt.client.widgets.events.ClickEvent;
bbd82bd8e541 flys-client: Cosmetics and warnings.
Christian Lins <christian.lins@intevation.de>
parents: 3537
diff changeset
21 import com.smartgwt.client.widgets.events.ClickHandler;
1429
16b7adc66330 Added stub for chart property editor.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
22 import com.smartgwt.client.widgets.form.DynamicForm;
4568
bbd82bd8e541 flys-client: Cosmetics and warnings.
Christian Lins <christian.lins@intevation.de>
parents: 3537
diff changeset
23 import com.smartgwt.client.widgets.form.fields.CheckboxItem;
1429
16b7adc66330 Added stub for chart property editor.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
24 import com.smartgwt.client.widgets.form.fields.FormItem;
3511
57eb38260015 Show logo selection box for logo chart property.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3356
diff changeset
25 import com.smartgwt.client.widgets.form.fields.SelectItem;
1431
987f95ceb623 Added property fields to the chart properties editor dialog.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1429
diff changeset
26 import com.smartgwt.client.widgets.form.fields.TextItem;
4568
bbd82bd8e541 flys-client: Cosmetics and warnings.
Christian Lins <christian.lins@intevation.de>
parents: 3537
diff changeset
27 import com.smartgwt.client.widgets.form.fields.events.BlurEvent;
bbd82bd8e541 flys-client: Cosmetics and warnings.
Christian Lins <christian.lins@intevation.de>
parents: 3537
diff changeset
28 import com.smartgwt.client.widgets.form.fields.events.BlurHandler;
bbd82bd8e541 flys-client: Cosmetics and warnings.
Christian Lins <christian.lins@intevation.de>
parents: 3537
diff changeset
29 import com.smartgwt.client.widgets.form.fields.events.ChangedEvent;
1465
d0bcf5ba7adf Create the properties dialog content dynamically based on the properties read
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1449
diff changeset
30 import com.smartgwt.client.widgets.form.fields.events.ChangedHandler;
4568
bbd82bd8e541 flys-client: Cosmetics and warnings.
Christian Lins <christian.lins@intevation.de>
parents: 3537
diff changeset
31 import com.smartgwt.client.widgets.layout.HLayout;
bbd82bd8e541 flys-client: Cosmetics and warnings.
Christian Lins <christian.lins@intevation.de>
parents: 3537
diff changeset
32 import com.smartgwt.client.widgets.layout.VLayout;
bbd82bd8e541 flys-client: Cosmetics and warnings.
Christian Lins <christian.lins@intevation.de>
parents: 3537
diff changeset
33 import com.smartgwt.client.widgets.tab.Tab;
bbd82bd8e541 flys-client: Cosmetics and warnings.
Christian Lins <christian.lins@intevation.de>
parents: 3537
diff changeset
34 import com.smartgwt.client.widgets.tab.TabSet;
1429
16b7adc66330 Added stub for chart property editor.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
35
5835
821a02bbfb4e Fixed internal java dependencies
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5834
diff changeset
36 import org.dive4elements.river.client.client.Config;
821a02bbfb4e Fixed internal java dependencies
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5834
diff changeset
37 import org.dive4elements.river.client.client.FLYSConstants;
821a02bbfb4e Fixed internal java dependencies
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5834
diff changeset
38 import org.dive4elements.river.client.client.services.CollectionAttributeService;
821a02bbfb4e Fixed internal java dependencies
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5834
diff changeset
39 import org.dive4elements.river.client.client.services.CollectionAttributeServiceAsync;
821a02bbfb4e Fixed internal java dependencies
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5834
diff changeset
40 import org.dive4elements.river.client.client.utils.DoubleValidator;
821a02bbfb4e Fixed internal java dependencies
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5834
diff changeset
41 import org.dive4elements.river.client.client.utils.IntegerValidator;
821a02bbfb4e Fixed internal java dependencies
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5834
diff changeset
42 import org.dive4elements.river.client.shared.model.BooleanProperty;
821a02bbfb4e Fixed internal java dependencies
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5834
diff changeset
43 import org.dive4elements.river.client.shared.model.Collection;
821a02bbfb4e Fixed internal java dependencies
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5834
diff changeset
44 import org.dive4elements.river.client.shared.model.DoubleProperty;
821a02bbfb4e Fixed internal java dependencies
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5834
diff changeset
45 import org.dive4elements.river.client.shared.model.IntegerProperty;
821a02bbfb4e Fixed internal java dependencies
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5834
diff changeset
46 import org.dive4elements.river.client.shared.model.OutputSettings;
821a02bbfb4e Fixed internal java dependencies
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5834
diff changeset
47 import org.dive4elements.river.client.shared.model.Property;
821a02bbfb4e Fixed internal java dependencies
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5834
diff changeset
48 import org.dive4elements.river.client.shared.model.PropertyGroup;
821a02bbfb4e Fixed internal java dependencies
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5834
diff changeset
49 import org.dive4elements.river.client.shared.model.PropertySetting;
821a02bbfb4e Fixed internal java dependencies
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5834
diff changeset
50 import org.dive4elements.river.client.shared.model.Settings;
821a02bbfb4e Fixed internal java dependencies
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5834
diff changeset
51 import org.dive4elements.river.client.shared.model.StringProperty;
1429
16b7adc66330 Added stub for chart property editor.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
52
4568
bbd82bd8e541 flys-client: Cosmetics and warnings.
Christian Lins <christian.lins@intevation.de>
parents: 3537
diff changeset
53 import java.util.LinkedHashMap;
bbd82bd8e541 flys-client: Cosmetics and warnings.
Christian Lins <christian.lins@intevation.de>
parents: 3537
diff changeset
54 import java.util.List;
bbd82bd8e541 flys-client: Cosmetics and warnings.
Christian Lins <christian.lins@intevation.de>
parents: 3537
diff changeset
55 import java.util.Map;
1478
237e7450ae2e Save output settings in chart properties dialog.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1465
diff changeset
56
1429
16b7adc66330 Added stub for chart property editor.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
57 /**
3511
57eb38260015 Show logo selection box for logo chart property.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3356
diff changeset
58 * Dialog for the Chart-Properties, constructed from respective xml document.
57eb38260015 Show logo selection box for logo chart property.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3356
diff changeset
59 *
1429
16b7adc66330 Added stub for chart property editor.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
60 * @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
61 */
16b7adc66330 Added stub for chart property editor.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
62 public class ChartPropertiesEditor
1550
9bf1ffd53dfb Cosmetics, docs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1543
diff changeset
63 extends Window
9bf1ffd53dfb Cosmetics, docs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1543
diff changeset
64 implements ClickHandler
1429
16b7adc66330 Added stub for chart property editor.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
65 {
16b7adc66330 Added stub for chart property editor.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
66 /** The interface that provides i18n messages. */
16b7adc66330 Added stub for chart property editor.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
67 protected FLYSConstants MSG = GWT.create(FLYSConstants.class);
16b7adc66330 Added stub for chart property editor.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
68
2940
2867a0192aed Cosmetics, whitespaces, docs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2475
diff changeset
69 /** CollectionAttribute Update Service. */
1478
237e7450ae2e Save output settings in chart properties dialog.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1465
diff changeset
70 protected CollectionAttributeServiceAsync updater =
237e7450ae2e Save output settings in chart properties dialog.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1465
diff changeset
71 GWT.create(CollectionAttributeService.class);
237e7450ae2e Save output settings in chart properties dialog.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1465
diff changeset
72
1429
16b7adc66330 Added stub for chart property editor.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
73 /** 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
74 protected ChartOutputTab tab;
1429
16b7adc66330 Added stub for chart property editor.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
75
1543
0b79630e3bcb Cosmetics, doc.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1508
diff changeset
76 /** The tabset for chart properties. */
1429
16b7adc66330 Added stub for chart property editor.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
77 protected TabSet tabs;
16b7adc66330 Added stub for chart property editor.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
78
1543
0b79630e3bcb Cosmetics, doc.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1508
diff changeset
79 /** The collection. */
1478
237e7450ae2e Save output settings in chart properties dialog.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1465
diff changeset
80 protected Collection collection;
237e7450ae2e Save output settings in chart properties dialog.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1465
diff changeset
81
1543
0b79630e3bcb Cosmetics, doc.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1508
diff changeset
82 /** The cloned output settings. */
1478
237e7450ae2e Save output settings in chart properties dialog.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1465
diff changeset
83 protected OutputSettings settings;
237e7450ae2e Save output settings in chart properties dialog.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1465
diff changeset
84
1543
0b79630e3bcb Cosmetics, doc.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1508
diff changeset
85 /** The original output settings. */
1503
3304608baf35 Issue 433.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1502
diff changeset
86 protected OutputSettings origSettings;
3304608baf35 Issue 433.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1502
diff changeset
87
1478
237e7450ae2e Save output settings in chart properties dialog.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1465
diff changeset
88
5334
b296d435fc69 Doc and whitespace fixes.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 4568
diff changeset
89
1429
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 * Setup editor dialog.
1560
1c47de6ccfb1 Cosmetics.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1550
diff changeset
92 * @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
93 */
1482
cd8a146d29cd Update chart if properties are changed successfully.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1478
diff changeset
94 public ChartPropertiesEditor(ChartOutputTab callerTab) {
1429
16b7adc66330 Added stub for chart property editor.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
95 this.tab = callerTab;
16b7adc66330 Added stub for chart property editor.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
96 this.tabs = new TabSet();
16b7adc66330 Added stub for chart property editor.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
97
16b7adc66330 Added stub for chart property editor.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
98 init();
16b7adc66330 Added stub for chart property editor.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
99 }
16b7adc66330 Added stub for chart property editor.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
100
2940
2867a0192aed Cosmetics, whitespaces, docs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2475
diff changeset
101
1429
16b7adc66330 Added stub for chart property editor.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
102 /**
16b7adc66330 Added stub for chart property editor.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
103 * Initialize the editor window and its components.
16b7adc66330 Added stub for chart property editor.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
104 */
16b7adc66330 Added stub for chart property editor.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
105 protected void init() {
16b7adc66330 Added stub for chart property editor.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
106 setTitle(MSG.properties());
16b7adc66330 Added stub for chart property editor.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
107 setCanDragReposition(true);
16b7adc66330 Added stub for chart property editor.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
108 setCanDragResize(true);
16b7adc66330 Added stub for chart property editor.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
109
1478
237e7450ae2e Save output settings in chart properties dialog.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1465
diff changeset
110 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
111 String outputName = tab.getOutputName();
1503
3304608baf35 Issue 433.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1502
diff changeset
112 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
113
1503
3304608baf35 Issue 433.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1502
diff changeset
114 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
115 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
116 return;
d0bcf5ba7adf Create the properties dialog content dynamically based on the properties read
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1449
diff changeset
117 }
d0bcf5ba7adf Create the properties dialog content dynamically based on the properties read
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1449
diff changeset
118 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
119
d0bcf5ba7adf Create the properties dialog content dynamically based on the properties read
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1449
diff changeset
120 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
121 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
122 List<Property> props = settings.getSettings(list.get(i));
1503
3304608baf35 Issue 433.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1502
diff changeset
123 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
124 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
125 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
126 if (props.get(j) instanceof PropertyGroup) {
1503
3304608baf35 Issue 433.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1502
diff changeset
127 layout.addMember(generatePropertyGroup(props.get(j),
3304608baf35 Issue 433.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1502
diff changeset
128 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
129 }
d0bcf5ba7adf Create the properties dialog content dynamically based on the properties read
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1449
diff changeset
130 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
131 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
132 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
133 continue;
d0bcf5ba7adf Create the properties dialog content dynamically based on the properties read
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1449
diff changeset
134 }
1503
3304608baf35 Issue 433.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1502
diff changeset
135 layout.addMember(generatePropertySetting(props.get(j),
3304608baf35 Issue 433.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1502
diff changeset
136 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
137 }
d0bcf5ba7adf Create the properties dialog content dynamically based on the properties read
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1449
diff changeset
138 }
d0bcf5ba7adf Create the properties dialog content dynamically based on the properties read
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1449
diff changeset
139 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
140 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
141 }
1429
16b7adc66330 Added stub for chart property editor.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
142
16b7adc66330 Added stub for chart property editor.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
143 Button accept = new Button(MSG.label_ok());
16b7adc66330 Added stub for chart property editor.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
144 Button cancel = new Button(MSG.label_cancel());
16b7adc66330 Added stub for chart property editor.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
145 cancel.addClickHandler(this);
16b7adc66330 Added stub for chart property editor.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
146 accept.addClickHandler(new ClickHandler() {
4568
bbd82bd8e541 flys-client: Cosmetics and warnings.
Christian Lins <christian.lins@intevation.de>
parents: 3537
diff changeset
147 @Override
1429
16b7adc66330 Added stub for chart property editor.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
148 public void onClick(ClickEvent e) {
1502
d1223d93dd68 Issue 358.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1501
diff changeset
149 if(isDialogValid()) {
d1223d93dd68 Issue 358.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1501
diff changeset
150 updateCollection();
d1223d93dd68 Issue 358.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1501
diff changeset
151 }
d1223d93dd68 Issue 358.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1501
diff changeset
152 else {
d1223d93dd68 Issue 358.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1501
diff changeset
153 GWT.log("Dialog not valid");
d1223d93dd68 Issue 358.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1501
diff changeset
154 SC.warn(MSG.error_dialog_not_valid());
d1223d93dd68 Issue 358.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1501
diff changeset
155 }
1429
16b7adc66330 Added stub for chart property editor.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
156 }
16b7adc66330 Added stub for chart property editor.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
157 });
16b7adc66330 Added stub for chart property editor.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
158
16b7adc66330 Added stub for chart property editor.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
159 HLayout buttons = new HLayout();
16b7adc66330 Added stub for chart property editor.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
160 buttons.addMember(accept);
16b7adc66330 Added stub for chart property editor.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
161 buttons.addMember(cancel);
16b7adc66330 Added stub for chart property editor.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
162 buttons.setAlign(Alignment.CENTER);
16b7adc66330 Added stub for chart property editor.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
163 buttons.setHeight(30);
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 addItem(tabs);
16b7adc66330 Added stub for chart property editor.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
166 addItem(buttons);
1500
2a8b5dcbe8ca Issue 358.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1482
diff changeset
167 setWidth(380);
1431
987f95ceb623 Added property fields to the chart properties editor dialog.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1429
diff changeset
168 setHeight(470);
1429
16b7adc66330 Added stub for chart property editor.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
169 centerInPage();
16b7adc66330 Added stub for chart property editor.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
170 }
16b7adc66330 Added stub for chart property editor.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
171
3511
57eb38260015 Show logo selection box for logo chart property.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3356
diff changeset
172
1429
16b7adc66330 Added stub for chart property editor.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
173 /**
16b7adc66330 Added stub for chart property editor.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
174 * 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
175 * @param event The event.
16b7adc66330 Added stub for chart property editor.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
176 */
4568
bbd82bd8e541 flys-client: Cosmetics and warnings.
Christian Lins <christian.lins@intevation.de>
parents: 3537
diff changeset
177 @Override
1429
16b7adc66330 Added stub for chart property editor.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
178 public void onClick(ClickEvent event) {
1503
3304608baf35 Issue 433.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1502
diff changeset
179 this.destroy();
1429
16b7adc66330 Added stub for chart property editor.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
180 }
1431
987f95ceb623 Added property fields to the chart properties editor dialog.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1429
diff changeset
181
987f95ceb623 Added property fields to the chart properties editor dialog.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1429
diff changeset
182
987f95ceb623 Added property fields to the chart properties editor dialog.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1429
diff changeset
183 /**
5334
b296d435fc69 Doc and whitespace fixes.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 4568
diff changeset
184 * Create a section from group (usually axis properties).
1431
987f95ceb623 Added property fields to the chart properties editor dialog.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1429
diff changeset
185 */
1503
3304608baf35 Issue 433.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1502
diff changeset
186 protected Canvas generatePropertyGroup(Property group, Property orig) {
1465
d0bcf5ba7adf Create the properties dialog content dynamically based on the properties read
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1449
diff changeset
187 PropertyGroup pg = (PropertyGroup)group;
1503
3304608baf35 Issue 433.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1502
diff changeset
188 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
189
1465
d0bcf5ba7adf Create the properties dialog content dynamically based on the properties read
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1449
diff changeset
190 if (pg.getName().equals("axis")) {
6534
480fb71ab73f issue1370: In GWT chart property editor, suppres editing the "W [cm]" axis.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 5993
diff changeset
191 // Certain axis shall be skipped (W/Q-Diagrams cm-axis especially).
480fb71ab73f issue1370: In GWT chart property editor, suppres editing the "W [cm]" axis.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 5993
diff changeset
192 String outputName = tab.getOutputName();
480fb71ab73f issue1370: In GWT chart property editor, suppres editing the "W [cm]" axis.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 5993
diff changeset
193 if (outputName.equals("fix_wq_curve") || outputName.equals("computed_discharge_curve")
480fb71ab73f issue1370: In GWT chart property editor, suppres editing the "W [cm]" axis.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 5993
diff changeset
194 || outputName.equals("extreme_wq_curve")) {
480fb71ab73f issue1370: In GWT chart property editor, suppres editing the "W [cm]" axis.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 5993
diff changeset
195 String labelString = ((StringProperty)origPg.getPropertyByName("label")).getValue();
480fb71ab73f issue1370: In GWT chart property editor, suppres editing the "W [cm]" axis.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 5993
diff changeset
196 if(labelString.equals("W [cm]")) {
480fb71ab73f issue1370: In GWT chart property editor, suppres editing the "W [cm]" axis.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 5993
diff changeset
197 VLayout layout = new VLayout();
480fb71ab73f issue1370: In GWT chart property editor, suppres editing the "W [cm]" axis.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 5993
diff changeset
198 layout.setHeight(0);
480fb71ab73f issue1370: In GWT chart property editor, suppres editing the "W [cm]" axis.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 5993
diff changeset
199 return layout;
480fb71ab73f issue1370: In GWT chart property editor, suppres editing the "W [cm]" axis.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 5993
diff changeset
200 }
480fb71ab73f issue1370: In GWT chart property editor, suppres editing the "W [cm]" axis.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 5993
diff changeset
201 }
1465
d0bcf5ba7adf Create the properties dialog content dynamically based on the properties read
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1449
diff changeset
202 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
203 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
204 scale.setMargin(2);
1431
987f95ceb623 Added property fields to the chart properties editor dialog.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1429
diff changeset
205
1465
d0bcf5ba7adf Create the properties dialog content dynamically based on the properties read
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1449
diff changeset
206 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
207 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
208 form2.setNumCols(6);
1431
987f95ceb623 Added property fields to the chart properties editor dialog.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1429
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 StringProperty label =
d0bcf5ba7adf Create the properties dialog content dynamically based on the properties read
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1449
diff changeset
211 (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
212 FormItem title = createStringProperty(label);
1503
3304608baf35 Issue 433.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1502
diff changeset
213 title.setValue(
3304608baf35 Issue 433.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1502
diff changeset
214 ((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
215
7597
fca46ce8e4f5 (issue1225) Implement Magic labels.
Andre Heinecke <aheinecke@intevation.de>
parents: 6534
diff changeset
216 StringProperty suggestedLabel =
fca46ce8e4f5 (issue1225) Implement Magic labels.
Andre Heinecke <aheinecke@intevation.de>
parents: 6534
diff changeset
217 (StringProperty)pg.getPropertyByName("suggested-label");
fca46ce8e4f5 (issue1225) Implement Magic labels.
Andre Heinecke <aheinecke@intevation.de>
parents: 6534
diff changeset
218 FormItem sugLabel = null;
fca46ce8e4f5 (issue1225) Implement Magic labels.
Andre Heinecke <aheinecke@intevation.de>
parents: 6534
diff changeset
219
fca46ce8e4f5 (issue1225) Implement Magic labels.
Andre Heinecke <aheinecke@intevation.de>
parents: 6534
diff changeset
220 if (suggestedLabel != null) {
fca46ce8e4f5 (issue1225) Implement Magic labels.
Andre Heinecke <aheinecke@intevation.de>
parents: 6534
diff changeset
221 // X Axis does not have a suggested label
fca46ce8e4f5 (issue1225) Implement Magic labels.
Andre Heinecke <aheinecke@intevation.de>
parents: 6534
diff changeset
222 // otherwise add an hidden property for suggestedLabel
fca46ce8e4f5 (issue1225) Implement Magic labels.
Andre Heinecke <aheinecke@intevation.de>
parents: 6534
diff changeset
223 sugLabel = createStringProperty(suggestedLabel);
fca46ce8e4f5 (issue1225) Implement Magic labels.
Andre Heinecke <aheinecke@intevation.de>
parents: 6534
diff changeset
224 sugLabel.setValue(
fca46ce8e4f5 (issue1225) Implement Magic labels.
Andre Heinecke <aheinecke@intevation.de>
parents: 6534
diff changeset
225 ((StringProperty)origPg.getPropertyByName("suggested-label")).getValue());
fca46ce8e4f5 (issue1225) Implement Magic labels.
Andre Heinecke <aheinecke@intevation.de>
parents: 6534
diff changeset
226 }
fca46ce8e4f5 (issue1225) Implement Magic labels.
Andre Heinecke <aheinecke@intevation.de>
parents: 6534
diff changeset
227
1465
d0bcf5ba7adf Create the properties dialog content dynamically based on the properties read
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1449
diff changeset
228 IntegerProperty fontsize =
d0bcf5ba7adf Create the properties dialog content dynamically based on the properties read
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1449
diff changeset
229 (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
230 FormItem fs = createIntegerProperty(fontsize);
1503
3304608baf35 Issue 433.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1502
diff changeset
231 fs.setValue(
3304608baf35 Issue 433.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1502
diff changeset
232 ((IntegerProperty)
3304608baf35 Issue 433.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1502
diff changeset
233 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
234
d0bcf5ba7adf Create the properties dialog content dynamically based on the properties read
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1449
diff changeset
235 DoubleProperty upper =
d0bcf5ba7adf Create the properties dialog content dynamically based on the properties read
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1449
diff changeset
236 (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
237 final FormItem range1 = createDoubleProperty(upper);
2475
d77b1e489df7 Issue 492.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1560
diff changeset
238 range1.setName("rangeupper");
1500
2a8b5dcbe8ca Issue 358.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1482
diff changeset
239 range1.setWidth(70);
1507
c21d14e48040 Improved validation and property handling.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1506
diff changeset
240 range1.setValue(
c21d14e48040 Improved validation and property handling.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1506
diff changeset
241 ((DoubleProperty)
c21d14e48040 Improved validation and property handling.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1506
diff changeset
242 origPg.getPropertyByName("upper")).toUIString());
c21d14e48040 Improved validation and property handling.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1506
diff changeset
243
1465
d0bcf5ba7adf Create the properties dialog content dynamically based on the properties read
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1449
diff changeset
244 DoubleProperty lower =
d0bcf5ba7adf Create the properties dialog content dynamically based on the properties read
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1449
diff changeset
245 (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
246 final FormItem range2 = createDoubleProperty(lower);
2475
d77b1e489df7 Issue 492.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1560
diff changeset
247 range2.setName("rangelower");
1500
2a8b5dcbe8ca Issue 358.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1482
diff changeset
248 range2.setWidth(70);
1507
c21d14e48040 Improved validation and property handling.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1506
diff changeset
249 range2.setValue(
c21d14e48040 Improved validation and property handling.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1506
diff changeset
250 ((DoubleProperty)
c21d14e48040 Improved validation and property handling.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1506
diff changeset
251 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
252
d0bcf5ba7adf Create the properties dialog content dynamically based on the properties read
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1449
diff changeset
253 BooleanProperty fixation =
d0bcf5ba7adf Create the properties dialog content dynamically based on the properties read
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1449
diff changeset
254 (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
255 FormItem fix = createBooleanProperty(fixation);
1507
c21d14e48040 Improved validation and property handling.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1506
diff changeset
256 fix.setValue(((BooleanProperty)
c21d14e48040 Improved validation and property handling.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1506
diff changeset
257 origPg.getPropertyByName("fixation")).getValue().booleanValue());
7982
b1ff606f01ee Fixed some smartgwt 4.1 related issues.
Raimund Renkert <rrenkert@intevation.de>
parents: 7598
diff changeset
258 fix.setWidth(30);
1507
c21d14e48040 Improved validation and property handling.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1506
diff changeset
259
1465
d0bcf5ba7adf Create the properties dialog content dynamically based on the properties read
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1449
diff changeset
260 fix.addChangedHandler(new ChangedHandler() {
4568
bbd82bd8e541 flys-client: Cosmetics and warnings.
Christian Lins <christian.lins@intevation.de>
parents: 3537
diff changeset
261 @Override
1465
d0bcf5ba7adf Create the properties dialog content dynamically based on the properties read
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1449
diff changeset
262 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
263 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
264 range1.enable();
d0bcf5ba7adf Create the properties dialog content dynamically based on the properties read
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1449
diff changeset
265 range2.enable();
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 else {
d0bcf5ba7adf Create the properties dialog content dynamically based on the properties read
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1449
diff changeset
268 range1.disable();
d0bcf5ba7adf Create the properties dialog content dynamically based on the properties read
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1449
diff changeset
269 range2.disable();
d0bcf5ba7adf Create the properties dialog content dynamically based on the properties read
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1449
diff changeset
270 }
d0bcf5ba7adf Create the properties dialog content dynamically based on the properties read
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1449
diff changeset
271 }
d0bcf5ba7adf Create the properties dialog content dynamically based on the properties read
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1449
diff changeset
272 });
1507
c21d14e48040 Improved validation and property handling.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1506
diff changeset
273 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
274 range1.enable();
d0bcf5ba7adf Create the properties dialog content dynamically based on the properties read
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1449
diff changeset
275 range2.enable();
d0bcf5ba7adf Create the properties dialog content dynamically based on the properties read
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1449
diff changeset
276 }
d0bcf5ba7adf Create the properties dialog content dynamically based on the properties read
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1449
diff changeset
277 else {
d0bcf5ba7adf Create the properties dialog content dynamically based on the properties read
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1449
diff changeset
278 range1.disable();
d0bcf5ba7adf Create the properties dialog content dynamically based on the properties read
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1449
diff changeset
279 range2.disable();
d0bcf5ba7adf Create the properties dialog content dynamically based on the properties read
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1449
diff changeset
280 }
d0bcf5ba7adf Create the properties dialog content dynamically based on the properties read
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1449
diff changeset
281
d0bcf5ba7adf Create the properties dialog content dynamically based on the properties read
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1449
diff changeset
282 form1.setFields(title, fs);
1501
d12cb71965cf Issue 358.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1500
diff changeset
283 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
284
d0bcf5ba7adf Create the properties dialog content dynamically based on the properties read
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1449
diff changeset
285 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
286 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
287 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
288 scaleLayout.addMember(form2);
1503
3304608baf35 Issue 433.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1502
diff changeset
289 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
290
d0bcf5ba7adf Create the properties dialog content dynamically based on the properties read
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1449
diff changeset
291 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
292 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
293 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
294 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
295
d0bcf5ba7adf Create the properties dialog content dynamically based on the properties read
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1449
diff changeset
296 return root;
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 return null;
d0bcf5ba7adf Create the properties dialog content dynamically based on the properties read
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1449
diff changeset
299 }
1431
987f95ceb623 Added property fields to the chart properties editor dialog.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1429
diff changeset
300
987f95ceb623 Added property fields to the chart properties editor dialog.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1429
diff changeset
301
1465
d0bcf5ba7adf Create the properties dialog content dynamically based on the properties read
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1449
diff changeset
302 /**
3511
57eb38260015 Show logo selection box for logo chart property.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3356
diff changeset
303 * Generate a form with items for the properties/settings, preset with
57eb38260015 Show logo selection box for logo chart property.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3356
diff changeset
304 * values.
1465
d0bcf5ba7adf Create the properties dialog content dynamically based on the properties read
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1449
diff changeset
305 */
1503
3304608baf35 Issue 433.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1502
diff changeset
306 protected DynamicForm generatePropertySetting(
3304608baf35 Issue 433.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1502
diff changeset
307 Property setting,
3304608baf35 Issue 433.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1502
diff changeset
308 Property orig)
3304608baf35 Issue 433.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1502
diff changeset
309 {
1465
d0bcf5ba7adf Create the properties dialog content dynamically based on the properties read
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1449
diff changeset
310 DynamicForm form = new DynamicForm();
1478
237e7450ae2e Save output settings in chart properties dialog.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1465
diff changeset
311 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
312 if (setting instanceof BooleanProperty) {
1478
237e7450ae2e Save output settings in chart properties dialog.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1465
diff changeset
313 item = createBooleanProperty((BooleanProperty)setting);
1508
8ac57bbc270c Fixed initial boolean value setting.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1507
diff changeset
314 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
315 }
d0bcf5ba7adf Create the properties dialog content dynamically based on the properties read
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1449
diff changeset
316 else if (setting instanceof DoubleProperty) {
1478
237e7450ae2e Save output settings in chart properties dialog.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1465
diff changeset
317 item = createDoubleProperty((DoubleProperty)setting);
1507
c21d14e48040 Improved validation and property handling.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1506
diff changeset
318 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
319 }
d0bcf5ba7adf Create the properties dialog content dynamically based on the properties read
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1449
diff changeset
320 else if (setting instanceof IntegerProperty) {
1478
237e7450ae2e Save output settings in chart properties dialog.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1465
diff changeset
321 item = createIntegerProperty((IntegerProperty)setting);
1503
3304608baf35 Issue 433.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1502
diff changeset
322 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
323 }
d0bcf5ba7adf Create the properties dialog content dynamically based on the properties read
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1449
diff changeset
324 else if (setting instanceof StringProperty) {
3511
57eb38260015 Show logo selection box for logo chart property.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3356
diff changeset
325 StringProperty property = (StringProperty) setting;
57eb38260015 Show logo selection box for logo chart property.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3356
diff changeset
326 item = createStringProperty(property);
1503
3304608baf35 Issue 433.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1502
diff changeset
327 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
328 }
3511
57eb38260015 Show logo selection box for logo chart property.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3356
diff changeset
329 else {
57eb38260015 Show logo selection box for logo chart property.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3356
diff changeset
330 GWT.log("generatePropertySetting: unknown setting type.");
57eb38260015 Show logo selection box for logo chart property.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3356
diff changeset
331 }
1478
237e7450ae2e Save output settings in chart properties dialog.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1465
diff changeset
332 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
333 return form;
d0bcf5ba7adf Create the properties dialog content dynamically based on the properties read
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1449
diff changeset
334 }
1431
987f95ceb623 Added property fields to the chart properties editor dialog.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1429
diff changeset
335
987f95ceb623 Added property fields to the chart properties editor dialog.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1429
diff changeset
336
1478
237e7450ae2e Save output settings in chart properties dialog.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1465
diff changeset
337 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
338 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
339 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
340 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
341 }
3511
57eb38260015 Show logo selection box for logo chart property.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3356
diff changeset
342
57eb38260015 Show logo selection box for logo chart property.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3356
diff changeset
343 String choiceAttribute = sp.getAttribute("choice");
3520
0b576ca67cd5 i18n for logo placement.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3513
diff changeset
344
3511
57eb38260015 Show logo selection box for logo chart property.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3356
diff changeset
345 if (choiceAttribute != null && choiceAttribute.equals("logo")) {
57eb38260015 Show logo selection box for logo chart property.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3356
diff changeset
346 SelectItem logoChooser = new SelectItem();
3536
a1610c7e4a4e Show logos in select box.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3520
diff changeset
347 logoChooser.setImageURLPrefix(GWT.getHostPageBaseURL() + "images/logo-");
a1610c7e4a4e Show logos in select box.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3520
diff changeset
348 logoChooser.setValueIconHeight(50);
a1610c7e4a4e Show logos in select box.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3520
diff changeset
349 logoChooser.setValueIconWidth(100);
a1610c7e4a4e Show logos in select box.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3520
diff changeset
350
3511
57eb38260015 Show logo selection box for logo chart property.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3356
diff changeset
351 LinkedHashMap valueMap = new LinkedHashMap<String, String>();
3536
a1610c7e4a4e Show logos in select box.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3520
diff changeset
352 LinkedHashMap<String, String> valueIcons = new LinkedHashMap<String, String>();
3520
0b576ca67cd5 i18n for logo placement.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3513
diff changeset
353 valueMap.put("none", MSG.getString("none"));
3536
a1610c7e4a4e Show logos in select box.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3520
diff changeset
354 /*
a1610c7e4a4e Show logos in select box.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3520
diff changeset
355 If you want to add images, remember to change code in these places:
a1610c7e4a4e Show logos in select box.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3520
diff changeset
356 flys-artifacts:
a1610c7e4a4e Show logos in select box.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3520
diff changeset
357 XYChartGenerator.java
a1610c7e4a4e Show logos in select box.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3520
diff changeset
358 Timeseries*Generator.java and
a1610c7e4a4e Show logos in select box.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3520
diff changeset
359 in the flys-client projects Chart*Propert*Editor.java.
a1610c7e4a4e Show logos in select box.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3520
diff changeset
360 Also, these images have to be put in
a1610c7e4a4e Show logos in select box.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3520
diff changeset
361 flys-artifacts/src/main/resources/images/
a1610c7e4a4e Show logos in select box.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3520
diff changeset
362 flys-client/src/main/webapp/images/
a1610c7e4a4e Show logos in select box.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3520
diff changeset
363 */
3537
45f2b0778a3a Do not show labels in logo selection combo box.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3536
diff changeset
364 valueMap.put("BfG", "");
45f2b0778a3a Do not show labels in logo selection combo box.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3536
diff changeset
365 valueMap.put("Intevation", "");
3536
a1610c7e4a4e Show logos in select box.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3520
diff changeset
366 valueIcons.put("BfG", "bfg.gif");
a1610c7e4a4e Show logos in select box.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3520
diff changeset
367 valueIcons.put("Intevation", "intevation.png");
a1610c7e4a4e Show logos in select box.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3520
diff changeset
368 logoChooser.setValueIcons(valueIcons);
3511
57eb38260015 Show logo selection box for logo chart property.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3356
diff changeset
369 logoChooser.setValueMap(valueMap);
57eb38260015 Show logo selection box for logo chart property.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3356
diff changeset
370 logoChooser.setTitleStyle("color:#000;");
57eb38260015 Show logo selection box for logo chart property.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3356
diff changeset
371 logoChooser.setTitleAlign(Alignment.LEFT);
57eb38260015 Show logo selection box for logo chart property.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3356
diff changeset
372 logoChooser.setTitle(MSG.getString(name));
57eb38260015 Show logo selection box for logo chart property.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3356
diff changeset
373 logoChooser.setTitleAlign(Alignment.LEFT);
57eb38260015 Show logo selection box for logo chart property.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3356
diff changeset
374 logoChooser.addBlurHandler(new BlurHandler() {
4568
bbd82bd8e541 flys-client: Cosmetics and warnings.
Christian Lins <christian.lins@intevation.de>
parents: 3537
diff changeset
375 @Override
3511
57eb38260015 Show logo selection box for logo chart property.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3356
diff changeset
376 public void onBlur(BlurEvent e) {
57eb38260015 Show logo selection box for logo chart property.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3356
diff changeset
377 String val;
57eb38260015 Show logo selection box for logo chart property.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3356
diff changeset
378 if (e.getItem().getValue() == null) {
57eb38260015 Show logo selection box for logo chart property.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3356
diff changeset
379 val = "";
57eb38260015 Show logo selection box for logo chart property.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3356
diff changeset
380 }
57eb38260015 Show logo selection box for logo chart property.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3356
diff changeset
381 else {
57eb38260015 Show logo selection box for logo chart property.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3356
diff changeset
382 val = e.getItem().getValue().toString();
57eb38260015 Show logo selection box for logo chart property.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3356
diff changeset
383 }
57eb38260015 Show logo selection box for logo chart property.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3356
diff changeset
384 sp.setValue(val);
57eb38260015 Show logo selection box for logo chart property.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3356
diff changeset
385 }
57eb38260015 Show logo selection box for logo chart property.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3356
diff changeset
386 });
57eb38260015 Show logo selection box for logo chart property.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3356
diff changeset
387 return logoChooser;
57eb38260015 Show logo selection box for logo chart property.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3356
diff changeset
388 }
3513
c657c0bbcf8f Updated to use split properties for logo placement.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3512
diff changeset
389 else if (choiceAttribute != null && choiceAttribute.equals("placeh")) {
c657c0bbcf8f Updated to use split properties for logo placement.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3512
diff changeset
390 SelectItem placeChooser = new SelectItem();
c657c0bbcf8f Updated to use split properties for logo placement.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3512
diff changeset
391 LinkedHashMap valueMap = new LinkedHashMap<String, String>();
3520
0b576ca67cd5 i18n for logo placement.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3513
diff changeset
392 valueMap.put("right", MSG.getString("right"));
0b576ca67cd5 i18n for logo placement.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3513
diff changeset
393 valueMap.put("left", MSG.getString("left"));
0b576ca67cd5 i18n for logo placement.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3513
diff changeset
394 valueMap.put("center", MSG.getString("center"));
3513
c657c0bbcf8f Updated to use split properties for logo placement.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3512
diff changeset
395 placeChooser.setValueMap(valueMap);
c657c0bbcf8f Updated to use split properties for logo placement.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3512
diff changeset
396 placeChooser.setTitleStyle("color:#000;");
c657c0bbcf8f Updated to use split properties for logo placement.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3512
diff changeset
397 placeChooser.setTitleAlign(Alignment.LEFT);
c657c0bbcf8f Updated to use split properties for logo placement.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3512
diff changeset
398 placeChooser.setTitle(MSG.getString(name));
c657c0bbcf8f Updated to use split properties for logo placement.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3512
diff changeset
399 placeChooser.setTitleAlign(Alignment.LEFT);
c657c0bbcf8f Updated to use split properties for logo placement.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3512
diff changeset
400 placeChooser.addBlurHandler(new BlurHandler() {
4568
bbd82bd8e541 flys-client: Cosmetics and warnings.
Christian Lins <christian.lins@intevation.de>
parents: 3537
diff changeset
401 @Override
3513
c657c0bbcf8f Updated to use split properties for logo placement.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3512
diff changeset
402 public void onBlur(BlurEvent e) {
c657c0bbcf8f Updated to use split properties for logo placement.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3512
diff changeset
403 String val;
c657c0bbcf8f Updated to use split properties for logo placement.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3512
diff changeset
404 if (e.getItem().getValue() == null) {
c657c0bbcf8f Updated to use split properties for logo placement.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3512
diff changeset
405 val = "";
c657c0bbcf8f Updated to use split properties for logo placement.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3512
diff changeset
406 }
c657c0bbcf8f Updated to use split properties for logo placement.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3512
diff changeset
407 else {
c657c0bbcf8f Updated to use split properties for logo placement.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3512
diff changeset
408 val = e.getItem().getValue().toString();
c657c0bbcf8f Updated to use split properties for logo placement.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3512
diff changeset
409 }
c657c0bbcf8f Updated to use split properties for logo placement.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3512
diff changeset
410 sp.setValue(val);
c657c0bbcf8f Updated to use split properties for logo placement.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3512
diff changeset
411 }
c657c0bbcf8f Updated to use split properties for logo placement.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3512
diff changeset
412 });
c657c0bbcf8f Updated to use split properties for logo placement.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3512
diff changeset
413 return placeChooser;
c657c0bbcf8f Updated to use split properties for logo placement.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3512
diff changeset
414 }
c657c0bbcf8f Updated to use split properties for logo placement.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3512
diff changeset
415 else if (choiceAttribute != null && choiceAttribute.equals("placev")) {
3512
b8a8ecdebc0d i18n and interpretation for logo placement chart property.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3511
diff changeset
416 SelectItem placeChooser = new SelectItem();
b8a8ecdebc0d i18n and interpretation for logo placement chart property.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3511
diff changeset
417 LinkedHashMap valueMap = new LinkedHashMap<String, String>();
3520
0b576ca67cd5 i18n for logo placement.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3513
diff changeset
418 valueMap.put("top", MSG.getString("top"));
0b576ca67cd5 i18n for logo placement.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3513
diff changeset
419 valueMap.put("bottom", MSG.getString("bottom"));
0b576ca67cd5 i18n for logo placement.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3513
diff changeset
420 valueMap.put("center", MSG.getString("center"));
3512
b8a8ecdebc0d i18n and interpretation for logo placement chart property.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3511
diff changeset
421 placeChooser.setValueMap(valueMap);
b8a8ecdebc0d i18n and interpretation for logo placement chart property.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3511
diff changeset
422 placeChooser.setTitleStyle("color:#000;");
b8a8ecdebc0d i18n and interpretation for logo placement chart property.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3511
diff changeset
423 placeChooser.setTitleAlign(Alignment.LEFT);
b8a8ecdebc0d i18n and interpretation for logo placement chart property.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3511
diff changeset
424 placeChooser.setTitle(MSG.getString(name));
b8a8ecdebc0d i18n and interpretation for logo placement chart property.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3511
diff changeset
425 placeChooser.setTitleAlign(Alignment.LEFT);
b8a8ecdebc0d i18n and interpretation for logo placement chart property.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3511
diff changeset
426 placeChooser.addBlurHandler(new BlurHandler() {
4568
bbd82bd8e541 flys-client: Cosmetics and warnings.
Christian Lins <christian.lins@intevation.de>
parents: 3537
diff changeset
427 @Override
3512
b8a8ecdebc0d i18n and interpretation for logo placement chart property.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3511
diff changeset
428 public void onBlur(BlurEvent e) {
b8a8ecdebc0d i18n and interpretation for logo placement chart property.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3511
diff changeset
429 String val;
b8a8ecdebc0d i18n and interpretation for logo placement chart property.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3511
diff changeset
430 if (e.getItem().getValue() == null) {
b8a8ecdebc0d i18n and interpretation for logo placement chart property.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3511
diff changeset
431 val = "";
b8a8ecdebc0d i18n and interpretation for logo placement chart property.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3511
diff changeset
432 }
b8a8ecdebc0d i18n and interpretation for logo placement chart property.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3511
diff changeset
433 else {
b8a8ecdebc0d i18n and interpretation for logo placement chart property.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3511
diff changeset
434 val = e.getItem().getValue().toString();
b8a8ecdebc0d i18n and interpretation for logo placement chart property.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3511
diff changeset
435 }
b8a8ecdebc0d i18n and interpretation for logo placement chart property.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3511
diff changeset
436 sp.setValue(val);
b8a8ecdebc0d i18n and interpretation for logo placement chart property.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3511
diff changeset
437 }
b8a8ecdebc0d i18n and interpretation for logo placement chart property.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3511
diff changeset
438 });
b8a8ecdebc0d i18n and interpretation for logo placement chart property.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3511
diff changeset
439 return placeChooser;
b8a8ecdebc0d i18n and interpretation for logo placement chart property.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3511
diff changeset
440 }
3511
57eb38260015 Show logo selection box for logo chart property.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3356
diff changeset
441
1465
d0bcf5ba7adf Create the properties dialog content dynamically based on the properties read
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1449
diff changeset
442 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
443 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
444 item.setTitleAlign(Alignment.LEFT);
1507
c21d14e48040 Improved validation and property handling.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1506
diff changeset
445 item.addBlurHandler(new BlurHandler() {
4568
bbd82bd8e541 flys-client: Cosmetics and warnings.
Christian Lins <christian.lins@intevation.de>
parents: 3537
diff changeset
446 @Override
1507
c21d14e48040 Improved validation and property handling.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1506
diff changeset
447 public void onBlur(BlurEvent e) {
1478
237e7450ae2e Save output settings in chart properties dialog.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1465
diff changeset
448 String val;
1507
c21d14e48040 Improved validation and property handling.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1506
diff changeset
449 if (e.getItem().getValue() == null) {
1478
237e7450ae2e Save output settings in chart properties dialog.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1465
diff changeset
450 val = "";
237e7450ae2e Save output settings in chart properties dialog.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1465
diff changeset
451 }
237e7450ae2e Save output settings in chart properties dialog.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1465
diff changeset
452 else {
1507
c21d14e48040 Improved validation and property handling.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1506
diff changeset
453 val = e.getItem().getValue().toString();
1478
237e7450ae2e Save output settings in chart properties dialog.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1465
diff changeset
454 }
237e7450ae2e Save output settings in chart properties dialog.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1465
diff changeset
455 sp.setValue(val);
237e7450ae2e Save output settings in chart properties dialog.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1465
diff changeset
456 }
237e7450ae2e Save output settings in chart properties dialog.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1465
diff changeset
457 });
1465
d0bcf5ba7adf Create the properties dialog content dynamically based on the properties read
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1449
diff changeset
458 return item;
d0bcf5ba7adf Create the properties dialog content dynamically based on the properties read
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1449
diff changeset
459 }
1431
987f95ceb623 Added property fields to the chart properties editor dialog.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1429
diff changeset
460
987f95ceb623 Added property fields to the chart properties editor dialog.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1429
diff changeset
461
1465
d0bcf5ba7adf Create the properties dialog content dynamically based on the properties read
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1449
diff changeset
462 /**
d0bcf5ba7adf Create the properties dialog content dynamically based on the properties read
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1449
diff changeset
463 *
d0bcf5ba7adf Create the properties dialog content dynamically based on the properties read
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1449
diff changeset
464 */
1478
237e7450ae2e Save output settings in chart properties dialog.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1465
diff changeset
465 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
466 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
467 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
468 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
469 }
1431
987f95ceb623 Added property fields to the chart properties editor dialog.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1429
diff changeset
470
1465
d0bcf5ba7adf Create the properties dialog content dynamically based on the properties read
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1449
diff changeset
471 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
472 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
473 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
474 item.setTitleAlign(Alignment.LEFT);
1507
c21d14e48040 Improved validation and property handling.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1506
diff changeset
475 item.addBlurHandler(new BlurHandler() {
4568
bbd82bd8e541 flys-client: Cosmetics and warnings.
Christian Lins <christian.lins@intevation.de>
parents: 3537
diff changeset
476 @Override
1507
c21d14e48040 Improved validation and property handling.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1506
diff changeset
477 public void onBlur(BlurEvent e) {
1478
237e7450ae2e Save output settings in chart properties dialog.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1465
diff changeset
478 String val;
1507
c21d14e48040 Improved validation and property handling.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1506
diff changeset
479 if (e.getItem().getValue() == null) {
1478
237e7450ae2e Save output settings in chart properties dialog.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1465
diff changeset
480 val = "";
237e7450ae2e Save output settings in chart properties dialog.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1465
diff changeset
481 }
237e7450ae2e Save output settings in chart properties dialog.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1465
diff changeset
482 else {
1507
c21d14e48040 Improved validation and property handling.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1506
diff changeset
483 val = e.getItem().getValue().toString();
1478
237e7450ae2e Save output settings in chart properties dialog.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1465
diff changeset
484 }
237e7450ae2e Save output settings in chart properties dialog.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1465
diff changeset
485 bp.setValue(val);
237e7450ae2e Save output settings in chart properties dialog.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1465
diff changeset
486 }
237e7450ae2e Save output settings in chart properties dialog.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1465
diff changeset
487 });
1465
d0bcf5ba7adf Create the properties dialog content dynamically based on the properties read
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1449
diff changeset
488 return item;
1431
987f95ceb623 Added property fields to the chart properties editor dialog.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1429
diff changeset
489 }
987f95ceb623 Added property fields to the chart properties editor dialog.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1429
diff changeset
490
1465
d0bcf5ba7adf Create the properties dialog content dynamically based on the properties read
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1449
diff changeset
491
1431
987f95ceb623 Added property fields to the chart properties editor dialog.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1429
diff changeset
492 /**
1465
d0bcf5ba7adf Create the properties dialog content dynamically based on the properties read
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1449
diff changeset
493 *
1431
987f95ceb623 Added property fields to the chart properties editor dialog.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1429
diff changeset
494 */
1478
237e7450ae2e Save output settings in chart properties dialog.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1465
diff changeset
495 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
496 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
497 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
498 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
499 }
1431
987f95ceb623 Added property fields to the chart properties editor dialog.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1429
diff changeset
500
1465
d0bcf5ba7adf Create the properties dialog content dynamically based on the properties read
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1449
diff changeset
501 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
502 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
503 item.setTitleAlign(Alignment.LEFT);
1507
c21d14e48040 Improved validation and property handling.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1506
diff changeset
504 item.addBlurHandler(new BlurHandler() {
4568
bbd82bd8e541 flys-client: Cosmetics and warnings.
Christian Lins <christian.lins@intevation.de>
parents: 3537
diff changeset
505 @Override
1507
c21d14e48040 Improved validation and property handling.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1506
diff changeset
506 public void onBlur(BlurEvent e) {
c21d14e48040 Improved validation and property handling.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1506
diff changeset
507 DoubleValidator validator = new DoubleValidator();
c21d14e48040 Improved validation and property handling.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1506
diff changeset
508 Map errors = e.getForm().getErrors();
c21d14e48040 Improved validation and property handling.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1506
diff changeset
509 if(validator.validate(e.getItem(), errors)) {
c21d14e48040 Improved validation and property handling.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1506
diff changeset
510 dp.setValueFromUI(e.getItem().getValue().toString());
c21d14e48040 Improved validation and property handling.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1506
diff changeset
511 }
3356
6352244a4153 Cosmetics.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2940
diff changeset
512 e.getForm().setErrors(errors, true);
1478
237e7450ae2e Save output settings in chart properties dialog.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1465
diff changeset
513 }
237e7450ae2e Save output settings in chart properties dialog.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1465
diff changeset
514 });
1465
d0bcf5ba7adf Create the properties dialog content dynamically based on the properties read
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1449
diff changeset
515 return item;
1431
987f95ceb623 Added property fields to the chart properties editor dialog.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1429
diff changeset
516 }
987f95ceb623 Added property fields to the chart properties editor dialog.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1429
diff changeset
517
1465
d0bcf5ba7adf Create the properties dialog content dynamically based on the properties read
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1449
diff changeset
518
d0bcf5ba7adf Create the properties dialog content dynamically based on the properties read
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1449
diff changeset
519 /**
d0bcf5ba7adf Create the properties dialog content dynamically based on the properties read
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1449
diff changeset
520 *
d0bcf5ba7adf Create the properties dialog content dynamically based on the properties read
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1449
diff changeset
521 */
1478
237e7450ae2e Save output settings in chart properties dialog.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1465
diff changeset
522 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
523 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
524 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
525 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
526 }
d0bcf5ba7adf Create the properties dialog content dynamically based on the properties read
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1449
diff changeset
527
d0bcf5ba7adf Create the properties dialog content dynamically based on the properties read
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1449
diff changeset
528 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
529 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
530 item.setTitleAlign(Alignment.LEFT);
1507
c21d14e48040 Improved validation and property handling.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1506
diff changeset
531 item.addBlurHandler(new BlurHandler() {
4568
bbd82bd8e541 flys-client: Cosmetics and warnings.
Christian Lins <christian.lins@intevation.de>
parents: 3537
diff changeset
532 @Override
1507
c21d14e48040 Improved validation and property handling.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1506
diff changeset
533 public void onBlur(BlurEvent e) {
c21d14e48040 Improved validation and property handling.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1506
diff changeset
534 IntegerValidator validator = new IntegerValidator();
c21d14e48040 Improved validation and property handling.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1506
diff changeset
535 Map errors = e.getForm().getErrors();
c21d14e48040 Improved validation and property handling.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1506
diff changeset
536 if(validator.validate(e.getItem(), errors)) {
c21d14e48040 Improved validation and property handling.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1506
diff changeset
537 ip.setValue(e.getItem().getValue().toString());
1478
237e7450ae2e Save output settings in chart properties dialog.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1465
diff changeset
538 }
3356
6352244a4153 Cosmetics.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2940
diff changeset
539 e.getForm().setErrors(errors, true);
1478
237e7450ae2e Save output settings in chart properties dialog.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1465
diff changeset
540 }
237e7450ae2e Save output settings in chart properties dialog.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1465
diff changeset
541 });
1465
d0bcf5ba7adf Create the properties dialog content dynamically based on the properties read
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1449
diff changeset
542 return item;
d0bcf5ba7adf Create the properties dialog content dynamically based on the properties read
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1449
diff changeset
543 }
1478
237e7450ae2e Save output settings in chart properties dialog.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1465
diff changeset
544
237e7450ae2e Save output settings in chart properties dialog.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1465
diff changeset
545
237e7450ae2e Save output settings in chart properties dialog.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1465
diff changeset
546 protected void updateCollection() {
237e7450ae2e Save output settings in chart properties dialog.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1465
diff changeset
547 final Config config = Config.getInstance();
237e7450ae2e Save output settings in chart properties dialog.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1465
diff changeset
548 final String loc = config.getLocale();
237e7450ae2e Save output settings in chart properties dialog.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1465
diff changeset
549
237e7450ae2e Save output settings in chart properties dialog.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1465
diff changeset
550 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
551
1503
3304608baf35 Issue 433.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1502
diff changeset
552 Settings s = settings;
3304608baf35 Issue 433.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1502
diff changeset
553 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
554 updater.update(collection, loc, new AsyncCallback<Collection>() {
4568
bbd82bd8e541 flys-client: Cosmetics and warnings.
Christian Lins <christian.lins@intevation.de>
parents: 3537
diff changeset
555 @Override
1478
237e7450ae2e Save output settings in chart properties dialog.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1465
diff changeset
556 public void onFailure(Throwable caught) {
237e7450ae2e Save output settings in chart properties dialog.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1465
diff changeset
557 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
558 SC.warn(MSG.getString(caught.getMessage()));
237e7450ae2e Save output settings in chart properties dialog.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1465
diff changeset
559 }
4568
bbd82bd8e541 flys-client: Cosmetics and warnings.
Christian Lins <christian.lins@intevation.de>
parents: 3537
diff changeset
560 @Override
1478
237e7450ae2e Save output settings in chart properties dialog.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1465
diff changeset
561 public void onSuccess(Collection collection) {
1482
cd8a146d29cd Update chart if properties are changed successfully.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1478
diff changeset
562 updateChartTab();
1478
237e7450ae2e Save output settings in chart properties dialog.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1465
diff changeset
563 }
237e7450ae2e Save output settings in chart properties dialog.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1465
diff changeset
564 });
237e7450ae2e Save output settings in chart properties dialog.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1465
diff changeset
565 }
237e7450ae2e Save output settings in chart properties dialog.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1465
diff changeset
566
1482
cd8a146d29cd Update chart if properties are changed successfully.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1478
diff changeset
567 protected void updateChartTab() {
cd8a146d29cd Update chart if properties are changed successfully.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1478
diff changeset
568 this.tab.updateChartInfo();
cd8a146d29cd Update chart if properties are changed successfully.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1478
diff changeset
569 this.tab.updateChartPanel();
1503
3304608baf35 Issue 433.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1502
diff changeset
570 this.destroy();
1482
cd8a146d29cd Update chart if properties are changed successfully.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1478
diff changeset
571 }
1502
d1223d93dd68 Issue 358.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1501
diff changeset
572
d1223d93dd68 Issue 358.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1501
diff changeset
573
d1223d93dd68 Issue 358.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1501
diff changeset
574 protected boolean isDialogValid() {
d1223d93dd68 Issue 358.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1501
diff changeset
575 boolean valid = true;
d1223d93dd68 Issue 358.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1501
diff changeset
576 for (int i = 0; i < tabs.getNumTabs(); i++) {
d1223d93dd68 Issue 358.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1501
diff changeset
577 Tab t = tabs.getTab(i);
d1223d93dd68 Issue 358.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1501
diff changeset
578 Canvas container = t.getPane();
d1223d93dd68 Issue 358.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1501
diff changeset
579 Canvas[] children = container.getChildren();
d1223d93dd68 Issue 358.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1501
diff changeset
580 for (Canvas c: children) {
d1223d93dd68 Issue 358.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1501
diff changeset
581 valid = validateCanvas(c);
d1223d93dd68 Issue 358.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1501
diff changeset
582 if(!valid) {
d1223d93dd68 Issue 358.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1501
diff changeset
583 return valid;
d1223d93dd68 Issue 358.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1501
diff changeset
584 }
d1223d93dd68 Issue 358.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1501
diff changeset
585 }
d1223d93dd68 Issue 358.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1501
diff changeset
586 }
d1223d93dd68 Issue 358.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1501
diff changeset
587 return valid;
d1223d93dd68 Issue 358.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1501
diff changeset
588 }
d1223d93dd68 Issue 358.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1501
diff changeset
589
d1223d93dd68 Issue 358.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1501
diff changeset
590
d1223d93dd68 Issue 358.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1501
diff changeset
591 protected boolean validateCanvas(Canvas c) {
d1223d93dd68 Issue 358.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1501
diff changeset
592 boolean valid = true;
d1223d93dd68 Issue 358.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1501
diff changeset
593 if(c instanceof DynamicForm) {
d1223d93dd68 Issue 358.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1501
diff changeset
594 DynamicForm f = (DynamicForm) c;
2475
d77b1e489df7 Issue 492.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1560
diff changeset
595 FormItem up = f.getItem("rangeupper");
d77b1e489df7 Issue 492.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1560
diff changeset
596 FormItem lo = f.getItem("rangelower");
d77b1e489df7 Issue 492.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1560
diff changeset
597
d77b1e489df7 Issue 492.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1560
diff changeset
598 if(up != null && lo != null &&
d77b1e489df7 Issue 492.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1560
diff changeset
599 !up.isDisabled() && !lo.isDisabled())
d77b1e489df7 Issue 492.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1560
diff changeset
600 {
d77b1e489df7 Issue 492.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1560
diff changeset
601 validateRange(f);
d77b1e489df7 Issue 492.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1560
diff changeset
602 }
1502
d1223d93dd68 Issue 358.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1501
diff changeset
603 return !f.hasErrors();
d1223d93dd68 Issue 358.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1501
diff changeset
604 }
d1223d93dd68 Issue 358.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1501
diff changeset
605 else if(c.getChildren().length > 0) {
d1223d93dd68 Issue 358.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1501
diff changeset
606 for (Canvas child: c.getChildren()) {
d1223d93dd68 Issue 358.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1501
diff changeset
607 valid = validateCanvas(child);
d1223d93dd68 Issue 358.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1501
diff changeset
608 if(!valid) {
d1223d93dd68 Issue 358.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1501
diff changeset
609 return valid;
d1223d93dd68 Issue 358.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1501
diff changeset
610 }
d1223d93dd68 Issue 358.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1501
diff changeset
611 }
d1223d93dd68 Issue 358.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1501
diff changeset
612 }
d1223d93dd68 Issue 358.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1501
diff changeset
613 return valid;
d1223d93dd68 Issue 358.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1501
diff changeset
614 }
2475
d77b1e489df7 Issue 492.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1560
diff changeset
615
d77b1e489df7 Issue 492.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1560
diff changeset
616 protected boolean validateRange(DynamicForm form) {
d77b1e489df7 Issue 492.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1560
diff changeset
617 Map errors = form.getErrors();
d77b1e489df7 Issue 492.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1560
diff changeset
618 FormItem up = form.getItem("rangeupper");
d77b1e489df7 Issue 492.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1560
diff changeset
619 FormItem lo = form.getItem("rangelower");
d77b1e489df7 Issue 492.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1560
diff changeset
620
d77b1e489df7 Issue 492.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1560
diff changeset
621 String v1 = up.getValue().toString();
d77b1e489df7 Issue 492.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1560
diff changeset
622 String v2 = lo.getValue().toString();
d77b1e489df7 Issue 492.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1560
diff changeset
623
d77b1e489df7 Issue 492.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1560
diff changeset
624 if(v1.equals(v2)) {
d77b1e489df7 Issue 492.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1560
diff changeset
625 errors.put(up.getFieldName(), MSG.wrongFormat());
d77b1e489df7 Issue 492.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1560
diff changeset
626 errors.put(lo.getFieldName(), MSG.wrongFormat());
d77b1e489df7 Issue 492.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1560
diff changeset
627 form.setErrors(errors, true);
d77b1e489df7 Issue 492.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1560
diff changeset
628 return false;
d77b1e489df7 Issue 492.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1560
diff changeset
629 }
d77b1e489df7 Issue 492.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1560
diff changeset
630 return true;
d77b1e489df7 Issue 492.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1560
diff changeset
631 }
1429
16b7adc66330 Added stub for chart property editor.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
632 }
1550
9bf1ffd53dfb Cosmetics, docs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1543
diff changeset
633 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :

http://dive4elements.wald.intevation.org