Mercurial > dive4elements > river
annotate gwt-client/src/main/java/org/dive4elements/river/client/client/ui/chart/ManualPointsEditor.java @ 8856:5e38e2924c07 3.2.x
Fix code style.
author | Tom Gottfried <tom@intevation.de> |
---|---|
date | Thu, 18 Jan 2018 20:12:01 +0100 |
parents | ea9eef426962 |
children | 0f7364772dd1 |
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; |
1545
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
10 |
3855
b6b2d9aad95d
Fix for #854
Christian Lins <christian.lins@intevation.de>
parents:
3706
diff
changeset
|
11 import com.google.gwt.core.client.GWT; |
3983
65e369ac4f99
ManualPointsEditor supports Date x axis values.
Christian Lins <christian.lins@intevation.de>
parents:
3859
diff
changeset
|
12 import com.google.gwt.i18n.client.DateTimeFormat; |
3855
b6b2d9aad95d
Fix for #854
Christian Lins <christian.lins@intevation.de>
parents:
3706
diff
changeset
|
13 import com.google.gwt.i18n.client.NumberFormat; |
1545
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
14 import com.google.gwt.json.client.JSONArray; |
1563
41abc345d2f1
Added dummy handling for new boolean property of each point.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1562
diff
changeset
|
15 import com.google.gwt.json.client.JSONBoolean; |
1545
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
16 import com.google.gwt.json.client.JSONNumber; |
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
17 import com.google.gwt.json.client.JSONParser; |
1553
9ad19e31d149
Improved points UI to also respect language and name of point.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1549
diff
changeset
|
18 import com.google.gwt.json.client.JSONString; |
1545
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
19 import com.google.gwt.user.client.rpc.AsyncCallback; |
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
20 |
3855
b6b2d9aad95d
Fix for #854
Christian Lins <christian.lins@intevation.de>
parents:
3706
diff
changeset
|
21 import com.smartgwt.client.types.Alignment; |
b6b2d9aad95d
Fix for #854
Christian Lins <christian.lins@intevation.de>
parents:
3706
diff
changeset
|
22 import com.smartgwt.client.types.ListGridFieldType; |
1545
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
23 import com.smartgwt.client.util.SC; |
3855
b6b2d9aad95d
Fix for #854
Christian Lins <christian.lins@intevation.de>
parents:
3706
diff
changeset
|
24 import com.smartgwt.client.widgets.Button; |
b6b2d9aad95d
Fix for #854
Christian Lins <christian.lins@intevation.de>
parents:
3706
diff
changeset
|
25 import com.smartgwt.client.widgets.IButton; |
b6b2d9aad95d
Fix for #854
Christian Lins <christian.lins@intevation.de>
parents:
3706
diff
changeset
|
26 import com.smartgwt.client.widgets.Label; |
1545
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
27 import com.smartgwt.client.widgets.Window; |
3855
b6b2d9aad95d
Fix for #854
Christian Lins <christian.lins@intevation.de>
parents:
3706
diff
changeset
|
28 import com.smartgwt.client.widgets.events.ClickEvent; |
b6b2d9aad95d
Fix for #854
Christian Lins <christian.lins@intevation.de>
parents:
3706
diff
changeset
|
29 import com.smartgwt.client.widgets.events.ClickHandler; |
b6b2d9aad95d
Fix for #854
Christian Lins <christian.lins@intevation.de>
parents:
3706
diff
changeset
|
30 import com.smartgwt.client.widgets.grid.CellEditValueFormatter; |
b6b2d9aad95d
Fix for #854
Christian Lins <christian.lins@intevation.de>
parents:
3706
diff
changeset
|
31 import com.smartgwt.client.widgets.grid.CellEditValueParser; |
b6b2d9aad95d
Fix for #854
Christian Lins <christian.lins@intevation.de>
parents:
3706
diff
changeset
|
32 import com.smartgwt.client.widgets.grid.CellFormatter; |
1545
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
33 import com.smartgwt.client.widgets.grid.ListGrid; |
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
34 import com.smartgwt.client.widgets.grid.ListGridField; |
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
35 import com.smartgwt.client.widgets.grid.ListGridRecord; |
1561
3cf3cd8dd92d
Made manual points edit- and removable.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1553
diff
changeset
|
36 import com.smartgwt.client.widgets.grid.events.RecordClickEvent; |
3cf3cd8dd92d
Made manual points edit- and removable.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1553
diff
changeset
|
37 import com.smartgwt.client.widgets.grid.events.RecordClickHandler; |
3855
b6b2d9aad95d
Fix for #854
Christian Lins <christian.lins@intevation.de>
parents:
3706
diff
changeset
|
38 import com.smartgwt.client.widgets.layout.HLayout; |
b6b2d9aad95d
Fix for #854
Christian Lins <christian.lins@intevation.de>
parents:
3706
diff
changeset
|
39 import com.smartgwt.client.widgets.layout.VLayout; |
1545
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
40 |
5835
821a02bbfb4e
Fixed internal java dependencies
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5834
diff
changeset
|
41 import org.dive4elements.river.client.client.Config; |
821a02bbfb4e
Fixed internal java dependencies
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5834
diff
changeset
|
42 import org.dive4elements.river.client.client.FLYSConstants; |
821a02bbfb4e
Fixed internal java dependencies
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5834
diff
changeset
|
43 import org.dive4elements.river.client.client.event.RedrawRequestEvent; |
821a02bbfb4e
Fixed internal java dependencies
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5834
diff
changeset
|
44 import org.dive4elements.river.client.client.event.RedrawRequestHandler; |
821a02bbfb4e
Fixed internal java dependencies
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5834
diff
changeset
|
45 import org.dive4elements.river.client.client.services.FeedServiceAsync; |
821a02bbfb4e
Fixed internal java dependencies
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5834
diff
changeset
|
46 import org.dive4elements.river.client.client.services.LoadArtifactServiceAsync; |
821a02bbfb4e
Fixed internal java dependencies
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5834
diff
changeset
|
47 import org.dive4elements.river.client.shared.model.Artifact; |
821a02bbfb4e
Fixed internal java dependencies
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5834
diff
changeset
|
48 import org.dive4elements.river.client.shared.model.Collection; |
821a02bbfb4e
Fixed internal java dependencies
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5834
diff
changeset
|
49 import org.dive4elements.river.client.shared.model.CollectionItem; |
821a02bbfb4e
Fixed internal java dependencies
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5834
diff
changeset
|
50 import org.dive4elements.river.client.shared.model.Data; |
821a02bbfb4e
Fixed internal java dependencies
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5834
diff
changeset
|
51 import org.dive4elements.river.client.shared.model.DefaultArtifact; |
821a02bbfb4e
Fixed internal java dependencies
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5834
diff
changeset
|
52 import org.dive4elements.river.client.shared.model.DefaultData; |
821a02bbfb4e
Fixed internal java dependencies
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5834
diff
changeset
|
53 import org.dive4elements.river.client.shared.model.Property; |
821a02bbfb4e
Fixed internal java dependencies
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5834
diff
changeset
|
54 import org.dive4elements.river.client.shared.model.PropertyGroup; |
821a02bbfb4e
Fixed internal java dependencies
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5834
diff
changeset
|
55 import org.dive4elements.river.client.shared.model.Recommendation; |
821a02bbfb4e
Fixed internal java dependencies
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5834
diff
changeset
|
56 import org.dive4elements.river.client.shared.model.Settings; |
821a02bbfb4e
Fixed internal java dependencies
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5834
diff
changeset
|
57 import org.dive4elements.river.client.shared.model.StringProperty; |
1545
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
58 |
3983
65e369ac4f99
ManualPointsEditor supports Date x axis values.
Christian Lins <christian.lins@intevation.de>
parents:
3859
diff
changeset
|
59 import java.util.Date; |
3855
b6b2d9aad95d
Fix for #854
Christian Lins <christian.lins@intevation.de>
parents:
3706
diff
changeset
|
60 import java.util.List; |
1549
42f1213dfbcc
Let ManualPointEditor use RedrawRequests to let freshly edited points show up in Chart.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1548
diff
changeset
|
61 |
1545
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
62 |
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
63 /** |
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
64 * UI to enter point data and save it to an PointArtifact. |
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
65 */ |
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
66 public class ManualPointsEditor |
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
67 extends Window |
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
68 implements ClickHandler |
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
69 { |
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
70 /** The interface that provides i18n messages. */ |
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
71 protected FLYSConstants MSG = GWT.create(FLYSConstants.class); |
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
72 |
2924
60c375173263
Minor refactoring.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2905
diff
changeset
|
73 /** Part of name of the main data item to be fed. */ |
1545
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
74 public static final String POINT_DATA = "manualpoints.data"; |
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
75 |
1549
42f1213dfbcc
Let ManualPointEditor use RedrawRequests to let freshly edited points show up in Chart.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1548
diff
changeset
|
76 /** When we chaged something, we need a RedrawRequest(Handler). */ |
42f1213dfbcc
Let ManualPointEditor use RedrawRequests to let freshly edited points show up in Chart.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1548
diff
changeset
|
77 protected RedrawRequestHandler redrawRequestHandler; |
1545
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
78 |
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
79 /** The collection */ |
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
80 protected Collection collection; |
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
81 |
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
82 /** The listGrid showing point entries. */ |
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
83 protected ListGrid listGrid; |
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
84 |
3859
62332fa199bf
Work on "Date" support for ManualPointsEditor.
Christian Lins <christian.lins@intevation.de>
parents:
3855
diff
changeset
|
85 protected ListGridFieldType fieldTypeX = ListGridFieldType.FLOAT; |
62332fa199bf
Work on "Date" support for ManualPointsEditor.
Christian Lins <christian.lins@intevation.de>
parents:
3855
diff
changeset
|
86 |
1545
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
87 /** Service handle to clone and add artifacts to collection. */ |
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
88 LoadArtifactServiceAsync loadArtifactService = GWT.create( |
8856 | 89 org.dive4elements.river.client.client.services |
90 .LoadArtifactService.class); | |
1545
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
91 |
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
92 /** Service to feed the artifact with new point-data. */ |
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
93 FeedServiceAsync feedService = GWT.create( |
5835
821a02bbfb4e
Fixed internal java dependencies
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5834
diff
changeset
|
94 org.dive4elements.river.client.client.services.FeedService.class); |
1545
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
95 |
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
96 /** UUID of artifact to feed. */ |
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
97 protected String uuid; |
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
98 |
1568
2432973ccced
Handle manual points on a per-chart(type) basis.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1565
diff
changeset
|
99 /** Name of the outputmode, important when feeding data. */ |
2432973ccced
Handle manual points on a per-chart(type) basis.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1565
diff
changeset
|
100 protected String outputModeName; |
2432973ccced
Handle manual points on a per-chart(type) basis.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1565
diff
changeset
|
101 |
2924
60c375173263
Minor refactoring.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2905
diff
changeset
|
102 /** Name of the point data item. */ |
60c375173263
Minor refactoring.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2905
diff
changeset
|
103 protected String pointDataItemName; |
60c375173263
Minor refactoring.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2905
diff
changeset
|
104 |
1545
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
105 |
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
106 /** |
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
107 * Setup editor dialog. |
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
108 * @param collection The collection to use. |
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
109 */ |
1549
42f1213dfbcc
Let ManualPointEditor use RedrawRequests to let freshly edited points show up in Chart.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1548
diff
changeset
|
110 public ManualPointsEditor(Collection collection, |
1568
2432973ccced
Handle manual points on a per-chart(type) basis.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1565
diff
changeset
|
111 RedrawRequestHandler handler, String outputModeName |
1549
42f1213dfbcc
Let ManualPointEditor use RedrawRequests to let freshly edited points show up in Chart.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1548
diff
changeset
|
112 ) { |
1545
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
113 this.collection = collection; |
1549
42f1213dfbcc
Let ManualPointEditor use RedrawRequests to let freshly edited points show up in Chart.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1548
diff
changeset
|
114 this.redrawRequestHandler = handler; |
1568
2432973ccced
Handle manual points on a per-chart(type) basis.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1565
diff
changeset
|
115 this.outputModeName = outputModeName; |
2924
60c375173263
Minor refactoring.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2905
diff
changeset
|
116 this.pointDataItemName = outputModeName + "." + POINT_DATA; |
1545
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
117 init(); |
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
118 } |
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
119 |
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
120 |
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
121 /** Searches collection for first artifact to serve (manual) point data. */ |
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
122 public String findManualPointsUUID() { |
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
123 // TODO Need to be more picky (different points in different diagrams) |
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
124 int size = collection.getItemLength(); |
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
125 |
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
126 for (int i = 0; i < size; i++) { |
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
127 CollectionItem item = collection.getItem(i); |
3855
b6b2d9aad95d
Fix for #854
Christian Lins <christian.lins@intevation.de>
parents:
3706
diff
changeset
|
128 String dataValue = item.getData().get(pointDataItemName); |
1545
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
129 if (dataValue != null) { |
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
130 // Found it. |
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
131 uuid = item.identifier(); |
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
132 return uuid; |
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
133 } |
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
134 } |
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
135 |
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
136 return null; |
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
137 } |
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
138 |
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
139 |
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
140 /** |
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
141 * Initialize the editor window and its components. |
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
142 */ |
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
143 protected void init() { |
1553
9ad19e31d149
Improved points UI to also respect language and name of point.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1549
diff
changeset
|
144 setTitle(MSG.addpoints()); |
1545
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
145 setCanDragReposition(true); |
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
146 setCanDragResize(true); |
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
147 |
2905
51ed89b754ae
FLYS client: Removed trailing whitespace.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2482
diff
changeset
|
148 // If no manualpoints artifact found, create it now. |
1545
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
149 if(findManualPointsUUID() == null) { |
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
150 addArtifactCreateUI(); |
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
151 } |
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
152 else { |
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
153 createUI(); |
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
154 } |
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
155 } |
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
156 |
1547
76377fe3f0c7
Cosmetics.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1545
diff
changeset
|
157 |
1545
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
158 /** Create and setup/add the ui. */ |
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
159 public void createUI() { |
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
160 Button accept = new Button(MSG.label_ok()); |
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
161 Button cancel = new Button(MSG.label_cancel()); |
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
162 cancel.addClickHandler(this); |
1561
3cf3cd8dd92d
Made manual points edit- and removable.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1553
diff
changeset
|
163 |
1545
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
164 accept.addClickHandler(new ClickHandler() { |
3983
65e369ac4f99
ManualPointsEditor supports Date x axis values.
Christian Lins <christian.lins@intevation.de>
parents:
3859
diff
changeset
|
165 @Override |
1545
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
166 public void onClick(ClickEvent e) { |
1563
41abc345d2f1
Added dummy handling for new boolean property of each point.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1562
diff
changeset
|
167 okClicked(); |
1545
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
168 } |
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
169 }); |
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
170 |
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
171 HLayout buttons = new HLayout(); |
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
172 buttons.addMember(accept); |
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
173 buttons.addMember(cancel); |
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
174 buttons.setAlign(Alignment.CENTER); |
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
175 buttons.setHeight(30); |
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
176 |
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
177 VLayout layout = new VLayout(); |
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
178 listGrid = new ListGrid(); |
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
179 listGrid.setWidth100(); |
1570
eeee85c4d996
Adjusted table height to fill the window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1569
diff
changeset
|
180 listGrid.setHeight("*"); |
1561
3cf3cd8dd92d
Made manual points edit- and removable.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1553
diff
changeset
|
181 listGrid.setCanSort(false); |
3cf3cd8dd92d
Made manual points edit- and removable.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1553
diff
changeset
|
182 listGrid.setCanEdit(true); |
3cf3cd8dd92d
Made manual points edit- and removable.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1553
diff
changeset
|
183 listGrid.setShowHeaderContextMenu(false); |
3cf3cd8dd92d
Made manual points edit- and removable.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1553
diff
changeset
|
184 |
1569
b85761d21975
Get the axes name from collection settings and use them as table header.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1568
diff
changeset
|
185 // Use X and Y as default fallback. |
b85761d21975
Get the axes name from collection settings and use them as table header.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1568
diff
changeset
|
186 String xAxis = "X"; |
b85761d21975
Get the axes name from collection settings and use them as table header.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1568
diff
changeset
|
187 String yAxis = "Y"; |
1563
41abc345d2f1
Added dummy handling for new boolean property of each point.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1562
diff
changeset
|
188 |
3983
65e369ac4f99
ManualPointsEditor supports Date x axis values.
Christian Lins <christian.lins@intevation.de>
parents:
3859
diff
changeset
|
189 // Get header text from collection settings |
1569
b85761d21975
Get the axes name from collection settings and use them as table header.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1568
diff
changeset
|
190 Settings settings = this.collection.getSettings(outputModeName); |
b85761d21975
Get the axes name from collection settings and use them as table header.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1568
diff
changeset
|
191 List<Property> axes = settings.getSettings("axes"); |
b85761d21975
Get the axes name from collection settings and use them as table header.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1568
diff
changeset
|
192 if(axes != null) { |
b85761d21975
Get the axes name from collection settings and use them as table header.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1568
diff
changeset
|
193 for (Property p: axes) { |
b85761d21975
Get the axes name from collection settings and use them as table header.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1568
diff
changeset
|
194 PropertyGroup pg = (PropertyGroup)p; |
3859
62332fa199bf
Work on "Date" support for ManualPointsEditor.
Christian Lins <christian.lins@intevation.de>
parents:
3855
diff
changeset
|
195 GWT.log(pg.toString()); |
1569
b85761d21975
Get the axes name from collection settings and use them as table header.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1568
diff
changeset
|
196 StringProperty id = |
b85761d21975
Get the axes name from collection settings and use them as table header.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1568
diff
changeset
|
197 (StringProperty)pg.getPropertyByName("id"); |
b85761d21975
Get the axes name from collection settings and use them as table header.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1568
diff
changeset
|
198 if(id.getValue().equals("X")) { |
b85761d21975
Get the axes name from collection settings and use them as table header.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1568
diff
changeset
|
199 StringProperty name = |
b85761d21975
Get the axes name from collection settings and use them as table header.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1568
diff
changeset
|
200 (StringProperty)pg.getPropertyByName("label"); |
b85761d21975
Get the axes name from collection settings and use them as table header.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1568
diff
changeset
|
201 xAxis = name.getValue(); |
b85761d21975
Get the axes name from collection settings and use them as table header.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1568
diff
changeset
|
202 } |
b85761d21975
Get the axes name from collection settings and use them as table header.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1568
diff
changeset
|
203 else if (yAxis.equals("Y")) { |
b85761d21975
Get the axes name from collection settings and use them as table header.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1568
diff
changeset
|
204 StringProperty name = |
b85761d21975
Get the axes name from collection settings and use them as table header.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1568
diff
changeset
|
205 (StringProperty)pg.getPropertyByName("label"); |
b85761d21975
Get the axes name from collection settings and use them as table header.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1568
diff
changeset
|
206 yAxis = name.getValue(); |
b85761d21975
Get the axes name from collection settings and use them as table header.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1568
diff
changeset
|
207 } |
b85761d21975
Get the axes name from collection settings and use them as table header.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1568
diff
changeset
|
208 } |
b85761d21975
Get the axes name from collection settings and use them as table header.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1568
diff
changeset
|
209 } |
3859
62332fa199bf
Work on "Date" support for ManualPointsEditor.
Christian Lins <christian.lins@intevation.de>
parents:
3855
diff
changeset
|
210 |
62332fa199bf
Work on "Date" support for ManualPointsEditor.
Christian Lins <christian.lins@intevation.de>
parents:
3855
diff
changeset
|
211 CellFormatter format = createCellFormatter(); |
62332fa199bf
Work on "Date" support for ManualPointsEditor.
Christian Lins <christian.lins@intevation.de>
parents:
3855
diff
changeset
|
212 CellEditValueParser cevp = createCellEditValueParser(); |
62332fa199bf
Work on "Date" support for ManualPointsEditor.
Christian Lins <christian.lins@intevation.de>
parents:
3855
diff
changeset
|
213 CellEditValueFormatter cevf = createCellEditValueFormatter(); |
62332fa199bf
Work on "Date" support for ManualPointsEditor.
Christian Lins <christian.lins@intevation.de>
parents:
3855
diff
changeset
|
214 |
1569
b85761d21975
Get the axes name from collection settings and use them as table header.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1568
diff
changeset
|
215 ListGridField xField = |
3859
62332fa199bf
Work on "Date" support for ManualPointsEditor.
Christian Lins <christian.lins@intevation.de>
parents:
3855
diff
changeset
|
216 new ListGridField(PointRecord.ATTRIBUTE_X, xAxis); |
62332fa199bf
Work on "Date" support for ManualPointsEditor.
Christian Lins <christian.lins@intevation.de>
parents:
3855
diff
changeset
|
217 if(xAxis.equalsIgnoreCase("date") || xAxis.equalsIgnoreCase("Datum")) { |
8856 | 218 // FIXME: This is a hack for Timeseries charts |
219 // with Date types on the x axis | |
3859
62332fa199bf
Work on "Date" support for ManualPointsEditor.
Christian Lins <christian.lins@intevation.de>
parents:
3855
diff
changeset
|
220 xField.setType(ListGridFieldType.DATE); |
62332fa199bf
Work on "Date" support for ManualPointsEditor.
Christian Lins <christian.lins@intevation.de>
parents:
3855
diff
changeset
|
221 this.fieldTypeX = ListGridFieldType.DATE; |
62332fa199bf
Work on "Date" support for ManualPointsEditor.
Christian Lins <christian.lins@intevation.de>
parents:
3855
diff
changeset
|
222 } |
62332fa199bf
Work on "Date" support for ManualPointsEditor.
Christian Lins <christian.lins@intevation.de>
parents:
3855
diff
changeset
|
223 else { |
62332fa199bf
Work on "Date" support for ManualPointsEditor.
Christian Lins <christian.lins@intevation.de>
parents:
3855
diff
changeset
|
224 xField.setType(ListGridFieldType.FLOAT); |
62332fa199bf
Work on "Date" support for ManualPointsEditor.
Christian Lins <christian.lins@intevation.de>
parents:
3855
diff
changeset
|
225 xField.setCellFormatter(format); |
62332fa199bf
Work on "Date" support for ManualPointsEditor.
Christian Lins <christian.lins@intevation.de>
parents:
3855
diff
changeset
|
226 xField.setEditValueParser(cevp); |
62332fa199bf
Work on "Date" support for ManualPointsEditor.
Christian Lins <christian.lins@intevation.de>
parents:
3855
diff
changeset
|
227 xField.setEditValueFormatter(cevf); |
62332fa199bf
Work on "Date" support for ManualPointsEditor.
Christian Lins <christian.lins@intevation.de>
parents:
3855
diff
changeset
|
228 } |
1563
41abc345d2f1
Added dummy handling for new boolean property of each point.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1562
diff
changeset
|
229 |
1569
b85761d21975
Get the axes name from collection settings and use them as table header.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1568
diff
changeset
|
230 ListGridField yField = |
b85761d21975
Get the axes name from collection settings and use them as table header.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1568
diff
changeset
|
231 new ListGridField(PointRecord.ATTRIBUTE_Y, yAxis); |
1553
9ad19e31d149
Improved points UI to also respect language and name of point.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1549
diff
changeset
|
232 yField.setType(ListGridFieldType.FLOAT); |
3859
62332fa199bf
Work on "Date" support for ManualPointsEditor.
Christian Lins <christian.lins@intevation.de>
parents:
3855
diff
changeset
|
233 yField.setCellFormatter(format); |
1604
cb3629a01126
Issue 473.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1594
diff
changeset
|
234 yField.setEditValueParser(cevp); |
cb3629a01126
Issue 473.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1594
diff
changeset
|
235 yField.setEditValueFormatter(cevf); |
1563
41abc345d2f1
Added dummy handling for new boolean property of each point.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1562
diff
changeset
|
236 |
1562
af29d43cf4da
Added basic validation, improved editing function, minor refac.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1561
diff
changeset
|
237 ListGridField nameField = new ListGridField(PointRecord.ATTRIBUTE_NAME, |
1553
9ad19e31d149
Improved points UI to also respect language and name of point.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1549
diff
changeset
|
238 MSG.pointname()); |
1561
3cf3cd8dd92d
Made manual points edit- and removable.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1553
diff
changeset
|
239 final ListGridField removeField = |
3cf3cd8dd92d
Made manual points edit- and removable.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1553
diff
changeset
|
240 new ListGridField("_removeRecord", MSG.removepoint()){{ |
3cf3cd8dd92d
Made manual points edit- and removable.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1553
diff
changeset
|
241 setType(ListGridFieldType.ICON); |
3cf3cd8dd92d
Made manual points edit- and removable.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1553
diff
changeset
|
242 setIcon(GWT.getHostPageBaseURL() + MSG.removeFeature()); |
3cf3cd8dd92d
Made manual points edit- and removable.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1553
diff
changeset
|
243 setCanEdit(false); |
3cf3cd8dd92d
Made manual points edit- and removable.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1553
diff
changeset
|
244 setCanFilter(false); |
3cf3cd8dd92d
Made manual points edit- and removable.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1553
diff
changeset
|
245 setCanSort(false); |
3cf3cd8dd92d
Made manual points edit- and removable.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1553
diff
changeset
|
246 setCanGroupBy(false); |
3cf3cd8dd92d
Made manual points edit- and removable.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1553
diff
changeset
|
247 setCanFreeze(false); |
3cf3cd8dd92d
Made manual points edit- and removable.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1553
diff
changeset
|
248 setWidth(25); |
3cf3cd8dd92d
Made manual points edit- and removable.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1553
diff
changeset
|
249 }}; |
3cf3cd8dd92d
Made manual points edit- and removable.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1553
diff
changeset
|
250 |
1563
41abc345d2f1
Added dummy handling for new boolean property of each point.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1562
diff
changeset
|
251 ListGridField activeField = new ListGridField( |
41abc345d2f1
Added dummy handling for new boolean property of each point.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1562
diff
changeset
|
252 PointRecord.ATTRIBUTE_ACTIVE, MSG.selection()); |
41abc345d2f1
Added dummy handling for new boolean property of each point.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1562
diff
changeset
|
253 activeField.setType(ListGridFieldType.BOOLEAN); |
1564
3606f2caf93e
Make manual Points active by default.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1563
diff
changeset
|
254 activeField.setDefaultValue(true); |
1563
41abc345d2f1
Added dummy handling for new boolean property of each point.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1562
diff
changeset
|
255 |
41abc345d2f1
Added dummy handling for new boolean property of each point.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1562
diff
changeset
|
256 listGrid.setFields(new ListGridField[] {activeField, xField, yField, |
1553
9ad19e31d149
Improved points UI to also respect language and name of point.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1549
diff
changeset
|
257 nameField, removeField}); |
1545
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
258 |
1561
3cf3cd8dd92d
Made manual points edit- and removable.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1553
diff
changeset
|
259 listGrid.addRecordClickHandler(new RecordClickHandler() { |
3983
65e369ac4f99
ManualPointsEditor supports Date x axis values.
Christian Lins <christian.lins@intevation.de>
parents:
3859
diff
changeset
|
260 @Override |
1561
3cf3cd8dd92d
Made manual points edit- and removable.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1553
diff
changeset
|
261 public void onRecordClick(final RecordClickEvent event) { |
3cf3cd8dd92d
Made manual points edit- and removable.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1553
diff
changeset
|
262 // Just handle remove-clicks |
8856 | 263 if(!event.getField().getName() |
264 .equals(removeField.getName()) | |
265 ) { | |
1561
3cf3cd8dd92d
Made manual points edit- and removable.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1553
diff
changeset
|
266 return; |
2905
51ed89b754ae
FLYS client: Removed trailing whitespace.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2482
diff
changeset
|
267 } |
1561
3cf3cd8dd92d
Made manual points edit- and removable.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1553
diff
changeset
|
268 event.getViewer().removeData(event.getRecord()); |
3cf3cd8dd92d
Made manual points edit- and removable.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1553
diff
changeset
|
269 } |
3cf3cd8dd92d
Made manual points edit- and removable.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1553
diff
changeset
|
270 }); |
3cf3cd8dd92d
Made manual points edit- and removable.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1553
diff
changeset
|
271 |
3983
65e369ac4f99
ManualPointsEditor supports Date x axis values.
Christian Lins <christian.lins@intevation.de>
parents:
3859
diff
changeset
|
272 // Find the artifacts uuid |
1545
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
273 findManualPointsUUID(); |
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
274 CollectionItem item = collection.getItem(uuid); |
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
275 |
3983
65e369ac4f99
ManualPointsEditor supports Date x axis values.
Christian Lins <christian.lins@intevation.de>
parents:
3859
diff
changeset
|
276 // Add points to grid |
1545
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
277 if (item != null) { |
2924
60c375173263
Minor refactoring.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2905
diff
changeset
|
278 // TODO store this from findPointUUID instead (we touched these). |
60c375173263
Minor refactoring.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2905
diff
changeset
|
279 String jsonData = item.getData().get(pointDataItemName); |
1545
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
280 JSONArray jsonArray = (JSONArray) JSONParser.parse(jsonData); |
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
281 for (int i = 0; i < jsonArray.size(); i++) { |
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
282 JSONArray point = (JSONArray) jsonArray.get(i); |
3983
65e369ac4f99
ManualPointsEditor supports Date x axis values.
Christian Lins <christian.lins@intevation.de>
parents:
3859
diff
changeset
|
283 listGrid.addData(PointRecord.fromJSON(point)); |
1545
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
284 } |
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
285 } |
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
286 else { |
3983
65e369ac4f99
ManualPointsEditor supports Date x axis values.
Christian Lins <christian.lins@intevation.de>
parents:
3859
diff
changeset
|
287 GWT.log("ManualPointsEditor: No item found for " + uuid); |
1545
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
288 } |
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
289 |
1553
9ad19e31d149
Improved points UI to also respect language and name of point.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1549
diff
changeset
|
290 IButton button = new IButton(MSG.newpoint()); |
1545
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
291 button.setTop(250); |
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
292 button.addClickHandler(new ClickHandler() { |
3983
65e369ac4f99
ManualPointsEditor supports Date x axis values.
Christian Lins <christian.lins@intevation.de>
parents:
3859
diff
changeset
|
293 @Override |
1545
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
294 public void onClick(ClickEvent event) { |
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
295 listGrid.startEditingNew(); |
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
296 } |
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
297 }); |
1553
9ad19e31d149
Improved points UI to also respect language and name of point.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1549
diff
changeset
|
298 |
9ad19e31d149
Improved points UI to also respect language and name of point.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1549
diff
changeset
|
299 layout.addMember(listGrid); |
9ad19e31d149
Improved points UI to also respect language and name of point.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1549
diff
changeset
|
300 layout.addMember(button); |
9ad19e31d149
Improved points UI to also respect language and name of point.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1549
diff
changeset
|
301 |
9ad19e31d149
Improved points UI to also respect language and name of point.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1549
diff
changeset
|
302 addItem(layout); |
9ad19e31d149
Improved points UI to also respect language and name of point.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1549
diff
changeset
|
303 |
1545
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
304 addItem(buttons); |
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
305 setWidth(380); |
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
306 setHeight(470); |
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
307 centerInPage(); |
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
308 } |
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
309 |
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
310 |
3859
62332fa199bf
Work on "Date" support for ManualPointsEditor.
Christian Lins <christian.lins@intevation.de>
parents:
3855
diff
changeset
|
311 protected CellFormatter createCellFormatter() { |
62332fa199bf
Work on "Date" support for ManualPointsEditor.
Christian Lins <christian.lins@intevation.de>
parents:
3855
diff
changeset
|
312 return new CellFormatter() { |
3983
65e369ac4f99
ManualPointsEditor supports Date x axis values.
Christian Lins <christian.lins@intevation.de>
parents:
3859
diff
changeset
|
313 @Override |
8856 | 314 public String format( |
315 Object value, ListGridRecord record, int rowNum, int colNum) { | |
3859
62332fa199bf
Work on "Date" support for ManualPointsEditor.
Christian Lins <christian.lins@intevation.de>
parents:
3855
diff
changeset
|
316 if(value != null) { |
62332fa199bf
Work on "Date" support for ManualPointsEditor.
Christian Lins <christian.lins@intevation.de>
parents:
3855
diff
changeset
|
317 NumberFormat nf = NumberFormat.getDecimalFormat(); |
62332fa199bf
Work on "Date" support for ManualPointsEditor.
Christian Lins <christian.lins@intevation.de>
parents:
3855
diff
changeset
|
318 try { |
8856 | 319 double d = Double.valueOf( |
320 value.toString()).doubleValue(); | |
3859
62332fa199bf
Work on "Date" support for ManualPointsEditor.
Christian Lins <christian.lins@intevation.de>
parents:
3855
diff
changeset
|
321 return nf.format(d); |
62332fa199bf
Work on "Date" support for ManualPointsEditor.
Christian Lins <christian.lins@intevation.de>
parents:
3855
diff
changeset
|
322 } catch (Exception e) { |
62332fa199bf
Work on "Date" support for ManualPointsEditor.
Christian Lins <christian.lins@intevation.de>
parents:
3855
diff
changeset
|
323 return value.toString(); |
62332fa199bf
Work on "Date" support for ManualPointsEditor.
Christian Lins <christian.lins@intevation.de>
parents:
3855
diff
changeset
|
324 } |
62332fa199bf
Work on "Date" support for ManualPointsEditor.
Christian Lins <christian.lins@intevation.de>
parents:
3855
diff
changeset
|
325 } else { |
62332fa199bf
Work on "Date" support for ManualPointsEditor.
Christian Lins <christian.lins@intevation.de>
parents:
3855
diff
changeset
|
326 return null; |
62332fa199bf
Work on "Date" support for ManualPointsEditor.
Christian Lins <christian.lins@intevation.de>
parents:
3855
diff
changeset
|
327 } |
62332fa199bf
Work on "Date" support for ManualPointsEditor.
Christian Lins <christian.lins@intevation.de>
parents:
3855
diff
changeset
|
328 }}; |
62332fa199bf
Work on "Date" support for ManualPointsEditor.
Christian Lins <christian.lins@intevation.de>
parents:
3855
diff
changeset
|
329 } |
62332fa199bf
Work on "Date" support for ManualPointsEditor.
Christian Lins <christian.lins@intevation.de>
parents:
3855
diff
changeset
|
330 |
62332fa199bf
Work on "Date" support for ManualPointsEditor.
Christian Lins <christian.lins@intevation.de>
parents:
3855
diff
changeset
|
331 |
62332fa199bf
Work on "Date" support for ManualPointsEditor.
Christian Lins <christian.lins@intevation.de>
parents:
3855
diff
changeset
|
332 protected CellEditValueParser createCellEditValueParser() { |
62332fa199bf
Work on "Date" support for ManualPointsEditor.
Christian Lins <christian.lins@intevation.de>
parents:
3855
diff
changeset
|
333 return new CellEditValueParser() { |
3983
65e369ac4f99
ManualPointsEditor supports Date x axis values.
Christian Lins <christian.lins@intevation.de>
parents:
3859
diff
changeset
|
334 @Override |
8856 | 335 public Object parse( |
336 Object value, ListGridRecord record, int rowNum, int colNum) { | |
3859
62332fa199bf
Work on "Date" support for ManualPointsEditor.
Christian Lins <christian.lins@intevation.de>
parents:
3855
diff
changeset
|
337 if (value == null) |
62332fa199bf
Work on "Date" support for ManualPointsEditor.
Christian Lins <christian.lins@intevation.de>
parents:
3855
diff
changeset
|
338 return null; |
62332fa199bf
Work on "Date" support for ManualPointsEditor.
Christian Lins <christian.lins@intevation.de>
parents:
3855
diff
changeset
|
339 try { |
62332fa199bf
Work on "Date" support for ManualPointsEditor.
Christian Lins <christian.lins@intevation.de>
parents:
3855
diff
changeset
|
340 NumberFormat nf = NumberFormat.getDecimalFormat(); |
62332fa199bf
Work on "Date" support for ManualPointsEditor.
Christian Lins <christian.lins@intevation.de>
parents:
3855
diff
changeset
|
341 double d = nf.parse(value.toString()); |
62332fa199bf
Work on "Date" support for ManualPointsEditor.
Christian Lins <christian.lins@intevation.de>
parents:
3855
diff
changeset
|
342 return (new Double(d)).toString(); |
62332fa199bf
Work on "Date" support for ManualPointsEditor.
Christian Lins <christian.lins@intevation.de>
parents:
3855
diff
changeset
|
343 } |
62332fa199bf
Work on "Date" support for ManualPointsEditor.
Christian Lins <christian.lins@intevation.de>
parents:
3855
diff
changeset
|
344 catch(NumberFormatException nfe) { |
62332fa199bf
Work on "Date" support for ManualPointsEditor.
Christian Lins <christian.lins@intevation.de>
parents:
3855
diff
changeset
|
345 return value; |
62332fa199bf
Work on "Date" support for ManualPointsEditor.
Christian Lins <christian.lins@intevation.de>
parents:
3855
diff
changeset
|
346 } |
62332fa199bf
Work on "Date" support for ManualPointsEditor.
Christian Lins <christian.lins@intevation.de>
parents:
3855
diff
changeset
|
347 } |
62332fa199bf
Work on "Date" support for ManualPointsEditor.
Christian Lins <christian.lins@intevation.de>
parents:
3855
diff
changeset
|
348 }; |
62332fa199bf
Work on "Date" support for ManualPointsEditor.
Christian Lins <christian.lins@intevation.de>
parents:
3855
diff
changeset
|
349 } |
62332fa199bf
Work on "Date" support for ManualPointsEditor.
Christian Lins <christian.lins@intevation.de>
parents:
3855
diff
changeset
|
350 |
62332fa199bf
Work on "Date" support for ManualPointsEditor.
Christian Lins <christian.lins@intevation.de>
parents:
3855
diff
changeset
|
351 |
62332fa199bf
Work on "Date" support for ManualPointsEditor.
Christian Lins <christian.lins@intevation.de>
parents:
3855
diff
changeset
|
352 protected CellEditValueFormatter createCellEditValueFormatter() { |
62332fa199bf
Work on "Date" support for ManualPointsEditor.
Christian Lins <christian.lins@intevation.de>
parents:
3855
diff
changeset
|
353 return new CellEditValueFormatter() { |
3983
65e369ac4f99
ManualPointsEditor supports Date x axis values.
Christian Lins <christian.lins@intevation.de>
parents:
3859
diff
changeset
|
354 @Override |
8856 | 355 public Object format( |
356 Object value, ListGridRecord record, int rowNum, int colNum) { | |
3859
62332fa199bf
Work on "Date" support for ManualPointsEditor.
Christian Lins <christian.lins@intevation.de>
parents:
3855
diff
changeset
|
357 if (value == null) { |
62332fa199bf
Work on "Date" support for ManualPointsEditor.
Christian Lins <christian.lins@intevation.de>
parents:
3855
diff
changeset
|
358 return ""; |
62332fa199bf
Work on "Date" support for ManualPointsEditor.
Christian Lins <christian.lins@intevation.de>
parents:
3855
diff
changeset
|
359 } |
62332fa199bf
Work on "Date" support for ManualPointsEditor.
Christian Lins <christian.lins@intevation.de>
parents:
3855
diff
changeset
|
360 NumberFormat nf = NumberFormat.getDecimalFormat(); |
62332fa199bf
Work on "Date" support for ManualPointsEditor.
Christian Lins <christian.lins@intevation.de>
parents:
3855
diff
changeset
|
361 try { |
62332fa199bf
Work on "Date" support for ManualPointsEditor.
Christian Lins <christian.lins@intevation.de>
parents:
3855
diff
changeset
|
362 double d = Double.valueOf(value.toString()).doubleValue(); |
62332fa199bf
Work on "Date" support for ManualPointsEditor.
Christian Lins <christian.lins@intevation.de>
parents:
3855
diff
changeset
|
363 return nf.format(d); |
62332fa199bf
Work on "Date" support for ManualPointsEditor.
Christian Lins <christian.lins@intevation.de>
parents:
3855
diff
changeset
|
364 } |
62332fa199bf
Work on "Date" support for ManualPointsEditor.
Christian Lins <christian.lins@intevation.de>
parents:
3855
diff
changeset
|
365 catch(NumberFormatException nfe) { |
62332fa199bf
Work on "Date" support for ManualPointsEditor.
Christian Lins <christian.lins@intevation.de>
parents:
3855
diff
changeset
|
366 return value; |
62332fa199bf
Work on "Date" support for ManualPointsEditor.
Christian Lins <christian.lins@intevation.de>
parents:
3855
diff
changeset
|
367 } |
62332fa199bf
Work on "Date" support for ManualPointsEditor.
Christian Lins <christian.lins@intevation.de>
parents:
3855
diff
changeset
|
368 } |
62332fa199bf
Work on "Date" support for ManualPointsEditor.
Christian Lins <christian.lins@intevation.de>
parents:
3855
diff
changeset
|
369 }; |
62332fa199bf
Work on "Date" support for ManualPointsEditor.
Christian Lins <christian.lins@intevation.de>
parents:
3855
diff
changeset
|
370 } |
62332fa199bf
Work on "Date" support for ManualPointsEditor.
Christian Lins <christian.lins@intevation.de>
parents:
3855
diff
changeset
|
371 |
3983
65e369ac4f99
ManualPointsEditor supports Date x axis values.
Christian Lins <christian.lins@intevation.de>
parents:
3859
diff
changeset
|
372 protected String getLocaleDateFormat() { |
65e369ac4f99
ManualPointsEditor supports Date x axis values.
Christian Lins <christian.lins@intevation.de>
parents:
3859
diff
changeset
|
373 String loc = Config.getInstance().getLocale(); |
65e369ac4f99
ManualPointsEditor supports Date x axis values.
Christian Lins <christian.lins@intevation.de>
parents:
3859
diff
changeset
|
374 if ("de".equals(loc)) { |
65e369ac4f99
ManualPointsEditor supports Date x axis values.
Christian Lins <christian.lins@intevation.de>
parents:
3859
diff
changeset
|
375 return "yy.MM.yyyy"; |
65e369ac4f99
ManualPointsEditor supports Date x axis values.
Christian Lins <christian.lins@intevation.de>
parents:
3859
diff
changeset
|
376 } |
65e369ac4f99
ManualPointsEditor supports Date x axis values.
Christian Lins <christian.lins@intevation.de>
parents:
3859
diff
changeset
|
377 else { |
65e369ac4f99
ManualPointsEditor supports Date x axis values.
Christian Lins <christian.lins@intevation.de>
parents:
3859
diff
changeset
|
378 return "MM/dd/yyyy"; |
65e369ac4f99
ManualPointsEditor supports Date x axis values.
Christian Lins <christian.lins@intevation.de>
parents:
3859
diff
changeset
|
379 } |
65e369ac4f99
ManualPointsEditor supports Date x axis values.
Christian Lins <christian.lins@intevation.de>
parents:
3859
diff
changeset
|
380 } |
65e369ac4f99
ManualPointsEditor supports Date x axis values.
Christian Lins <christian.lins@intevation.de>
parents:
3859
diff
changeset
|
381 |
65e369ac4f99
ManualPointsEditor supports Date x axis values.
Christian Lins <christian.lins@intevation.de>
parents:
3859
diff
changeset
|
382 protected String formatDate(Date date) { |
65e369ac4f99
ManualPointsEditor supports Date x axis values.
Christian Lins <christian.lins@intevation.de>
parents:
3859
diff
changeset
|
383 DateTimeFormat dtf = DateTimeFormat.getFormat(getLocaleDateFormat()); |
65e369ac4f99
ManualPointsEditor supports Date x axis values.
Christian Lins <christian.lins@intevation.de>
parents:
3859
diff
changeset
|
384 return dtf.format(date); |
65e369ac4f99
ManualPointsEditor supports Date x axis values.
Christian Lins <christian.lins@intevation.de>
parents:
3859
diff
changeset
|
385 } |
3859
62332fa199bf
Work on "Date" support for ManualPointsEditor.
Christian Lins <christian.lins@intevation.de>
parents:
3855
diff
changeset
|
386 |
1563
41abc345d2f1
Added dummy handling for new boolean property of each point.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1562
diff
changeset
|
387 /** Create JSON representation of the points present in the list grid. */ |
41abc345d2f1
Added dummy handling for new boolean property of each point.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1562
diff
changeset
|
388 protected JSONArray jsonArrayFromListGrid() { |
41abc345d2f1
Added dummy handling for new boolean property of each point.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1562
diff
changeset
|
389 JSONArray list = new JSONArray(); |
41abc345d2f1
Added dummy handling for new boolean property of each point.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1562
diff
changeset
|
390 int idx = 0; |
41abc345d2f1
Added dummy handling for new boolean property of each point.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1562
diff
changeset
|
391 |
41abc345d2f1
Added dummy handling for new boolean property of each point.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1562
diff
changeset
|
392 for(ListGridRecord record : listGrid.getRecords()) { |
41abc345d2f1
Added dummy handling for new boolean property of each point.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1562
diff
changeset
|
393 if (record instanceof PointRecord) { |
41abc345d2f1
Added dummy handling for new boolean property of each point.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1562
diff
changeset
|
394 JSONArray data = new JSONArray(); |
41abc345d2f1
Added dummy handling for new boolean property of each point.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1562
diff
changeset
|
395 |
41abc345d2f1
Added dummy handling for new boolean property of each point.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1562
diff
changeset
|
396 PointRecord point = (PointRecord) record; |
3983
65e369ac4f99
ManualPointsEditor supports Date x axis values.
Christian Lins <christian.lins@intevation.de>
parents:
3859
diff
changeset
|
397 if(point.isTimeseriesPoint()) { |
65e369ac4f99
ManualPointsEditor supports Date x axis values.
Christian Lins <christian.lins@intevation.de>
parents:
3859
diff
changeset
|
398 data.set(0, new JSONString(point.getXAsDate())); |
65e369ac4f99
ManualPointsEditor supports Date x axis values.
Christian Lins <christian.lins@intevation.de>
parents:
3859
diff
changeset
|
399 GWT.log("Date: " + point.getXAsDate()); |
65e369ac4f99
ManualPointsEditor supports Date x axis values.
Christian Lins <christian.lins@intevation.de>
parents:
3859
diff
changeset
|
400 } |
65e369ac4f99
ManualPointsEditor supports Date x axis values.
Christian Lins <christian.lins@intevation.de>
parents:
3859
diff
changeset
|
401 else { |
65e369ac4f99
ManualPointsEditor supports Date x axis values.
Christian Lins <christian.lins@intevation.de>
parents:
3859
diff
changeset
|
402 data.set(0, new JSONNumber(point.getX())); |
65e369ac4f99
ManualPointsEditor supports Date x axis values.
Christian Lins <christian.lins@intevation.de>
parents:
3859
diff
changeset
|
403 } |
1563
41abc345d2f1
Added dummy handling for new boolean property of each point.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1562
diff
changeset
|
404 data.set(1, new JSONNumber(point.getY())); |
41abc345d2f1
Added dummy handling for new boolean property of each point.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1562
diff
changeset
|
405 data.set(2, new JSONString(point.getName())); |
41abc345d2f1
Added dummy handling for new boolean property of each point.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1562
diff
changeset
|
406 data.set(3, JSONBoolean.getInstance(point.isActive())); |
41abc345d2f1
Added dummy handling for new boolean property of each point.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1562
diff
changeset
|
407 |
41abc345d2f1
Added dummy handling for new boolean property of each point.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1562
diff
changeset
|
408 list.set(idx, data); |
41abc345d2f1
Added dummy handling for new boolean property of each point.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1562
diff
changeset
|
409 idx++; |
41abc345d2f1
Added dummy handling for new boolean property of each point.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1562
diff
changeset
|
410 } |
41abc345d2f1
Added dummy handling for new boolean property of each point.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1562
diff
changeset
|
411 else { |
41abc345d2f1
Added dummy handling for new boolean property of each point.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1562
diff
changeset
|
412 JSONArray data = new JSONArray(); |
41abc345d2f1
Added dummy handling for new boolean property of each point.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1562
diff
changeset
|
413 |
8856 | 414 String nameString = record.getAttributeAsString( |
415 PointRecord.ATTRIBUTE_NAME); | |
1563
41abc345d2f1
Added dummy handling for new boolean property of each point.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1562
diff
changeset
|
416 // Apply default name if none set. |
41abc345d2f1
Added dummy handling for new boolean property of each point.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1562
diff
changeset
|
417 if (nameString == null || nameString.equals("")) { |
41abc345d2f1
Added dummy handling for new boolean property of each point.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1562
diff
changeset
|
418 String xString = record.getAttributeAsString( |
41abc345d2f1
Added dummy handling for new boolean property of each point.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1562
diff
changeset
|
419 PointRecord.ATTRIBUTE_X); |
41abc345d2f1
Added dummy handling for new boolean property of each point.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1562
diff
changeset
|
420 String yString = record.getAttributeAsString( |
41abc345d2f1
Added dummy handling for new boolean property of each point.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1562
diff
changeset
|
421 PointRecord.ATTRIBUTE_Y); |
41abc345d2f1
Added dummy handling for new boolean property of each point.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1562
diff
changeset
|
422 nameString = xString + "/" + yString; |
41abc345d2f1
Added dummy handling for new boolean property of each point.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1562
diff
changeset
|
423 } |
41abc345d2f1
Added dummy handling for new boolean property of each point.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1562
diff
changeset
|
424 |
3859
62332fa199bf
Work on "Date" support for ManualPointsEditor.
Christian Lins <christian.lins@intevation.de>
parents:
3855
diff
changeset
|
425 if(fieldTypeX.equals(ListGridFieldType.DATE)) { |
8856 | 426 Date date = record.getAttributeAsDate( |
427 PointRecord.ATTRIBUTE_X); | |
3983
65e369ac4f99
ManualPointsEditor supports Date x axis values.
Christian Lins <christian.lins@intevation.de>
parents:
3859
diff
changeset
|
428 data.set(0, new JSONString(formatDate(date))); |
65e369ac4f99
ManualPointsEditor supports Date x axis values.
Christian Lins <christian.lins@intevation.de>
parents:
3859
diff
changeset
|
429 GWT.log("Date: " + formatDate(date)); |
3859
62332fa199bf
Work on "Date" support for ManualPointsEditor.
Christian Lins <christian.lins@intevation.de>
parents:
3855
diff
changeset
|
430 } |
62332fa199bf
Work on "Date" support for ManualPointsEditor.
Christian Lins <christian.lins@intevation.de>
parents:
3855
diff
changeset
|
431 else { |
62332fa199bf
Work on "Date" support for ManualPointsEditor.
Christian Lins <christian.lins@intevation.de>
parents:
3855
diff
changeset
|
432 data.set(0, new JSONNumber(record. |
62332fa199bf
Work on "Date" support for ManualPointsEditor.
Christian Lins <christian.lins@intevation.de>
parents:
3855
diff
changeset
|
433 getAttributeAsDouble(PointRecord.ATTRIBUTE_X))); |
62332fa199bf
Work on "Date" support for ManualPointsEditor.
Christian Lins <christian.lins@intevation.de>
parents:
3855
diff
changeset
|
434 } |
1563
41abc345d2f1
Added dummy handling for new boolean property of each point.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1562
diff
changeset
|
435 data.set(1, new JSONNumber(record. |
41abc345d2f1
Added dummy handling for new boolean property of each point.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1562
diff
changeset
|
436 getAttributeAsDouble(PointRecord.ATTRIBUTE_Y))); |
41abc345d2f1
Added dummy handling for new boolean property of each point.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1562
diff
changeset
|
437 data.set(2, new JSONString(nameString)); |
8856 | 438 data.set(3, JSONBoolean.getInstance( |
439 record.getAttributeAsBoolean( | |
1563
41abc345d2f1
Added dummy handling for new boolean property of each point.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1562
diff
changeset
|
440 PointRecord.ATTRIBUTE_ACTIVE))); |
41abc345d2f1
Added dummy handling for new boolean property of each point.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1562
diff
changeset
|
441 |
41abc345d2f1
Added dummy handling for new boolean property of each point.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1562
diff
changeset
|
442 list.set(idx, data); |
41abc345d2f1
Added dummy handling for new boolean property of each point.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1562
diff
changeset
|
443 idx++; |
41abc345d2f1
Added dummy handling for new boolean property of each point.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1562
diff
changeset
|
444 } |
41abc345d2f1
Added dummy handling for new boolean property of each point.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1562
diff
changeset
|
445 } |
41abc345d2f1
Added dummy handling for new boolean property of each point.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1562
diff
changeset
|
446 return list; |
41abc345d2f1
Added dummy handling for new boolean property of each point.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1562
diff
changeset
|
447 } |
41abc345d2f1
Added dummy handling for new boolean property of each point.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1562
diff
changeset
|
448 |
41abc345d2f1
Added dummy handling for new boolean property of each point.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1562
diff
changeset
|
449 |
41abc345d2f1
Added dummy handling for new boolean property of each point.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1562
diff
changeset
|
450 /** |
41abc345d2f1
Added dummy handling for new boolean property of each point.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1562
diff
changeset
|
451 * Called when OK Button was clicked. Then, if entered values are valid, |
41abc345d2f1
Added dummy handling for new boolean property of each point.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1562
diff
changeset
|
452 * fire a RedrawRequest and destroy. |
41abc345d2f1
Added dummy handling for new boolean property of each point.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1562
diff
changeset
|
453 */ |
41abc345d2f1
Added dummy handling for new boolean property of each point.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1562
diff
changeset
|
454 protected void okClicked() { |
41abc345d2f1
Added dummy handling for new boolean property of each point.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1562
diff
changeset
|
455 if(isDialogValid()) { |
41abc345d2f1
Added dummy handling for new boolean property of each point.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1562
diff
changeset
|
456 // Feed JSON-encoded content of listgrid. |
41abc345d2f1
Added dummy handling for new boolean property of each point.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1562
diff
changeset
|
457 JSONArray list = jsonArrayFromListGrid(); |
41abc345d2f1
Added dummy handling for new boolean property of each point.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1562
diff
changeset
|
458 |
41abc345d2f1
Added dummy handling for new boolean property of each point.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1562
diff
changeset
|
459 Data[] feedData = new Data[] { |
2924
60c375173263
Minor refactoring.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2905
diff
changeset
|
460 DefaultData.createSimpleStringData(pointDataItemName, |
1563
41abc345d2f1
Added dummy handling for new boolean property of each point.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1562
diff
changeset
|
461 list.toString()) |
41abc345d2f1
Added dummy handling for new boolean property of each point.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1562
diff
changeset
|
462 }; |
41abc345d2f1
Added dummy handling for new boolean property of each point.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1562
diff
changeset
|
463 |
41abc345d2f1
Added dummy handling for new boolean property of each point.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1562
diff
changeset
|
464 feedService.feed( |
41abc345d2f1
Added dummy handling for new boolean property of each point.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1562
diff
changeset
|
465 Config.getInstance().getLocale(), |
41abc345d2f1
Added dummy handling for new boolean property of each point.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1562
diff
changeset
|
466 new DefaultArtifact(uuid, "TODO:hash"), |
41abc345d2f1
Added dummy handling for new boolean property of each point.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1562
diff
changeset
|
467 feedData, |
41abc345d2f1
Added dummy handling for new boolean property of each point.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1562
diff
changeset
|
468 new AsyncCallback<Artifact>() { |
3983
65e369ac4f99
ManualPointsEditor supports Date x axis values.
Christian Lins <christian.lins@intevation.de>
parents:
3859
diff
changeset
|
469 @Override |
1563
41abc345d2f1
Added dummy handling for new boolean property of each point.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1562
diff
changeset
|
470 public void onFailure(Throwable caught) { |
41abc345d2f1
Added dummy handling for new boolean property of each point.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1562
diff
changeset
|
471 GWT.log("Could not feed artifact with points."); |
41abc345d2f1
Added dummy handling for new boolean property of each point.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1562
diff
changeset
|
472 SC.warn(MSG.getString(caught.getMessage())); |
41abc345d2f1
Added dummy handling for new boolean property of each point.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1562
diff
changeset
|
473 enable(); |
41abc345d2f1
Added dummy handling for new boolean property of each point.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1562
diff
changeset
|
474 } |
3983
65e369ac4f99
ManualPointsEditor supports Date x axis values.
Christian Lins <christian.lins@intevation.de>
parents:
3859
diff
changeset
|
475 @Override |
1563
41abc345d2f1
Added dummy handling for new boolean property of each point.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1562
diff
changeset
|
476 public void onSuccess(Artifact fartifact) { |
3706 | 477 GWT.log("Successfully set points"); |
1563
41abc345d2f1
Added dummy handling for new boolean property of each point.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1562
diff
changeset
|
478 redrawRequestHandler.onRedrawRequest( |
41abc345d2f1
Added dummy handling for new boolean property of each point.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1562
diff
changeset
|
479 new RedrawRequestEvent()); |
41abc345d2f1
Added dummy handling for new boolean property of each point.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1562
diff
changeset
|
480 destroy(); |
41abc345d2f1
Added dummy handling for new boolean property of each point.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1562
diff
changeset
|
481 } |
41abc345d2f1
Added dummy handling for new boolean property of each point.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1562
diff
changeset
|
482 }); |
41abc345d2f1
Added dummy handling for new boolean property of each point.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1562
diff
changeset
|
483 } |
41abc345d2f1
Added dummy handling for new boolean property of each point.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1562
diff
changeset
|
484 else { |
41abc345d2f1
Added dummy handling for new boolean property of each point.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1562
diff
changeset
|
485 GWT.log("Dialog not valid"); |
41abc345d2f1
Added dummy handling for new boolean property of each point.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1562
diff
changeset
|
486 SC.warn(MSG.error_dialog_not_valid()); |
41abc345d2f1
Added dummy handling for new boolean property of each point.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1562
diff
changeset
|
487 } |
41abc345d2f1
Added dummy handling for new boolean property of each point.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1562
diff
changeset
|
488 } |
41abc345d2f1
Added dummy handling for new boolean property of each point.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1562
diff
changeset
|
489 |
41abc345d2f1
Added dummy handling for new boolean property of each point.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1562
diff
changeset
|
490 |
1545
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
491 /** Add a ManualPointArtifact to Collection. */ |
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
492 public void addArtifactCreateUI() { |
1553
9ad19e31d149
Improved points UI to also respect language and name of point.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1549
diff
changeset
|
493 final Label standByLabel = new Label(MSG.standby()); |
1545
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
494 addItem(standByLabel); |
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
495 |
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
496 setWidth(380); |
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
497 setHeight(470); |
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
498 centerInPage(); |
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
499 |
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
500 Config config = Config.getInstance(); |
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
501 String locale = config.getLocale(); |
2905
51ed89b754ae
FLYS client: Removed trailing whitespace.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2482
diff
changeset
|
502 |
1545
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
503 loadArtifactService.load( |
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
504 this.collection, |
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
505 new Recommendation("manualpoints", ""), |
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
506 "manualpoints", |
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
507 locale, |
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
508 new AsyncCallback<Artifact>() { |
3983
65e369ac4f99
ManualPointsEditor supports Date x axis values.
Christian Lins <christian.lins@intevation.de>
parents:
3859
diff
changeset
|
509 @Override |
1545
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
510 public void onFailure(Throwable caught) { |
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
511 GWT.log("Creating manualpoint artifact failed!"); |
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
512 } |
3983
65e369ac4f99
ManualPointsEditor supports Date x axis values.
Christian Lins <christian.lins@intevation.de>
parents:
3859
diff
changeset
|
513 @Override |
1545
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
514 public void onSuccess(Artifact artifact) { |
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
515 GWT.log("Successfully created artifact."); |
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
516 removeItem(standByLabel); |
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
517 uuid = artifact.getUuid(); |
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
518 createUI(); |
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
519 } |
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
520 }); |
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
521 } |
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
522 |
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
523 |
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
524 /** |
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
525 * This method is called when the user aborts point editing. |
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
526 * @param event The event. |
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
527 */ |
3983
65e369ac4f99
ManualPointsEditor supports Date x axis values.
Christian Lins <christian.lins@intevation.de>
parents:
3859
diff
changeset
|
528 @Override |
1545
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
529 public void onClick(ClickEvent event) { |
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
530 this.destroy(); |
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
531 } |
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
532 |
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
533 |
1565
87f5ed6960e8
Improved form validation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1564
diff
changeset
|
534 /** Return false if x or y attribute is missing. */ |
1545
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
535 protected boolean isDialogValid() { |
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
536 boolean valid = true; |
1565
87f5ed6960e8
Improved form validation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1564
diff
changeset
|
537 for (ListGridRecord record : listGrid.getRecords()) { |
3859
62332fa199bf
Work on "Date" support for ManualPointsEditor.
Christian Lins <christian.lins@intevation.de>
parents:
3855
diff
changeset
|
538 try { |
62332fa199bf
Work on "Date" support for ManualPointsEditor.
Christian Lins <christian.lins@intevation.de>
parents:
3855
diff
changeset
|
539 if (record.getAttribute(PointRecord.ATTRIBUTE_X) == null |
62332fa199bf
Work on "Date" support for ManualPointsEditor.
Christian Lins <christian.lins@intevation.de>
parents:
3855
diff
changeset
|
540 || record.getAttribute(PointRecord.ATTRIBUTE_Y) == null) { |
62332fa199bf
Work on "Date" support for ManualPointsEditor.
Christian Lins <christian.lins@intevation.de>
parents:
3855
diff
changeset
|
541 return false; |
62332fa199bf
Work on "Date" support for ManualPointsEditor.
Christian Lins <christian.lins@intevation.de>
parents:
3855
diff
changeset
|
542 } |
62332fa199bf
Work on "Date" support for ManualPointsEditor.
Christian Lins <christian.lins@intevation.de>
parents:
3855
diff
changeset
|
543 } |
62332fa199bf
Work on "Date" support for ManualPointsEditor.
Christian Lins <christian.lins@intevation.de>
parents:
3855
diff
changeset
|
544 catch(IllegalArgumentException ex) { |
62332fa199bf
Work on "Date" support for ManualPointsEditor.
Christian Lins <christian.lins@intevation.de>
parents:
3855
diff
changeset
|
545 |
1545
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
546 } |
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
547 } |
1604
cb3629a01126
Issue 473.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1594
diff
changeset
|
548 if (listGrid.hasErrors()) { |
cb3629a01126
Issue 473.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1594
diff
changeset
|
549 valid = false; |
cb3629a01126
Issue 473.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1594
diff
changeset
|
550 } |
1545
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
551 return valid; |
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
552 } |
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
553 } |
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
554 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : |