annotate flys-client/src/main/java/de/intevation/flys/client/client/ui/fixation/FixationPanel.java @ 2922:71db63f67d31

FixA: Do not throw layout away if only the km chart needs reloading. flys-client/trunk@4777 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Sascha L. Teichmann <sascha.teichmann@intevation.de>
date Mon, 25 Jun 2012 13:50:22 +0000
parents be99bf1aa59b
children 43e0f6d96206
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.HashMap;
2884
88bca9f735c0 Implemented filter for fix analysis helper widgets.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2539
diff changeset
4 import java.util.Date;
88bca9f735c0 Implemented filter for fix analysis helper widgets.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2539
diff changeset
5
88bca9f735c0 Implemented filter for fix analysis helper widgets.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2539
diff changeset
6 import java.io.Serializable;
2517
8f528f5ae137 Added filter object class and scrollable chart to helper panel.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2505
diff changeset
7
2505
87ac5c532523 First part of the UI for fixing analysis parameter.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
8 import com.google.gwt.core.client.GWT;
87ac5c532523 First part of the UI for fixing analysis parameter.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
9 import com.google.gwt.user.client.rpc.AsyncCallback;
87ac5c532523 First part of the UI for fixing analysis parameter.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
10
2884
88bca9f735c0 Implemented filter for fix analysis helper widgets.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2539
diff changeset
11 import com.google.gwt.json.client.JSONObject;
88bca9f735c0 Implemented filter for fix analysis helper widgets.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2539
diff changeset
12 import com.google.gwt.json.client.JSONNumber;
88bca9f735c0 Implemented filter for fix analysis helper widgets.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2539
diff changeset
13 import com.google.gwt.json.client.JSONString;
88bca9f735c0 Implemented filter for fix analysis helper widgets.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2539
diff changeset
14 import com.google.gwt.i18n.client.DateTimeFormat;
88bca9f735c0 Implemented filter for fix analysis helper widgets.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2539
diff changeset
15
2505
87ac5c532523 First part of the UI for fixing analysis parameter.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
16 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
17
87ac5c532523 First part of the UI for fixing analysis parameter.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
18 import com.smartgwt.client.widgets.Canvas;
2517
8f528f5ae137 Added filter object class and scrollable chart to helper panel.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2505
diff changeset
19 import com.smartgwt.client.widgets.Button;
2505
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.DynamicForm;
87ac5c532523 First part of the UI for fixing analysis parameter.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
21 import com.smartgwt.client.widgets.HTMLPane;
87ac5c532523 First part of the UI for fixing analysis parameter.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
22 import com.smartgwt.client.widgets.layout.VLayout;
2517
8f528f5ae137 Added filter object class and scrollable chart to helper panel.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2505
diff changeset
23 import com.smartgwt.client.widgets.layout.HLayout;
8f528f5ae137 Added filter object class and scrollable chart to helper panel.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2505
diff changeset
24 import com.smartgwt.client.widgets.form.fields.TextItem;
8f528f5ae137 Added filter object class and scrollable chart to helper panel.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2505
diff changeset
25 import com.smartgwt.client.widgets.form.fields.events.ChangedHandler;
8f528f5ae137 Added filter object class and scrollable chart to helper panel.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2505
diff changeset
26 import com.smartgwt.client.widgets.form.fields.events.ChangedEvent;
8f528f5ae137 Added filter object class and scrollable chart to helper panel.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2505
diff changeset
27 import com.smartgwt.client.widgets.events.ClickHandler;
8f528f5ae137 Added filter object class and scrollable chart to helper panel.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2505
diff changeset
28 import com.smartgwt.client.widgets.events.ClickEvent;
8f528f5ae137 Added filter object class and scrollable chart to helper panel.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2505
diff changeset
29 import com.smartgwt.client.widgets.events.ResizedHandler;
8f528f5ae137 Added filter object class and scrollable chart to helper panel.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2505
diff changeset
30 import com.smartgwt.client.widgets.events.ResizedEvent;
8f528f5ae137 Added filter object class and scrollable chart to helper panel.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2505
diff changeset
31 import com.smartgwt.client.widgets.form.validator.IsFloatValidator;
8f528f5ae137 Added filter object class and scrollable chart to helper panel.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2505
diff changeset
32 import com.smartgwt.client.types.Alignment;
8f528f5ae137 Added filter object class and scrollable chart to helper panel.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2505
diff changeset
33
8f528f5ae137 Added filter object class and scrollable chart to helper panel.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2505
diff changeset
34 import com.smartgwt.client.widgets.tab.Tab;
8f528f5ae137 Added filter object class and scrollable chart to helper panel.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2505
diff changeset
35 import com.smartgwt.client.widgets.tab.TabSet;
8f528f5ae137 Added filter object class and scrollable chart to helper panel.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2505
diff changeset
36 import com.smartgwt.client.widgets.Img;
2505
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 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
39 import de.intevation.flys.client.client.ui.AbstractUIProvider;
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 import de.intevation.flys.client.client.Config;
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 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
44 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
45 import de.intevation.flys.client.shared.model.FixingsOverviewInfo;
2884
88bca9f735c0 Implemented filter for fix analysis helper widgets.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2539
diff changeset
46 import de.intevation.flys.client.shared.model.FixAnalysisArtifact;
2505
87ac5c532523 First part of the UI for fixing analysis parameter.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
47
87ac5c532523 First part of the UI for fixing analysis parameter.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
48 import de.intevation.flys.client.client.services.FixingsOverviewService;
87ac5c532523 First part of the UI for fixing analysis parameter.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
49 import de.intevation.flys.client.client.services.FixingsOverviewServiceAsync;
87ac5c532523 First part of the UI for fixing analysis parameter.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
50
87ac5c532523 First part of the UI for fixing analysis parameter.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
51
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 * This UIProvider creates helper panel for fixation analysis without input
87ac5c532523 First part of the UI for fixing analysis parameter.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
54 * elements.
87ac5c532523 First part of the UI for fixing analysis parameter.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
55 *
87ac5c532523 First part of the UI for fixing analysis parameter.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
56 * @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
57 */
87ac5c532523 First part of the UI for fixing analysis parameter.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
58 public abstract class FixationPanel
2517
8f528f5ae137 Added filter object class and scrollable chart to helper panel.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2505
diff changeset
59 extends AbstractUIProvider
8f528f5ae137 Added filter object class and scrollable chart to helper panel.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2505
diff changeset
60 implements ResizedHandler
2505
87ac5c532523 First part of the UI for fixing analysis parameter.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
61 {
87ac5c532523 First part of the UI for fixing analysis parameter.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
62 protected static HashMap<String, FixationPanel> instances = new HashMap<String, FixationPanel>();
87ac5c532523 First part of the UI for fixing analysis parameter.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
63
87ac5c532523 First part of the UI for fixing analysis parameter.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
64 /** 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
65 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
66
87ac5c532523 First part of the UI for fixing analysis parameter.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
67 protected FixingsOverviewServiceAsync overviewService =
87ac5c532523 First part of the UI for fixing analysis parameter.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
68 GWT.create(FixingsOverviewService.class);
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 protected String htmlOverview;
87ac5c532523 First part of the UI for fixing analysis parameter.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
71 protected FixingsOverviewInfo fixInfo;
2517
8f528f5ae137 Added filter object class and scrollable chart to helper panel.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2505
diff changeset
72 protected TabSet tabs;
8f528f5ae137 Added filter object class and scrollable chart to helper panel.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2505
diff changeset
73 protected Tab events;
8f528f5ae137 Added filter object class and scrollable chart to helper panel.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2505
diff changeset
74 protected Tab chart;
8f528f5ae137 Added filter object class and scrollable chart to helper panel.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2505
diff changeset
75 protected VLayout chartContainer;
8f528f5ae137 Added filter object class and scrollable chart to helper panel.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2505
diff changeset
76 protected Img chartImg;
2505
87ac5c532523 First part of the UI for fixing analysis parameter.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
77
87ac5c532523 First part of the UI for fixing analysis parameter.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
78 public FixationPanel() {
2517
8f528f5ae137 Added filter object class and scrollable chart to helper panel.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2505
diff changeset
79 chartImg = new Img();
2505
87ac5c532523 First part of the UI for fixing analysis parameter.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
80 htmlOverview = "";
87ac5c532523 First part of the UI for fixing analysis parameter.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
81 }
87ac5c532523 First part of the UI for fixing analysis parameter.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
82
87ac5c532523 First part of the UI for fixing analysis parameter.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
83 protected String getArtifactUuid() {
87ac5c532523 First part of the UI for fixing analysis parameter.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
84 return this.artifact.getUuid();
87ac5c532523 First part of the UI for fixing analysis parameter.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
85 }
87ac5c532523 First part of the UI for fixing analysis parameter.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
86
87ac5c532523 First part of the UI for fixing analysis parameter.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
87 protected void init() {
87ac5c532523 First part of the UI for fixing analysis parameter.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
88
87ac5c532523 First part of the UI for fixing analysis parameter.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
89 }
87ac5c532523 First part of the UI for fixing analysis parameter.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
90
87ac5c532523 First part of the UI for fixing analysis parameter.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
91 public Data[] getData() {
87ac5c532523 First part of the UI for fixing analysis parameter.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
92 return null;
87ac5c532523 First part of the UI for fixing analysis parameter.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
93 }
87ac5c532523 First part of the UI for fixing analysis parameter.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
94
87ac5c532523 First part of the UI for fixing analysis parameter.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
95 public Canvas create(DataList list) {
87ac5c532523 First part of the UI for fixing analysis parameter.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
96 VLayout layout = new VLayout();
87ac5c532523 First part of the UI for fixing analysis parameter.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
97
87ac5c532523 First part of the UI for fixing analysis parameter.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
98 Canvas helper = createHelper();
87ac5c532523 First part of the UI for fixing analysis parameter.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
99 this.helperContainer.addMember(helper);
87ac5c532523 First part of the UI for fixing analysis parameter.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
100
87ac5c532523 First part of the UI for fixing analysis parameter.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
101 Canvas submit = getNextButton();
87ac5c532523 First part of the UI for fixing analysis parameter.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
102 Canvas widget = createWidget(list);
87ac5c532523 First part of the UI for fixing analysis parameter.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
103
87ac5c532523 First part of the UI for fixing analysis parameter.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
104 layout.addMember(widget);
87ac5c532523 First part of the UI for fixing analysis parameter.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
105 layout.addMember(submit);
87ac5c532523 First part of the UI for fixing analysis parameter.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
106 return layout;
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
87ac5c532523 First part of the UI for fixing analysis parameter.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
109 public Canvas createOld(DataList list) {
87ac5c532523 First part of the UI for fixing analysis parameter.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
110 return new DynamicForm();
87ac5c532523 First part of the UI for fixing analysis parameter.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
111 }
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 protected Canvas createHelper() {
87ac5c532523 First part of the UI for fixing analysis parameter.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
114 Config config = Config.getInstance();
87ac5c532523 First part of the UI for fixing analysis parameter.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
115 String locale = config.getLocale ();
87ac5c532523 First part of the UI for fixing analysis parameter.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
116
2517
8f528f5ae137 Added filter object class and scrollable chart to helper panel.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2505
diff changeset
117 tabs = new TabSet();
8f528f5ae137 Added filter object class and scrollable chart to helper panel.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2505
diff changeset
118 events = new Tab(MESSAGES.events());
8f528f5ae137 Added filter object class and scrollable chart to helper panel.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2505
diff changeset
119 chart = new Tab(MESSAGES.kmchart());
8f528f5ae137 Added filter object class and scrollable chart to helper panel.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2505
diff changeset
120
8f528f5ae137 Added filter object class and scrollable chart to helper panel.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2505
diff changeset
121 chartContainer = new VLayout();
8f528f5ae137 Added filter object class and scrollable chart to helper panel.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2505
diff changeset
122 Canvas scroll = createChartHelper();
8f528f5ae137 Added filter object class and scrollable chart to helper panel.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2505
diff changeset
123
8f528f5ae137 Added filter object class and scrollable chart to helper panel.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2505
diff changeset
124 VLayout layout = new VLayout();
8f528f5ae137 Added filter object class and scrollable chart to helper panel.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2505
diff changeset
125 layout.addResizedHandler(this);
8f528f5ae137 Added filter object class and scrollable chart to helper panel.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2505
diff changeset
126 layout.addMember(chartContainer);
8f528f5ae137 Added filter object class and scrollable chart to helper panel.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2505
diff changeset
127 layout.addMember(scroll);
8f528f5ae137 Added filter object class and scrollable chart to helper panel.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2505
diff changeset
128 layout.setAlign(Alignment.CENTER);
8f528f5ae137 Added filter object class and scrollable chart to helper panel.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2505
diff changeset
129 chart.setPane(layout);
8f528f5ae137 Added filter object class and scrollable chart to helper panel.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2505
diff changeset
130
8f528f5ae137 Added filter object class and scrollable chart to helper panel.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2505
diff changeset
131 final HTMLPane eventPane = new HTMLPane();
2505
87ac5c532523 First part of the UI for fixing analysis parameter.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
132
87ac5c532523 First part of the UI for fixing analysis parameter.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
133 String river = artifact.getArtifactDescription().getRiver();
87ac5c532523 First part of the UI for fixing analysis parameter.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
134 createCallback();
2914
7d69e570e79b FixA: Set discharge sectors 0 and 3 as default in UI.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2901
diff changeset
135
2505
87ac5c532523 First part of the UI for fixing analysis parameter.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
136 String callBack = "fixationCallback(this.checked, this.name)";
2884
88bca9f735c0 Implemented filter for fix analysis helper widgets.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2539
diff changeset
137 FixAnalysisArtifact art = (FixAnalysisArtifact) this.artifact;
88bca9f735c0 Implemented filter for fix analysis helper widgets.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2539
diff changeset
138
2505
87ac5c532523 First part of the UI for fixing analysis parameter.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
139 overviewService.generateOverview(
87ac5c532523 First part of the UI for fixing analysis parameter.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
140 locale,
87ac5c532523 First part of the UI for fixing analysis parameter.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
141 artifact.getUuid(),
2884
88bca9f735c0 Implemented filter for fix analysis helper widgets.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2539
diff changeset
142 art.getFilter().getOverviewFilter(),
2505
87ac5c532523 First part of the UI for fixing analysis parameter.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
143 renderCheckboxes(),
87ac5c532523 First part of the UI for fixing analysis parameter.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
144 callBack,
87ac5c532523 First part of the UI for fixing analysis parameter.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
145 new AsyncCallback<FixingsOverviewInfo>() {
87ac5c532523 First part of the UI for fixing analysis parameter.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
146 public void onFailure(Throwable caught) {
87ac5c532523 First part of the UI for fixing analysis parameter.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
147 GWT.log("Could not receive overview.");
87ac5c532523 First part of the UI for fixing analysis parameter.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
148 SC.warn(caught.getMessage());
87ac5c532523 First part of the UI for fixing analysis parameter.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
149 }
87ac5c532523 First part of the UI for fixing analysis parameter.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
150 public void onSuccess(FixingsOverviewInfo info) {
87ac5c532523 First part of the UI for fixing analysis parameter.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
151 GWT.log("Successfully loaded overview.");
87ac5c532523 First part of the UI for fixing analysis parameter.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
152 fixInfo = info;
87ac5c532523 First part of the UI for fixing analysis parameter.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
153 htmlOverview = info.getHTML();
2884
88bca9f735c0 Implemented filter for fix analysis helper widgets.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2539
diff changeset
154 FixAnalysisArtifact art = (FixAnalysisArtifact)artifact;
88bca9f735c0 Implemented filter for fix analysis helper widgets.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2539
diff changeset
155 art.getFilter().setRiver(info.getRiver());
88bca9f735c0 Implemented filter for fix analysis helper widgets.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2539
diff changeset
156 art.getFilter().setCurrentKm(1d);
88bca9f735c0 Implemented filter for fix analysis helper widgets.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2539
diff changeset
157 art.getFilter().setFromKm(info.getFrom());
88bca9f735c0 Implemented filter for fix analysis helper widgets.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2539
diff changeset
158 art.getFilter().setToKm(info.getTo());
2517
8f528f5ae137 Added filter object class and scrollable chart to helper panel.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2505
diff changeset
159 eventPane.setContents(htmlOverview);
8f528f5ae137 Added filter object class and scrollable chart to helper panel.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2505
diff changeset
160 updateChartTab(fixInfo.getFrom());
8f528f5ae137 Added filter object class and scrollable chart to helper panel.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2505
diff changeset
161 events.setPane(eventPane);
2537
cc5969df0490 New methods in UI providers for fixings states and minor protocol changes.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2526
diff changeset
162 success();
2505
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 tabs.addTab(events);
8f528f5ae137 Added filter object class and scrollable chart to helper panel.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2505
diff changeset
167 tabs.addTab(chart);
2505
87ac5c532523 First part of the UI for fixing analysis parameter.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
168
2517
8f528f5ae137 Added filter object class and scrollable chart to helper panel.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2505
diff changeset
169 return tabs;
2505
87ac5c532523 First part of the UI for fixing analysis parameter.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
170 }
87ac5c532523 First part of the UI for fixing analysis parameter.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
171
2517
8f528f5ae137 Added filter object class and scrollable chart to helper panel.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2505
diff changeset
172
8f528f5ae137 Added filter object class and scrollable chart to helper panel.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2505
diff changeset
173 protected Canvas createChartHelper() {
8f528f5ae137 Added filter object class and scrollable chart to helper panel.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2505
diff changeset
174
8f528f5ae137 Added filter object class and scrollable chart to helper panel.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2505
diff changeset
175
8f528f5ae137 Added filter object class and scrollable chart to helper panel.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2505
diff changeset
176 DynamicForm form = new DynamicForm();
8f528f5ae137 Added filter object class and scrollable chart to helper panel.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2505
diff changeset
177 Button lower = new Button("<<");
8f528f5ae137 Added filter object class and scrollable chart to helper panel.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2505
diff changeset
178 lower.setWidth(30);
8f528f5ae137 Added filter object class and scrollable chart to helper panel.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2505
diff changeset
179 Button upper = new Button(">>");
8f528f5ae137 Added filter object class and scrollable chart to helper panel.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2505
diff changeset
180 upper.setWidth(30);
8f528f5ae137 Added filter object class and scrollable chart to helper panel.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2505
diff changeset
181 final TextItem currentkm = new TextItem();
8f528f5ae137 Added filter object class and scrollable chart to helper panel.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2505
diff changeset
182 currentkm.setWidth(60);
8f528f5ae137 Added filter object class and scrollable chart to helper panel.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2505
diff changeset
183 currentkm.setShowTitle(false);
8f528f5ae137 Added filter object class and scrollable chart to helper panel.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2505
diff changeset
184 currentkm.setValidators(new IsFloatValidator());
8f528f5ae137 Added filter object class and scrollable chart to helper panel.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2505
diff changeset
185
8f528f5ae137 Added filter object class and scrollable chart to helper panel.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2505
diff changeset
186 form.setFields(currentkm);
8f528f5ae137 Added filter object class and scrollable chart to helper panel.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2505
diff changeset
187 form.setWidth(60);
8f528f5ae137 Added filter object class and scrollable chart to helper panel.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2505
diff changeset
188 lower.addClickHandler(new ClickHandler() {
8f528f5ae137 Added filter object class and scrollable chart to helper panel.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2505
diff changeset
189 public void onClick(ClickEvent ce) {
8f528f5ae137 Added filter object class and scrollable chart to helper panel.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2505
diff changeset
190 updateChartTabLow();
2884
88bca9f735c0 Implemented filter for fix analysis helper widgets.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2539
diff changeset
191 FixAnalysisArtifact art = (FixAnalysisArtifact) artifact;
88bca9f735c0 Implemented filter for fix analysis helper widgets.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2539
diff changeset
192 currentkm.setValue(art.getFilter().getCurrentKm());
2517
8f528f5ae137 Added filter object class and scrollable chart to helper panel.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2505
diff changeset
193 }
8f528f5ae137 Added filter object class and scrollable chart to helper panel.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2505
diff changeset
194 });
8f528f5ae137 Added filter object class and scrollable chart to helper panel.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2505
diff changeset
195
8f528f5ae137 Added filter object class and scrollable chart to helper panel.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2505
diff changeset
196 upper.addClickHandler(new ClickHandler() {
8f528f5ae137 Added filter object class and scrollable chart to helper panel.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2505
diff changeset
197 public void onClick(ClickEvent ce) {
8f528f5ae137 Added filter object class and scrollable chart to helper panel.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2505
diff changeset
198 updateChartTabUp();
2884
88bca9f735c0 Implemented filter for fix analysis helper widgets.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2539
diff changeset
199 FixAnalysisArtifact art = (FixAnalysisArtifact) artifact;
88bca9f735c0 Implemented filter for fix analysis helper widgets.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2539
diff changeset
200 currentkm.setValue(art.getFilter().getCurrentKm());
2517
8f528f5ae137 Added filter object class and scrollable chart to helper panel.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2505
diff changeset
201 }
8f528f5ae137 Added filter object class and scrollable chart to helper panel.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2505
diff changeset
202 });
8f528f5ae137 Added filter object class and scrollable chart to helper panel.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2505
diff changeset
203
8f528f5ae137 Added filter object class and scrollable chart to helper panel.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2505
diff changeset
204 currentkm.addChangedHandler(new ChangedHandler() {
8f528f5ae137 Added filter object class and scrollable chart to helper panel.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2505
diff changeset
205 public void onChanged(ChangedEvent ce) {
8f528f5ae137 Added filter object class and scrollable chart to helper panel.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2505
diff changeset
206 //TODO: get current value.
8f528f5ae137 Added filter object class and scrollable chart to helper panel.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2505
diff changeset
207 if(ce.getForm().validate() && ce.getItem().getValue() != null) {
8f528f5ae137 Added filter object class and scrollable chart to helper panel.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2505
diff changeset
208 try {
8f528f5ae137 Added filter object class and scrollable chart to helper panel.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2505
diff changeset
209 String s = ce.getItem().getValue().toString();
8f528f5ae137 Added filter object class and scrollable chart to helper panel.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2505
diff changeset
210 Double d = new Double(s);
8f528f5ae137 Added filter object class and scrollable chart to helper panel.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2505
diff changeset
211 updateChartTab(d.doubleValue());
8f528f5ae137 Added filter object class and scrollable chart to helper panel.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2505
diff changeset
212 }
8f528f5ae137 Added filter object class and scrollable chart to helper panel.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2505
diff changeset
213 catch(NumberFormatException nfe) {
8f528f5ae137 Added filter object class and scrollable chart to helper panel.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2505
diff changeset
214 // Do nothing.
8f528f5ae137 Added filter object class and scrollable chart to helper panel.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2505
diff changeset
215 }
8f528f5ae137 Added filter object class and scrollable chart to helper panel.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2505
diff changeset
216 }
8f528f5ae137 Added filter object class and scrollable chart to helper panel.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2505
diff changeset
217 }
8f528f5ae137 Added filter object class and scrollable chart to helper panel.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2505
diff changeset
218 });
8f528f5ae137 Added filter object class and scrollable chart to helper panel.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2505
diff changeset
219
8f528f5ae137 Added filter object class and scrollable chart to helper panel.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2505
diff changeset
220 HLayout layout = new HLayout();
8f528f5ae137 Added filter object class and scrollable chart to helper panel.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2505
diff changeset
221 layout.setAlign(Alignment.CENTER);
8f528f5ae137 Added filter object class and scrollable chart to helper panel.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2505
diff changeset
222
8f528f5ae137 Added filter object class and scrollable chart to helper panel.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2505
diff changeset
223 layout.addMember(lower);
8f528f5ae137 Added filter object class and scrollable chart to helper panel.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2505
diff changeset
224 layout.addMember(form);
8f528f5ae137 Added filter object class and scrollable chart to helper panel.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2505
diff changeset
225 layout.addMember(upper);
8f528f5ae137 Added filter object class and scrollable chart to helper panel.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2505
diff changeset
226 return layout;
8f528f5ae137 Added filter object class and scrollable chart to helper panel.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2505
diff changeset
227 }
8f528f5ae137 Added filter object class and scrollable chart to helper panel.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2505
diff changeset
228
8f528f5ae137 Added filter object class and scrollable chart to helper panel.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2505
diff changeset
229 protected void updateChartTab(double km) {
8f528f5ae137 Added filter object class and scrollable chart to helper panel.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2505
diff changeset
230 Config config = Config.getInstance();
8f528f5ae137 Added filter object class and scrollable chart to helper panel.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2505
diff changeset
231 String locale = config.getLocale ();
8f528f5ae137 Added filter object class and scrollable chart to helper panel.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2505
diff changeset
232
2884
88bca9f735c0 Implemented filter for fix analysis helper widgets.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2539
diff changeset
233 FixAnalysisArtifact art = (FixAnalysisArtifact) this.artifact;
88bca9f735c0 Implemented filter for fix analysis helper widgets.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2539
diff changeset
234 if (km < 0) {
88bca9f735c0 Implemented filter for fix analysis helper widgets.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2539
diff changeset
235 km = 0;
88bca9f735c0 Implemented filter for fix analysis helper widgets.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2539
diff changeset
236 }
88bca9f735c0 Implemented filter for fix analysis helper widgets.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2539
diff changeset
237 art.getFilter().setCurrentKm(km);
2901
2fdeb239bbd2 Changed helper chart size in Fix analysis to avoid overlapping in maximized project window.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2899
diff changeset
238
2fdeb239bbd2 Changed helper chart size in Fix analysis to avoid overlapping in maximized project window.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2899
diff changeset
239 int hWidth = helperContainer.getWidth() - 12;
2fdeb239bbd2 Changed helper chart size in Fix analysis to avoid overlapping in maximized project window.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2899
diff changeset
240 int hHeight = helperContainer.getHeight() - 62;
2fdeb239bbd2 Changed helper chart size in Fix analysis to avoid overlapping in maximized project window.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2899
diff changeset
241
2922
71db63f67d31 FixA: Do not throw layout away if only the km chart needs reloading.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2917
diff changeset
242 if ((int)(hHeight *4f/3) < hWidth) {
71db63f67d31 FixA: Do not throw layout away if only the km chart needs reloading.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2917
diff changeset
243 hWidth = (int)(hHeight * 4f/3);
2901
2fdeb239bbd2 Changed helper chart size in Fix analysis to avoid overlapping in maximized project window.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2899
diff changeset
244 }
2fdeb239bbd2 Changed helper chart size in Fix analysis to avoid overlapping in maximized project window.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2899
diff changeset
245 else {
2922
71db63f67d31 FixA: Do not throw layout away if only the km chart needs reloading.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2917
diff changeset
246 hHeight = (int)(hWidth *3f/4);
2901
2fdeb239bbd2 Changed helper chart size in Fix analysis to avoid overlapping in maximized project window.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2899
diff changeset
247 }
2fdeb239bbd2 Changed helper chart size in Fix analysis to avoid overlapping in maximized project window.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2899
diff changeset
248
2517
8f528f5ae137 Added filter object class and scrollable chart to helper panel.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2505
diff changeset
249 String imgUrl = GWT.getModuleBaseURL();
8f528f5ae137 Added filter object class and scrollable chart to helper panel.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2505
diff changeset
250 imgUrl += "fixings-km-chart";
8f528f5ae137 Added filter object class and scrollable chart to helper panel.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2505
diff changeset
251 imgUrl += "?locale=" + locale;
2901
2fdeb239bbd2 Changed helper chart size in Fix analysis to avoid overlapping in maximized project window.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2899
diff changeset
252 imgUrl += "&filter=" + art.getFilter().getChartFilter(hWidth, hHeight);
2517
8f528f5ae137 Added filter object class and scrollable chart to helper panel.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2505
diff changeset
253
2922
71db63f67d31 FixA: Do not throw layout away if only the km chart needs reloading.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2917
diff changeset
254 if (chartContainer.hasMember(chartImg)) {
71db63f67d31 FixA: Do not throw layout away if only the km chart needs reloading.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2917
diff changeset
255 chartImg.setWidth(hWidth);
71db63f67d31 FixA: Do not throw layout away if only the km chart needs reloading.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2917
diff changeset
256 chartImg.setHeight(hHeight);
71db63f67d31 FixA: Do not throw layout away if only the km chart needs reloading.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2917
diff changeset
257 chartImg.setSrc(imgUrl);
71db63f67d31 FixA: Do not throw layout away if only the km chart needs reloading.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2917
diff changeset
258 }
71db63f67d31 FixA: Do not throw layout away if only the km chart needs reloading.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2917
diff changeset
259 else {
71db63f67d31 FixA: Do not throw layout away if only the km chart needs reloading.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2917
diff changeset
260 chartImg = new Img(imgUrl, hWidth, hHeight);
71db63f67d31 FixA: Do not throw layout away if only the km chart needs reloading.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2917
diff changeset
261 chartContainer.addMember(chartImg);
71db63f67d31 FixA: Do not throw layout away if only the km chart needs reloading.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2917
diff changeset
262 }
2517
8f528f5ae137 Added filter object class and scrollable chart to helper panel.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2505
diff changeset
263 }
8f528f5ae137 Added filter object class and scrollable chart to helper panel.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2505
diff changeset
264
8f528f5ae137 Added filter object class and scrollable chart to helper panel.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2505
diff changeset
265
8f528f5ae137 Added filter object class and scrollable chart to helper panel.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2505
diff changeset
266 protected void updateChartTabLow() {
2884
88bca9f735c0 Implemented filter for fix analysis helper widgets.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2539
diff changeset
267 FixAnalysisArtifact art = (FixAnalysisArtifact) this.artifact;
88bca9f735c0 Implemented filter for fix analysis helper widgets.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2539
diff changeset
268
88bca9f735c0 Implemented filter for fix analysis helper widgets.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2539
diff changeset
269 double curr = art.getFilter().getCurrentKm();
88bca9f735c0 Implemented filter for fix analysis helper widgets.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2539
diff changeset
270 if (curr > art.getFilter().getFromKm()) {
2517
8f528f5ae137 Added filter object class and scrollable chart to helper panel.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2505
diff changeset
271 double newVal = (curr - 0.1) * 10;
8f528f5ae137 Added filter object class and scrollable chart to helper panel.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2505
diff changeset
272 long round = Math.round(newVal);
8f528f5ae137 Added filter object class and scrollable chart to helper panel.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2505
diff changeset
273 updateChartTab(((double)round) / 10);
8f528f5ae137 Added filter object class and scrollable chart to helper panel.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2505
diff changeset
274 }
8f528f5ae137 Added filter object class and scrollable chart to helper panel.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2505
diff changeset
275 return;
8f528f5ae137 Added filter object class and scrollable chart to helper panel.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2505
diff changeset
276 }
8f528f5ae137 Added filter object class and scrollable chart to helper panel.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2505
diff changeset
277
8f528f5ae137 Added filter object class and scrollable chart to helper panel.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2505
diff changeset
278
8f528f5ae137 Added filter object class and scrollable chart to helper panel.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2505
diff changeset
279 protected void updateChartTabUp() {
2884
88bca9f735c0 Implemented filter for fix analysis helper widgets.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2539
diff changeset
280 FixAnalysisArtifact art = (FixAnalysisArtifact) this.artifact;
88bca9f735c0 Implemented filter for fix analysis helper widgets.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2539
diff changeset
281
88bca9f735c0 Implemented filter for fix analysis helper widgets.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2539
diff changeset
282 double curr = art.getFilter().getCurrentKm();
88bca9f735c0 Implemented filter for fix analysis helper widgets.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2539
diff changeset
283 if (curr < art.getFilter().getToKm()) {
2517
8f528f5ae137 Added filter object class and scrollable chart to helper panel.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2505
diff changeset
284 double newVal = (curr + 0.1) * 10;
8f528f5ae137 Added filter object class and scrollable chart to helper panel.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2505
diff changeset
285 long round = Math.round(newVal);
8f528f5ae137 Added filter object class and scrollable chart to helper panel.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2505
diff changeset
286 updateChartTab(((double)round) / 10);
8f528f5ae137 Added filter object class and scrollable chart to helper panel.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2505
diff changeset
287 }
8f528f5ae137 Added filter object class and scrollable chart to helper panel.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2505
diff changeset
288 return;
8f528f5ae137 Added filter object class and scrollable chart to helper panel.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2505
diff changeset
289 }
8f528f5ae137 Added filter object class and scrollable chart to helper panel.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2505
diff changeset
290
8f528f5ae137 Added filter object class and scrollable chart to helper panel.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2505
diff changeset
291
8f528f5ae137 Added filter object class and scrollable chart to helper panel.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2505
diff changeset
292 public void onResized(ResizedEvent re) {
2884
88bca9f735c0 Implemented filter for fix analysis helper widgets.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2539
diff changeset
293 FixAnalysisArtifact art = (FixAnalysisArtifact) this.artifact;
88bca9f735c0 Implemented filter for fix analysis helper widgets.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2539
diff changeset
294
88bca9f735c0 Implemented filter for fix analysis helper widgets.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2539
diff changeset
295 updateChartTab(art.getFilter().getCurrentKm());
2517
8f528f5ae137 Added filter object class and scrollable chart to helper panel.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2505
diff changeset
296 }
8f528f5ae137 Added filter object class and scrollable chart to helper panel.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2505
diff changeset
297
8f528f5ae137 Added filter object class and scrollable chart to helper panel.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2505
diff changeset
298
2505
87ac5c532523 First part of the UI for fixing analysis parameter.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
299 private native void createCallback() /*-{
87ac5c532523 First part of the UI for fixing analysis parameter.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
300 $wnd.fixationCallback = @de.intevation.flys.client.client.ui.fixation.FixationPanel::helperCallback(ZLjava/lang/String;);
87ac5c532523 First part of the UI for fixing analysis parameter.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
301 }-*/;
87ac5c532523 First part of the UI for fixing analysis parameter.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
302
87ac5c532523 First part of the UI for fixing analysis parameter.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
303 private static void helperCallback(boolean checked, String name) {
87ac5c532523 First part of the UI for fixing analysis parameter.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
304 String[] parts = name.split(":");
87ac5c532523 First part of the UI for fixing analysis parameter.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
305 String uuid = parts[0];
87ac5c532523 First part of the UI for fixing analysis parameter.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
306 String cid = parts[1];
87ac5c532523 First part of the UI for fixing analysis parameter.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
307 FixationPanel p = FixationPanel.getInstance(uuid);
87ac5c532523 First part of the UI for fixing analysis parameter.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
308 if (p != null) {
87ac5c532523 First part of the UI for fixing analysis parameter.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
309 p.setValues(cid, checked);
87ac5c532523 First part of the UI for fixing analysis parameter.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
310 }
87ac5c532523 First part of the UI for fixing analysis parameter.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
311 }
87ac5c532523 First part of the UI for fixing analysis parameter.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
312
87ac5c532523 First part of the UI for fixing analysis parameter.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
313 private static FixationPanel getInstance(String uuid) {
87ac5c532523 First part of the UI for fixing analysis parameter.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
314 for (int i = 0; i < instances.size(); i++) {
87ac5c532523 First part of the UI for fixing analysis parameter.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
315 if (instances.get(uuid) != null) {
87ac5c532523 First part of the UI for fixing analysis parameter.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
316 return instances.get(uuid);
87ac5c532523 First part of the UI for fixing analysis parameter.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
317 }
87ac5c532523 First part of the UI for fixing analysis parameter.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
318 }
87ac5c532523 First part of the UI for fixing analysis parameter.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
319 return null;
87ac5c532523 First part of the UI for fixing analysis parameter.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
320 }
87ac5c532523 First part of the UI for fixing analysis parameter.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
321
87ac5c532523 First part of the UI for fixing analysis parameter.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
322 public abstract Canvas createWidget(DataList data);
87ac5c532523 First part of the UI for fixing analysis parameter.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
323 public abstract 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
324 public abstract boolean renderCheckboxes();
2537
cc5969df0490 New methods in UI providers for fixings states and minor protocol changes.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2526
diff changeset
325 public abstract void success();
2517
8f528f5ae137 Added filter object class and scrollable chart to helper panel.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2505
diff changeset
326
2884
88bca9f735c0 Implemented filter for fix analysis helper widgets.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2539
diff changeset
327 public static class FixFilter implements Serializable{
2517
8f528f5ae137 Added filter object class and scrollable chart to helper panel.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2505
diff changeset
328 protected String river;
8f528f5ae137 Added filter object class and scrollable chart to helper panel.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2505
diff changeset
329 protected double fromKm;
8f528f5ae137 Added filter object class and scrollable chart to helper panel.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2505
diff changeset
330 protected double toKm;
8f528f5ae137 Added filter object class and scrollable chart to helper panel.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2505
diff changeset
331 protected double currentKm;
8f528f5ae137 Added filter object class and scrollable chart to helper panel.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2505
diff changeset
332 protected int fromClass;
8f528f5ae137 Added filter object class and scrollable chart to helper panel.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2505
diff changeset
333 protected int toClass;
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
334 protected long fromDate;
a911e2968cb1 Changed some data types in states and filter and added new preprocessing state
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2517
diff changeset
335 protected long toDate;
a911e2968cb1 Changed some data types in states and filter and added new preprocessing state
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2517
diff changeset
336 protected boolean hasDate;
2517
8f528f5ae137 Added filter object class and scrollable chart to helper panel.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2505
diff changeset
337 protected int[] events;
8f528f5ae137 Added filter object class and scrollable chart to helper panel.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2505
diff changeset
338
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
339 public FixFilter() {
a911e2968cb1 Changed some data types in states and filter and added new preprocessing state
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2517
diff changeset
340 this.river = "";
a911e2968cb1 Changed some data types in states and filter and added new preprocessing state
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2517
diff changeset
341 this.fromKm = -1d;
a911e2968cb1 Changed some data types in states and filter and added new preprocessing state
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2517
diff changeset
342 this.toKm = -1;
a911e2968cb1 Changed some data types in states and filter and added new preprocessing state
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2517
diff changeset
343 this.currentKm = -1;
a911e2968cb1 Changed some data types in states and filter and added new preprocessing state
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2517
diff changeset
344 this.fromClass = -1;
a911e2968cb1 Changed some data types in states and filter and added new preprocessing state
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2517
diff changeset
345 this.toClass = -1;
a911e2968cb1 Changed some data types in states and filter and added new preprocessing state
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2517
diff changeset
346 this.fromDate = -1;
a911e2968cb1 Changed some data types in states and filter and added new preprocessing state
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2517
diff changeset
347 this.toDate = -1;
a911e2968cb1 Changed some data types in states and filter and added new preprocessing state
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2517
diff changeset
348 this.hasDate = false;
a911e2968cb1 Changed some data types in states and filter and added new preprocessing state
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2517
diff changeset
349 this.events = new int[0];
a911e2968cb1 Changed some data types in states and filter and added new preprocessing state
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2517
diff changeset
350 }
2517
8f528f5ae137 Added filter object class and scrollable chart to helper panel.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2505
diff changeset
351
8f528f5ae137 Added filter object class and scrollable chart to helper panel.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2505
diff changeset
352 public void setRiver(String river) {
8f528f5ae137 Added filter object class and scrollable chart to helper panel.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2505
diff changeset
353 this.river = river;
8f528f5ae137 Added filter object class and scrollable chart to helper panel.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2505
diff changeset
354 }
8f528f5ae137 Added filter object class and scrollable chart to helper panel.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2505
diff changeset
355
8f528f5ae137 Added filter object class and scrollable chart to helper panel.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2505
diff changeset
356 public void setFromKm(double from) {
8f528f5ae137 Added filter object class and scrollable chart to helper panel.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2505
diff changeset
357 this.fromKm = from;
8f528f5ae137 Added filter object class and scrollable chart to helper panel.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2505
diff changeset
358 }
8f528f5ae137 Added filter object class and scrollable chart to helper panel.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2505
diff changeset
359
8f528f5ae137 Added filter object class and scrollable chart to helper panel.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2505
diff changeset
360 public void setToKm(double to) {
8f528f5ae137 Added filter object class and scrollable chart to helper panel.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2505
diff changeset
361 this.toKm = to;
8f528f5ae137 Added filter object class and scrollable chart to helper panel.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2505
diff changeset
362 }
8f528f5ae137 Added filter object class and scrollable chart to helper panel.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2505
diff changeset
363
8f528f5ae137 Added filter object class and scrollable chart to helper panel.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2505
diff changeset
364 public void setCurrentKm(double km) {
8f528f5ae137 Added filter object class and scrollable chart to helper panel.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2505
diff changeset
365 this.currentKm = km;
8f528f5ae137 Added filter object class and scrollable chart to helper panel.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2505
diff changeset
366 }
8f528f5ae137 Added filter object class and scrollable chart to helper panel.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2505
diff changeset
367
8f528f5ae137 Added filter object class and scrollable chart to helper panel.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2505
diff changeset
368 public void setFromClass(int from) {
8f528f5ae137 Added filter object class and scrollable chart to helper panel.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2505
diff changeset
369 this.fromClass = from;
8f528f5ae137 Added filter object class and scrollable chart to helper panel.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2505
diff changeset
370 }
8f528f5ae137 Added filter object class and scrollable chart to helper panel.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2505
diff changeset
371
8f528f5ae137 Added filter object class and scrollable chart to helper panel.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2505
diff changeset
372 public void setToClass(int to) {
8f528f5ae137 Added filter object class and scrollable chart to helper panel.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2505
diff changeset
373 this.toClass = to;
8f528f5ae137 Added filter object class and scrollable chart to helper panel.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2505
diff changeset
374 }
8f528f5ae137 Added filter object class and scrollable chart to helper panel.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2505
diff changeset
375
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
376 public void setFromDate(long from) {
a911e2968cb1 Changed some data types in states and filter and added new preprocessing state
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2517
diff changeset
377 this.hasDate = true;
2517
8f528f5ae137 Added filter object class and scrollable chart to helper panel.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2505
diff changeset
378 this.fromDate = from;
8f528f5ae137 Added filter object class and scrollable chart to helper panel.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2505
diff changeset
379 }
8f528f5ae137 Added filter object class and scrollable chart to helper panel.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2505
diff changeset
380
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
381 public void setToDate(long to) {
a911e2968cb1 Changed some data types in states and filter and added new preprocessing state
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2517
diff changeset
382 this.hasDate = true;
2517
8f528f5ae137 Added filter object class and scrollable chart to helper panel.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2505
diff changeset
383 this.toDate = to;
8f528f5ae137 Added filter object class and scrollable chart to helper panel.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2505
diff changeset
384 }
8f528f5ae137 Added filter object class and scrollable chart to helper panel.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2505
diff changeset
385
8f528f5ae137 Added filter object class and scrollable chart to helper panel.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2505
diff changeset
386 public void setEvents(int[] ev) {
8f528f5ae137 Added filter object class and scrollable chart to helper panel.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2505
diff changeset
387 this.events = ev;
8f528f5ae137 Added filter object class and scrollable chart to helper panel.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2505
diff changeset
388 }
8f528f5ae137 Added filter object class and scrollable chart to helper panel.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2505
diff changeset
389
8f528f5ae137 Added filter object class and scrollable chart to helper panel.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2505
diff changeset
390 public String getRiver() {
8f528f5ae137 Added filter object class and scrollable chart to helper panel.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2505
diff changeset
391 return this.river;
8f528f5ae137 Added filter object class and scrollable chart to helper panel.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2505
diff changeset
392 }
8f528f5ae137 Added filter object class and scrollable chart to helper panel.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2505
diff changeset
393
8f528f5ae137 Added filter object class and scrollable chart to helper panel.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2505
diff changeset
394 public double getFromKm() {
8f528f5ae137 Added filter object class and scrollable chart to helper panel.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2505
diff changeset
395 return this.fromKm;
8f528f5ae137 Added filter object class and scrollable chart to helper panel.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2505
diff changeset
396 }
8f528f5ae137 Added filter object class and scrollable chart to helper panel.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2505
diff changeset
397
8f528f5ae137 Added filter object class and scrollable chart to helper panel.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2505
diff changeset
398 public double getToKm() {
8f528f5ae137 Added filter object class and scrollable chart to helper panel.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2505
diff changeset
399 return this.toKm;
8f528f5ae137 Added filter object class and scrollable chart to helper panel.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2505
diff changeset
400 }
8f528f5ae137 Added filter object class and scrollable chart to helper panel.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2505
diff changeset
401
8f528f5ae137 Added filter object class and scrollable chart to helper panel.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2505
diff changeset
402 public double getCurrentKm() {
8f528f5ae137 Added filter object class and scrollable chart to helper panel.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2505
diff changeset
403 return this.currentKm;
8f528f5ae137 Added filter object class and scrollable chart to helper panel.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2505
diff changeset
404 }
8f528f5ae137 Added filter object class and scrollable chart to helper panel.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2505
diff changeset
405
8f528f5ae137 Added filter object class and scrollable chart to helper panel.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2505
diff changeset
406 public int getFromClass() {
8f528f5ae137 Added filter object class and scrollable chart to helper panel.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2505
diff changeset
407 return this.fromClass;
8f528f5ae137 Added filter object class and scrollable chart to helper panel.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2505
diff changeset
408 }
8f528f5ae137 Added filter object class and scrollable chart to helper panel.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2505
diff changeset
409
8f528f5ae137 Added filter object class and scrollable chart to helper panel.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2505
diff changeset
410 public int getToClass() {
8f528f5ae137 Added filter object class and scrollable chart to helper panel.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2505
diff changeset
411 return this.toClass;
8f528f5ae137 Added filter object class and scrollable chart to helper panel.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2505
diff changeset
412 }
8f528f5ae137 Added filter object class and scrollable chart to helper panel.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2505
diff changeset
413
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
414 public long getFromDate() {
2517
8f528f5ae137 Added filter object class and scrollable chart to helper panel.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2505
diff changeset
415 return this.fromDate;
8f528f5ae137 Added filter object class and scrollable chart to helper panel.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2505
diff changeset
416 }
8f528f5ae137 Added filter object class and scrollable chart to helper panel.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2505
diff changeset
417
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
418 public long getToDate() {
2517
8f528f5ae137 Added filter object class and scrollable chart to helper panel.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2505
diff changeset
419 return this.toDate;
8f528f5ae137 Added filter object class and scrollable chart to helper panel.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2505
diff changeset
420 }
8f528f5ae137 Added filter object class and scrollable chart to helper panel.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2505
diff changeset
421
8f528f5ae137 Added filter object class and scrollable chart to helper panel.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2505
diff changeset
422 public int[] getEvents() {
8f528f5ae137 Added filter object class and scrollable chart to helper panel.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2505
diff changeset
423 return this.events;
8f528f5ae137 Added filter object class and scrollable chart to helper panel.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2505
diff changeset
424 }
8f528f5ae137 Added filter object class and scrollable chart to helper panel.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2505
diff changeset
425
8f528f5ae137 Added filter object class and scrollable chart to helper panel.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2505
diff changeset
426 public String getOverviewFilter() {
8f528f5ae137 Added filter object class and scrollable chart to helper panel.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2505
diff changeset
427 if (river != null && river.length() > 0) {
2884
88bca9f735c0 Implemented filter for fix analysis helper widgets.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2539
diff changeset
428 JSONObject jfix = new JSONObject();
88bca9f735c0 Implemented filter for fix analysis helper widgets.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2539
diff changeset
429 JSONObject jfilter = new JSONObject();
88bca9f735c0 Implemented filter for fix analysis helper widgets.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2539
diff changeset
430 JSONObject jrName = new JSONObject();
88bca9f735c0 Implemented filter for fix analysis helper widgets.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2539
diff changeset
431 JSONString jrValue = new JSONString(river);
88bca9f735c0 Implemented filter for fix analysis helper widgets.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2539
diff changeset
432 jrName.put("name", jrValue);
88bca9f735c0 Implemented filter for fix analysis helper widgets.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2539
diff changeset
433 jfilter.put("river", jrName);
88bca9f735c0 Implemented filter for fix analysis helper widgets.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2539
diff changeset
434 jfix.put("fixings", createFilter(jfilter));
88bca9f735c0 Implemented filter for fix analysis helper widgets.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2539
diff changeset
435 return jfix.toString();
2517
8f528f5ae137 Added filter object class and scrollable chart to helper panel.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2505
diff changeset
436 }
2884
88bca9f735c0 Implemented filter for fix analysis helper widgets.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2539
diff changeset
437 return "";
2517
8f528f5ae137 Added filter object class and scrollable chart to helper panel.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2505
diff changeset
438 }
8f528f5ae137 Added filter object class and scrollable chart to helper panel.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2505
diff changeset
439
8f528f5ae137 Added filter object class and scrollable chart to helper panel.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2505
diff changeset
440 public String getChartFilter(int width, int height) {
8f528f5ae137 Added filter object class and scrollable chart to helper panel.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2505
diff changeset
441 if (river != null && river.length() > 0 &&
8f528f5ae137 Added filter object class and scrollable chart to helper panel.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2505
diff changeset
442 currentKm >= fromKm && currentKm <= toKm)
8f528f5ae137 Added filter object class and scrollable chart to helper panel.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2505
diff changeset
443 {
2884
88bca9f735c0 Implemented filter for fix analysis helper widgets.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2539
diff changeset
444 JSONObject jfix = new JSONObject();
88bca9f735c0 Implemented filter for fix analysis helper widgets.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2539
diff changeset
445 JSONObject jfilter = new JSONObject();
88bca9f735c0 Implemented filter for fix analysis helper widgets.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2539
diff changeset
446 JSONObject jrName = new JSONObject();
88bca9f735c0 Implemented filter for fix analysis helper widgets.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2539
diff changeset
447 JSONString jrValue = new JSONString(river);
88bca9f735c0 Implemented filter for fix analysis helper widgets.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2539
diff changeset
448 JSONObject jkm = new JSONObject();
88bca9f735c0 Implemented filter for fix analysis helper widgets.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2539
diff changeset
449 JSONNumber jkmValue = new JSONNumber(currentKm);
88bca9f735c0 Implemented filter for fix analysis helper widgets.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2539
diff changeset
450 JSONObject jextent = new JSONObject();
88bca9f735c0 Implemented filter for fix analysis helper widgets.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2539
diff changeset
451 JSONNumber jwidth = new JSONNumber(width);
88bca9f735c0 Implemented filter for fix analysis helper widgets.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2539
diff changeset
452 JSONNumber jheight = new JSONNumber(height);
88bca9f735c0 Implemented filter for fix analysis helper widgets.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2539
diff changeset
453
88bca9f735c0 Implemented filter for fix analysis helper widgets.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2539
diff changeset
454 jkm.put("value", jkmValue);
88bca9f735c0 Implemented filter for fix analysis helper widgets.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2539
diff changeset
455 jrName.put("name", jrValue);
88bca9f735c0 Implemented filter for fix analysis helper widgets.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2539
diff changeset
456 jfilter.put("river", jrName);
88bca9f735c0 Implemented filter for fix analysis helper widgets.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2539
diff changeset
457 jfilter.put("km", jkm);
88bca9f735c0 Implemented filter for fix analysis helper widgets.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2539
diff changeset
458 jextent.put("width", jwidth);
88bca9f735c0 Implemented filter for fix analysis helper widgets.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2539
diff changeset
459 jextent.put("height", jheight);
88bca9f735c0 Implemented filter for fix analysis helper widgets.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2539
diff changeset
460 jfilter.put("extent", jextent);
88bca9f735c0 Implemented filter for fix analysis helper widgets.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2539
diff changeset
461 jfix.put("fixings", createFilter(jfilter));
88bca9f735c0 Implemented filter for fix analysis helper widgets.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2539
diff changeset
462 return jfix.toString();
2517
8f528f5ae137 Added filter object class and scrollable chart to helper panel.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2505
diff changeset
463 }
2884
88bca9f735c0 Implemented filter for fix analysis helper widgets.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2539
diff changeset
464 return "";
2517
8f528f5ae137 Added filter object class and scrollable chart to helper panel.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2505
diff changeset
465 }
8f528f5ae137 Added filter object class and scrollable chart to helper panel.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2505
diff changeset
466
2884
88bca9f735c0 Implemented filter for fix analysis helper widgets.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2539
diff changeset
467 protected JSONObject createFilter(JSONObject root) {
88bca9f735c0 Implemented filter for fix analysis helper widgets.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2539
diff changeset
468 if (this.fromKm >= 0 && this.toKm >= 0 && this.fromKm <=this.toKm) {
88bca9f735c0 Implemented filter for fix analysis helper widgets.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2539
diff changeset
469 JSONObject range = new JSONObject();
88bca9f735c0 Implemented filter for fix analysis helper widgets.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2539
diff changeset
470 JSONObject fromtokm = new JSONObject();
88bca9f735c0 Implemented filter for fix analysis helper widgets.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2539
diff changeset
471 JSONNumber f = new JSONNumber(this.fromKm);
88bca9f735c0 Implemented filter for fix analysis helper widgets.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2539
diff changeset
472 JSONNumber t = new JSONNumber(this.toKm);
88bca9f735c0 Implemented filter for fix analysis helper widgets.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2539
diff changeset
473 fromtokm.put("from", f);
88bca9f735c0 Implemented filter for fix analysis helper widgets.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2539
diff changeset
474 fromtokm.put("to", t);
88bca9f735c0 Implemented filter for fix analysis helper widgets.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2539
diff changeset
475 root.put("range", fromtokm);
88bca9f735c0 Implemented filter for fix analysis helper widgets.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2539
diff changeset
476 }
88bca9f735c0 Implemented filter for fix analysis helper widgets.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2539
diff changeset
477 JSONObject and = new JSONObject();
88bca9f735c0 Implemented filter for fix analysis helper widgets.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2539
diff changeset
478 if (this.hasDate) {
88bca9f735c0 Implemented filter for fix analysis helper widgets.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2539
diff changeset
479 JSONObject daterange = new JSONObject();
88bca9f735c0 Implemented filter for fix analysis helper widgets.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2539
diff changeset
480 Date df = new Date(this.fromDate);
88bca9f735c0 Implemented filter for fix analysis helper widgets.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2539
diff changeset
481 Date dt = new Date(this.toDate);
88bca9f735c0 Implemented filter for fix analysis helper widgets.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2539
diff changeset
482 DateTimeFormat dtf = DateTimeFormat.getFormat("dd.MM.yyyy");
88bca9f735c0 Implemented filter for fix analysis helper widgets.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2539
diff changeset
483 JSONString f = new JSONString(dtf.format(df));
88bca9f735c0 Implemented filter for fix analysis helper widgets.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2539
diff changeset
484 JSONString t = new JSONString(dtf.format(dt));
88bca9f735c0 Implemented filter for fix analysis helper widgets.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2539
diff changeset
485 daterange.put("from", f);
88bca9f735c0 Implemented filter for fix analysis helper widgets.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2539
diff changeset
486 daterange.put("to", t);
88bca9f735c0 Implemented filter for fix analysis helper widgets.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2539
diff changeset
487 and.put("date-range", daterange);
88bca9f735c0 Implemented filter for fix analysis helper widgets.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2539
diff changeset
488 }
88bca9f735c0 Implemented filter for fix analysis helper widgets.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2539
diff changeset
489 if (this.fromClass >= 0 &&
88bca9f735c0 Implemented filter for fix analysis helper widgets.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2539
diff changeset
490 this.toClass >= 0 &&
88bca9f735c0 Implemented filter for fix analysis helper widgets.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2539
diff changeset
491 this.fromClass <= this.toClass) {
88bca9f735c0 Implemented filter for fix analysis helper widgets.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2539
diff changeset
492 JSONObject classrange = new JSONObject();
88bca9f735c0 Implemented filter for fix analysis helper widgets.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2539
diff changeset
493 JSONNumber f = new JSONNumber(this.fromClass);
88bca9f735c0 Implemented filter for fix analysis helper widgets.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2539
diff changeset
494 JSONNumber t = new JSONNumber(this.toClass);
88bca9f735c0 Implemented filter for fix analysis helper widgets.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2539
diff changeset
495 classrange.put("from", f);
88bca9f735c0 Implemented filter for fix analysis helper widgets.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2539
diff changeset
496 classrange.put("to", t);
88bca9f735c0 Implemented filter for fix analysis helper widgets.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2539
diff changeset
497 and.put("sector-range", classrange);
88bca9f735c0 Implemented filter for fix analysis helper widgets.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2539
diff changeset
498 }
88bca9f735c0 Implemented filter for fix analysis helper widgets.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2539
diff changeset
499 if (this.events.length > 0) {
2917
be99bf1aa59b Create simplified column filter.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2914
diff changeset
500 StringBuilder cids = new StringBuilder();
be99bf1aa59b Create simplified column filter.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2914
diff changeset
501
be99bf1aa59b Create simplified column filter.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2914
diff changeset
502 for (int i = 0; i < events.length; i++) {
be99bf1aa59b Create simplified column filter.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2914
diff changeset
503 if (i > 0) cids.append(' ');
be99bf1aa59b Create simplified column filter.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2914
diff changeset
504 cids.append(events[i]);
2884
88bca9f735c0 Implemented filter for fix analysis helper widgets.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2539
diff changeset
505 }
2917
be99bf1aa59b Create simplified column filter.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2914
diff changeset
506 JSONObject columns = new JSONObject();
be99bf1aa59b Create simplified column filter.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2914
diff changeset
507 columns.put("cids", new JSONString(cids.toString()));
be99bf1aa59b Create simplified column filter.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2914
diff changeset
508 and.put("columns", columns);
2884
88bca9f735c0 Implemented filter for fix analysis helper widgets.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2539
diff changeset
509 }
88bca9f735c0 Implemented filter for fix analysis helper widgets.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2539
diff changeset
510 if (and.size() > 0) {
88bca9f735c0 Implemented filter for fix analysis helper widgets.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2539
diff changeset
511 JSONObject filter = new JSONObject();
88bca9f735c0 Implemented filter for fix analysis helper widgets.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2539
diff changeset
512 filter.put("and", and);
88bca9f735c0 Implemented filter for fix analysis helper widgets.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2539
diff changeset
513 root.put("filter", filter);
88bca9f735c0 Implemented filter for fix analysis helper widgets.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2539
diff changeset
514 }
88bca9f735c0 Implemented filter for fix analysis helper widgets.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2539
diff changeset
515 return root;
2517
8f528f5ae137 Added filter object class and scrollable chart to helper panel.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2505
diff changeset
516 }
8f528f5ae137 Added filter object class and scrollable chart to helper panel.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2505
diff changeset
517 }
2505
87ac5c532523 First part of the UI for fixing analysis parameter.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
518 }

http://dive4elements.wald.intevation.org