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