annotate flys-client/src/main/java/de/intevation/flys/client/client/ui/chart/ManualPointsEditor.java @ 1549:42f1213dfbcc

Let ManualPointEditor use RedrawRequests to let freshly edited points show up in Chart. flys-client/trunk@3780 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Felix Wolfsteller <felix.wolfsteller@intevation.de>
date Fri, 27 Jan 2012 09:26:53 +0000
parents e2f74131ffc1
children 9ad19e31d149
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;
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
6 import com.google.gwt.core.client.GWT;
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
7 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
8
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
9 import com.smartgwt.client.util.SC;
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
10 import com.smartgwt.client.widgets.Window;
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
11 import com.smartgwt.client.widgets.layout.VLayout;
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
12 import com.smartgwt.client.widgets.layout.HLayout;
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
13 import com.smartgwt.client.widgets.IButton;
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
14 import com.smartgwt.client.widgets.Button;
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
15 import com.smartgwt.client.widgets.Label;
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
16 import com.smartgwt.client.widgets.Canvas;
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
17 import com.smartgwt.client.widgets.grid.ListGrid;
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
18 import com.smartgwt.client.widgets.grid.ListGridField;
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
19 import com.smartgwt.client.widgets.grid.ListGridRecord;
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
20
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
21 import com.smartgwt.client.widgets.form.DynamicForm;
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.events.ClickEvent;
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
24 import com.smartgwt.client.widgets.events.ClickHandler;
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
25
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
26 import com.smartgwt.client.types.Alignment;
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 de.intevation.flys.client.shared.model.Artifact;
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.client.Config;
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
31 import de.intevation.flys.client.client.FLYSConstants;
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
32 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
33 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
34 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
35
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
36 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
37 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
38 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
39 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
40
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.Data;
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
42 import de.intevation.flys.client.shared.model.DefaultArtifact;
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.DefaultData;
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.Recommendation;
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
45
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
46 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
47 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
48 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
49
1545
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
50
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
51 /**
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
52 * 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
53 */
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
54 public class ManualPointsEditor
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
55 extends Window
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
56 implements ClickHandler
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
57 {
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
58 /** The interface that provides i18n messages. */
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
59 protected FLYSConstants MSG = GWT.create(FLYSConstants.class);
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 /** 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
62 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
63 // 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
64 // 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
65
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
66 /** 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
67 protected RedrawRequestHandler redrawRequestHandler;
1545
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
68
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
69 /** The collection */
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
70 protected Collection collection;
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
71
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
72 /** The listGrid showing point entries. */
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
73 protected ListGrid listGrid;
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
74
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
75 /** 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
76 LoadArtifactServiceAsync loadArtifactService = GWT.create(
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
77 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
78
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
79 /** 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
80 FeedServiceAsync feedService = GWT.create(
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
81 de.intevation.flys.client.client.services.FeedService.class);
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
82
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
83 /** UUID of artifact to feed. */
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
84 protected String uuid;
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
85
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 /**
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
88 * Setup editor dialog.
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
89 * @param collection The collection to use.
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
90 */
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
91 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
92 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
93 ) {
1545
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
94 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
95 this.redrawRequestHandler = handler;
1545
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
96 init();
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
97 }
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
98
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 /** 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
101 public String findManualPointsUUID() {
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
102 // 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
103 int size = collection.getItemLength();
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
104
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
105 for (int i = 0; i < size; i++) {
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
106 CollectionItem item = collection.getItem(i);
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
107 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
108 if (dataValue != null) {
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
109 // Found it.
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
110 uuid = item.identifier();
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
111 return uuid;
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
112 }
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 return null;
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
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 * Initialize the editor window and its components.
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 protected void init() {
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
123 setTitle("Add Points");
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
124 //TODO MSG.properties());
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
125 setCanDragReposition(true);
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
126 setCanDragResize(true);
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
127
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
128 // 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
129 if(findManualPointsUUID() == null) {
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
130 addArtifactCreateUI();
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
131 }
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
132 else {
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
133 createUI();
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
1547
76377fe3f0c7 Cosmetics.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1545
diff changeset
137
1545
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
138 /** Create and setup/add the ui. */
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
139 public void createUI() {
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
140 Config config = Config.getInstance();
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
141
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
142 Button accept = new Button(MSG.label_ok());
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
143 Button cancel = new Button(MSG.label_cancel());
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
144 cancel.addClickHandler(this);
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
145 accept.addClickHandler(new ClickHandler() {
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
146 public void onClick(ClickEvent e) {
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
147 if(isDialogValid()) {
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
148 // Feed JSON-encoded content of listgrid.
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
149 String jsonString = "";
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
150 int idx = 0;
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
151 JSONArray list = new JSONArray();
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
152
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
153 // TODO also need name attribute
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()));
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
161
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
162 list.set(idx, data);
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
163 idx++;
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 else {
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
166 JSONArray data = new JSONArray();
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
167
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
168 // 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
169 String xString = record.getAttributeAsString("X");
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
170 String yString = record.getAttributeAsString("Y");
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
171
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
172 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
173 data.set(1, new JSONNumber(Double.valueOf(yString)));
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
174
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
175 list.set(idx, data);
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
176 idx++;
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
177 }
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
178 }
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
179
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
180 // TODO lock UI until feed succeeded/failed.
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
181
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
182 // Feed list.toString to respective artifact.
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
183 Data[] feedData = new Data[] {
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
184 DefaultData.createSimpleStringData(POINT_DATA,
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
185 list.toString())
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
186 };
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
187 feedService.feed(
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
188 Config.getInstance().getLocale(),
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
189 new DefaultArtifact(uuid, "TODO:hash"),
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
190 feedData,
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
191 new AsyncCallback<Artifact>() {
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
192 public void onFailure(Throwable caught) {
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
193 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
194 SC.warn(MSG.getString(caught.getMessage()));
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
195 enable();
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
196 }
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
197 public void onSuccess(Artifact fartifact) {
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
198 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
199 // 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
200 // the new points are shown.
1545
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
201 //requestRedraw();
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
202 //updateCollection();
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
203 //updateGrid();
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
204 //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
205 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
206 new RedrawRequestEvent(Type.DEFAULT));
1545
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
207 destroy();
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
208 }
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
209 });
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
210 }
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
211 else {
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
212 GWT.log("Dialog not valid");
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
213 SC.warn(MSG.error_dialog_not_valid());
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 }
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
216 });
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
217
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
218 HLayout buttons = new HLayout();
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
219 buttons.addMember(accept);
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
220 buttons.addMember(cancel);
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
221 buttons.setAlign(Alignment.CENTER);
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
222 buttons.setHeight(30);
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
223
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
224 VLayout layout = new VLayout();
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
225 listGrid = new ListGrid();
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
226 listGrid.setWidth100();
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
227 listGrid.setHeight(200);
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
228 final ListGridField xField = new ListGridField("X", "X");
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
229 final ListGridField yField = new ListGridField("Y", "Y");
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
230 final ListGridField nameField = new ListGridField("name", "name");
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
231 final ListGridField removeField = new ListGridField("remove", "remove");
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
232 listGrid.setFields(new ListGridField[] {xField, yField, removeField});
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
233
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
234 // Find the artifacts uuid.
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
235 findManualPointsUUID();
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
236 CollectionItem item = collection.getItem(uuid);
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
237
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
238 // Add points to grid.
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
239 if (item != null) {
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
240 String jsonData = item.getData().get(POINT_DATA);
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
241 JSONArray jsonArray = (JSONArray) JSONParser.parse(jsonData);
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
242 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
243 JSONArray point = (JSONArray) jsonArray.get(i);
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
244 listGrid.addData(pointRecordFromJSON(point));
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
245 }
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
246 }
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
247 else {
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
248 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
249 }
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
250
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
251 layout.addMember(listGrid);
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
252
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
253 addItem(layout);
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
254 IButton button = new IButton("Edit New");
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
255 button.setTop(250);
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
256 button.addClickHandler(new ClickHandler() {
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
257 public void onClick(ClickEvent event) {
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
258 listGrid.startEditingNew();
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
259 }
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 addItem(button);
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
262 addItem(buttons);
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
263 setWidth(380);
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
264 setHeight(470);
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
265 centerInPage();
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
266 }
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
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
269 /** 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
270 public PointRecord pointRecordFromJSON(JSONArray jsonArray) {
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
271 JSONNumber x = (JSONNumber) jsonArray.get(0);
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
272 JSONNumber y = (JSONNumber) jsonArray.get(1);
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
273 return new PointRecord(x.doubleValue(), y.doubleValue());
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
274 }
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
275
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
276
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
277 /** Add a ManualPointArtifact to Collection. */
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
278 public void addArtifactCreateUI() {
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
279 // TODO MSG:/i18n
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
280 final Label standByLabel = new Label("Creating artifact, these are not the droids");
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
281 addItem(standByLabel);
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
282
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
283 setWidth(380);
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
284 setHeight(470);
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
285 centerInPage();
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
286
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
287 Config config = Config.getInstance();
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
288 String locale = config.getLocale();
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 loadArtifactService.load(
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
291 this.collection,
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
292 new Recommendation("manualpoints", ""),
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
293 "manualpoints",
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
294 locale,
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
295 new AsyncCallback<Artifact>() {
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
296 public void onFailure(Throwable caught) {
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
297 GWT.log("Creating manualpoint artifact failed!");
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
298 }
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
299 public void onSuccess(Artifact artifact) {
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
300 GWT.log("Successfully created artifact.");
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
301 removeItem(standByLabel);
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
302 uuid = artifact.getUuid();
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
303 createUI();
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
304 }
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
305 });
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
306 }
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
307
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
308
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
309 /**
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
310 * 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
311 * @param event The event.
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
312 */
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
313 public void onClick(ClickEvent event) {
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
314 this.destroy();
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
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 /** Simple record to store points. */
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
319 public class PointRecord extends ListGridRecord {
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
320 protected static final String ATTRIBUTE_X = "X";
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
321 protected static final String ATTRIBUTE_Y = "Y";
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 double x;
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
324 double y;
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 private PointRecord() {;}
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
327
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
328 public PointRecord(double x, double y) {
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
329 setX(x);
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
330 setY(y);
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
331 }
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
332
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
333 public void setX(double x) {
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
334 this.x = x;
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
335 setAttribute(ATTRIBUTE_X, getX());
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
336 }
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
337
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
338 public void setY(double y) {
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
339 this.y = y;
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
340 setAttribute(ATTRIBUTE_Y, getY());
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
341 }
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
342
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
343 public double getX() {
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
344 return this.x;
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
345 }
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
346
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
347 public double getY() {
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
348 return this.y;
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
349 }
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
350 }
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
351
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
352
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
353 // TODO cleanup. We need code similar to the following.
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
354
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
355 /*
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
356 protected void updateCollection() {
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
357 final Config config = Config.getInstance();
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
358 final String loc = config.getLocale();
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
359
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
360 GWT.log("PropertiesEditor.updateCollection via RPC now");
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 Settings s = settings;
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
363 collection.addSettings(this.tab.getOutputName(), s);
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
364 updater.update(collection, loc, new AsyncCallback<Collection>() {
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
365 public void onFailure(Throwable caught) {
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
366 GWT.log("Could not update collection attributes.");
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
367 SC.warn(MSG.getString(caught.getMessage()));
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
368 }
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
369 public void onSuccess(Collection collection) {
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
370 updateChartTab();
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 });
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
373 }
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 protected void updateChartTab() {
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
377 this.tab.updateChartInfo();
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
378 this.tab.updateChartPanel();
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
379 this.destroy();
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
380 }
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
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
383 protected boolean isDialogValid() {
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
384 boolean valid = true;
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
385 /*
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
386 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
387 Tab t = tabs.getTab(i);
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
388 Canvas container = t.getPane();
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
389 Canvas[] children = container.getChildren();
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
390 for (Canvas c: children) {
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
391 valid = validateCanvas(c);
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
392 if(!valid) {
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
393 return valid;
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
394 }
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 return valid;
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
399 }
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
400
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
401
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
402 protected boolean validateCanvas(Canvas c) {
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
403 boolean valid = true;
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
404 if(c instanceof DynamicForm) {
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
405 DynamicForm f = (DynamicForm) c;
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
406 return !f.hasErrors();
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
407 }
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
408 else if(c.getChildren().length > 0) {
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
409 for (Canvas child: c.getChildren()) {
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
410 valid = validateCanvas(child);
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
411 if(!valid) {
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 }
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
416 return valid;
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
417 }
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
418 }
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
419 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :

http://dive4elements.wald.intevation.org