annotate flys-client/src/main/java/de/intevation/flys/client/client/ui/chart/ManualPointsEditor.java @ 1547:76377fe3f0c7

Cosmetics. flys-client/trunk@3778 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Felix Wolfsteller <felix.wolfsteller@intevation.de>
date Fri, 27 Jan 2012 08:43:43 +0000
parents 2f0150f21e77
children e2f74131ffc1
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 java.util.ArrayList;
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
4 import java.util.List;
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
5 import java.util.Map;
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
6
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
7 import com.google.gwt.json.client.JSONArray;
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
8 import com.google.gwt.json.client.JSONNumber;
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
9 import com.google.gwt.json.client.JSONParser;
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
10 import com.google.gwt.core.client.GWT;
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
11 import com.google.gwt.user.client.rpc.AsyncCallback;
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
12
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
13 import com.smartgwt.client.util.SC;
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
14 import com.smartgwt.client.widgets.Window;
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
15 import com.smartgwt.client.widgets.tab.TabSet;
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
16 import com.smartgwt.client.widgets.tab.Tab;
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
17 import com.smartgwt.client.widgets.layout.VLayout;
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
18 import com.smartgwt.client.widgets.layout.HLayout;
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
19 import com.smartgwt.client.widgets.IButton;
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
20 import com.smartgwt.client.widgets.Button;
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
21 import com.smartgwt.client.widgets.Label;
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
22 import com.smartgwt.client.widgets.Canvas;
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
23 import com.smartgwt.client.widgets.grid.ListGrid;
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
24 import com.smartgwt.client.widgets.grid.ListGridField;
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
25 import com.smartgwt.client.widgets.grid.ListGridRecord;
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
26
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
27 import com.smartgwt.client.widgets.form.DynamicForm;
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
28 import com.smartgwt.client.widgets.form.fields.FormItem;
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
29 import com.smartgwt.client.widgets.form.fields.CheckboxItem;
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
30 import com.smartgwt.client.widgets.form.fields.TextItem;
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 com.smartgwt.client.widgets.events.ClickEvent;
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
33 import com.smartgwt.client.widgets.events.ClickHandler;
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
34 import com.smartgwt.client.widgets.form.fields.events.ChangedHandler;
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
35 import com.smartgwt.client.widgets.form.fields.events.ChangedEvent;
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
36 import com.smartgwt.client.widgets.form.fields.events.BlurHandler;
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
37 import com.smartgwt.client.widgets.form.fields.events.BlurEvent;
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
38
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
39 import com.smartgwt.client.types.Alignment;
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.Artifact;
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
42
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
43 import de.intevation.flys.client.client.Config;
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
44 import de.intevation.flys.client.client.FLYSConstants;
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.Property;
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.PropertyGroup;
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
47 import de.intevation.flys.client.shared.model.PropertySetting;
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
48 import de.intevation.flys.client.shared.model.BooleanProperty;
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
49 import de.intevation.flys.client.shared.model.DoubleProperty;
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
50 import de.intevation.flys.client.shared.model.IntegerProperty;
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
51 import de.intevation.flys.client.shared.model.StringProperty;
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
52 import de.intevation.flys.client.shared.model.Settings;
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
53 import de.intevation.flys.client.shared.model.OutputSettings;
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
54 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
55 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
56 import de.intevation.flys.client.client.utils.IntegerValidator;
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
57 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
58
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
59 import de.intevation.flys.client.client.services.CollectionAttributeService;
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
60 import de.intevation.flys.client.client.services.CollectionAttributeServiceAsync;
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
61 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
62 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
63 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
64 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
65
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
66 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
67 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
68 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
69 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
70 import de.intevation.flys.client.shared.model.Recommendation.Facet;
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
71 import de.intevation.flys.client.shared.model.Recommendation.Filter;
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
72
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 /**
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
75 * 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
76 */
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
77 public class ManualPointsEditor
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
78 extends Window
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
79 implements ClickHandler
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 /** The interface that provides i18n messages. */
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
82 protected FLYSConstants MSG = GWT.create(FLYSConstants.class);
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
83
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
84 /** 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
85 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
86 // 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
87 // 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
88
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
89 protected CollectionAttributeServiceAsync updater =
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
90 GWT.create(CollectionAttributeService.class);
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
91
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
92 /** The collection */
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
93 protected Collection collection;
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
94
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
95 /** The listGrid showing point entries. */
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
96 protected ListGrid listGrid;
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 /** 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
99 LoadArtifactServiceAsync loadArtifactService = GWT.create(
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
100 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
101
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
102 /** 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
103 FeedServiceAsync feedService = GWT.create(
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
104 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
105
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
106 /** UUID of artifact to feed. */
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
107 protected String uuid;
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
108
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
109
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
110 /**
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
111 * Setup editor dialog.
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
112 * @param collection The collection to use.
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 public ManualPointsEditor(Collection collection) {
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
115 this.collection = collection;
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
116 init();
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 /** 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
121 public String findManualPointsUUID() {
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
122 // 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
123 int size = collection.getItemLength();
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
124
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
125 for (int i = 0; i < size; i++) {
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
126 CollectionItem item = collection.getItem(i);
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
127 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
128 if (dataValue != null) {
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
129 // Found it.
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
130 uuid = item.identifier();
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
131 return uuid;
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
132 }
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
133 }
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
134
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
135 return null;
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
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
138
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
139 /**
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
140 * Initialize the editor window and its components.
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 protected void init() {
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
143 setTitle("Add Points");
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
144 //TODO MSG.properties());
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
145 setCanDragReposition(true);
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
146 setCanDragResize(true);
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
147
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
148 // 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
149 if(findManualPointsUUID() == null) {
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
150 addArtifactCreateUI();
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
151 }
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
152 else {
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
153 createUI();
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
154 }
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
155 }
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
156
1547
76377fe3f0c7 Cosmetics.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1545
diff changeset
157
1545
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
158 /** Create and setup/add the ui. */
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
159 public void createUI() {
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
160 Config config = Config.getInstance();
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 Button accept = new Button(MSG.label_ok());
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
163 Button cancel = new Button(MSG.label_cancel());
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
164 cancel.addClickHandler(this);
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
165 accept.addClickHandler(new ClickHandler() {
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
166 public void onClick(ClickEvent e) {
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
167 if(isDialogValid()) {
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
168 // Feed JSON-encoded content of listgrid.
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
169 String jsonString = "";
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
170 int idx = 0;
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
171 JSONArray list = new JSONArray();
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
172
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
173 // TODO also need name attribute
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
174 for(ListGridRecord record : listGrid.getRecords()) {
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
175 if (record instanceof PointRecord) {
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
176 JSONArray data = new JSONArray();
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 PointRecord point = (PointRecord) record;
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
179 data.set(0, new JSONNumber(point.getX()));
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
180 data.set(1, new JSONNumber(point.getY()));
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 list.set(idx, data);
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
183 idx++;
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 else {
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
186 JSONArray data = new JSONArray();
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
187
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
188 // 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
189 String xString = record.getAttributeAsString("X");
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
190 String yString = record.getAttributeAsString("Y");
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
191
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
192 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
193 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
194
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
195 list.set(idx, data);
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
196 idx++;
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
197 }
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
198 }
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
199
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
200 // TODO lock UI until feed succeeded/failed.
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
201
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
202 // Feed list.toString to respective artifact.
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
203 Data[] feedData = new Data[] {
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
204 DefaultData.createSimpleStringData(POINT_DATA,
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
205 list.toString())
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
206 };
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
207 feedService.feed(
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
208 Config.getInstance().getLocale(),
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
209 new DefaultArtifact(uuid, "TODO:hash"),
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
210 feedData,
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
211 new AsyncCallback<Artifact>() {
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
212 public void onFailure(Throwable caught) {
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
213 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
214 SC.warn(MSG.getString(caught.getMessage()));
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
215 enable();
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 public void onSuccess(Artifact fartifact) {
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
218 GWT.log("Successfully set points ");
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
219 // TODO refresh view
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
220 //requestRedraw();
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
221 //updateCollection();
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
222 //updateGrid();
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
223 //enable();
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
224 destroy();
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
225 }
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
226 });
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 else {
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
229 GWT.log("Dialog not valid");
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
230 SC.warn(MSG.error_dialog_not_valid());
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
231 }
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
232 }
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
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
235 HLayout buttons = new HLayout();
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
236 buttons.addMember(accept);
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
237 buttons.addMember(cancel);
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
238 buttons.setAlign(Alignment.CENTER);
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
239 buttons.setHeight(30);
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
240
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
241 VLayout layout = new VLayout();
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
242 listGrid = new ListGrid();
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
243 listGrid.setWidth100();
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
244 listGrid.setHeight(200);
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
245 final ListGridField xField = new ListGridField("X", "X");
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
246 final ListGridField yField = new ListGridField("Y", "Y");
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
247 final ListGridField nameField = new ListGridField("name", "name");
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
248 final ListGridField removeField = new ListGridField("remove", "remove");
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
249 listGrid.setFields(new ListGridField[] {xField, yField, removeField});
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 // Find the artifacts uuid.
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
252 findManualPointsUUID();
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
253 CollectionItem item = collection.getItem(uuid);
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
254
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
255 // Add points to grid.
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
256 if (item != null) {
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
257 String jsonData = item.getData().get(POINT_DATA);
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
258 JSONArray jsonArray = (JSONArray) JSONParser.parse(jsonData);
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
259 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
260 JSONArray point = (JSONArray) jsonArray.get(i);
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
261 listGrid.addData(pointRecordFromJSON(point));
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
262 }
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
263 }
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
264 else {
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
265 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
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 layout.addMember(listGrid);
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
269
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
270 addItem(layout);
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
271 IButton button = new IButton("Edit New");
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
272 button.setTop(250);
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
273 button.addClickHandler(new ClickHandler() {
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
274 public void onClick(ClickEvent event) {
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
275 listGrid.startEditingNew();
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 });
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
278 addItem(button);
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
279 addItem(buttons);
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
280 setWidth(380);
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
281 setHeight(470);
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
282 centerInPage();
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
283 }
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
284
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
285
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
286 /** 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
287 public PointRecord pointRecordFromJSON(JSONArray jsonArray) {
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
288 JSONNumber x = (JSONNumber) jsonArray.get(0);
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
289 JSONNumber y = (JSONNumber) jsonArray.get(1);
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
290 return new PointRecord(x.doubleValue(), y.doubleValue());
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
291 }
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
292
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
293
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
294 /** Add a ManualPointArtifact to Collection. */
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
295 public void addArtifactCreateUI() {
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
296 // TODO MSG:/i18n
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
297 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
298 addItem(standByLabel);
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 setWidth(380);
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
301 setHeight(470);
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
302 centerInPage();
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
303
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
304 Config config = Config.getInstance();
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
305 String locale = config.getLocale();
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 loadArtifactService.load(
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
308 this.collection,
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
309 new Recommendation("manualpoints", ""),
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
310 "manualpoints",
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
311 locale,
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
312 new AsyncCallback<Artifact>() {
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
313 public void onFailure(Throwable caught) {
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
314 GWT.log("Creating manualpoint artifact failed!");
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 public void onSuccess(Artifact artifact) {
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
317 GWT.log("Successfully created artifact.");
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
318 removeItem(standByLabel);
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
319 uuid = artifact.getUuid();
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
320 createUI();
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 }
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
324
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 /**
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
327 * 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
328 * @param event The event.
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 public void onClick(ClickEvent event) {
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
331 this.destroy();
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
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
334
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
335 /** Simple record to store points. */
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
336 public class PointRecord extends ListGridRecord {
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
337 protected static final String ATTRIBUTE_X = "X";
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
338 protected static final String ATTRIBUTE_Y = "Y";
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
339
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
340 double x;
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
341 double y;
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 private PointRecord() {;}
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
344
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
345 public PointRecord(double x, double y) {
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
346 setX(x);
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
347 setY(y);
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
348 }
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 public void setX(double x) {
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
351 this.x = x;
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
352 setAttribute(ATTRIBUTE_X, getX());
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
353 }
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 public void setY(double y) {
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
356 this.y = y;
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
357 setAttribute(ATTRIBUTE_Y, getY());
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
358 }
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 public double getX() {
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
361 return this.x;
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
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
364 public double getY() {
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
365 return this.y;
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
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
369
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
370 // 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
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 protected void updateCollection() {
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
374 final Config config = Config.getInstance();
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
375 final String loc = config.getLocale();
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 GWT.log("PropertiesEditor.updateCollection via RPC now");
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
378
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
379 Settings s = settings;
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
380 collection.addSettings(this.tab.getOutputName(), s);
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
381 updater.update(collection, loc, new AsyncCallback<Collection>() {
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
382 public void onFailure(Throwable caught) {
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
383 GWT.log("Could not update collection attributes.");
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
384 SC.warn(MSG.getString(caught.getMessage()));
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 public void onSuccess(Collection collection) {
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
387 updateChartTab();
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
388 }
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
389 });
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 protected void updateChartTab() {
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
394 this.tab.updateChartInfo();
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
395 this.tab.updateChartPanel();
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
396 this.destroy();
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 */
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 protected boolean isDialogValid() {
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
401 boolean valid = true;
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
402 /*
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
403 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
404 Tab t = tabs.getTab(i);
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
405 Canvas container = t.getPane();
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
406 Canvas[] children = container.getChildren();
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
407 for (Canvas c: children) {
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
408 valid = validateCanvas(c);
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
409 if(!valid) {
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
410 return valid;
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 }
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 return valid;
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
416 }
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 protected boolean validateCanvas(Canvas c) {
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
420 boolean valid = true;
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
421 if(c instanceof DynamicForm) {
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
422 DynamicForm f = (DynamicForm) c;
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
423 return !f.hasErrors();
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
424 }
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
425 else if(c.getChildren().length > 0) {
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
426 for (Canvas child: c.getChildren()) {
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
427 valid = validateCanvas(child);
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
428 if(!valid) {
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
429 return valid;
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
430 }
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
431 }
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
432 }
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
433 return valid;
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
434 }
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
435 }
2f0150f21e77 Added basic UI to enter manual points.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
436 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :

http://dive4elements.wald.intevation.org