annotate flys-client/src/main/java/de/intevation/flys/client/client/ui/chart/ManualPointsEditor.java @ 1553:9ad19e31d149

Improved points UI to also respect language and name of point. flys-client/trunk@3791 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Felix Wolfsteller <felix.wolfsteller@intevation.de>
date Fri, 27 Jan 2012 12:03:04 +0000
parents 42f1213dfbcc
children 3cf3cd8dd92d
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
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
3 import com.google.gwt.json.client.JSONArray;
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
4 import com.google.gwt.json.client.JSONNumber;
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
5 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
6 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
7 import com.google.gwt.core.client.GWT;
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
8 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
9
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
10 import com.smartgwt.client.util.SC;
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
11 import com.smartgwt.client.widgets.Window;
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
12 import com.smartgwt.client.widgets.layout.VLayout;
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
13 import com.smartgwt.client.widgets.layout.HLayout;
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
14 import com.smartgwt.client.widgets.IButton;
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
15 import com.smartgwt.client.widgets.Button;
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
16 import com.smartgwt.client.widgets.Label;
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
17 import com.smartgwt.client.widgets.Canvas;
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
18 import com.smartgwt.client.widgets.grid.ListGrid;
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
19 import com.smartgwt.client.widgets.grid.ListGridField;
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
20 import com.smartgwt.client.widgets.grid.ListGridRecord;
1553
9ad19e31d149 Improved points UI to also respect language and name of point.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1549
diff changeset
21 import com.smartgwt.client.types.ListGridFieldType;
1545
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
22
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
23 import com.smartgwt.client.widgets.form.DynamicForm;
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
24
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
25 import com.smartgwt.client.widgets.events.ClickEvent;
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
26 import com.smartgwt.client.widgets.events.ClickHandler;
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
27
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
28 import com.smartgwt.client.types.Alignment;
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
29
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
30 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
31
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
32 import de.intevation.flys.client.client.Config;
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
33 import de.intevation.flys.client.client.FLYSConstants;
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
34 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
35 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
36 import de.intevation.flys.client.client.utils.DoubleValidator;
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.services.LoadArtifactService;
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
39 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
40 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
41 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
42
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
43 import de.intevation.flys.client.shared.model.Data;
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
44 import de.intevation.flys.client.shared.model.DefaultArtifact;
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
45 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
46 import de.intevation.flys.client.shared.model.Recommendation;
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
47
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
48 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
49 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
50 import de.intevation.flys.client.client.event.RedrawRequestEvent.Type;
42f1213dfbcc Let ManualPointEditor use RedrawRequests to let freshly edited points show up in Chart.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1548
diff changeset
51
1545
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
52
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
53 /**
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
54 * 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
55 */
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
56 public class ManualPointsEditor
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
57 extends Window
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
58 implements ClickHandler
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
59 {
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
60 /** The interface that provides i18n messages. */
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
61 protected FLYSConstants MSG = GWT.create(FLYSConstants.class);
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
62
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
63 /** Name of the main data item to be fed. */
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
64 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
65 // TODO with separate point sets in multiple diagrams, we might need
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
66 // different POINT_DATA-names (e.g. one per diagram).
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
67
1549
42f1213dfbcc Let ManualPointEditor use RedrawRequests to let freshly edited points show up in Chart.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1548
diff changeset
68 /** When we chaged something, we need a RedrawRequest(Handler). */
42f1213dfbcc Let ManualPointEditor use RedrawRequests to let freshly edited points show up in Chart.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1548
diff changeset
69 protected RedrawRequestHandler redrawRequestHandler;
1545
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
70
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
71 /** The collection */
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
72 protected Collection collection;
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
73
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
74 /** The listGrid showing point entries. */
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
75 protected ListGrid listGrid;
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
76
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
77 /** 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
78 LoadArtifactServiceAsync loadArtifactService = GWT.create(
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
79 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
80
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
81 /** 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
82 FeedServiceAsync feedService = GWT.create(
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
83 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
84
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
85 /** UUID of artifact to feed. */
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
86 protected String uuid;
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
87
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
88
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
89 /**
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
90 * Setup editor dialog.
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
91 * @param collection The collection to use.
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
92 */
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
93 public ManualPointsEditor(Collection collection,
42f1213dfbcc Let ManualPointEditor use RedrawRequests to let freshly edited points show up in Chart.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1548
diff changeset
94 RedrawRequestHandler 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
95 ) {
1545
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
96 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
97 this.redrawRequestHandler = handler;
1545
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
98 init();
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
99 }
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 /** 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
103 public String findManualPointsUUID() {
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
104 // 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
105 int size = collection.getItemLength();
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
106
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
107 for (int i = 0; i < size; i++) {
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
108 CollectionItem item = collection.getItem(i);
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
109 String dataValue = (String) item.getData().get(POINT_DATA);
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
110 if (dataValue != null) {
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
111 // Found it.
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
112 uuid = item.identifier();
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
113 return uuid;
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
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
117 return null;
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
118 }
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
119
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
120
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
121 /**
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
122 * Initialize the editor window and its components.
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
123 */
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
124 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
125 setTitle(MSG.addpoints());
1545
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
126 setCanDragReposition(true);
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
127 setCanDragResize(true);
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 // If no manualpoints artifact found, create it now.
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
130 if(findManualPointsUUID() == null) {
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
131 addArtifactCreateUI();
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 else {
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
134 createUI();
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 }
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
137
1547
76377fe3f0c7 Cosmetics.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1545
diff changeset
138
1545
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
139 /** Create and setup/add the ui. */
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
140 public void createUI() {
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
141 Config config = Config.getInstance();
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
142
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
143 Button accept = new Button(MSG.label_ok());
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
144 Button cancel = new Button(MSG.label_cancel());
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
145 cancel.addClickHandler(this);
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
146 accept.addClickHandler(new ClickHandler() {
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
147 public void onClick(ClickEvent e) {
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
148 if(isDialogValid()) {
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
149 // Feed JSON-encoded content of listgrid.
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
150 String jsonString = "";
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
151 int idx = 0;
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
152 JSONArray list = new JSONArray();
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
153
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
154 for(ListGridRecord record : listGrid.getRecords()) {
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
155 if (record instanceof PointRecord) {
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
156 JSONArray data = new JSONArray();
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
157
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
158 PointRecord point = (PointRecord) record;
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
159 data.set(0, new JSONNumber(point.getX()));
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
160 data.set(1, new JSONNumber(point.getY()));
1553
9ad19e31d149 Improved points UI to also respect language and name of point.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1549
diff changeset
161 data.set(2, new JSONString(point.getName()));
1545
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
162
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
163 list.set(idx, data);
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
164 idx++;
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 else {
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
167 JSONArray data = new JSONArray();
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
168
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
169 // TODO better get double directly (via cell-formatter etc)
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
170 String xString = record.getAttributeAsString("X");
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
171 String yString = record.getAttributeAsString("Y");
1553
9ad19e31d149 Improved points UI to also respect language and name of point.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1549
diff changeset
172 String nameString = record.getAttributeAsString("name");
9ad19e31d149 Improved points UI to also respect language and name of point.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1549
diff changeset
173 if (nameString == null || nameString.equals("")) {
9ad19e31d149 Improved points UI to also respect language and name of point.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1549
diff changeset
174 nameString = xString + "/" + yString;
9ad19e31d149 Improved points UI to also respect language and name of point.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1549
diff changeset
175 }
1545
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
176
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
177 data.set(0, new JSONNumber(Double.valueOf(xString)));
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
178 data.set(1, new JSONNumber(Double.valueOf(yString)));
1553
9ad19e31d149 Improved points UI to also respect language and name of point.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1549
diff changeset
179 data.set(2, new JSONString(nameString));
1545
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
180
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
181 list.set(idx, data);
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
182 idx++;
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
183 }
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
184 }
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
185
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
186 // Feed list.toString to respective artifact.
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
187 Data[] feedData = new Data[] {
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
188 DefaultData.createSimpleStringData(POINT_DATA,
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
189 list.toString())
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
190 };
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
191 feedService.feed(
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
192 Config.getInstance().getLocale(),
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
193 new DefaultArtifact(uuid, "TODO:hash"),
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
194 feedData,
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
195 new AsyncCallback<Artifact>() {
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
196 public void onFailure(Throwable caught) {
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
197 GWT.log("Could not feed artifact with points.");
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
198 SC.warn(MSG.getString(caught.getMessage()));
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
199 enable();
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
200 }
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
201 public void onSuccess(Artifact fartifact) {
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
202 GWT.log("Successfully set points ");
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
203 // TODO refresh collection such that next time
42f1213dfbcc Let ManualPointEditor use RedrawRequests to let freshly edited points show up in Chart.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1548
diff changeset
204 // the new points are shown.
1545
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
205 //requestRedraw();
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
206 //updateCollection();
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
207 //updateGrid();
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
208 //enable();
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
209 redrawRequestHandler.onRedrawRequest(
42f1213dfbcc Let ManualPointEditor use RedrawRequests to let freshly edited points show up in Chart.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1548
diff changeset
210 new RedrawRequestEvent(Type.DEFAULT));
1545
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
211 destroy();
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
212 }
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
213 });
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
214 }
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
215 else {
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
216 GWT.log("Dialog not valid");
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
217 SC.warn(MSG.error_dialog_not_valid());
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
218 }
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
219 }
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
220 });
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
221
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
222 HLayout buttons = new HLayout();
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
223 buttons.addMember(accept);
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
224 buttons.addMember(cancel);
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
225 buttons.setAlign(Alignment.CENTER);
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
226 buttons.setHeight(30);
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
227
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
228 VLayout layout = new VLayout();
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
229 listGrid = new ListGrid();
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
230 listGrid.setWidth100();
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
231 listGrid.setHeight(200);
1553
9ad19e31d149 Improved points UI to also respect language and name of point.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1549
diff changeset
232 // TODO X and Y Header depend on the current chart and axis (e.g. W[nn+m])
9ad19e31d149 Improved points UI to also respect language and name of point.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1549
diff changeset
233 ListGridField xField = new ListGridField("X", "X");
9ad19e31d149 Improved points UI to also respect language and name of point.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1549
diff changeset
234 xField.setType(ListGridFieldType.FLOAT);
9ad19e31d149 Improved points UI to also respect language and name of point.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1549
diff changeset
235 ListGridField yField = new ListGridField("Y", "Y");
9ad19e31d149 Improved points UI to also respect language and name of point.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1549
diff changeset
236 yField.setType(ListGridFieldType.FLOAT);
9ad19e31d149 Improved points UI to also respect language and name of point.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1549
diff changeset
237 ListGridField nameField = new ListGridField("name",
9ad19e31d149 Improved points UI to also respect language and name of point.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1549
diff changeset
238 MSG.pointname());
9ad19e31d149 Improved points UI to also respect language and name of point.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1549
diff changeset
239 ListGridField removeField = new ListGridField("remove",
9ad19e31d149 Improved points UI to also respect language and name of point.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1549
diff changeset
240 MSG.removepoint());
9ad19e31d149 Improved points UI to also respect language and name of point.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1549
diff changeset
241 listGrid.setFields(new ListGridField[] {xField, yField,
9ad19e31d149 Improved points UI to also respect language and name of point.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1549
diff changeset
242 nameField, removeField});
1545
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
243
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
244 // Find the artifacts uuid.
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
245 findManualPointsUUID();
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
246 CollectionItem item = collection.getItem(uuid);
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
247
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
248 // Add points to grid.
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
249 if (item != null) {
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
250 String jsonData = item.getData().get(POINT_DATA);
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
251 JSONArray jsonArray = (JSONArray) JSONParser.parse(jsonData);
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
252 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
253 JSONArray point = (JSONArray) jsonArray.get(i);
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
254 listGrid.addData(pointRecordFromJSON(point));
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
255 }
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
256 }
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
257 else {
1553
9ad19e31d149 Improved points UI to also respect language and name of point.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1549
diff changeset
258 // TODO proper log
1545
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
259 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
260 }
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
261
1553
9ad19e31d149 Improved points UI to also respect language and name of point.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1549
diff changeset
262 IButton button = new IButton(MSG.newpoint());
1545
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
263 button.setTop(250);
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
264 button.addClickHandler(new ClickHandler() {
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
265 public void onClick(ClickEvent event) {
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
266 listGrid.startEditingNew();
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
267 }
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
268 });
1553
9ad19e31d149 Improved points UI to also respect language and name of point.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1549
diff changeset
269
9ad19e31d149 Improved points UI to also respect language and name of point.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1549
diff changeset
270 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
271 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
272
9ad19e31d149 Improved points UI to also respect language and name of point.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1549
diff changeset
273 addItem(layout);
9ad19e31d149 Improved points UI to also respect language and name of point.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1549
diff changeset
274
1545
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
275 addItem(buttons);
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
276 setWidth(380);
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
277 setHeight(470);
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
278 centerInPage();
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
279 }
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
280
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
281
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
282 /** 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
283 public PointRecord pointRecordFromJSON(JSONArray jsonArray) {
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
284 JSONNumber x = (JSONNumber) jsonArray.get(0);
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
285 JSONNumber y = (JSONNumber) jsonArray.get(1);
1553
9ad19e31d149 Improved points UI to also respect language and name of point.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1549
diff changeset
286 JSONString s = (JSONString) jsonArray.get(2);
9ad19e31d149 Improved points UI to also respect language and name of point.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1549
diff changeset
287 return new PointRecord(x.doubleValue(), y.doubleValue(), s.stringValue());
1545
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
288 }
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
289
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
290
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
291 /** Add a ManualPointArtifact to Collection. */
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
292 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
293 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
294 addItem(standByLabel);
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
295
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
296 setWidth(380);
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
297 setHeight(470);
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
298 centerInPage();
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
299
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
300 Config config = Config.getInstance();
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
301 String locale = config.getLocale();
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
302
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
303 loadArtifactService.load(
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
304 this.collection,
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
305 new Recommendation("manualpoints", ""),
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
306 "manualpoints",
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
307 locale,
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
308 new AsyncCallback<Artifact>() {
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
309 public void onFailure(Throwable caught) {
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
310 GWT.log("Creating manualpoint artifact failed!");
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 public void onSuccess(Artifact artifact) {
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
313 GWT.log("Successfully created artifact.");
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
314 removeItem(standByLabel);
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
315 uuid = artifact.getUuid();
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
316 createUI();
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
317 }
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
318 });
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
319 }
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
320
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
321
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 * 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
324 * @param event The event.
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
325 */
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
326 public void onClick(ClickEvent event) {
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
327 this.destroy();
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
328 }
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
329
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
330
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
331 /** Simple record to store points. */
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
332 public class PointRecord extends ListGridRecord {
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
333 protected static final String ATTRIBUTE_X = "X";
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
334 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
335 protected static final String ATTRIBUTE_NAME = "name";
1545
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
336
1553
9ad19e31d149 Improved points UI to also respect language and name of point.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1549
diff changeset
337 String name;
1545
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
338 double x;
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
339 double y;
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
340
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
341 private PointRecord() {;}
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
342
1553
9ad19e31d149 Improved points UI to also respect language and name of point.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1549
diff changeset
343 public PointRecord(double x, double y, String name) {
9ad19e31d149 Improved points UI to also respect language and name of point.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1549
diff changeset
344 setName(name);
1545
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
345 setX(x);
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
346 setY(y);
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
347 }
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
348
1553
9ad19e31d149 Improved points UI to also respect language and name of point.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1549
diff changeset
349 public void setName(String name) {
9ad19e31d149 Improved points UI to also respect language and name of point.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1549
diff changeset
350 this.name = name;
9ad19e31d149 Improved points UI to also respect language and name of point.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1549
diff changeset
351 setAttribute(ATTRIBUTE_NAME, getName());
9ad19e31d149 Improved points UI to also respect language and name of point.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1549
diff changeset
352 }
9ad19e31d149 Improved points UI to also respect language and name of point.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1549
diff changeset
353
9ad19e31d149 Improved points UI to also respect language and name of point.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1549
diff changeset
354 public String getName() {
9ad19e31d149 Improved points UI to also respect language and name of point.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1549
diff changeset
355 return this.name;
9ad19e31d149 Improved points UI to also respect language and name of point.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1549
diff changeset
356 }
9ad19e31d149 Improved points UI to also respect language and name of point.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1549
diff changeset
357
1545
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
358 public void setX(double x) {
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
359 this.x = x;
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
360 setAttribute(ATTRIBUTE_X, getX());
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
361 }
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
362
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
363 public void setY(double y) {
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
364 this.y = y;
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
365 setAttribute(ATTRIBUTE_Y, getY());
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
366 }
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
367
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
368 public double getX() {
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
369 return this.x;
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
370 }
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
371
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
372 public double getY() {
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
373 return this.y;
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
374 }
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
375 }
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
376
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
377
1553
9ad19e31d149 Improved points UI to also respect language and name of point.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1549
diff changeset
378 // TODO validate entered values (CellFormatter).
1545
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
379 protected boolean isDialogValid() {
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
380 boolean valid = true;
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
381 /*
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
382 for (int i = 0; i < tabs.getNumTabs(); i++) {
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
383 Tab t = tabs.getTab(i);
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
384 Canvas container = t.getPane();
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
385 Canvas[] children = container.getChildren();
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
386 for (Canvas c: children) {
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
387 valid = validateCanvas(c);
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
388 if(!valid) {
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
389 return valid;
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
390 }
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
391 }
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
392 }
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
393 */
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
394 return valid;
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
395 }
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
396
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
397
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
398 protected boolean validateCanvas(Canvas c) {
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
399 boolean valid = true;
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
400 if(c instanceof DynamicForm) {
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
401 DynamicForm f = (DynamicForm) c;
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
402 return !f.hasErrors();
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
403 }
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
404 else if(c.getChildren().length > 0) {
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
405 for (Canvas child: c.getChildren()) {
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
406 valid = validateCanvas(child);
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
407 if(!valid) {
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
408 return valid;
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
409 }
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
410 }
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
411 }
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
412 return valid;
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
413 }
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
414 }
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
415 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :

http://dive4elements.wald.intevation.org