Mercurial > dive4elements > river
annotate flys-client/src/main/java/de/intevation/flys/client/client/ui/chart/ManualPointsEditor.java @ 5536:adcad5104fd1
Fix typo in i18n for potential
author | Andre Heinecke <aheinecke@intevation.de> |
---|---|
date | Wed, 03 Apr 2013 15:32:29 +0200 |
parents | bbd82bd8e541 |
children |
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 Button accept = new Button(MSG.label_ok()); |
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
152 Button cancel = new Button(MSG.label_cancel()); |
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
153 cancel.addClickHandler(this); |
1561
3cf3cd8dd92d
Made manual points edit- and removable.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1553
diff
changeset
|
154 |
1545
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
155 accept.addClickHandler(new ClickHandler() { |
3983
65e369ac4f99
ManualPointsEditor supports Date x axis values.
Christian Lins <christian.lins@intevation.de>
parents:
3859
diff
changeset
|
156 @Override |
1545
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
157 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
|
158 okClicked(); |
1545
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
159 } |
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
160 }); |
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 HLayout buttons = new HLayout(); |
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
163 buttons.addMember(accept); |
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
164 buttons.addMember(cancel); |
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
165 buttons.setAlign(Alignment.CENTER); |
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
166 buttons.setHeight(30); |
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
167 |
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
168 VLayout layout = new VLayout(); |
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
169 listGrid = new ListGrid(); |
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
170 listGrid.setWidth100(); |
1570
eeee85c4d996
Adjusted table height to fill the window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1569
diff
changeset
|
171 listGrid.setHeight("*"); |
1561
3cf3cd8dd92d
Made manual points edit- and removable.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1553
diff
changeset
|
172 listGrid.setCanSort(false); |
3cf3cd8dd92d
Made manual points edit- and removable.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1553
diff
changeset
|
173 listGrid.setCanEdit(true); |
3cf3cd8dd92d
Made manual points edit- and removable.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1553
diff
changeset
|
174 listGrid.setShowHeaderContextMenu(false); |
3cf3cd8dd92d
Made manual points edit- and removable.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1553
diff
changeset
|
175 |
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
|
176 // 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
|
177 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
|
178 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
|
179 |
3983
65e369ac4f99
ManualPointsEditor supports Date x axis values.
Christian Lins <christian.lins@intevation.de>
parents:
3859
diff
changeset
|
180 // 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
|
181 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
|
182 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
|
183 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
|
184 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
|
185 PropertyGroup pg = (PropertyGroup)p; |
3859
62332fa199bf
Work on "Date" support for ManualPointsEditor.
Christian Lins <christian.lins@intevation.de>
parents:
3855
diff
changeset
|
186 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
|
187 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
|
188 (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
|
189 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
|
190 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
|
191 (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
|
192 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
|
193 } |
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 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
|
195 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
|
196 (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
|
197 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
|
198 } |
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 } |
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 } |
3859
62332fa199bf
Work on "Date" support for ManualPointsEditor.
Christian Lins <christian.lins@intevation.de>
parents:
3855
diff
changeset
|
201 |
62332fa199bf
Work on "Date" support for ManualPointsEditor.
Christian Lins <christian.lins@intevation.de>
parents:
3855
diff
changeset
|
202 CellFormatter format = createCellFormatter(); |
62332fa199bf
Work on "Date" support for ManualPointsEditor.
Christian Lins <christian.lins@intevation.de>
parents:
3855
diff
changeset
|
203 CellEditValueParser cevp = createCellEditValueParser(); |
62332fa199bf
Work on "Date" support for ManualPointsEditor.
Christian Lins <christian.lins@intevation.de>
parents:
3855
diff
changeset
|
204 CellEditValueFormatter cevf = createCellEditValueFormatter(); |
62332fa199bf
Work on "Date" support for ManualPointsEditor.
Christian Lins <christian.lins@intevation.de>
parents:
3855
diff
changeset
|
205 |
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
|
206 ListGridField xField = |
3859
62332fa199bf
Work on "Date" support for ManualPointsEditor.
Christian Lins <christian.lins@intevation.de>
parents:
3855
diff
changeset
|
207 new ListGridField(PointRecord.ATTRIBUTE_X, xAxis); |
62332fa199bf
Work on "Date" support for ManualPointsEditor.
Christian Lins <christian.lins@intevation.de>
parents:
3855
diff
changeset
|
208 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
|
209 // 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
|
210 xField.setType(ListGridFieldType.DATE); |
62332fa199bf
Work on "Date" support for ManualPointsEditor.
Christian Lins <christian.lins@intevation.de>
parents:
3855
diff
changeset
|
211 this.fieldTypeX = ListGridFieldType.DATE; |
62332fa199bf
Work on "Date" support for ManualPointsEditor.
Christian Lins <christian.lins@intevation.de>
parents:
3855
diff
changeset
|
212 } |
62332fa199bf
Work on "Date" support for ManualPointsEditor.
Christian Lins <christian.lins@intevation.de>
parents:
3855
diff
changeset
|
213 else { |
62332fa199bf
Work on "Date" support for ManualPointsEditor.
Christian Lins <christian.lins@intevation.de>
parents:
3855
diff
changeset
|
214 xField.setType(ListGridFieldType.FLOAT); |
62332fa199bf
Work on "Date" support for ManualPointsEditor.
Christian Lins <christian.lins@intevation.de>
parents:
3855
diff
changeset
|
215 xField.setCellFormatter(format); |
62332fa199bf
Work on "Date" support for ManualPointsEditor.
Christian Lins <christian.lins@intevation.de>
parents:
3855
diff
changeset
|
216 xField.setEditValueParser(cevp); |
62332fa199bf
Work on "Date" support for ManualPointsEditor.
Christian Lins <christian.lins@intevation.de>
parents:
3855
diff
changeset
|
217 xField.setEditValueFormatter(cevf); |
62332fa199bf
Work on "Date" support for ManualPointsEditor.
Christian Lins <christian.lins@intevation.de>
parents:
3855
diff
changeset
|
218 } |
1563
41abc345d2f1
Added dummy handling for new boolean property of each point.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1562
diff
changeset
|
219 |
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
|
220 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
|
221 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
|
222 yField.setType(ListGridFieldType.FLOAT); |
3859
62332fa199bf
Work on "Date" support for ManualPointsEditor.
Christian Lins <christian.lins@intevation.de>
parents:
3855
diff
changeset
|
223 yField.setCellFormatter(format); |
1604
cb3629a01126
Issue 473.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1594
diff
changeset
|
224 yField.setEditValueParser(cevp); |
cb3629a01126
Issue 473.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1594
diff
changeset
|
225 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
|
226 |
1562
af29d43cf4da
Added basic validation, improved editing function, minor refac.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1561
diff
changeset
|
227 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
|
228 MSG.pointname()); |
1561
3cf3cd8dd92d
Made manual points edit- and removable.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1553
diff
changeset
|
229 final ListGridField removeField = |
3cf3cd8dd92d
Made manual points edit- and removable.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1553
diff
changeset
|
230 new ListGridField("_removeRecord", MSG.removepoint()){{ |
3cf3cd8dd92d
Made manual points edit- and removable.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1553
diff
changeset
|
231 setType(ListGridFieldType.ICON); |
3cf3cd8dd92d
Made manual points edit- and removable.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1553
diff
changeset
|
232 setIcon(GWT.getHostPageBaseURL() + MSG.removeFeature()); |
3cf3cd8dd92d
Made manual points edit- and removable.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1553
diff
changeset
|
233 setCanEdit(false); |
3cf3cd8dd92d
Made manual points edit- and removable.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1553
diff
changeset
|
234 setCanFilter(false); |
3cf3cd8dd92d
Made manual points edit- and removable.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1553
diff
changeset
|
235 setCanSort(false); |
3cf3cd8dd92d
Made manual points edit- and removable.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1553
diff
changeset
|
236 setCanGroupBy(false); |
3cf3cd8dd92d
Made manual points edit- and removable.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1553
diff
changeset
|
237 setCanFreeze(false); |
3cf3cd8dd92d
Made manual points edit- and removable.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1553
diff
changeset
|
238 setWidth(25); |
3cf3cd8dd92d
Made manual points edit- and removable.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1553
diff
changeset
|
239 }}; |
3cf3cd8dd92d
Made manual points edit- and removable.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1553
diff
changeset
|
240 |
1563
41abc345d2f1
Added dummy handling for new boolean property of each point.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1562
diff
changeset
|
241 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
|
242 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
|
243 activeField.setType(ListGridFieldType.BOOLEAN); |
1564
3606f2caf93e
Make manual Points active by default.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1563
diff
changeset
|
244 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
|
245 |
41abc345d2f1
Added dummy handling for new boolean property of each point.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1562
diff
changeset
|
246 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
|
247 nameField, removeField}); |
1545
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
248 |
1561
3cf3cd8dd92d
Made manual points edit- and removable.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1553
diff
changeset
|
249 listGrid.addRecordClickHandler(new RecordClickHandler() { |
3983
65e369ac4f99
ManualPointsEditor supports Date x axis values.
Christian Lins <christian.lins@intevation.de>
parents:
3859
diff
changeset
|
250 @Override |
1561
3cf3cd8dd92d
Made manual points edit- and removable.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1553
diff
changeset
|
251 public void onRecordClick(final RecordClickEvent event) { |
3cf3cd8dd92d
Made manual points edit- and removable.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1553
diff
changeset
|
252 // Just handle remove-clicks |
3cf3cd8dd92d
Made manual points edit- and removable.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1553
diff
changeset
|
253 if(!event.getField().getName().equals(removeField.getName())) { |
3cf3cd8dd92d
Made manual points edit- and removable.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1553
diff
changeset
|
254 return; |
2905
51ed89b754ae
FLYS client: Removed trailing whitespace.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2482
diff
changeset
|
255 } |
1561
3cf3cd8dd92d
Made manual points edit- and removable.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1553
diff
changeset
|
256 event.getViewer().removeData(event.getRecord()); |
3cf3cd8dd92d
Made manual points edit- and removable.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1553
diff
changeset
|
257 } |
3cf3cd8dd92d
Made manual points edit- and removable.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1553
diff
changeset
|
258 }); |
3cf3cd8dd92d
Made manual points edit- and removable.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1553
diff
changeset
|
259 |
3983
65e369ac4f99
ManualPointsEditor supports Date x axis values.
Christian Lins <christian.lins@intevation.de>
parents:
3859
diff
changeset
|
260 // Find the artifacts uuid |
1545
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
261 findManualPointsUUID(); |
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
262 CollectionItem item = collection.getItem(uuid); |
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
263 |
3983
65e369ac4f99
ManualPointsEditor supports Date x axis values.
Christian Lins <christian.lins@intevation.de>
parents:
3859
diff
changeset
|
264 // Add points to grid |
1545
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
265 if (item != null) { |
2924
60c375173263
Minor refactoring.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2905
diff
changeset
|
266 // TODO store this from findPointUUID instead (we touched these). |
60c375173263
Minor refactoring.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2905
diff
changeset
|
267 String jsonData = item.getData().get(pointDataItemName); |
1545
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
268 JSONArray jsonArray = (JSONArray) JSONParser.parse(jsonData); |
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
269 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
|
270 JSONArray point = (JSONArray) jsonArray.get(i); |
3983
65e369ac4f99
ManualPointsEditor supports Date x axis values.
Christian Lins <christian.lins@intevation.de>
parents:
3859
diff
changeset
|
271 listGrid.addData(PointRecord.fromJSON(point)); |
1545
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
272 } |
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
273 } |
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
274 else { |
3983
65e369ac4f99
ManualPointsEditor supports Date x axis values.
Christian Lins <christian.lins@intevation.de>
parents:
3859
diff
changeset
|
275 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
|
276 } |
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
277 |
1553
9ad19e31d149
Improved points UI to also respect language and name of point.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1549
diff
changeset
|
278 IButton button = new IButton(MSG.newpoint()); |
1545
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
279 button.setTop(250); |
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
280 button.addClickHandler(new ClickHandler() { |
3983
65e369ac4f99
ManualPointsEditor supports Date x axis values.
Christian Lins <christian.lins@intevation.de>
parents:
3859
diff
changeset
|
281 @Override |
1545
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
282 public void onClick(ClickEvent event) { |
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
283 listGrid.startEditingNew(); |
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
284 } |
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
285 }); |
1553
9ad19e31d149
Improved points UI to also respect language and name of point.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1549
diff
changeset
|
286 |
9ad19e31d149
Improved points UI to also respect language and name of point.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1549
diff
changeset
|
287 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
|
288 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
|
289 |
9ad19e31d149
Improved points UI to also respect language and name of point.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1549
diff
changeset
|
290 addItem(layout); |
9ad19e31d149
Improved points UI to also respect language and name of point.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1549
diff
changeset
|
291 |
1545
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
292 addItem(buttons); |
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
293 setWidth(380); |
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
294 setHeight(470); |
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
295 centerInPage(); |
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
296 } |
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
297 |
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
298 |
3859
62332fa199bf
Work on "Date" support for ManualPointsEditor.
Christian Lins <christian.lins@intevation.de>
parents:
3855
diff
changeset
|
299 protected CellFormatter createCellFormatter() { |
62332fa199bf
Work on "Date" support for ManualPointsEditor.
Christian Lins <christian.lins@intevation.de>
parents:
3855
diff
changeset
|
300 return new CellFormatter() { |
3983
65e369ac4f99
ManualPointsEditor supports Date x axis values.
Christian Lins <christian.lins@intevation.de>
parents:
3859
diff
changeset
|
301 @Override |
3859
62332fa199bf
Work on "Date" support for ManualPointsEditor.
Christian Lins <christian.lins@intevation.de>
parents:
3855
diff
changeset
|
302 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
|
303 if(value != null) { |
62332fa199bf
Work on "Date" support for ManualPointsEditor.
Christian Lins <christian.lins@intevation.de>
parents:
3855
diff
changeset
|
304 NumberFormat nf = NumberFormat.getDecimalFormat(); |
62332fa199bf
Work on "Date" support for ManualPointsEditor.
Christian Lins <christian.lins@intevation.de>
parents:
3855
diff
changeset
|
305 try { |
62332fa199bf
Work on "Date" support for ManualPointsEditor.
Christian Lins <christian.lins@intevation.de>
parents:
3855
diff
changeset
|
306 double d = Double.valueOf(value.toString()).doubleValue(); |
62332fa199bf
Work on "Date" support for ManualPointsEditor.
Christian Lins <christian.lins@intevation.de>
parents:
3855
diff
changeset
|
307 return nf.format(d); |
62332fa199bf
Work on "Date" support for ManualPointsEditor.
Christian Lins <christian.lins@intevation.de>
parents:
3855
diff
changeset
|
308 } catch (Exception e) { |
62332fa199bf
Work on "Date" support for ManualPointsEditor.
Christian Lins <christian.lins@intevation.de>
parents:
3855
diff
changeset
|
309 return value.toString(); |
62332fa199bf
Work on "Date" support for ManualPointsEditor.
Christian Lins <christian.lins@intevation.de>
parents:
3855
diff
changeset
|
310 } |
62332fa199bf
Work on "Date" support for ManualPointsEditor.
Christian Lins <christian.lins@intevation.de>
parents:
3855
diff
changeset
|
311 } else { |
62332fa199bf
Work on "Date" support for ManualPointsEditor.
Christian Lins <christian.lins@intevation.de>
parents:
3855
diff
changeset
|
312 return null; |
62332fa199bf
Work on "Date" support for ManualPointsEditor.
Christian Lins <christian.lins@intevation.de>
parents:
3855
diff
changeset
|
313 } |
62332fa199bf
Work on "Date" support for ManualPointsEditor.
Christian Lins <christian.lins@intevation.de>
parents:
3855
diff
changeset
|
314 }}; |
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 protected CellEditValueParser createCellEditValueParser() { |
62332fa199bf
Work on "Date" support for ManualPointsEditor.
Christian Lins <christian.lins@intevation.de>
parents:
3855
diff
changeset
|
319 return new CellEditValueParser() { |
3983
65e369ac4f99
ManualPointsEditor supports Date x axis values.
Christian Lins <christian.lins@intevation.de>
parents:
3859
diff
changeset
|
320 @Override |
3859
62332fa199bf
Work on "Date" support for ManualPointsEditor.
Christian Lins <christian.lins@intevation.de>
parents:
3855
diff
changeset
|
321 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
|
322 if (value == null) |
62332fa199bf
Work on "Date" support for ManualPointsEditor.
Christian Lins <christian.lins@intevation.de>
parents:
3855
diff
changeset
|
323 return null; |
62332fa199bf
Work on "Date" support for ManualPointsEditor.
Christian Lins <christian.lins@intevation.de>
parents:
3855
diff
changeset
|
324 try { |
62332fa199bf
Work on "Date" support for ManualPointsEditor.
Christian Lins <christian.lins@intevation.de>
parents:
3855
diff
changeset
|
325 NumberFormat nf = NumberFormat.getDecimalFormat(); |
62332fa199bf
Work on "Date" support for ManualPointsEditor.
Christian Lins <christian.lins@intevation.de>
parents:
3855
diff
changeset
|
326 double d = nf.parse(value.toString()); |
62332fa199bf
Work on "Date" support for ManualPointsEditor.
Christian Lins <christian.lins@intevation.de>
parents:
3855
diff
changeset
|
327 return (new Double(d)).toString(); |
62332fa199bf
Work on "Date" support for ManualPointsEditor.
Christian Lins <christian.lins@intevation.de>
parents:
3855
diff
changeset
|
328 } |
62332fa199bf
Work on "Date" support for ManualPointsEditor.
Christian Lins <christian.lins@intevation.de>
parents:
3855
diff
changeset
|
329 catch(NumberFormatException nfe) { |
62332fa199bf
Work on "Date" support for ManualPointsEditor.
Christian Lins <christian.lins@intevation.de>
parents:
3855
diff
changeset
|
330 return value; |
62332fa199bf
Work on "Date" support for ManualPointsEditor.
Christian Lins <christian.lins@intevation.de>
parents:
3855
diff
changeset
|
331 } |
62332fa199bf
Work on "Date" support for ManualPointsEditor.
Christian Lins <christian.lins@intevation.de>
parents:
3855
diff
changeset
|
332 } |
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 protected CellEditValueFormatter createCellEditValueFormatter() { |
62332fa199bf
Work on "Date" support for ManualPointsEditor.
Christian Lins <christian.lins@intevation.de>
parents:
3855
diff
changeset
|
338 return new CellEditValueFormatter() { |
3983
65e369ac4f99
ManualPointsEditor supports Date x axis values.
Christian Lins <christian.lins@intevation.de>
parents:
3859
diff
changeset
|
339 @Override |
3859
62332fa199bf
Work on "Date" support for ManualPointsEditor.
Christian Lins <christian.lins@intevation.de>
parents:
3855
diff
changeset
|
340 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
|
341 if (value == null) { |
62332fa199bf
Work on "Date" support for ManualPointsEditor.
Christian Lins <christian.lins@intevation.de>
parents:
3855
diff
changeset
|
342 return ""; |
62332fa199bf
Work on "Date" support for ManualPointsEditor.
Christian Lins <christian.lins@intevation.de>
parents:
3855
diff
changeset
|
343 } |
62332fa199bf
Work on "Date" support for ManualPointsEditor.
Christian Lins <christian.lins@intevation.de>
parents:
3855
diff
changeset
|
344 NumberFormat nf = NumberFormat.getDecimalFormat(); |
62332fa199bf
Work on "Date" support for ManualPointsEditor.
Christian Lins <christian.lins@intevation.de>
parents:
3855
diff
changeset
|
345 try { |
62332fa199bf
Work on "Date" support for ManualPointsEditor.
Christian Lins <christian.lins@intevation.de>
parents:
3855
diff
changeset
|
346 double d = Double.valueOf(value.toString()).doubleValue(); |
62332fa199bf
Work on "Date" support for ManualPointsEditor.
Christian Lins <christian.lins@intevation.de>
parents:
3855
diff
changeset
|
347 return nf.format(d); |
62332fa199bf
Work on "Date" support for ManualPointsEditor.
Christian Lins <christian.lins@intevation.de>
parents:
3855
diff
changeset
|
348 } |
62332fa199bf
Work on "Date" support for ManualPointsEditor.
Christian Lins <christian.lins@intevation.de>
parents:
3855
diff
changeset
|
349 catch(NumberFormatException nfe) { |
62332fa199bf
Work on "Date" support for ManualPointsEditor.
Christian Lins <christian.lins@intevation.de>
parents:
3855
diff
changeset
|
350 return value; |
62332fa199bf
Work on "Date" support for ManualPointsEditor.
Christian Lins <christian.lins@intevation.de>
parents:
3855
diff
changeset
|
351 } |
62332fa199bf
Work on "Date" support for ManualPointsEditor.
Christian Lins <christian.lins@intevation.de>
parents:
3855
diff
changeset
|
352 } |
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 |
3983
65e369ac4f99
ManualPointsEditor supports Date x axis values.
Christian Lins <christian.lins@intevation.de>
parents:
3859
diff
changeset
|
356 protected String getLocaleDateFormat() { |
65e369ac4f99
ManualPointsEditor supports Date x axis values.
Christian Lins <christian.lins@intevation.de>
parents:
3859
diff
changeset
|
357 String loc = Config.getInstance().getLocale(); |
65e369ac4f99
ManualPointsEditor supports Date x axis values.
Christian Lins <christian.lins@intevation.de>
parents:
3859
diff
changeset
|
358 if ("de".equals(loc)) { |
65e369ac4f99
ManualPointsEditor supports Date x axis values.
Christian Lins <christian.lins@intevation.de>
parents:
3859
diff
changeset
|
359 return "yy.MM.yyyy"; |
65e369ac4f99
ManualPointsEditor supports Date x axis values.
Christian Lins <christian.lins@intevation.de>
parents:
3859
diff
changeset
|
360 } |
65e369ac4f99
ManualPointsEditor supports Date x axis values.
Christian Lins <christian.lins@intevation.de>
parents:
3859
diff
changeset
|
361 else { |
65e369ac4f99
ManualPointsEditor supports Date x axis values.
Christian Lins <christian.lins@intevation.de>
parents:
3859
diff
changeset
|
362 return "MM/dd/yyyy"; |
65e369ac4f99
ManualPointsEditor supports Date x axis values.
Christian Lins <christian.lins@intevation.de>
parents:
3859
diff
changeset
|
363 } |
65e369ac4f99
ManualPointsEditor supports Date x axis values.
Christian Lins <christian.lins@intevation.de>
parents:
3859
diff
changeset
|
364 } |
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 protected String formatDate(Date date) { |
65e369ac4f99
ManualPointsEditor supports Date x axis values.
Christian Lins <christian.lins@intevation.de>
parents:
3859
diff
changeset
|
367 DateTimeFormat dtf = DateTimeFormat.getFormat(getLocaleDateFormat()); |
65e369ac4f99
ManualPointsEditor supports Date x axis values.
Christian Lins <christian.lins@intevation.de>
parents:
3859
diff
changeset
|
368 return dtf.format(date); |
65e369ac4f99
ManualPointsEditor supports Date x axis values.
Christian Lins <christian.lins@intevation.de>
parents:
3859
diff
changeset
|
369 } |
3859
62332fa199bf
Work on "Date" support for ManualPointsEditor.
Christian Lins <christian.lins@intevation.de>
parents:
3855
diff
changeset
|
370 |
1563
41abc345d2f1
Added dummy handling for new boolean property of each point.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1562
diff
changeset
|
371 /** 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
|
372 protected JSONArray jsonArrayFromListGrid() { |
41abc345d2f1
Added dummy handling for new boolean property of each point.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1562
diff
changeset
|
373 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
|
374 int idx = 0; |
41abc345d2f1
Added dummy handling for new boolean property of each point.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1562
diff
changeset
|
375 |
41abc345d2f1
Added dummy handling for new boolean property of each point.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1562
diff
changeset
|
376 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
|
377 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
|
378 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
|
379 |
41abc345d2f1
Added dummy handling for new boolean property of each point.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1562
diff
changeset
|
380 PointRecord point = (PointRecord) record; |
3983
65e369ac4f99
ManualPointsEditor supports Date x axis values.
Christian Lins <christian.lins@intevation.de>
parents:
3859
diff
changeset
|
381 if(point.isTimeseriesPoint()) { |
65e369ac4f99
ManualPointsEditor supports Date x axis values.
Christian Lins <christian.lins@intevation.de>
parents:
3859
diff
changeset
|
382 data.set(0, new JSONString(point.getXAsDate())); |
65e369ac4f99
ManualPointsEditor supports Date x axis values.
Christian Lins <christian.lins@intevation.de>
parents:
3859
diff
changeset
|
383 GWT.log("Date: " + point.getXAsDate()); |
65e369ac4f99
ManualPointsEditor supports Date x axis values.
Christian Lins <christian.lins@intevation.de>
parents:
3859
diff
changeset
|
384 } |
65e369ac4f99
ManualPointsEditor supports Date x axis values.
Christian Lins <christian.lins@intevation.de>
parents:
3859
diff
changeset
|
385 else { |
65e369ac4f99
ManualPointsEditor supports Date x axis values.
Christian Lins <christian.lins@intevation.de>
parents:
3859
diff
changeset
|
386 data.set(0, new JSONNumber(point.getX())); |
65e369ac4f99
ManualPointsEditor supports Date x axis values.
Christian Lins <christian.lins@intevation.de>
parents:
3859
diff
changeset
|
387 } |
1563
41abc345d2f1
Added dummy handling for new boolean property of each point.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1562
diff
changeset
|
388 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
|
389 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
|
390 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
|
391 |
41abc345d2f1
Added dummy handling for new boolean property of each point.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1562
diff
changeset
|
392 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
|
393 idx++; |
41abc345d2f1
Added dummy handling for new boolean property of each point.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1562
diff
changeset
|
394 } |
41abc345d2f1
Added dummy handling for new boolean property of each point.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1562
diff
changeset
|
395 else { |
41abc345d2f1
Added dummy handling for new boolean property of each point.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1562
diff
changeset
|
396 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
|
397 |
1565
87f5ed6960e8
Improved form validation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1564
diff
changeset
|
398 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
|
399 // 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
|
400 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
|
401 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
|
402 PointRecord.ATTRIBUTE_X); |
41abc345d2f1
Added dummy handling for new boolean property of each point.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1562
diff
changeset
|
403 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
|
404 PointRecord.ATTRIBUTE_Y); |
41abc345d2f1
Added dummy handling for new boolean property of each point.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1562
diff
changeset
|
405 nameString = xString + "/" + yString; |
41abc345d2f1
Added dummy handling for new boolean property of each point.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1562
diff
changeset
|
406 } |
41abc345d2f1
Added dummy handling for new boolean property of each point.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1562
diff
changeset
|
407 |
3859
62332fa199bf
Work on "Date" support for ManualPointsEditor.
Christian Lins <christian.lins@intevation.de>
parents:
3855
diff
changeset
|
408 if(fieldTypeX.equals(ListGridFieldType.DATE)) { |
3983
65e369ac4f99
ManualPointsEditor supports Date x axis values.
Christian Lins <christian.lins@intevation.de>
parents:
3859
diff
changeset
|
409 Date date = record.getAttributeAsDate(PointRecord.ATTRIBUTE_X); |
65e369ac4f99
ManualPointsEditor supports Date x axis values.
Christian Lins <christian.lins@intevation.de>
parents:
3859
diff
changeset
|
410 data.set(0, new JSONString(formatDate(date))); |
65e369ac4f99
ManualPointsEditor supports Date x axis values.
Christian Lins <christian.lins@intevation.de>
parents:
3859
diff
changeset
|
411 GWT.log("Date: " + formatDate(date)); |
3859
62332fa199bf
Work on "Date" support for ManualPointsEditor.
Christian Lins <christian.lins@intevation.de>
parents:
3855
diff
changeset
|
412 } |
62332fa199bf
Work on "Date" support for ManualPointsEditor.
Christian Lins <christian.lins@intevation.de>
parents:
3855
diff
changeset
|
413 else { |
62332fa199bf
Work on "Date" support for ManualPointsEditor.
Christian Lins <christian.lins@intevation.de>
parents:
3855
diff
changeset
|
414 data.set(0, new JSONNumber(record. |
62332fa199bf
Work on "Date" support for ManualPointsEditor.
Christian Lins <christian.lins@intevation.de>
parents:
3855
diff
changeset
|
415 getAttributeAsDouble(PointRecord.ATTRIBUTE_X))); |
62332fa199bf
Work on "Date" support for ManualPointsEditor.
Christian Lins <christian.lins@intevation.de>
parents:
3855
diff
changeset
|
416 } |
1563
41abc345d2f1
Added dummy handling for new boolean property of each point.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1562
diff
changeset
|
417 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
|
418 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
|
419 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
|
420 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
|
421 PointRecord.ATTRIBUTE_ACTIVE))); |
41abc345d2f1
Added dummy handling for new boolean property of each point.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1562
diff
changeset
|
422 |
41abc345d2f1
Added dummy handling for new boolean property of each point.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1562
diff
changeset
|
423 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
|
424 idx++; |
41abc345d2f1
Added dummy handling for new boolean property of each point.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1562
diff
changeset
|
425 } |
41abc345d2f1
Added dummy handling for new boolean property of each point.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1562
diff
changeset
|
426 } |
41abc345d2f1
Added dummy handling for new boolean property of each point.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1562
diff
changeset
|
427 return list; |
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 |
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 * 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
|
433 * 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
|
434 */ |
41abc345d2f1
Added dummy handling for new boolean property of each point.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1562
diff
changeset
|
435 protected void okClicked() { |
41abc345d2f1
Added dummy handling for new boolean property of each point.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1562
diff
changeset
|
436 if(isDialogValid()) { |
41abc345d2f1
Added dummy handling for new boolean property of each point.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1562
diff
changeset
|
437 // 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
|
438 JSONArray list = jsonArrayFromListGrid(); |
41abc345d2f1
Added dummy handling for new boolean property of each point.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1562
diff
changeset
|
439 |
41abc345d2f1
Added dummy handling for new boolean property of each point.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1562
diff
changeset
|
440 Data[] feedData = new Data[] { |
2924
60c375173263
Minor refactoring.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2905
diff
changeset
|
441 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
|
442 list.toString()) |
41abc345d2f1
Added dummy handling for new boolean property of each point.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1562
diff
changeset
|
443 }; |
41abc345d2f1
Added dummy handling for new boolean property of each point.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1562
diff
changeset
|
444 |
41abc345d2f1
Added dummy handling for new boolean property of each point.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1562
diff
changeset
|
445 feedService.feed( |
41abc345d2f1
Added dummy handling for new boolean property of each point.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1562
diff
changeset
|
446 Config.getInstance().getLocale(), |
41abc345d2f1
Added dummy handling for new boolean property of each point.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1562
diff
changeset
|
447 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
|
448 feedData, |
41abc345d2f1
Added dummy handling for new boolean property of each point.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1562
diff
changeset
|
449 new AsyncCallback<Artifact>() { |
3983
65e369ac4f99
ManualPointsEditor supports Date x axis values.
Christian Lins <christian.lins@intevation.de>
parents:
3859
diff
changeset
|
450 @Override |
1563
41abc345d2f1
Added dummy handling for new boolean property of each point.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1562
diff
changeset
|
451 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
|
452 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
|
453 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
|
454 enable(); |
41abc345d2f1
Added dummy handling for new boolean property of each point.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1562
diff
changeset
|
455 } |
3983
65e369ac4f99
ManualPointsEditor supports Date x axis values.
Christian Lins <christian.lins@intevation.de>
parents:
3859
diff
changeset
|
456 @Override |
1563
41abc345d2f1
Added dummy handling for new boolean property of each point.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1562
diff
changeset
|
457 public void onSuccess(Artifact fartifact) { |
3706 | 458 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
|
459 redrawRequestHandler.onRedrawRequest( |
41abc345d2f1
Added dummy handling for new boolean property of each point.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1562
diff
changeset
|
460 new RedrawRequestEvent()); |
41abc345d2f1
Added dummy handling for new boolean property of each point.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1562
diff
changeset
|
461 destroy(); |
41abc345d2f1
Added dummy handling for new boolean property of each point.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1562
diff
changeset
|
462 } |
41abc345d2f1
Added dummy handling for new boolean property of each point.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1562
diff
changeset
|
463 }); |
41abc345d2f1
Added dummy handling for new boolean property of each point.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1562
diff
changeset
|
464 } |
41abc345d2f1
Added dummy handling for new boolean property of each point.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1562
diff
changeset
|
465 else { |
41abc345d2f1
Added dummy handling for new boolean property of each point.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1562
diff
changeset
|
466 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
|
467 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
|
468 } |
41abc345d2f1
Added dummy handling for new boolean property of each point.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1562
diff
changeset
|
469 } |
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 |
1545
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
472 /** Add a ManualPointArtifact to Collection. */ |
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
473 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
|
474 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
|
475 addItem(standByLabel); |
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
476 |
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
477 setWidth(380); |
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
478 setHeight(470); |
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
479 centerInPage(); |
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
480 |
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
481 Config config = Config.getInstance(); |
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
482 String locale = config.getLocale(); |
2905
51ed89b754ae
FLYS client: Removed trailing whitespace.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2482
diff
changeset
|
483 |
1545
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
484 loadArtifactService.load( |
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
485 this.collection, |
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
486 new Recommendation("manualpoints", ""), |
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
487 "manualpoints", |
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
488 locale, |
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
489 new AsyncCallback<Artifact>() { |
3983
65e369ac4f99
ManualPointsEditor supports Date x axis values.
Christian Lins <christian.lins@intevation.de>
parents:
3859
diff
changeset
|
490 @Override |
1545
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
491 public void onFailure(Throwable caught) { |
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
492 GWT.log("Creating manualpoint artifact failed!"); |
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
493 } |
3983
65e369ac4f99
ManualPointsEditor supports Date x axis values.
Christian Lins <christian.lins@intevation.de>
parents:
3859
diff
changeset
|
494 @Override |
1545
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
495 public void onSuccess(Artifact artifact) { |
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
496 GWT.log("Successfully created artifact."); |
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
497 removeItem(standByLabel); |
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
498 uuid = artifact.getUuid(); |
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
499 createUI(); |
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
500 } |
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
501 }); |
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 * 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
|
507 * @param event The event. |
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
508 */ |
3983
65e369ac4f99
ManualPointsEditor supports Date x axis values.
Christian Lins <christian.lins@intevation.de>
parents:
3859
diff
changeset
|
509 @Override |
1545
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
510 public void onClick(ClickEvent event) { |
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
511 this.destroy(); |
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
512 } |
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
513 |
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
514 |
1565
87f5ed6960e8
Improved form validation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1564
diff
changeset
|
515 /** 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
|
516 protected boolean isDialogValid() { |
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
517 boolean valid = true; |
1565
87f5ed6960e8
Improved form validation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1564
diff
changeset
|
518 for (ListGridRecord record : listGrid.getRecords()) { |
3859
62332fa199bf
Work on "Date" support for ManualPointsEditor.
Christian Lins <christian.lins@intevation.de>
parents:
3855
diff
changeset
|
519 try { |
62332fa199bf
Work on "Date" support for ManualPointsEditor.
Christian Lins <christian.lins@intevation.de>
parents:
3855
diff
changeset
|
520 if (record.getAttribute(PointRecord.ATTRIBUTE_X) == null |
62332fa199bf
Work on "Date" support for ManualPointsEditor.
Christian Lins <christian.lins@intevation.de>
parents:
3855
diff
changeset
|
521 || record.getAttribute(PointRecord.ATTRIBUTE_Y) == null) { |
62332fa199bf
Work on "Date" support for ManualPointsEditor.
Christian Lins <christian.lins@intevation.de>
parents:
3855
diff
changeset
|
522 return false; |
62332fa199bf
Work on "Date" support for ManualPointsEditor.
Christian Lins <christian.lins@intevation.de>
parents:
3855
diff
changeset
|
523 } |
62332fa199bf
Work on "Date" support for ManualPointsEditor.
Christian Lins <christian.lins@intevation.de>
parents:
3855
diff
changeset
|
524 } |
62332fa199bf
Work on "Date" support for ManualPointsEditor.
Christian Lins <christian.lins@intevation.de>
parents:
3855
diff
changeset
|
525 catch(IllegalArgumentException ex) { |
62332fa199bf
Work on "Date" support for ManualPointsEditor.
Christian Lins <christian.lins@intevation.de>
parents:
3855
diff
changeset
|
526 |
1545
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
527 } |
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
528 } |
1604
cb3629a01126
Issue 473.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1594
diff
changeset
|
529 if (listGrid.hasErrors()) { |
cb3629a01126
Issue 473.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1594
diff
changeset
|
530 valid = false; |
cb3629a01126
Issue 473.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1594
diff
changeset
|
531 } |
1545
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
532 return valid; |
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
533 } |
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
534 } |
2f0150f21e77
Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
535 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : |