Mercurial > dive4elements > river
annotate flys-client/src/main/java/de/intevation/flys/client/client/ui/fixation/FixPeriodPanel.java @ 2537:cc5969df0490
New methods in UI providers for fixings states and minor protocol changes.
flys-client/trunk@4449 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Raimund Renkert <raimund.renkert@intevation.de> |
---|---|
date | Mon, 21 May 2012 09:22:29 +0000 |
parents | a911e2968cb1 |
children | c7da05282644 |
rev | line source |
---|---|
2505
87ac5c532523
First part of the UI for fixing analysis parameter.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
1 package de.intevation.flys.client.client.ui.fixation; |
87ac5c532523
First part of the UI for fixing analysis parameter.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
2 |
87ac5c532523
First part of the UI for fixing analysis parameter.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
3 import java.util.List; |
87ac5c532523
First part of the UI for fixing analysis parameter.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
4 import java.util.ArrayList; |
87ac5c532523
First part of the UI for fixing analysis parameter.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
5 import java.util.Date; |
87ac5c532523
First part of the UI for fixing analysis parameter.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
6 |
87ac5c532523
First part of the UI for fixing analysis parameter.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
7 import com.google.gwt.core.client.GWT; |
2537
cc5969df0490
New methods in UI providers for fixings states and minor protocol changes.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2526
diff
changeset
|
8 import com.google.gwt.i18n.client.DateTimeFormat; |
cc5969df0490
New methods in UI providers for fixings states and minor protocol changes.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2526
diff
changeset
|
9 import com.google.gwt.i18n.client.DateTimeFormat.PredefinedFormat; |
cc5969df0490
New methods in UI providers for fixings states and minor protocol changes.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2526
diff
changeset
|
10 |
2505
87ac5c532523
First part of the UI for fixing analysis parameter.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
11 import com.smartgwt.client.util.SC; |
87ac5c532523
First part of the UI for fixing analysis parameter.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
12 |
87ac5c532523
First part of the UI for fixing analysis parameter.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
13 import com.smartgwt.client.widgets.Canvas; |
87ac5c532523
First part of the UI for fixing analysis parameter.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
14 import com.smartgwt.client.widgets.Label; |
87ac5c532523
First part of the UI for fixing analysis parameter.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
15 |
87ac5c532523
First part of the UI for fixing analysis parameter.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
16 import com.smartgwt.client.widgets.layout.HLayout; |
87ac5c532523
First part of the UI for fixing analysis parameter.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
17 import com.smartgwt.client.widgets.layout.VLayout; |
87ac5c532523
First part of the UI for fixing analysis parameter.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
18 |
87ac5c532523
First part of the UI for fixing analysis parameter.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
19 import com.smartgwt.client.widgets.form.DynamicForm; |
87ac5c532523
First part of the UI for fixing analysis parameter.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
20 import com.smartgwt.client.widgets.form.fields.DateRangeItem; |
87ac5c532523
First part of the UI for fixing analysis parameter.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
21 |
87ac5c532523
First part of the UI for fixing analysis parameter.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
22 import de.intevation.flys.client.client.FLYSConstants; |
87ac5c532523
First part of the UI for fixing analysis parameter.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
23 |
87ac5c532523
First part of the UI for fixing analysis parameter.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
24 import de.intevation.flys.client.shared.model.Data; |
87ac5c532523
First part of the UI for fixing analysis parameter.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
25 import de.intevation.flys.client.shared.model.DataItem; |
87ac5c532523
First part of the UI for fixing analysis parameter.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
26 import de.intevation.flys.client.shared.model.DataList; |
87ac5c532523
First part of the UI for fixing analysis parameter.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
27 import de.intevation.flys.client.shared.model.DefaultData; |
87ac5c532523
First part of the UI for fixing analysis parameter.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
28 import de.intevation.flys.client.shared.model.DefaultDataItem; |
87ac5c532523
First part of the UI for fixing analysis parameter.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
29 |
87ac5c532523
First part of the UI for fixing analysis parameter.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
30 /** |
87ac5c532523
First part of the UI for fixing analysis parameter.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
31 * This UIProvider creates a panel for location or distance input. |
87ac5c532523
First part of the UI for fixing analysis parameter.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
32 * |
87ac5c532523
First part of the UI for fixing analysis parameter.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
33 * @author <a href="mailto:raimund.renkert@intevation.de">Raimund Renkert</a> |
87ac5c532523
First part of the UI for fixing analysis parameter.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
34 */ |
87ac5c532523
First part of the UI for fixing analysis parameter.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
35 public class FixPeriodPanel |
87ac5c532523
First part of the UI for fixing analysis parameter.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
36 extends FixationPanel |
87ac5c532523
First part of the UI for fixing analysis parameter.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
37 { |
87ac5c532523
First part of the UI for fixing analysis parameter.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
38 /** The message class that provides i18n strings. */ |
87ac5c532523
First part of the UI for fixing analysis parameter.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
39 protected FLYSConstants MESSAGES = GWT.create(FLYSConstants.class); |
87ac5c532523
First part of the UI for fixing analysis parameter.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
40 |
87ac5c532523
First part of the UI for fixing analysis parameter.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
41 DateRangeItem inputPanel; |
87ac5c532523
First part of the UI for fixing analysis parameter.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
42 |
87ac5c532523
First part of the UI for fixing analysis parameter.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
43 long start; |
87ac5c532523
First part of the UI for fixing analysis parameter.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
44 long end; |
87ac5c532523
First part of the UI for fixing analysis parameter.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
45 |
87ac5c532523
First part of the UI for fixing analysis parameter.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
46 public FixPeriodPanel() { |
87ac5c532523
First part of the UI for fixing analysis parameter.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
47 htmlOverview = ""; |
87ac5c532523
First part of the UI for fixing analysis parameter.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
48 } |
87ac5c532523
First part of the UI for fixing analysis parameter.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
49 |
87ac5c532523
First part of the UI for fixing analysis parameter.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
50 public Canvas createWidget(DataList data) { |
87ac5c532523
First part of the UI for fixing analysis parameter.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
51 instances.put(this.artifact.getUuid(), this); |
87ac5c532523
First part of the UI for fixing analysis parameter.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
52 |
87ac5c532523
First part of the UI for fixing analysis parameter.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
53 VLayout layout = new VLayout(); |
87ac5c532523
First part of the UI for fixing analysis parameter.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
54 |
2537
cc5969df0490
New methods in UI providers for fixings states and minor protocol changes.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2526
diff
changeset
|
55 Label title = new Label(data.get(0).getDescription()); |
2505
87ac5c532523
First part of the UI for fixing analysis parameter.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
56 title.setHeight("25px"); |
87ac5c532523
First part of the UI for fixing analysis parameter.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
57 |
87ac5c532523
First part of the UI for fixing analysis parameter.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
58 DynamicForm form = new DynamicForm(); |
87ac5c532523
First part of the UI for fixing analysis parameter.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
59 inputPanel = new DateRangeItem(); |
87ac5c532523
First part of the UI for fixing analysis parameter.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
60 inputPanel.setToTitle(MESSAGES.to()); |
87ac5c532523
First part of the UI for fixing analysis parameter.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
61 inputPanel.setFromTitle(MESSAGES.from()); |
87ac5c532523
First part of the UI for fixing analysis parameter.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
62 inputPanel.setShowTitle(false); |
87ac5c532523
First part of the UI for fixing analysis parameter.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
63 form.setFields(inputPanel); |
87ac5c532523
First part of the UI for fixing analysis parameter.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
64 |
87ac5c532523
First part of the UI for fixing analysis parameter.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
65 layout.addMember(title); |
87ac5c532523
First part of the UI for fixing analysis parameter.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
66 layout.addMember(form); |
87ac5c532523
First part of the UI for fixing analysis parameter.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
67 |
87ac5c532523
First part of the UI for fixing analysis parameter.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
68 return layout; |
87ac5c532523
First part of the UI for fixing analysis parameter.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
69 } |
87ac5c532523
First part of the UI for fixing analysis parameter.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
70 |
87ac5c532523
First part of the UI for fixing analysis parameter.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
71 @Override |
87ac5c532523
First part of the UI for fixing analysis parameter.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
72 public Canvas createOld(DataList dataList) { |
87ac5c532523
First part of the UI for fixing analysis parameter.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
73 List<Data> items = dataList.getAll(); |
87ac5c532523
First part of the UI for fixing analysis parameter.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
74 |
87ac5c532523
First part of the UI for fixing analysis parameter.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
75 Data start = getData(items, "start"); |
87ac5c532523
First part of the UI for fixing analysis parameter.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
76 Data end = getData(items, "end"); |
87ac5c532523
First part of the UI for fixing analysis parameter.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
77 DataItem[] startItem = start.getItems(); |
87ac5c532523
First part of the UI for fixing analysis parameter.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
78 DataItem[] endItem = end.getItems(); |
87ac5c532523
First part of the UI for fixing analysis parameter.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
79 |
2537
cc5969df0490
New methods in UI providers for fixings states and minor protocol changes.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2526
diff
changeset
|
80 String v1 = startItem[0].getStringValue(); |
cc5969df0490
New methods in UI providers for fixings states and minor protocol changes.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2526
diff
changeset
|
81 String v2 = endItem[0].getStringValue(); |
cc5969df0490
New methods in UI providers for fixings states and minor protocol changes.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2526
diff
changeset
|
82 |
cc5969df0490
New methods in UI providers for fixings states and minor protocol changes.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2526
diff
changeset
|
83 long v1l = 0; |
cc5969df0490
New methods in UI providers for fixings states and minor protocol changes.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2526
diff
changeset
|
84 long v2l = 0; |
cc5969df0490
New methods in UI providers for fixings states and minor protocol changes.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2526
diff
changeset
|
85 try { |
cc5969df0490
New methods in UI providers for fixings states and minor protocol changes.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2526
diff
changeset
|
86 v1l = Long.parseLong(v1); |
cc5969df0490
New methods in UI providers for fixings states and minor protocol changes.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2526
diff
changeset
|
87 v2l = Long.parseLong(v2); |
cc5969df0490
New methods in UI providers for fixings states and minor protocol changes.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2526
diff
changeset
|
88 } |
cc5969df0490
New methods in UI providers for fixings states and minor protocol changes.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2526
diff
changeset
|
89 catch(NumberFormatException nfe) { |
cc5969df0490
New methods in UI providers for fixings states and minor protocol changes.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2526
diff
changeset
|
90 GWT.log(nfe.toString()); |
cc5969df0490
New methods in UI providers for fixings states and minor protocol changes.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2526
diff
changeset
|
91 } |
cc5969df0490
New methods in UI providers for fixings states and minor protocol changes.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2526
diff
changeset
|
92 Date d1 = new Date(v1l); |
cc5969df0490
New methods in UI providers for fixings states and minor protocol changes.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2526
diff
changeset
|
93 Date d2 = new Date(v2l); |
cc5969df0490
New methods in UI providers for fixings states and minor protocol changes.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2526
diff
changeset
|
94 |
cc5969df0490
New methods in UI providers for fixings states and minor protocol changes.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2526
diff
changeset
|
95 DateTimeFormat f = |
cc5969df0490
New methods in UI providers for fixings states and minor protocol changes.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2526
diff
changeset
|
96 DateTimeFormat.getFormat( |
cc5969df0490
New methods in UI providers for fixings states and minor protocol changes.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2526
diff
changeset
|
97 DateTimeFormat.PredefinedFormat.DATE_MEDIUM); |
2505
87ac5c532523
First part of the UI for fixing analysis parameter.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
98 StringBuilder sb = new StringBuilder(); |
2537
cc5969df0490
New methods in UI providers for fixings states and minor protocol changes.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2526
diff
changeset
|
99 sb.append(f.format(d1) + " - "); |
cc5969df0490
New methods in UI providers for fixings states and minor protocol changes.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2526
diff
changeset
|
100 sb.append(f.format(d2)); |
2505
87ac5c532523
First part of the UI for fixing analysis parameter.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
101 |
87ac5c532523
First part of the UI for fixing analysis parameter.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
102 Label old = new Label(sb.toString()); |
87ac5c532523
First part of the UI for fixing analysis parameter.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
103 old.setWidth(130); |
87ac5c532523
First part of the UI for fixing analysis parameter.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
104 |
87ac5c532523
First part of the UI for fixing analysis parameter.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
105 HLayout layout = new HLayout(); |
87ac5c532523
First part of the UI for fixing analysis parameter.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
106 layout.setWidth("400px"); |
87ac5c532523
First part of the UI for fixing analysis parameter.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
107 |
87ac5c532523
First part of the UI for fixing analysis parameter.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
108 Label label = new Label(dataList.getLabel()); |
87ac5c532523
First part of the UI for fixing analysis parameter.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
109 label.setWidth("200px"); |
87ac5c532523
First part of the UI for fixing analysis parameter.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
110 |
87ac5c532523
First part of the UI for fixing analysis parameter.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
111 Canvas back = getBackButton(dataList.getState()); |
87ac5c532523
First part of the UI for fixing analysis parameter.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
112 |
87ac5c532523
First part of the UI for fixing analysis parameter.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
113 layout.addMember(label); |
87ac5c532523
First part of the UI for fixing analysis parameter.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
114 layout.addMember(old); |
87ac5c532523
First part of the UI for fixing analysis parameter.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
115 layout.addMember(back); |
87ac5c532523
First part of the UI for fixing analysis parameter.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
116 |
87ac5c532523
First part of the UI for fixing analysis parameter.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
117 return layout; |
87ac5c532523
First part of the UI for fixing analysis parameter.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
118 } |
87ac5c532523
First part of the UI for fixing analysis parameter.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
119 |
87ac5c532523
First part of the UI for fixing analysis parameter.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
120 |
87ac5c532523
First part of the UI for fixing analysis parameter.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
121 /** |
87ac5c532523
First part of the UI for fixing analysis parameter.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
122 * This method returns the selected data. |
87ac5c532523
First part of the UI for fixing analysis parameter.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
123 * |
87ac5c532523
First part of the UI for fixing analysis parameter.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
124 * @return the selected/inserted data. |
87ac5c532523
First part of the UI for fixing analysis parameter.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
125 */ |
87ac5c532523
First part of the UI for fixing analysis parameter.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
126 public Data[] getData() { |
87ac5c532523
First part of the UI for fixing analysis parameter.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
127 List<Data> data = new ArrayList<Data>(); |
87ac5c532523
First part of the UI for fixing analysis parameter.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
128 |
87ac5c532523
First part of the UI for fixing analysis parameter.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
129 boolean valid = saveDateValues(); |
87ac5c532523
First part of the UI for fixing analysis parameter.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
130 if(valid) { |
2526
a911e2968cb1
Changed some data types in states and filter and added new preprocessing state
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2517
diff
changeset
|
131 this.fixFilter.setFromDate(this.start); |
a911e2968cb1
Changed some data types in states and filter and added new preprocessing state
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2517
diff
changeset
|
132 this.fixFilter.setToDate(this.end); |
2505
87ac5c532523
First part of the UI for fixing analysis parameter.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
133 String start = Long.valueOf(this.start).toString(); |
87ac5c532523
First part of the UI for fixing analysis parameter.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
134 String end = Long.valueOf(this.end).toString(); |
87ac5c532523
First part of the UI for fixing analysis parameter.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
135 DataItem startItem = new DefaultDataItem("start", "start", start); |
87ac5c532523
First part of the UI for fixing analysis parameter.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
136 DataItem endItem = new DefaultDataItem("end", "end", end); |
87ac5c532523
First part of the UI for fixing analysis parameter.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
137 data.add(new DefaultData( |
87ac5c532523
First part of the UI for fixing analysis parameter.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
138 "start", |
87ac5c532523
First part of the UI for fixing analysis parameter.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
139 null, |
87ac5c532523
First part of the UI for fixing analysis parameter.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
140 null, |
87ac5c532523
First part of the UI for fixing analysis parameter.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
141 new DataItem[] { startItem })); |
87ac5c532523
First part of the UI for fixing analysis parameter.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
142 data.add(new DefaultData( |
87ac5c532523
First part of the UI for fixing analysis parameter.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
143 "end", |
87ac5c532523
First part of the UI for fixing analysis parameter.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
144 null, |
87ac5c532523
First part of the UI for fixing analysis parameter.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
145 null, |
87ac5c532523
First part of the UI for fixing analysis parameter.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
146 new DataItem[] { endItem })); |
87ac5c532523
First part of the UI for fixing analysis parameter.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
147 } |
87ac5c532523
First part of the UI for fixing analysis parameter.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
148 |
87ac5c532523
First part of the UI for fixing analysis parameter.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
149 return (Data[]) data.toArray(new Data[data.size()]); |
87ac5c532523
First part of the UI for fixing analysis parameter.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
150 } |
87ac5c532523
First part of the UI for fixing analysis parameter.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
151 |
87ac5c532523
First part of the UI for fixing analysis parameter.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
152 |
87ac5c532523
First part of the UI for fixing analysis parameter.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
153 @Override |
87ac5c532523
First part of the UI for fixing analysis parameter.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
154 public void setValues(String cid, boolean checked) { |
87ac5c532523
First part of the UI for fixing analysis parameter.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
155 // No user interaction, do nothing. |
87ac5c532523
First part of the UI for fixing analysis parameter.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
156 } |
87ac5c532523
First part of the UI for fixing analysis parameter.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
157 |
87ac5c532523
First part of the UI for fixing analysis parameter.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
158 |
87ac5c532523
First part of the UI for fixing analysis parameter.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
159 @Override |
87ac5c532523
First part of the UI for fixing analysis parameter.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
160 public boolean renderCheckboxes() { |
87ac5c532523
First part of the UI for fixing analysis parameter.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
161 // No selection, return false. |
87ac5c532523
First part of the UI for fixing analysis parameter.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
162 return false; |
87ac5c532523
First part of the UI for fixing analysis parameter.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
163 } |
87ac5c532523
First part of the UI for fixing analysis parameter.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
164 |
87ac5c532523
First part of the UI for fixing analysis parameter.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
165 |
2517
8f528f5ae137
Added filter object class and scrollable chart to helper panel.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2505
diff
changeset
|
166 public void setFilter(FixFilter filter) { |
8f528f5ae137
Added filter object class and scrollable chart to helper panel.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2505
diff
changeset
|
167 this.fixFilter = filter; |
8f528f5ae137
Added filter object class and scrollable chart to helper panel.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2505
diff
changeset
|
168 } |
8f528f5ae137
Added filter object class and scrollable chart to helper panel.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2505
diff
changeset
|
169 |
8f528f5ae137
Added filter object class and scrollable chart to helper panel.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2505
diff
changeset
|
170 |
8f528f5ae137
Added filter object class and scrollable chart to helper panel.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2505
diff
changeset
|
171 public FixFilter getFilter() { |
8f528f5ae137
Added filter object class and scrollable chart to helper panel.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2505
diff
changeset
|
172 return this.fixFilter; |
8f528f5ae137
Added filter object class and scrollable chart to helper panel.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2505
diff
changeset
|
173 } |
8f528f5ae137
Added filter object class and scrollable chart to helper panel.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2505
diff
changeset
|
174 |
2537
cc5969df0490
New methods in UI providers for fixings states and minor protocol changes.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2526
diff
changeset
|
175 public void success() {} |
2517
8f528f5ae137
Added filter object class and scrollable chart to helper panel.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2505
diff
changeset
|
176 |
2505
87ac5c532523
First part of the UI for fixing analysis parameter.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
177 protected boolean saveDateValues() { |
87ac5c532523
First part of the UI for fixing analysis parameter.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
178 Date st = inputPanel.getFromDate(); |
87ac5c532523
First part of the UI for fixing analysis parameter.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
179 Date en = inputPanel.getToDate(); |
87ac5c532523
First part of the UI for fixing analysis parameter.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
180 if (st == null || en == null) { |
87ac5c532523
First part of the UI for fixing analysis parameter.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
181 SC.warn(MESSAGES.error_wrong_date()); |
87ac5c532523
First part of the UI for fixing analysis parameter.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
182 return false; |
87ac5c532523
First part of the UI for fixing analysis parameter.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
183 } |
87ac5c532523
First part of the UI for fixing analysis parameter.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
184 |
87ac5c532523
First part of the UI for fixing analysis parameter.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
185 long start = st.getTime(); |
87ac5c532523
First part of the UI for fixing analysis parameter.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
186 long end = en.getTime(); |
87ac5c532523
First part of the UI for fixing analysis parameter.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
187 |
87ac5c532523
First part of the UI for fixing analysis parameter.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
188 if (start <= end) { |
87ac5c532523
First part of the UI for fixing analysis parameter.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
189 this.start = start; |
87ac5c532523
First part of the UI for fixing analysis parameter.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
190 this.end = end; |
87ac5c532523
First part of the UI for fixing analysis parameter.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
191 return true; |
87ac5c532523
First part of the UI for fixing analysis parameter.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
192 } |
87ac5c532523
First part of the UI for fixing analysis parameter.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
193 return false; |
87ac5c532523
First part of the UI for fixing analysis parameter.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
194 } |
87ac5c532523
First part of the UI for fixing analysis parameter.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
195 } |