Mercurial > dive4elements > river
annotate gwt-client/src/main/java/org/dive4elements/river/client/client/ui/chart/ManualPointsEditor.java @ 7941:48d8dba891f6
Fixed columns in location/distance helper panels.
author | Raimund Renkert <rrenkert@intevation.de> |
---|---|
date | Wed, 18 Jun 2014 14:25:46 +0200 |
parents | ea9eef426962 |
children | 5e38e2924c07 |
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( |
5835
821a02bbfb4e
Fixed internal java dependencies
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5834
diff
changeset
|
89 org.dive4elements.river.client.client.services.LoadArtifactService.class); |
1545
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
90 |
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
91 /** 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
|
92 FeedServiceAsync feedService = GWT.create( |
5835
821a02bbfb4e
Fixed internal java dependencies
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5834
diff
changeset
|
93 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
|
94 |
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
95 /** UUID of artifact to feed. */ |
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
96 protected String uuid; |
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
97 |
1568
2432973ccced
Handle manual points on a per-chart(type) basis.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1565
diff
changeset
|
98 /** 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
|
99 protected String outputModeName; |
2432973ccced
Handle manual points on a per-chart(type) basis.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1565
diff
changeset
|
100 |
2924
60c375173263
Minor refactoring.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2905
diff
changeset
|
101 /** Name of the point data item. */ |
60c375173263
Minor refactoring.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2905
diff
changeset
|
102 protected String pointDataItemName; |
60c375173263
Minor refactoring.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2905
diff
changeset
|
103 |
1545
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
104 |
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 * Setup editor dialog. |
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
107 * @param collection The collection to use. |
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
108 */ |
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
|
109 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
|
110 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
|
111 ) { |
1545
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
112 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
|
113 this.redrawRequestHandler = handler; |
1568
2432973ccced
Handle manual points on a per-chart(type) basis.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1565
diff
changeset
|
114 this.outputModeName = outputModeName; |
2924
60c375173263
Minor refactoring.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2905
diff
changeset
|
115 this.pointDataItemName = outputModeName + "." + POINT_DATA; |
1545
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
116 init(); |
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
117 } |
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 /** 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
|
121 public String findManualPointsUUID() { |
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
122 // 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
|
123 int size = collection.getItemLength(); |
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
124 |
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
125 for (int i = 0; i < size; i++) { |
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
126 CollectionItem item = collection.getItem(i); |
3855
b6b2d9aad95d
Fix for #854
Christian Lins <christian.lins@intevation.de>
parents:
3706
diff
changeset
|
127 String dataValue = item.getData().get(pointDataItemName); |
1545
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
128 if (dataValue != null) { |
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
129 // Found it. |
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
130 uuid = item.identifier(); |
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
131 return uuid; |
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
132 } |
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 return null; |
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
136 } |
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 * Initialize the editor window and its components. |
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
141 */ |
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
142 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
|
143 setTitle(MSG.addpoints()); |
1545
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
144 setCanDragReposition(true); |
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
145 setCanDragResize(true); |
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
146 |
2905
51ed89b754ae
FLYS client: Removed trailing whitespace.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2482
diff
changeset
|
147 // 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
|
148 if(findManualPointsUUID() == null) { |
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
149 addArtifactCreateUI(); |
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
150 } |
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
151 else { |
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
152 createUI(); |
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
153 } |
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 |
1547
76377fe3f0c7
Cosmetics.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1545
diff
changeset
|
156 |
1545
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
157 /** Create and setup/add the ui. */ |
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
158 public void createUI() { |
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
159 Button accept = new Button(MSG.label_ok()); |
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
160 Button cancel = new Button(MSG.label_cancel()); |
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
161 cancel.addClickHandler(this); |
1561
3cf3cd8dd92d
Made manual points edit- and removable.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1553
diff
changeset
|
162 |
1545
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
163 accept.addClickHandler(new ClickHandler() { |
3983
65e369ac4f99
ManualPointsEditor supports Date x axis values.
Christian Lins <christian.lins@intevation.de>
parents:
3859
diff
changeset
|
164 @Override |
1545
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
165 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
|
166 okClicked(); |
1545
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
167 } |
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 HLayout buttons = new HLayout(); |
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
171 buttons.addMember(accept); |
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
172 buttons.addMember(cancel); |
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
173 buttons.setAlign(Alignment.CENTER); |
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
174 buttons.setHeight(30); |
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
175 |
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
176 VLayout layout = new VLayout(); |
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
177 listGrid = new ListGrid(); |
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
178 listGrid.setWidth100(); |
1570
eeee85c4d996
Adjusted table height to fill the window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1569
diff
changeset
|
179 listGrid.setHeight("*"); |
1561
3cf3cd8dd92d
Made manual points edit- and removable.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1553
diff
changeset
|
180 listGrid.setCanSort(false); |
3cf3cd8dd92d
Made manual points edit- and removable.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1553
diff
changeset
|
181 listGrid.setCanEdit(true); |
3cf3cd8dd92d
Made manual points edit- and removable.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1553
diff
changeset
|
182 listGrid.setShowHeaderContextMenu(false); |
3cf3cd8dd92d
Made manual points edit- and removable.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1553
diff
changeset
|
183 |
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
|
184 // 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
|
185 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
|
186 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
|
187 |
3983
65e369ac4f99
ManualPointsEditor supports Date x axis values.
Christian Lins <christian.lins@intevation.de>
parents:
3859
diff
changeset
|
188 // 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
|
189 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
|
190 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
|
191 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
|
192 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
|
193 PropertyGroup pg = (PropertyGroup)p; |
3859
62332fa199bf
Work on "Date" support for ManualPointsEditor.
Christian Lins <christian.lins@intevation.de>
parents:
3855
diff
changeset
|
194 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
|
195 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
|
196 (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
|
197 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
|
198 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
|
199 (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
|
200 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
|
201 } |
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 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
|
203 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
|
204 (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
|
205 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
|
206 } |
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 } |
3859
62332fa199bf
Work on "Date" support for ManualPointsEditor.
Christian Lins <christian.lins@intevation.de>
parents:
3855
diff
changeset
|
209 |
62332fa199bf
Work on "Date" support for ManualPointsEditor.
Christian Lins <christian.lins@intevation.de>
parents:
3855
diff
changeset
|
210 CellFormatter format = createCellFormatter(); |
62332fa199bf
Work on "Date" support for ManualPointsEditor.
Christian Lins <christian.lins@intevation.de>
parents:
3855
diff
changeset
|
211 CellEditValueParser cevp = createCellEditValueParser(); |
62332fa199bf
Work on "Date" support for ManualPointsEditor.
Christian Lins <christian.lins@intevation.de>
parents:
3855
diff
changeset
|
212 CellEditValueFormatter cevf = createCellEditValueFormatter(); |
62332fa199bf
Work on "Date" support for ManualPointsEditor.
Christian Lins <christian.lins@intevation.de>
parents:
3855
diff
changeset
|
213 |
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
|
214 ListGridField xField = |
3859
62332fa199bf
Work on "Date" support for ManualPointsEditor.
Christian Lins <christian.lins@intevation.de>
parents:
3855
diff
changeset
|
215 new ListGridField(PointRecord.ATTRIBUTE_X, xAxis); |
62332fa199bf
Work on "Date" support for ManualPointsEditor.
Christian Lins <christian.lins@intevation.de>
parents:
3855
diff
changeset
|
216 if(xAxis.equalsIgnoreCase("date") || xAxis.equalsIgnoreCase("Datum")) { |
3983
65e369ac4f99
ManualPointsEditor supports Date x axis values.
Christian Lins <christian.lins@intevation.de>
parents:
3859
diff
changeset
|
217 // FIXME: This is a hack for Timeseries charts 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
|
218 xField.setType(ListGridFieldType.DATE); |
62332fa199bf
Work on "Date" support for ManualPointsEditor.
Christian Lins <christian.lins@intevation.de>
parents:
3855
diff
changeset
|
219 this.fieldTypeX = ListGridFieldType.DATE; |
62332fa199bf
Work on "Date" support for ManualPointsEditor.
Christian Lins <christian.lins@intevation.de>
parents:
3855
diff
changeset
|
220 } |
62332fa199bf
Work on "Date" support for ManualPointsEditor.
Christian Lins <christian.lins@intevation.de>
parents:
3855
diff
changeset
|
221 else { |
62332fa199bf
Work on "Date" support for ManualPointsEditor.
Christian Lins <christian.lins@intevation.de>
parents:
3855
diff
changeset
|
222 xField.setType(ListGridFieldType.FLOAT); |
62332fa199bf
Work on "Date" support for ManualPointsEditor.
Christian Lins <christian.lins@intevation.de>
parents:
3855
diff
changeset
|
223 xField.setCellFormatter(format); |
62332fa199bf
Work on "Date" support for ManualPointsEditor.
Christian Lins <christian.lins@intevation.de>
parents:
3855
diff
changeset
|
224 xField.setEditValueParser(cevp); |
62332fa199bf
Work on "Date" support for ManualPointsEditor.
Christian Lins <christian.lins@intevation.de>
parents:
3855
diff
changeset
|
225 xField.setEditValueFormatter(cevf); |
62332fa199bf
Work on "Date" support for ManualPointsEditor.
Christian Lins <christian.lins@intevation.de>
parents:
3855
diff
changeset
|
226 } |
1563
41abc345d2f1
Added dummy handling for new boolean property of each point.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1562
diff
changeset
|
227 |
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
|
228 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
|
229 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
|
230 yField.setType(ListGridFieldType.FLOAT); |
3859
62332fa199bf
Work on "Date" support for ManualPointsEditor.
Christian Lins <christian.lins@intevation.de>
parents:
3855
diff
changeset
|
231 yField.setCellFormatter(format); |
1604
cb3629a01126
Issue 473.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1594
diff
changeset
|
232 yField.setEditValueParser(cevp); |
cb3629a01126
Issue 473.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1594
diff
changeset
|
233 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
|
234 |
1562
af29d43cf4da
Added basic validation, improved editing function, minor refac.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1561
diff
changeset
|
235 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
|
236 MSG.pointname()); |
1561
3cf3cd8dd92d
Made manual points edit- and removable.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1553
diff
changeset
|
237 final ListGridField removeField = |
3cf3cd8dd92d
Made manual points edit- and removable.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1553
diff
changeset
|
238 new ListGridField("_removeRecord", MSG.removepoint()){{ |
3cf3cd8dd92d
Made manual points edit- and removable.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1553
diff
changeset
|
239 setType(ListGridFieldType.ICON); |
3cf3cd8dd92d
Made manual points edit- and removable.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1553
diff
changeset
|
240 setIcon(GWT.getHostPageBaseURL() + MSG.removeFeature()); |
3cf3cd8dd92d
Made manual points edit- and removable.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1553
diff
changeset
|
241 setCanEdit(false); |
3cf3cd8dd92d
Made manual points edit- and removable.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1553
diff
changeset
|
242 setCanFilter(false); |
3cf3cd8dd92d
Made manual points edit- and removable.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1553
diff
changeset
|
243 setCanSort(false); |
3cf3cd8dd92d
Made manual points edit- and removable.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1553
diff
changeset
|
244 setCanGroupBy(false); |
3cf3cd8dd92d
Made manual points edit- and removable.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1553
diff
changeset
|
245 setCanFreeze(false); |
3cf3cd8dd92d
Made manual points edit- and removable.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1553
diff
changeset
|
246 setWidth(25); |
3cf3cd8dd92d
Made manual points edit- and removable.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1553
diff
changeset
|
247 }}; |
3cf3cd8dd92d
Made manual points edit- and removable.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1553
diff
changeset
|
248 |
1563
41abc345d2f1
Added dummy handling for new boolean property of each point.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1562
diff
changeset
|
249 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
|
250 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
|
251 activeField.setType(ListGridFieldType.BOOLEAN); |
1564
3606f2caf93e
Make manual Points active by default.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1563
diff
changeset
|
252 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
|
253 |
41abc345d2f1
Added dummy handling for new boolean property of each point.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1562
diff
changeset
|
254 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
|
255 nameField, removeField}); |
1545
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
256 |
1561
3cf3cd8dd92d
Made manual points edit- and removable.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1553
diff
changeset
|
257 listGrid.addRecordClickHandler(new RecordClickHandler() { |
3983
65e369ac4f99
ManualPointsEditor supports Date x axis values.
Christian Lins <christian.lins@intevation.de>
parents:
3859
diff
changeset
|
258 @Override |
1561
3cf3cd8dd92d
Made manual points edit- and removable.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1553
diff
changeset
|
259 public void onRecordClick(final RecordClickEvent event) { |
3cf3cd8dd92d
Made manual points edit- and removable.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1553
diff
changeset
|
260 // Just handle remove-clicks |
3cf3cd8dd92d
Made manual points edit- and removable.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1553
diff
changeset
|
261 if(!event.getField().getName().equals(removeField.getName())) { |
3cf3cd8dd92d
Made manual points edit- and removable.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1553
diff
changeset
|
262 return; |
2905
51ed89b754ae
FLYS client: Removed trailing whitespace.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2482
diff
changeset
|
263 } |
1561
3cf3cd8dd92d
Made manual points edit- and removable.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1553
diff
changeset
|
264 event.getViewer().removeData(event.getRecord()); |
3cf3cd8dd92d
Made manual points edit- and removable.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1553
diff
changeset
|
265 } |
3cf3cd8dd92d
Made manual points edit- and removable.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1553
diff
changeset
|
266 }); |
3cf3cd8dd92d
Made manual points edit- and removable.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1553
diff
changeset
|
267 |
3983
65e369ac4f99
ManualPointsEditor supports Date x axis values.
Christian Lins <christian.lins@intevation.de>
parents:
3859
diff
changeset
|
268 // Find the artifacts uuid |
1545
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
269 findManualPointsUUID(); |
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
270 CollectionItem item = collection.getItem(uuid); |
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
271 |
3983
65e369ac4f99
ManualPointsEditor supports Date x axis values.
Christian Lins <christian.lins@intevation.de>
parents:
3859
diff
changeset
|
272 // Add points to grid |
1545
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
273 if (item != null) { |
2924
60c375173263
Minor refactoring.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2905
diff
changeset
|
274 // TODO store this from findPointUUID instead (we touched these). |
60c375173263
Minor refactoring.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2905
diff
changeset
|
275 String jsonData = item.getData().get(pointDataItemName); |
1545
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
276 JSONArray jsonArray = (JSONArray) JSONParser.parse(jsonData); |
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
277 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
|
278 JSONArray point = (JSONArray) jsonArray.get(i); |
3983
65e369ac4f99
ManualPointsEditor supports Date x axis values.
Christian Lins <christian.lins@intevation.de>
parents:
3859
diff
changeset
|
279 listGrid.addData(PointRecord.fromJSON(point)); |
1545
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
280 } |
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
281 } |
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
282 else { |
3983
65e369ac4f99
ManualPointsEditor supports Date x axis values.
Christian Lins <christian.lins@intevation.de>
parents:
3859
diff
changeset
|
283 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
|
284 } |
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
285 |
1553
9ad19e31d149
Improved points UI to also respect language and name of point.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1549
diff
changeset
|
286 IButton button = new IButton(MSG.newpoint()); |
1545
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
287 button.setTop(250); |
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
288 button.addClickHandler(new ClickHandler() { |
3983
65e369ac4f99
ManualPointsEditor supports Date x axis values.
Christian Lins <christian.lins@intevation.de>
parents:
3859
diff
changeset
|
289 @Override |
1545
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
290 public void onClick(ClickEvent event) { |
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
291 listGrid.startEditingNew(); |
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
292 } |
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
293 }); |
1553
9ad19e31d149
Improved points UI to also respect language and name of point.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1549
diff
changeset
|
294 |
9ad19e31d149
Improved points UI to also respect language and name of point.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1549
diff
changeset
|
295 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
|
296 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
|
297 |
9ad19e31d149
Improved points UI to also respect language and name of point.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1549
diff
changeset
|
298 addItem(layout); |
9ad19e31d149
Improved points UI to also respect language and name of point.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1549
diff
changeset
|
299 |
1545
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
300 addItem(buttons); |
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
301 setWidth(380); |
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
302 setHeight(470); |
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
303 centerInPage(); |
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
304 } |
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
305 |
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
306 |
3859
62332fa199bf
Work on "Date" support for ManualPointsEditor.
Christian Lins <christian.lins@intevation.de>
parents:
3855
diff
changeset
|
307 protected CellFormatter createCellFormatter() { |
62332fa199bf
Work on "Date" support for ManualPointsEditor.
Christian Lins <christian.lins@intevation.de>
parents:
3855
diff
changeset
|
308 return new CellFormatter() { |
3983
65e369ac4f99
ManualPointsEditor supports Date x axis values.
Christian Lins <christian.lins@intevation.de>
parents:
3859
diff
changeset
|
309 @Override |
3859
62332fa199bf
Work on "Date" support for ManualPointsEditor.
Christian Lins <christian.lins@intevation.de>
parents:
3855
diff
changeset
|
310 public String format(Object value, ListGridRecord record, int rowNum, int colNum) { |
62332fa199bf
Work on "Date" support for ManualPointsEditor.
Christian Lins <christian.lins@intevation.de>
parents:
3855
diff
changeset
|
311 if(value != null) { |
62332fa199bf
Work on "Date" support for ManualPointsEditor.
Christian Lins <christian.lins@intevation.de>
parents:
3855
diff
changeset
|
312 NumberFormat nf = NumberFormat.getDecimalFormat(); |
62332fa199bf
Work on "Date" support for ManualPointsEditor.
Christian Lins <christian.lins@intevation.de>
parents:
3855
diff
changeset
|
313 try { |
62332fa199bf
Work on "Date" support for ManualPointsEditor.
Christian Lins <christian.lins@intevation.de>
parents:
3855
diff
changeset
|
314 double d = Double.valueOf(value.toString()).doubleValue(); |
62332fa199bf
Work on "Date" support for ManualPointsEditor.
Christian Lins <christian.lins@intevation.de>
parents:
3855
diff
changeset
|
315 return nf.format(d); |
62332fa199bf
Work on "Date" support for ManualPointsEditor.
Christian Lins <christian.lins@intevation.de>
parents:
3855
diff
changeset
|
316 } catch (Exception e) { |
62332fa199bf
Work on "Date" support for ManualPointsEditor.
Christian Lins <christian.lins@intevation.de>
parents:
3855
diff
changeset
|
317 return value.toString(); |
62332fa199bf
Work on "Date" support for ManualPointsEditor.
Christian Lins <christian.lins@intevation.de>
parents:
3855
diff
changeset
|
318 } |
62332fa199bf
Work on "Date" support for ManualPointsEditor.
Christian Lins <christian.lins@intevation.de>
parents:
3855
diff
changeset
|
319 } else { |
62332fa199bf
Work on "Date" support for ManualPointsEditor.
Christian Lins <christian.lins@intevation.de>
parents:
3855
diff
changeset
|
320 return null; |
62332fa199bf
Work on "Date" support for ManualPointsEditor.
Christian Lins <christian.lins@intevation.de>
parents:
3855
diff
changeset
|
321 } |
62332fa199bf
Work on "Date" support for ManualPointsEditor.
Christian Lins <christian.lins@intevation.de>
parents:
3855
diff
changeset
|
322 }}; |
62332fa199bf
Work on "Date" support for ManualPointsEditor.
Christian Lins <christian.lins@intevation.de>
parents:
3855
diff
changeset
|
323 } |
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 |
62332fa199bf
Work on "Date" support for ManualPointsEditor.
Christian Lins <christian.lins@intevation.de>
parents:
3855
diff
changeset
|
326 protected CellEditValueParser createCellEditValueParser() { |
62332fa199bf
Work on "Date" support for ManualPointsEditor.
Christian Lins <christian.lins@intevation.de>
parents:
3855
diff
changeset
|
327 return new CellEditValueParser() { |
3983
65e369ac4f99
ManualPointsEditor supports Date x axis values.
Christian Lins <christian.lins@intevation.de>
parents:
3859
diff
changeset
|
328 @Override |
3859
62332fa199bf
Work on "Date" support for ManualPointsEditor.
Christian Lins <christian.lins@intevation.de>
parents:
3855
diff
changeset
|
329 public Object parse(Object value, ListGridRecord record, int rowNum, int colNum) { |
62332fa199bf
Work on "Date" support for ManualPointsEditor.
Christian Lins <christian.lins@intevation.de>
parents:
3855
diff
changeset
|
330 if (value == null) |
62332fa199bf
Work on "Date" support for ManualPointsEditor.
Christian Lins <christian.lins@intevation.de>
parents:
3855
diff
changeset
|
331 return null; |
62332fa199bf
Work on "Date" support for ManualPointsEditor.
Christian Lins <christian.lins@intevation.de>
parents:
3855
diff
changeset
|
332 try { |
62332fa199bf
Work on "Date" support for ManualPointsEditor.
Christian Lins <christian.lins@intevation.de>
parents:
3855
diff
changeset
|
333 NumberFormat nf = NumberFormat.getDecimalFormat(); |
62332fa199bf
Work on "Date" support for ManualPointsEditor.
Christian Lins <christian.lins@intevation.de>
parents:
3855
diff
changeset
|
334 double d = nf.parse(value.toString()); |
62332fa199bf
Work on "Date" support for ManualPointsEditor.
Christian Lins <christian.lins@intevation.de>
parents:
3855
diff
changeset
|
335 return (new Double(d)).toString(); |
62332fa199bf
Work on "Date" support for ManualPointsEditor.
Christian Lins <christian.lins@intevation.de>
parents:
3855
diff
changeset
|
336 } |
62332fa199bf
Work on "Date" support for ManualPointsEditor.
Christian Lins <christian.lins@intevation.de>
parents:
3855
diff
changeset
|
337 catch(NumberFormatException nfe) { |
62332fa199bf
Work on "Date" support for ManualPointsEditor.
Christian Lins <christian.lins@intevation.de>
parents:
3855
diff
changeset
|
338 return value; |
62332fa199bf
Work on "Date" support for ManualPointsEditor.
Christian Lins <christian.lins@intevation.de>
parents:
3855
diff
changeset
|
339 } |
62332fa199bf
Work on "Date" support for ManualPointsEditor.
Christian Lins <christian.lins@intevation.de>
parents:
3855
diff
changeset
|
340 } |
62332fa199bf
Work on "Date" support for ManualPointsEditor.
Christian Lins <christian.lins@intevation.de>
parents:
3855
diff
changeset
|
341 }; |
62332fa199bf
Work on "Date" support for ManualPointsEditor.
Christian Lins <christian.lins@intevation.de>
parents:
3855
diff
changeset
|
342 } |
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 |
62332fa199bf
Work on "Date" support for ManualPointsEditor.
Christian Lins <christian.lins@intevation.de>
parents:
3855
diff
changeset
|
345 protected CellEditValueFormatter createCellEditValueFormatter() { |
62332fa199bf
Work on "Date" support for ManualPointsEditor.
Christian Lins <christian.lins@intevation.de>
parents:
3855
diff
changeset
|
346 return new CellEditValueFormatter() { |
3983
65e369ac4f99
ManualPointsEditor supports Date x axis values.
Christian Lins <christian.lins@intevation.de>
parents:
3859
diff
changeset
|
347 @Override |
3859
62332fa199bf
Work on "Date" support for ManualPointsEditor.
Christian Lins <christian.lins@intevation.de>
parents:
3855
diff
changeset
|
348 public Object format(Object value, ListGridRecord record, int rowNum, int colNum) { |
62332fa199bf
Work on "Date" support for ManualPointsEditor.
Christian Lins <christian.lins@intevation.de>
parents:
3855
diff
changeset
|
349 if (value == null) { |
62332fa199bf
Work on "Date" support for ManualPointsEditor.
Christian Lins <christian.lins@intevation.de>
parents:
3855
diff
changeset
|
350 return ""; |
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 NumberFormat nf = NumberFormat.getDecimalFormat(); |
62332fa199bf
Work on "Date" support for ManualPointsEditor.
Christian Lins <christian.lins@intevation.de>
parents:
3855
diff
changeset
|
353 try { |
62332fa199bf
Work on "Date" support for ManualPointsEditor.
Christian Lins <christian.lins@intevation.de>
parents:
3855
diff
changeset
|
354 double d = Double.valueOf(value.toString()).doubleValue(); |
62332fa199bf
Work on "Date" support for ManualPointsEditor.
Christian Lins <christian.lins@intevation.de>
parents:
3855
diff
changeset
|
355 return nf.format(d); |
62332fa199bf
Work on "Date" support for ManualPointsEditor.
Christian Lins <christian.lins@intevation.de>
parents:
3855
diff
changeset
|
356 } |
62332fa199bf
Work on "Date" support for ManualPointsEditor.
Christian Lins <christian.lins@intevation.de>
parents:
3855
diff
changeset
|
357 catch(NumberFormatException nfe) { |
62332fa199bf
Work on "Date" support for ManualPointsEditor.
Christian Lins <christian.lins@intevation.de>
parents:
3855
diff
changeset
|
358 return value; |
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 } |
62332fa199bf
Work on "Date" support for ManualPointsEditor.
Christian Lins <christian.lins@intevation.de>
parents:
3855
diff
changeset
|
361 }; |
62332fa199bf
Work on "Date" support for ManualPointsEditor.
Christian Lins <christian.lins@intevation.de>
parents:
3855
diff
changeset
|
362 } |
62332fa199bf
Work on "Date" support for ManualPointsEditor.
Christian Lins <christian.lins@intevation.de>
parents:
3855
diff
changeset
|
363 |
3983
65e369ac4f99
ManualPointsEditor supports Date x axis values.
Christian Lins <christian.lins@intevation.de>
parents:
3859
diff
changeset
|
364 protected String getLocaleDateFormat() { |
65e369ac4f99
ManualPointsEditor supports Date x axis values.
Christian Lins <christian.lins@intevation.de>
parents:
3859
diff
changeset
|
365 String loc = Config.getInstance().getLocale(); |
65e369ac4f99
ManualPointsEditor supports Date x axis values.
Christian Lins <christian.lins@intevation.de>
parents:
3859
diff
changeset
|
366 if ("de".equals(loc)) { |
65e369ac4f99
ManualPointsEditor supports Date x axis values.
Christian Lins <christian.lins@intevation.de>
parents:
3859
diff
changeset
|
367 return "yy.MM.yyyy"; |
65e369ac4f99
ManualPointsEditor supports Date x axis values.
Christian Lins <christian.lins@intevation.de>
parents:
3859
diff
changeset
|
368 } |
65e369ac4f99
ManualPointsEditor supports Date x axis values.
Christian Lins <christian.lins@intevation.de>
parents:
3859
diff
changeset
|
369 else { |
65e369ac4f99
ManualPointsEditor supports Date x axis values.
Christian Lins <christian.lins@intevation.de>
parents:
3859
diff
changeset
|
370 return "MM/dd/yyyy"; |
65e369ac4f99
ManualPointsEditor supports Date x axis values.
Christian Lins <christian.lins@intevation.de>
parents:
3859
diff
changeset
|
371 } |
65e369ac4f99
ManualPointsEditor supports Date x axis values.
Christian Lins <christian.lins@intevation.de>
parents:
3859
diff
changeset
|
372 } |
65e369ac4f99
ManualPointsEditor supports Date x axis values.
Christian Lins <christian.lins@intevation.de>
parents:
3859
diff
changeset
|
373 |
65e369ac4f99
ManualPointsEditor supports Date x axis values.
Christian Lins <christian.lins@intevation.de>
parents:
3859
diff
changeset
|
374 protected String formatDate(Date date) { |
65e369ac4f99
ManualPointsEditor supports Date x axis values.
Christian Lins <christian.lins@intevation.de>
parents:
3859
diff
changeset
|
375 DateTimeFormat dtf = DateTimeFormat.getFormat(getLocaleDateFormat()); |
65e369ac4f99
ManualPointsEditor supports Date x axis values.
Christian Lins <christian.lins@intevation.de>
parents:
3859
diff
changeset
|
376 return dtf.format(date); |
65e369ac4f99
ManualPointsEditor supports Date x axis values.
Christian Lins <christian.lins@intevation.de>
parents:
3859
diff
changeset
|
377 } |
3859
62332fa199bf
Work on "Date" support for ManualPointsEditor.
Christian Lins <christian.lins@intevation.de>
parents:
3855
diff
changeset
|
378 |
1563
41abc345d2f1
Added dummy handling for new boolean property of each point.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1562
diff
changeset
|
379 /** 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
|
380 protected JSONArray jsonArrayFromListGrid() { |
41abc345d2f1
Added dummy handling for new boolean property of each point.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1562
diff
changeset
|
381 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
|
382 int idx = 0; |
41abc345d2f1
Added dummy handling for new boolean property of each point.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1562
diff
changeset
|
383 |
41abc345d2f1
Added dummy handling for new boolean property of each point.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1562
diff
changeset
|
384 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
|
385 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
|
386 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
|
387 |
41abc345d2f1
Added dummy handling for new boolean property of each point.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1562
diff
changeset
|
388 PointRecord point = (PointRecord) record; |
3983
65e369ac4f99
ManualPointsEditor supports Date x axis values.
Christian Lins <christian.lins@intevation.de>
parents:
3859
diff
changeset
|
389 if(point.isTimeseriesPoint()) { |
65e369ac4f99
ManualPointsEditor supports Date x axis values.
Christian Lins <christian.lins@intevation.de>
parents:
3859
diff
changeset
|
390 data.set(0, new JSONString(point.getXAsDate())); |
65e369ac4f99
ManualPointsEditor supports Date x axis values.
Christian Lins <christian.lins@intevation.de>
parents:
3859
diff
changeset
|
391 GWT.log("Date: " + point.getXAsDate()); |
65e369ac4f99
ManualPointsEditor supports Date x axis values.
Christian Lins <christian.lins@intevation.de>
parents:
3859
diff
changeset
|
392 } |
65e369ac4f99
ManualPointsEditor supports Date x axis values.
Christian Lins <christian.lins@intevation.de>
parents:
3859
diff
changeset
|
393 else { |
65e369ac4f99
ManualPointsEditor supports Date x axis values.
Christian Lins <christian.lins@intevation.de>
parents:
3859
diff
changeset
|
394 data.set(0, new JSONNumber(point.getX())); |
65e369ac4f99
ManualPointsEditor supports Date x axis values.
Christian Lins <christian.lins@intevation.de>
parents:
3859
diff
changeset
|
395 } |
1563
41abc345d2f1
Added dummy handling for new boolean property of each point.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1562
diff
changeset
|
396 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
|
397 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
|
398 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
|
399 |
41abc345d2f1
Added dummy handling for new boolean property of each point.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1562
diff
changeset
|
400 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
|
401 idx++; |
41abc345d2f1
Added dummy handling for new boolean property of each point.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1562
diff
changeset
|
402 } |
41abc345d2f1
Added dummy handling for new boolean property of each point.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1562
diff
changeset
|
403 else { |
41abc345d2f1
Added dummy handling for new boolean property of each point.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1562
diff
changeset
|
404 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
|
405 |
1565
87f5ed6960e8
Improved form validation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1564
diff
changeset
|
406 String nameString = record.getAttributeAsString(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
|
407 // 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
|
408 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
|
409 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
|
410 PointRecord.ATTRIBUTE_X); |
41abc345d2f1
Added dummy handling for new boolean property of each point.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1562
diff
changeset
|
411 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
|
412 PointRecord.ATTRIBUTE_Y); |
41abc345d2f1
Added dummy handling for new boolean property of each point.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1562
diff
changeset
|
413 nameString = xString + "/" + yString; |
41abc345d2f1
Added dummy handling for new boolean property of each point.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1562
diff
changeset
|
414 } |
41abc345d2f1
Added dummy handling for new boolean property of each point.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1562
diff
changeset
|
415 |
3859
62332fa199bf
Work on "Date" support for ManualPointsEditor.
Christian Lins <christian.lins@intevation.de>
parents:
3855
diff
changeset
|
416 if(fieldTypeX.equals(ListGridFieldType.DATE)) { |
3983
65e369ac4f99
ManualPointsEditor supports Date x axis values.
Christian Lins <christian.lins@intevation.de>
parents:
3859
diff
changeset
|
417 Date date = record.getAttributeAsDate(PointRecord.ATTRIBUTE_X); |
65e369ac4f99
ManualPointsEditor supports Date x axis values.
Christian Lins <christian.lins@intevation.de>
parents:
3859
diff
changeset
|
418 data.set(0, new JSONString(formatDate(date))); |
65e369ac4f99
ManualPointsEditor supports Date x axis values.
Christian Lins <christian.lins@intevation.de>
parents:
3859
diff
changeset
|
419 GWT.log("Date: " + formatDate(date)); |
3859
62332fa199bf
Work on "Date" support for ManualPointsEditor.
Christian Lins <christian.lins@intevation.de>
parents:
3855
diff
changeset
|
420 } |
62332fa199bf
Work on "Date" support for ManualPointsEditor.
Christian Lins <christian.lins@intevation.de>
parents:
3855
diff
changeset
|
421 else { |
62332fa199bf
Work on "Date" support for ManualPointsEditor.
Christian Lins <christian.lins@intevation.de>
parents:
3855
diff
changeset
|
422 data.set(0, new JSONNumber(record. |
62332fa199bf
Work on "Date" support for ManualPointsEditor.
Christian Lins <christian.lins@intevation.de>
parents:
3855
diff
changeset
|
423 getAttributeAsDouble(PointRecord.ATTRIBUTE_X))); |
62332fa199bf
Work on "Date" support for ManualPointsEditor.
Christian Lins <christian.lins@intevation.de>
parents:
3855
diff
changeset
|
424 } |
1563
41abc345d2f1
Added dummy handling for new boolean property of each point.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1562
diff
changeset
|
425 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
|
426 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
|
427 data.set(2, new JSONString(nameString)); |
41abc345d2f1
Added dummy handling for new boolean property of each point.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1562
diff
changeset
|
428 data.set(3, JSONBoolean.getInstance(record.getAttributeAsBoolean( |
41abc345d2f1
Added dummy handling for new boolean property of each point.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1562
diff
changeset
|
429 PointRecord.ATTRIBUTE_ACTIVE))); |
41abc345d2f1
Added dummy handling for new boolean property of each point.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1562
diff
changeset
|
430 |
41abc345d2f1
Added dummy handling for new boolean property of each point.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1562
diff
changeset
|
431 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
|
432 idx++; |
41abc345d2f1
Added dummy handling for new boolean property of each point.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1562
diff
changeset
|
433 } |
41abc345d2f1
Added dummy handling for new boolean property of each point.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1562
diff
changeset
|
434 } |
41abc345d2f1
Added dummy handling for new boolean property of each point.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1562
diff
changeset
|
435 return list; |
41abc345d2f1
Added dummy handling for new boolean property of each point.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1562
diff
changeset
|
436 } |
41abc345d2f1
Added dummy handling for new boolean property of each point.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1562
diff
changeset
|
437 |
41abc345d2f1
Added dummy handling for new boolean property of each point.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1562
diff
changeset
|
438 |
41abc345d2f1
Added dummy handling for new boolean property of each point.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1562
diff
changeset
|
439 /** |
41abc345d2f1
Added dummy handling for new boolean property of each point.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1562
diff
changeset
|
440 * 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
|
441 * 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
|
442 */ |
41abc345d2f1
Added dummy handling for new boolean property of each point.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1562
diff
changeset
|
443 protected void okClicked() { |
41abc345d2f1
Added dummy handling for new boolean property of each point.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1562
diff
changeset
|
444 if(isDialogValid()) { |
41abc345d2f1
Added dummy handling for new boolean property of each point.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1562
diff
changeset
|
445 // 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
|
446 JSONArray list = jsonArrayFromListGrid(); |
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 Data[] feedData = new Data[] { |
2924
60c375173263
Minor refactoring.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2905
diff
changeset
|
449 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
|
450 list.toString()) |
41abc345d2f1
Added dummy handling for new boolean property of each point.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1562
diff
changeset
|
451 }; |
41abc345d2f1
Added dummy handling for new boolean property of each point.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1562
diff
changeset
|
452 |
41abc345d2f1
Added dummy handling for new boolean property of each point.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1562
diff
changeset
|
453 feedService.feed( |
41abc345d2f1
Added dummy handling for new boolean property of each point.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1562
diff
changeset
|
454 Config.getInstance().getLocale(), |
41abc345d2f1
Added dummy handling for new boolean property of each point.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1562
diff
changeset
|
455 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
|
456 feedData, |
41abc345d2f1
Added dummy handling for new boolean property of each point.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1562
diff
changeset
|
457 new AsyncCallback<Artifact>() { |
3983
65e369ac4f99
ManualPointsEditor supports Date x axis values.
Christian Lins <christian.lins@intevation.de>
parents:
3859
diff
changeset
|
458 @Override |
1563
41abc345d2f1
Added dummy handling for new boolean property of each point.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1562
diff
changeset
|
459 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
|
460 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
|
461 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
|
462 enable(); |
41abc345d2f1
Added dummy handling for new boolean property of each point.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1562
diff
changeset
|
463 } |
3983
65e369ac4f99
ManualPointsEditor supports Date x axis values.
Christian Lins <christian.lins@intevation.de>
parents:
3859
diff
changeset
|
464 @Override |
1563
41abc345d2f1
Added dummy handling for new boolean property of each point.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1562
diff
changeset
|
465 public void onSuccess(Artifact fartifact) { |
3706 | 466 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
|
467 redrawRequestHandler.onRedrawRequest( |
41abc345d2f1
Added dummy handling for new boolean property of each point.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1562
diff
changeset
|
468 new RedrawRequestEvent()); |
41abc345d2f1
Added dummy handling for new boolean property of each point.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1562
diff
changeset
|
469 destroy(); |
41abc345d2f1
Added dummy handling for new boolean property of each point.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1562
diff
changeset
|
470 } |
41abc345d2f1
Added dummy handling for new boolean property of each point.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1562
diff
changeset
|
471 }); |
41abc345d2f1
Added dummy handling for new boolean property of each point.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1562
diff
changeset
|
472 } |
41abc345d2f1
Added dummy handling for new boolean property of each point.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1562
diff
changeset
|
473 else { |
41abc345d2f1
Added dummy handling for new boolean property of each point.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1562
diff
changeset
|
474 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
|
475 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
|
476 } |
41abc345d2f1
Added dummy handling for new boolean property of each point.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1562
diff
changeset
|
477 } |
41abc345d2f1
Added dummy handling for new boolean property of each point.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1562
diff
changeset
|
478 |
41abc345d2f1
Added dummy handling for new boolean property of each point.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1562
diff
changeset
|
479 |
1545
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
480 /** Add a ManualPointArtifact to Collection. */ |
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
481 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
|
482 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
|
483 addItem(standByLabel); |
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
484 |
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
485 setWidth(380); |
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
486 setHeight(470); |
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
487 centerInPage(); |
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
488 |
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
489 Config config = Config.getInstance(); |
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
490 String locale = config.getLocale(); |
2905
51ed89b754ae
FLYS client: Removed trailing whitespace.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2482
diff
changeset
|
491 |
1545
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
492 loadArtifactService.load( |
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
493 this.collection, |
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
494 new Recommendation("manualpoints", ""), |
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
495 "manualpoints", |
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
496 locale, |
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
497 new AsyncCallback<Artifact>() { |
3983
65e369ac4f99
ManualPointsEditor supports Date x axis values.
Christian Lins <christian.lins@intevation.de>
parents:
3859
diff
changeset
|
498 @Override |
1545
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
499 public void onFailure(Throwable caught) { |
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
500 GWT.log("Creating manualpoint artifact failed!"); |
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
501 } |
3983
65e369ac4f99
ManualPointsEditor supports Date x axis values.
Christian Lins <christian.lins@intevation.de>
parents:
3859
diff
changeset
|
502 @Override |
1545
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
503 public void onSuccess(Artifact artifact) { |
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
504 GWT.log("Successfully created artifact."); |
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
505 removeItem(standByLabel); |
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
506 uuid = artifact.getUuid(); |
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
507 createUI(); |
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
508 } |
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
509 }); |
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
510 } |
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
511 |
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
512 |
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
513 /** |
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
514 * 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
|
515 * @param event The event. |
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
516 */ |
3983
65e369ac4f99
ManualPointsEditor supports Date x axis values.
Christian Lins <christian.lins@intevation.de>
parents:
3859
diff
changeset
|
517 @Override |
1545
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
518 public void onClick(ClickEvent event) { |
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
519 this.destroy(); |
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 |
1565
87f5ed6960e8
Improved form validation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1564
diff
changeset
|
523 /** 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
|
524 protected boolean isDialogValid() { |
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
525 boolean valid = true; |
1565
87f5ed6960e8
Improved form validation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1564
diff
changeset
|
526 for (ListGridRecord record : listGrid.getRecords()) { |
3859
62332fa199bf
Work on "Date" support for ManualPointsEditor.
Christian Lins <christian.lins@intevation.de>
parents:
3855
diff
changeset
|
527 try { |
62332fa199bf
Work on "Date" support for ManualPointsEditor.
Christian Lins <christian.lins@intevation.de>
parents:
3855
diff
changeset
|
528 if (record.getAttribute(PointRecord.ATTRIBUTE_X) == null |
62332fa199bf
Work on "Date" support for ManualPointsEditor.
Christian Lins <christian.lins@intevation.de>
parents:
3855
diff
changeset
|
529 || record.getAttribute(PointRecord.ATTRIBUTE_Y) == null) { |
62332fa199bf
Work on "Date" support for ManualPointsEditor.
Christian Lins <christian.lins@intevation.de>
parents:
3855
diff
changeset
|
530 return false; |
62332fa199bf
Work on "Date" support for ManualPointsEditor.
Christian Lins <christian.lins@intevation.de>
parents:
3855
diff
changeset
|
531 } |
62332fa199bf
Work on "Date" support for ManualPointsEditor.
Christian Lins <christian.lins@intevation.de>
parents:
3855
diff
changeset
|
532 } |
62332fa199bf
Work on "Date" support for ManualPointsEditor.
Christian Lins <christian.lins@intevation.de>
parents:
3855
diff
changeset
|
533 catch(IllegalArgumentException ex) { |
62332fa199bf
Work on "Date" support for ManualPointsEditor.
Christian Lins <christian.lins@intevation.de>
parents:
3855
diff
changeset
|
534 |
1545
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
535 } |
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
536 } |
1604
cb3629a01126
Issue 473.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1594
diff
changeset
|
537 if (listGrid.hasErrors()) { |
cb3629a01126
Issue 473.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1594
diff
changeset
|
538 valid = false; |
cb3629a01126
Issue 473.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1594
diff
changeset
|
539 } |
1545
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
540 return valid; |
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
541 } |
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
542 } |
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
543 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : |