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