Mercurial > dive4elements > river
comparison flys-client/src/main/java/de/intevation/flys/client/client/ui/fixation/FixationPanel.java @ 4568:bbd82bd8e541
flys-client: Cosmetics and warnings.
author | Christian Lins <christian.lins@intevation.de> |
---|---|
date | Mon, 19 Nov 2012 00:07:53 +0100 |
parents | 1ba0927855b4 |
children | b296d435fc69 |
comparison
equal
deleted
inserted
replaced
4567:5e6e89f19a37 | 4568:bbd82bd8e541 |
---|---|
1 package de.intevation.flys.client.client.ui.fixation; | 1 package de.intevation.flys.client.client.ui.fixation; |
2 | 2 |
3 import com.google.gwt.core.client.GWT; | 3 import com.google.gwt.core.client.GWT; |
4 | |
5 import com.google.gwt.i18n.client.DateTimeFormat; | 4 import com.google.gwt.i18n.client.DateTimeFormat; |
6 import com.google.gwt.i18n.client.NumberFormat; | 5 import com.google.gwt.i18n.client.NumberFormat; |
7 | |
8 import com.google.gwt.json.client.JSONNumber; | 6 import com.google.gwt.json.client.JSONNumber; |
9 import com.google.gwt.json.client.JSONObject; | 7 import com.google.gwt.json.client.JSONObject; |
10 import com.google.gwt.json.client.JSONString; | 8 import com.google.gwt.json.client.JSONString; |
11 | |
12 import com.google.gwt.user.client.rpc.AsyncCallback; | 9 import com.google.gwt.user.client.rpc.AsyncCallback; |
13 | 10 |
14 import com.smartgwt.client.types.Alignment; | 11 import com.smartgwt.client.types.Alignment; |
15 | |
16 import com.smartgwt.client.util.SC; | 12 import com.smartgwt.client.util.SC; |
17 | |
18 import com.smartgwt.client.widgets.Button; | 13 import com.smartgwt.client.widgets.Button; |
19 import com.smartgwt.client.widgets.Canvas; | 14 import com.smartgwt.client.widgets.Canvas; |
20 import com.smartgwt.client.widgets.HTMLPane; | 15 import com.smartgwt.client.widgets.HTMLPane; |
21 import com.smartgwt.client.widgets.Img; | 16 import com.smartgwt.client.widgets.Img; |
22 | |
23 import com.smartgwt.client.widgets.events.ClickEvent; | 17 import com.smartgwt.client.widgets.events.ClickEvent; |
24 import com.smartgwt.client.widgets.events.ClickHandler; | 18 import com.smartgwt.client.widgets.events.ClickHandler; |
25 import com.smartgwt.client.widgets.events.ResizedEvent; | 19 import com.smartgwt.client.widgets.events.ResizedEvent; |
26 import com.smartgwt.client.widgets.events.ResizedHandler; | 20 import com.smartgwt.client.widgets.events.ResizedHandler; |
27 | |
28 import com.smartgwt.client.widgets.form.DynamicForm; | 21 import com.smartgwt.client.widgets.form.DynamicForm; |
29 | |
30 import com.smartgwt.client.widgets.form.fields.TextItem; | 22 import com.smartgwt.client.widgets.form.fields.TextItem; |
31 | |
32 import com.smartgwt.client.widgets.form.fields.events.ChangedEvent; | 23 import com.smartgwt.client.widgets.form.fields.events.ChangedEvent; |
33 import com.smartgwt.client.widgets.form.fields.events.ChangedHandler; | 24 import com.smartgwt.client.widgets.form.fields.events.ChangedHandler; |
34 | |
35 import com.smartgwt.client.widgets.layout.HLayout; | 25 import com.smartgwt.client.widgets.layout.HLayout; |
36 import com.smartgwt.client.widgets.layout.VLayout; | 26 import com.smartgwt.client.widgets.layout.VLayout; |
37 | |
38 import com.smartgwt.client.widgets.tab.Tab; | 27 import com.smartgwt.client.widgets.tab.Tab; |
39 import com.smartgwt.client.widgets.tab.TabSet; | 28 import com.smartgwt.client.widgets.tab.TabSet; |
40 | 29 |
41 import de.intevation.flys.client.client.Config; | 30 import de.intevation.flys.client.client.Config; |
42 import de.intevation.flys.client.client.FLYSConstants; | 31 import de.intevation.flys.client.client.FLYSConstants; |
43 | |
44 import de.intevation.flys.client.client.services.FixingsOverviewService; | 32 import de.intevation.flys.client.client.services.FixingsOverviewService; |
45 import de.intevation.flys.client.client.services.FixingsOverviewServiceAsync; | 33 import de.intevation.flys.client.client.services.FixingsOverviewServiceAsync; |
46 | |
47 import de.intevation.flys.client.client.ui.AbstractUIProvider; | 34 import de.intevation.flys.client.client.ui.AbstractUIProvider; |
48 | |
49 import de.intevation.flys.client.shared.model.Data; | 35 import de.intevation.flys.client.shared.model.Data; |
50 import de.intevation.flys.client.shared.model.DataList; | 36 import de.intevation.flys.client.shared.model.DataList; |
51 import de.intevation.flys.client.shared.model.FixAnalysisArtifact; | 37 import de.intevation.flys.client.shared.model.FixAnalysisArtifact; |
52 import de.intevation.flys.client.shared.model.FixFilter; | 38 import de.intevation.flys.client.shared.model.FixFilter; |
53 import de.intevation.flys.client.shared.model.FixingsOverviewInfo; | 39 import de.intevation.flys.client.shared.model.FixingsOverviewInfo; |
64 */ | 50 */ |
65 public abstract class FixationPanel | 51 public abstract class FixationPanel |
66 extends AbstractUIProvider | 52 extends AbstractUIProvider |
67 implements ResizedHandler | 53 implements ResizedHandler |
68 { | 54 { |
55 private static final long serialVersionUID = -3667553404493415619L; | |
56 | |
69 protected static HashMap<String, FixationPanel> instances = new HashMap<String, FixationPanel>(); | 57 protected static HashMap<String, FixationPanel> instances = new HashMap<String, FixationPanel>(); |
70 | 58 |
71 /** The message class that provides i18n strings. */ | 59 /** The message class that provides i18n strings. */ |
72 protected FLYSConstants MESSAGES = GWT.create(FLYSConstants.class); | 60 protected FLYSConstants MESSAGES = GWT.create(FLYSConstants.class); |
73 | 61 |
89 public FixationPanel() { | 77 public FixationPanel() { |
90 chartImg = new Img(); | 78 chartImg = new Img(); |
91 htmlOverview = ""; | 79 htmlOverview = ""; |
92 } | 80 } |
93 | 81 |
94 | 82 |
95 /** Get the (master) artifact UUID. */ | 83 /** Get the (master) artifact UUID. */ |
96 protected String getArtifactUuid() { | 84 protected String getArtifactUuid() { |
97 return this.artifact.getUuid(); | 85 return this.artifact.getUuid(); |
98 } | 86 } |
99 | 87 |
100 protected void init() { | 88 protected void init() { |
101 } | 89 } |
102 | 90 |
91 @Override | |
103 public Data[] getData() { | 92 public Data[] getData() { |
104 return null; | 93 return null; |
105 } | 94 } |
106 | 95 |
96 @Override | |
107 public Canvas create(DataList list) { | 97 public Canvas create(DataList list) { |
108 VLayout layout = new VLayout(); | 98 VLayout layout = new VLayout(); |
109 | 99 |
110 Canvas helper = createHelper(); | 100 Canvas helper = createHelper(); |
111 this.helperContainer.addMember(helper); | 101 this.helperContainer.addMember(helper); |
116 layout.addMember(widget); | 106 layout.addMember(widget); |
117 layout.addMember(submit); | 107 layout.addMember(submit); |
118 return layout; | 108 return layout; |
119 } | 109 } |
120 | 110 |
111 @Override | |
121 public Canvas createOld(DataList list) { | 112 public Canvas createOld(DataList list) { |
122 return new DynamicForm(); | 113 return new DynamicForm(); |
123 } | 114 } |
124 | 115 |
125 protected Canvas createHelper() { | 116 protected Canvas createHelper() { |
157 artifact.getUuid(), | 148 artifact.getUuid(), |
158 getOverviewFilter(art.getFilter()), | 149 getOverviewFilter(art.getFilter()), |
159 renderCheckboxes(), | 150 renderCheckboxes(), |
160 callBack, | 151 callBack, |
161 new AsyncCallback<FixingsOverviewInfo>() { | 152 new AsyncCallback<FixingsOverviewInfo>() { |
153 @Override | |
162 public void onFailure(Throwable caught) { | 154 public void onFailure(Throwable caught) { |
163 GWT.log("Could not receive overview."); | 155 GWT.log("Could not receive overview."); |
164 SC.warn(caught.getMessage()); | 156 SC.warn(caught.getMessage()); |
165 } | 157 } |
158 @Override | |
166 public void onSuccess(FixingsOverviewInfo info) { | 159 public void onSuccess(FixingsOverviewInfo info) { |
167 GWT.log("Successfully loaded overview."); | 160 GWT.log("Successfully loaded overview."); |
168 fixInfo = info; | 161 fixInfo = info; |
169 htmlOverview = info.getHTML(); | 162 htmlOverview = info.getHTML(); |
170 FixAnalysisArtifact art = (FixAnalysisArtifact)artifact; | 163 FixAnalysisArtifact art = (FixAnalysisArtifact)artifact; |
210 | 203 |
211 | 204 |
212 form.setFields(kmText); | 205 form.setFields(kmText); |
213 form.setWidth(60); | 206 form.setWidth(60); |
214 lower.addClickHandler(new ClickHandler() { | 207 lower.addClickHandler(new ClickHandler() { |
208 @Override | |
215 public void onClick(ClickEvent ce) { | 209 public void onClick(ClickEvent ce) { |
216 FixFilter filter = updateChartTabLow(); | 210 FixFilter filter = updateChartTabLow(); |
217 NumberFormat nf = NumberFormat.getDecimalFormat(); | 211 NumberFormat nf = NumberFormat.getDecimalFormat(); |
218 try { | 212 try { |
219 double d = Double.valueOf(filter.getCurrentKm()); | 213 double d = Double.valueOf(filter.getCurrentKm()); |
223 } | 217 } |
224 } | 218 } |
225 }); | 219 }); |
226 | 220 |
227 upper.addClickHandler(new ClickHandler() { | 221 upper.addClickHandler(new ClickHandler() { |
222 @Override | |
228 public void onClick(ClickEvent ce) { | 223 public void onClick(ClickEvent ce) { |
229 FixFilter filter = updateChartTabUp(); | 224 FixFilter filter = updateChartTabUp(); |
230 NumberFormat nf = NumberFormat.getDecimalFormat(); | 225 NumberFormat nf = NumberFormat.getDecimalFormat(); |
231 try { | 226 try { |
232 double d = Double.valueOf(filter.getCurrentKm()); | 227 double d = Double.valueOf(filter.getCurrentKm()); |
236 } | 231 } |
237 } | 232 } |
238 }); | 233 }); |
239 | 234 |
240 kmText.addChangedHandler(new ChangedHandler() { | 235 kmText.addChangedHandler(new ChangedHandler() { |
236 @Override | |
241 public void onChanged(ChangedEvent ce) { | 237 public void onChanged(ChangedEvent ce) { |
242 //TODO: get current value. | 238 //TODO: get current value. |
243 if(ce.getItem().getValue() != null) { | 239 if(ce.getItem().getValue() != null) { |
244 NumberFormat nf = NumberFormat.getDecimalFormat(); | 240 NumberFormat nf = NumberFormat.getDecimalFormat(); |
245 try { | 241 try { |
335 } | 331 } |
336 return filter; | 332 return filter; |
337 } | 333 } |
338 | 334 |
339 | 335 |
336 @Override | |
340 public void onResized(ResizedEvent re) { | 337 public void onResized(ResizedEvent re) { |
341 FixAnalysisArtifact art = (FixAnalysisArtifact) this.artifact; | 338 FixAnalysisArtifact art = (FixAnalysisArtifact) this.artifact; |
342 | 339 |
343 updateChartTab(art.getFilter().getCurrentKm()); | 340 updateChartTab(art.getFilter().getCurrentKm()); |
344 } | 341 } |