annotate gwt-client/src/main/java/org/dive4elements/river/client/client/ui/fixation/FixationPanel.java @ 9256:6c24c857ccf9

fixation refactoring and inputItem behaviour to interfaces
author gernotbelger
date Fri, 13 Jul 2018 12:04:21 +0200
parents 9be51f776798
children 1a7cfeb1ff89
rev   line source
5861
172338b1407f GWT client: Added copyright header.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5838
diff changeset
1 /* Copyright (C) 2011, 2012, 2013 by Bundesanstalt für Gewässerkunde
172338b1407f GWT client: Added copyright header.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5838
diff changeset
2 * Software engineering by Intevation GmbH
172338b1407f GWT client: Added copyright header.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5838
diff changeset
3 *
5993
ea9eef426962 Removed trailing whitespace.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5861
diff changeset
4 * This file is Free Software under the GNU AGPL (>=v3)
5861
172338b1407f GWT client: Added copyright header.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5838
diff changeset
5 * and comes with ABSOLUTELY NO WARRANTY! Check out the
5993
ea9eef426962 Removed trailing whitespace.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5861
diff changeset
6 * documentation coming with Dive4Elements River for details.
5861
172338b1407f GWT client: Added copyright header.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5838
diff changeset
7 */
172338b1407f GWT client: Added copyright header.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5838
diff changeset
8
5835
821a02bbfb4e Fixed internal java dependencies
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5834
diff changeset
9 package org.dive4elements.river.client.client.ui.fixation;
2505
87ac5c532523 First part of the UI for fixing analysis parameter.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
10
9072
02739b8c010d bundu progress (Klon FixationAnalysis +Vollmer funktioniert; Verzweigung neue Berechnungsart Bezugswst)
gernotbelger
parents: 8856
diff changeset
11 import java.util.Date;
02739b8c010d bundu progress (Klon FixationAnalysis +Vollmer funktioniert; Verzweigung neue Berechnungsart Bezugswst)
gernotbelger
parents: 8856
diff changeset
12 import java.util.HashMap;
02739b8c010d bundu progress (Klon FixationAnalysis +Vollmer funktioniert; Verzweigung neue Berechnungsart Bezugswst)
gernotbelger
parents: 8856
diff changeset
13
02739b8c010d bundu progress (Klon FixationAnalysis +Vollmer funktioniert; Verzweigung neue Berechnungsart Bezugswst)
gernotbelger
parents: 8856
diff changeset
14 import org.dive4elements.river.client.client.Config;
02739b8c010d bundu progress (Klon FixationAnalysis +Vollmer funktioniert; Verzweigung neue Berechnungsart Bezugswst)
gernotbelger
parents: 8856
diff changeset
15 import org.dive4elements.river.client.client.FLYSConstants;
02739b8c010d bundu progress (Klon FixationAnalysis +Vollmer funktioniert; Verzweigung neue Berechnungsart Bezugswst)
gernotbelger
parents: 8856
diff changeset
16 import org.dive4elements.river.client.client.services.FixingsOverviewService;
02739b8c010d bundu progress (Klon FixationAnalysis +Vollmer funktioniert; Verzweigung neue Berechnungsart Bezugswst)
gernotbelger
parents: 8856
diff changeset
17 import org.dive4elements.river.client.client.services.FixingsOverviewServiceAsync;
02739b8c010d bundu progress (Klon FixationAnalysis +Vollmer funktioniert; Verzweigung neue Berechnungsart Bezugswst)
gernotbelger
parents: 8856
diff changeset
18 import org.dive4elements.river.client.client.ui.AbstractUIProvider;
02739b8c010d bundu progress (Klon FixationAnalysis +Vollmer funktioniert; Verzweigung neue Berechnungsart Bezugswst)
gernotbelger
parents: 8856
diff changeset
19 import org.dive4elements.river.client.shared.model.AbstractFixBunduArtifact;
02739b8c010d bundu progress (Klon FixationAnalysis +Vollmer funktioniert; Verzweigung neue Berechnungsart Bezugswst)
gernotbelger
parents: 8856
diff changeset
20 import org.dive4elements.river.client.shared.model.DataList;
02739b8c010d bundu progress (Klon FixationAnalysis +Vollmer funktioniert; Verzweigung neue Berechnungsart Bezugswst)
gernotbelger
parents: 8856
diff changeset
21 import org.dive4elements.river.client.shared.model.FixFilter;
02739b8c010d bundu progress (Klon FixationAnalysis +Vollmer funktioniert; Verzweigung neue Berechnungsart Bezugswst)
gernotbelger
parents: 8856
diff changeset
22 import org.dive4elements.river.client.shared.model.FixingsOverviewInfo;
02739b8c010d bundu progress (Klon FixationAnalysis +Vollmer funktioniert; Verzweigung neue Berechnungsart Bezugswst)
gernotbelger
parents: 8856
diff changeset
23
2505
87ac5c532523 First part of the UI for fixing analysis parameter.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
24 import com.google.gwt.core.client.GWT;
8864
fa8897698133 Encode fixation preview image-URL with GWT-means.
Tom Gottfried <tom@intevation.de>
parents: 8856
diff changeset
25 import com.google.gwt.http.client.URL;
3366
8bedd1fcaeee Removed trailing whitespace. Import cleanup
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3362
diff changeset
26 import com.google.gwt.i18n.client.DateTimeFormat;
8bedd1fcaeee Removed trailing whitespace. Import cleanup
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3362
diff changeset
27 import com.google.gwt.i18n.client.NumberFormat;
8bedd1fcaeee Removed trailing whitespace. Import cleanup
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3362
diff changeset
28 import com.google.gwt.json.client.JSONNumber;
8bedd1fcaeee Removed trailing whitespace. Import cleanup
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3362
diff changeset
29 import com.google.gwt.json.client.JSONObject;
8bedd1fcaeee Removed trailing whitespace. Import cleanup
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3362
diff changeset
30 import com.google.gwt.json.client.JSONString;
2505
87ac5c532523 First part of the UI for fixing analysis parameter.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
31 import com.google.gwt.user.client.rpc.AsyncCallback;
3366
8bedd1fcaeee Removed trailing whitespace. Import cleanup
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3362
diff changeset
32 import com.smartgwt.client.types.Alignment;
2505
87ac5c532523 First part of the UI for fixing analysis parameter.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
33 import com.smartgwt.client.util.SC;
3366
8bedd1fcaeee Removed trailing whitespace. Import cleanup
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3362
diff changeset
34 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
35 import com.smartgwt.client.widgets.Canvas;
3366
8bedd1fcaeee Removed trailing whitespace. Import cleanup
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3362
diff changeset
36 import com.smartgwt.client.widgets.HTMLPane;
8bedd1fcaeee Removed trailing whitespace. Import cleanup
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3362
diff changeset
37 import com.smartgwt.client.widgets.Img;
8bedd1fcaeee Removed trailing whitespace. Import cleanup
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3362
diff changeset
38 import com.smartgwt.client.widgets.events.ClickEvent;
8bedd1fcaeee Removed trailing whitespace. Import cleanup
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3362
diff changeset
39 import com.smartgwt.client.widgets.events.ClickHandler;
8bedd1fcaeee Removed trailing whitespace. Import cleanup
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3362
diff changeset
40 import com.smartgwt.client.widgets.events.ResizedEvent;
8bedd1fcaeee Removed trailing whitespace. Import cleanup
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3362
diff changeset
41 import com.smartgwt.client.widgets.events.ResizedHandler;
2505
87ac5c532523 First part of the UI for fixing analysis parameter.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
42 import com.smartgwt.client.widgets.form.DynamicForm;
2517
8f528f5ae137 Added filter object class and scrollable chart to helper panel.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2505
diff changeset
43 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
44 import com.smartgwt.client.widgets.form.fields.events.ChangedEvent;
3366
8bedd1fcaeee Removed trailing whitespace. Import cleanup
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3362
diff changeset
45 import com.smartgwt.client.widgets.form.fields.events.ChangedHandler;
8bedd1fcaeee Removed trailing whitespace. Import cleanup
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3362
diff changeset
46 import com.smartgwt.client.widgets.layout.HLayout;
8bedd1fcaeee Removed trailing whitespace. Import cleanup
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3362
diff changeset
47 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
48 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
49 import com.smartgwt.client.widgets.tab.TabSet;
2505
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 * 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
53 * elements.
87ac5c532523 First part of the UI for fixing analysis parameter.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
54 *
87ac5c532523 First part of the UI for fixing analysis parameter.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
55 * @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
56 */
9072
02739b8c010d bundu progress (Klon FixationAnalysis +Vollmer funktioniert; Verzweigung neue Berechnungsart Bezugswst)
gernotbelger
parents: 8856
diff changeset
57 public abstract class FixationPanel extends AbstractUIProvider implements ResizedHandler {
4568
bbd82bd8e541 flys-client: Cosmetics and warnings.
Christian Lins <christian.lins@intevation.de>
parents: 4148
diff changeset
58 private static final long serialVersionUID = -3667553404493415619L;
bbd82bd8e541 flys-client: Cosmetics and warnings.
Christian Lins <christian.lins@intevation.de>
parents: 4148
diff changeset
59
9072
02739b8c010d bundu progress (Klon FixationAnalysis +Vollmer funktioniert; Verzweigung neue Berechnungsart Bezugswst)
gernotbelger
parents: 8856
diff changeset
60 protected static HashMap<String, FixationPanel> instances = new HashMap<String, FixationPanel>();
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 /** The message class that provides i18n strings. */
9256
6c24c857ccf9 fixation refactoring and inputItem behaviour to interfaces
gernotbelger
parents: 9255
diff changeset
63 private final FLYSConstants MESSAGES = GWT.create(FLYSConstants.class);
2505
87ac5c532523 First part of the UI for fixing analysis parameter.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
64
9256
6c24c857ccf9 fixation refactoring and inputItem behaviour to interfaces
gernotbelger
parents: 9255
diff changeset
65 private final FixingsOverviewServiceAsync overviewService = GWT.create(FixingsOverviewService.class);
2505
87ac5c532523 First part of the UI for fixing analysis parameter.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
66
9256
6c24c857ccf9 fixation refactoring and inputItem behaviour to interfaces
gernotbelger
parents: 9255
diff changeset
67 private String htmlOverview;
6c24c857ccf9 fixation refactoring and inputItem behaviour to interfaces
gernotbelger
parents: 9255
diff changeset
68 private FixingsOverviewInfo fixInfo;
6c24c857ccf9 fixation refactoring and inputItem behaviour to interfaces
gernotbelger
parents: 9255
diff changeset
69 private TabSet tabs;
6c24c857ccf9 fixation refactoring and inputItem behaviour to interfaces
gernotbelger
parents: 9255
diff changeset
70 private Tab events;
6c24c857ccf9 fixation refactoring and inputItem behaviour to interfaces
gernotbelger
parents: 9255
diff changeset
71 private Tab chart;
6c24c857ccf9 fixation refactoring and inputItem behaviour to interfaces
gernotbelger
parents: 9255
diff changeset
72 private VLayout chartContainer;
6c24c857ccf9 fixation refactoring and inputItem behaviour to interfaces
gernotbelger
parents: 9255
diff changeset
73 private Img chartImg;
6c24c857ccf9 fixation refactoring and inputItem behaviour to interfaces
gernotbelger
parents: 9255
diff changeset
74 private TextItem kmText;
6c24c857ccf9 fixation refactoring and inputItem behaviour to interfaces
gernotbelger
parents: 9255
diff changeset
75
6c24c857ccf9 fixation refactoring and inputItem behaviour to interfaces
gernotbelger
parents: 9255
diff changeset
76 private static final DateTimeFormat DTF = DateTimeFormat.getFormat("dd.MM.yyyy");
2962
f14d4c668ec5 Bugfix: #698 Fix-Analysis is working in Tomcat again.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2923
diff changeset
77
2505
87ac5c532523 First part of the UI for fixing analysis parameter.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
78 public FixationPanel() {
9072
02739b8c010d bundu progress (Klon FixationAnalysis +Vollmer funktioniert; Verzweigung neue Berechnungsart Bezugswst)
gernotbelger
parents: 8856
diff changeset
79 this.chartImg = new Img();
02739b8c010d bundu progress (Klon FixationAnalysis +Vollmer funktioniert; Verzweigung neue Berechnungsart Bezugswst)
gernotbelger
parents: 8856
diff changeset
80 this.htmlOverview = "";
2505
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
3861
16840d849298 Cosmetics, docs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3366
diff changeset
83 /** Get the (master) artifact UUID. */
9256
6c24c857ccf9 fixation refactoring and inputItem behaviour to interfaces
gernotbelger
parents: 9255
diff changeset
84 private String getArtifactUuid() {
2505
87ac5c532523 First part of the UI for fixing analysis parameter.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
85 return this.artifact.getUuid();
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
4568
bbd82bd8e541 flys-client: Cosmetics and warnings.
Christian Lins <christian.lins@intevation.de>
parents: 4148
diff changeset
88 @Override
9256
6c24c857ccf9 fixation refactoring and inputItem behaviour to interfaces
gernotbelger
parents: 9255
diff changeset
89 public final Canvas create(final DataList list) {
9072
02739b8c010d bundu progress (Klon FixationAnalysis +Vollmer funktioniert; Verzweigung neue Berechnungsart Bezugswst)
gernotbelger
parents: 8856
diff changeset
90 final VLayout layout = new VLayout();
2505
87ac5c532523 First part of the UI for fixing analysis parameter.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
91
9072
02739b8c010d bundu progress (Klon FixationAnalysis +Vollmer funktioniert; Verzweigung neue Berechnungsart Bezugswst)
gernotbelger
parents: 8856
diff changeset
92 final Canvas helper = createHelper();
2505
87ac5c532523 First part of the UI for fixing analysis parameter.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
93 this.helperContainer.addMember(helper);
87ac5c532523 First part of the UI for fixing analysis parameter.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
94
9072
02739b8c010d bundu progress (Klon FixationAnalysis +Vollmer funktioniert; Verzweigung neue Berechnungsart Bezugswst)
gernotbelger
parents: 8856
diff changeset
95 final Canvas submit = getNextButton();
02739b8c010d bundu progress (Klon FixationAnalysis +Vollmer funktioniert; Verzweigung neue Berechnungsart Bezugswst)
gernotbelger
parents: 8856
diff changeset
96 final Canvas widget = createWidget(list);
2505
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 layout.addMember(widget);
87ac5c532523 First part of the UI for fixing analysis parameter.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
99 layout.addMember(submit);
87ac5c532523 First part of the UI for fixing analysis parameter.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
100 return layout;
87ac5c532523 First part of the UI for fixing analysis parameter.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
101 }
87ac5c532523 First part of the UI for fixing analysis parameter.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
102
9256
6c24c857ccf9 fixation refactoring and inputItem behaviour to interfaces
gernotbelger
parents: 9255
diff changeset
103 private Canvas createHelper() {
9072
02739b8c010d bundu progress (Klon FixationAnalysis +Vollmer funktioniert; Verzweigung neue Berechnungsart Bezugswst)
gernotbelger
parents: 8856
diff changeset
104 final Config config = Config.getInstance();
02739b8c010d bundu progress (Klon FixationAnalysis +Vollmer funktioniert; Verzweigung neue Berechnungsart Bezugswst)
gernotbelger
parents: 8856
diff changeset
105 final String locale = config.getLocale();
2505
87ac5c532523 First part of the UI for fixing analysis parameter.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
106
9072
02739b8c010d bundu progress (Klon FixationAnalysis +Vollmer funktioniert; Verzweigung neue Berechnungsart Bezugswst)
gernotbelger
parents: 8856
diff changeset
107 this.tabs = new TabSet();
02739b8c010d bundu progress (Klon FixationAnalysis +Vollmer funktioniert; Verzweigung neue Berechnungsart Bezugswst)
gernotbelger
parents: 8856
diff changeset
108 this.events = new Tab(this.MESSAGES.events());
02739b8c010d bundu progress (Klon FixationAnalysis +Vollmer funktioniert; Verzweigung neue Berechnungsart Bezugswst)
gernotbelger
parents: 8856
diff changeset
109 this.chart = new Tab(this.MESSAGES.kmchart());
2517
8f528f5ae137 Added filter object class and scrollable chart to helper panel.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2505
diff changeset
110
9072
02739b8c010d bundu progress (Klon FixationAnalysis +Vollmer funktioniert; Verzweigung neue Berechnungsart Bezugswst)
gernotbelger
parents: 8856
diff changeset
111 this.chartContainer = new VLayout();
02739b8c010d bundu progress (Klon FixationAnalysis +Vollmer funktioniert; Verzweigung neue Berechnungsart Bezugswst)
gernotbelger
parents: 8856
diff changeset
112 final Canvas scroll = createChartHelper();
2517
8f528f5ae137 Added filter object class and scrollable chart to helper panel.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2505
diff changeset
113
9072
02739b8c010d bundu progress (Klon FixationAnalysis +Vollmer funktioniert; Verzweigung neue Berechnungsart Bezugswst)
gernotbelger
parents: 8856
diff changeset
114 final VLayout layout = new VLayout();
2517
8f528f5ae137 Added filter object class and scrollable chart to helper panel.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2505
diff changeset
115 layout.addResizedHandler(this);
9072
02739b8c010d bundu progress (Klon FixationAnalysis +Vollmer funktioniert; Verzweigung neue Berechnungsart Bezugswst)
gernotbelger
parents: 8856
diff changeset
116 layout.addMember(this.chartContainer);
2517
8f528f5ae137 Added filter object class and scrollable chart to helper panel.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2505
diff changeset
117 layout.addMember(scroll);
8f528f5ae137 Added filter object class and scrollable chart to helper panel.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2505
diff changeset
118 layout.setAlign(Alignment.CENTER);
9072
02739b8c010d bundu progress (Klon FixationAnalysis +Vollmer funktioniert; Verzweigung neue Berechnungsart Bezugswst)
gernotbelger
parents: 8856
diff changeset
119 this.chart.setPane(layout);
2517
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 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
122
9256
6c24c857ccf9 fixation refactoring and inputItem behaviour to interfaces
gernotbelger
parents: 9255
diff changeset
123 // final String river = this.artifact.getArtifactDescription().getRiver();
2505
87ac5c532523 First part of the UI for fixing analysis parameter.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
124 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
125
9072
02739b8c010d bundu progress (Klon FixationAnalysis +Vollmer funktioniert; Verzweigung neue Berechnungsart Bezugswst)
gernotbelger
parents: 8856
diff changeset
126 final 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
127
9072
02739b8c010d bundu progress (Klon FixationAnalysis +Vollmer funktioniert; Verzweigung neue Berechnungsart Bezugswst)
gernotbelger
parents: 8856
diff changeset
128 if (this.artifact instanceof AbstractFixBunduArtifact == false)
02739b8c010d bundu progress (Klon FixationAnalysis +Vollmer funktioniert; Verzweigung neue Berechnungsart Bezugswst)
gernotbelger
parents: 8856
diff changeset
129 return this.chartContainer;
02739b8c010d bundu progress (Klon FixationAnalysis +Vollmer funktioniert; Verzweigung neue Berechnungsart Bezugswst)
gernotbelger
parents: 8856
diff changeset
130
02739b8c010d bundu progress (Klon FixationAnalysis +Vollmer funktioniert; Verzweigung neue Berechnungsart Bezugswst)
gernotbelger
parents: 8856
diff changeset
131 final AbstractFixBunduArtifact art = (AbstractFixBunduArtifact) this.artifact;
02739b8c010d bundu progress (Klon FixationAnalysis +Vollmer funktioniert; Verzweigung neue Berechnungsart Bezugswst)
gernotbelger
parents: 8856
diff changeset
132
9255
9be51f776798 Merge from 3.2.1
gernotbelger
parents: 9099 8864
diff changeset
133 this.overviewService.generateOverview(locale, this.artifact.getUuid(), getOverviewFilter(art.getFilter()),
9072
02739b8c010d bundu progress (Klon FixationAnalysis +Vollmer funktioniert; Verzweigung neue Berechnungsart Bezugswst)
gernotbelger
parents: 8856
diff changeset
134 renderCheckboxes(), callBack, new AsyncCallback<FixingsOverviewInfo>() {
02739b8c010d bundu progress (Klon FixationAnalysis +Vollmer funktioniert; Verzweigung neue Berechnungsart Bezugswst)
gernotbelger
parents: 8856
diff changeset
135 @Override
02739b8c010d bundu progress (Klon FixationAnalysis +Vollmer funktioniert; Verzweigung neue Berechnungsart Bezugswst)
gernotbelger
parents: 8856
diff changeset
136 public void onFailure(final Throwable caught) {
02739b8c010d bundu progress (Klon FixationAnalysis +Vollmer funktioniert; Verzweigung neue Berechnungsart Bezugswst)
gernotbelger
parents: 8856
diff changeset
137 GWT.log("Could not receive overview.");
02739b8c010d bundu progress (Klon FixationAnalysis +Vollmer funktioniert; Verzweigung neue Berechnungsart Bezugswst)
gernotbelger
parents: 8856
diff changeset
138 SC.warn(caught.getMessage());
2923
43e0f6d96206 FixA: Make the km chart helper panel more useful.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2922
diff changeset
139 }
9072
02739b8c010d bundu progress (Klon FixationAnalysis +Vollmer funktioniert; Verzweigung neue Berechnungsart Bezugswst)
gernotbelger
parents: 8856
diff changeset
140
02739b8c010d bundu progress (Klon FixationAnalysis +Vollmer funktioniert; Verzweigung neue Berechnungsart Bezugswst)
gernotbelger
parents: 8856
diff changeset
141 @Override
02739b8c010d bundu progress (Klon FixationAnalysis +Vollmer funktioniert; Verzweigung neue Berechnungsart Bezugswst)
gernotbelger
parents: 8856
diff changeset
142 public void onSuccess(final FixingsOverviewInfo info) {
02739b8c010d bundu progress (Klon FixationAnalysis +Vollmer funktioniert; Verzweigung neue Berechnungsart Bezugswst)
gernotbelger
parents: 8856
diff changeset
143 GWT.log("Successfully loaded overview.");
02739b8c010d bundu progress (Klon FixationAnalysis +Vollmer funktioniert; Verzweigung neue Berechnungsart Bezugswst)
gernotbelger
parents: 8856
diff changeset
144 FixationPanel.this.fixInfo = info;
02739b8c010d bundu progress (Klon FixationAnalysis +Vollmer funktioniert; Verzweigung neue Berechnungsart Bezugswst)
gernotbelger
parents: 8856
diff changeset
145 FixationPanel.this.htmlOverview = info.getHTML();
02739b8c010d bundu progress (Klon FixationAnalysis +Vollmer funktioniert; Verzweigung neue Berechnungsart Bezugswst)
gernotbelger
parents: 8856
diff changeset
146 final AbstractFixBunduArtifact art = (AbstractFixBunduArtifact) FixationPanel.this.artifact;
02739b8c010d bundu progress (Klon FixationAnalysis +Vollmer funktioniert; Verzweigung neue Berechnungsart Bezugswst)
gernotbelger
parents: 8856
diff changeset
147 final FixFilter filter = art.getFilter();
02739b8c010d bundu progress (Klon FixationAnalysis +Vollmer funktioniert; Verzweigung neue Berechnungsart Bezugswst)
gernotbelger
parents: 8856
diff changeset
148 filter.setRiver(info.getRiver());
02739b8c010d bundu progress (Klon FixationAnalysis +Vollmer funktioniert; Verzweigung neue Berechnungsart Bezugswst)
gernotbelger
parents: 8856
diff changeset
149 if (filter.getCurrentKm() == -Double.MAX_VALUE || filter.getCurrentKm() == -1d) {
9099
850ce16034e9 2.3.4.1.10 Berechnung mit Start-km > End-km
gernotbelger
parents: 9072
diff changeset
150 filter.setCurrentKm(filter.getLowerKm());
850ce16034e9 2.3.4.1.10 Berechnung mit Start-km > End-km
gernotbelger
parents: 9072
diff changeset
151 filter.setToKm(filter.getUpperKm());
3362
bea50e45f0d3 FixA: Input fields for chart navigation now use the correct i18n number formats.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2963
diff changeset
152 }
9072
02739b8c010d bundu progress (Klon FixationAnalysis +Vollmer funktioniert; Verzweigung neue Berechnungsart Bezugswst)
gernotbelger
parents: 8856
diff changeset
153 if (FixationPanel.this.kmText != null) {
02739b8c010d bundu progress (Klon FixationAnalysis +Vollmer funktioniert; Verzweigung neue Berechnungsart Bezugswst)
gernotbelger
parents: 8856
diff changeset
154 final NumberFormat nf = NumberFormat.getDecimalFormat();
02739b8c010d bundu progress (Klon FixationAnalysis +Vollmer funktioniert; Verzweigung neue Berechnungsart Bezugswst)
gernotbelger
parents: 8856
diff changeset
155 try {
02739b8c010d bundu progress (Klon FixationAnalysis +Vollmer funktioniert; Verzweigung neue Berechnungsart Bezugswst)
gernotbelger
parents: 8856
diff changeset
156 final double d = Double.valueOf(filter.getCurrentKm());
02739b8c010d bundu progress (Klon FixationAnalysis +Vollmer funktioniert; Verzweigung neue Berechnungsart Bezugswst)
gernotbelger
parents: 8856
diff changeset
157 FixationPanel.this.kmText.setValue(nf.format(d));
02739b8c010d bundu progress (Klon FixationAnalysis +Vollmer funktioniert; Verzweigung neue Berechnungsart Bezugswst)
gernotbelger
parents: 8856
diff changeset
158 }
02739b8c010d bundu progress (Klon FixationAnalysis +Vollmer funktioniert; Verzweigung neue Berechnungsart Bezugswst)
gernotbelger
parents: 8856
diff changeset
159 catch (final NumberFormatException e) {
02739b8c010d bundu progress (Klon FixationAnalysis +Vollmer funktioniert; Verzweigung neue Berechnungsart Bezugswst)
gernotbelger
parents: 8856
diff changeset
160 FixationPanel.this.kmText.setValue(filter.getCurrentKm());
02739b8c010d bundu progress (Klon FixationAnalysis +Vollmer funktioniert; Verzweigung neue Berechnungsart Bezugswst)
gernotbelger
parents: 8856
diff changeset
161 }
02739b8c010d bundu progress (Klon FixationAnalysis +Vollmer funktioniert; Verzweigung neue Berechnungsart Bezugswst)
gernotbelger
parents: 8856
diff changeset
162 }
02739b8c010d bundu progress (Klon FixationAnalysis +Vollmer funktioniert; Verzweigung neue Berechnungsart Bezugswst)
gernotbelger
parents: 8856
diff changeset
163 eventPane.setContents(FixationPanel.this.htmlOverview);
9099
850ce16034e9 2.3.4.1.10 Berechnung mit Start-km > End-km
gernotbelger
parents: 9072
diff changeset
164 updateChartTab(FixationPanel.this.fixInfo.getLowerKm());
9072
02739b8c010d bundu progress (Klon FixationAnalysis +Vollmer funktioniert; Verzweigung neue Berechnungsart Bezugswst)
gernotbelger
parents: 8856
diff changeset
165 FixationPanel.this.events.setPane(eventPane);
9256
6c24c857ccf9 fixation refactoring and inputItem behaviour to interfaces
gernotbelger
parents: 9255
diff changeset
166 success(FixationPanel.this.fixInfo);
2923
43e0f6d96206 FixA: Make the km chart helper panel more useful.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2922
diff changeset
167 }
9072
02739b8c010d bundu progress (Klon FixationAnalysis +Vollmer funktioniert; Verzweigung neue Berechnungsart Bezugswst)
gernotbelger
parents: 8856
diff changeset
168 });
2505
87ac5c532523 First part of the UI for fixing analysis parameter.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
169
9072
02739b8c010d bundu progress (Klon FixationAnalysis +Vollmer funktioniert; Verzweigung neue Berechnungsart Bezugswst)
gernotbelger
parents: 8856
diff changeset
170 this.tabs.addTab(this.events);
02739b8c010d bundu progress (Klon FixationAnalysis +Vollmer funktioniert; Verzweigung neue Berechnungsart Bezugswst)
gernotbelger
parents: 8856
diff changeset
171 this.tabs.addTab(this.chart);
2505
87ac5c532523 First part of the UI for fixing analysis parameter.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
172
9072
02739b8c010d bundu progress (Klon FixationAnalysis +Vollmer funktioniert; Verzweigung neue Berechnungsart Bezugswst)
gernotbelger
parents: 8856
diff changeset
173 return this.tabs;
2505
87ac5c532523 First part of the UI for fixing analysis parameter.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
174 }
87ac5c532523 First part of the UI for fixing analysis parameter.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
175
9256
6c24c857ccf9 fixation refactoring and inputItem behaviour to interfaces
gernotbelger
parents: 9255
diff changeset
176 private Canvas createChartHelper() {
9072
02739b8c010d bundu progress (Klon FixationAnalysis +Vollmer funktioniert; Verzweigung neue Berechnungsart Bezugswst)
gernotbelger
parents: 8856
diff changeset
177 final DynamicForm form = new DynamicForm();
02739b8c010d bundu progress (Klon FixationAnalysis +Vollmer funktioniert; Verzweigung neue Berechnungsart Bezugswst)
gernotbelger
parents: 8856
diff changeset
178 final Button lower = new Button("<<");
2517
8f528f5ae137 Added filter object class and scrollable chart to helper panel.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2505
diff changeset
179 lower.setWidth(30);
9072
02739b8c010d bundu progress (Klon FixationAnalysis +Vollmer funktioniert; Verzweigung neue Berechnungsart Bezugswst)
gernotbelger
parents: 8856
diff changeset
180 final Button upper = new Button(">>");
2517
8f528f5ae137 Added filter object class and scrollable chart to helper panel.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2505
diff changeset
181 upper.setWidth(30);
9072
02739b8c010d bundu progress (Klon FixationAnalysis +Vollmer funktioniert; Verzweigung neue Berechnungsart Bezugswst)
gernotbelger
parents: 8856
diff changeset
182 this.kmText = new TextItem();
02739b8c010d bundu progress (Klon FixationAnalysis +Vollmer funktioniert; Verzweigung neue Berechnungsart Bezugswst)
gernotbelger
parents: 8856
diff changeset
183 this.kmText.setWidth(60);
02739b8c010d bundu progress (Klon FixationAnalysis +Vollmer funktioniert; Verzweigung neue Berechnungsart Bezugswst)
gernotbelger
parents: 8856
diff changeset
184 this.kmText.setShowTitle(false);
3362
bea50e45f0d3 FixA: Input fields for chart navigation now use the correct i18n number formats.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2963
diff changeset
185
9072
02739b8c010d bundu progress (Klon FixationAnalysis +Vollmer funktioniert; Verzweigung neue Berechnungsart Bezugswst)
gernotbelger
parents: 8856
diff changeset
186 form.setFields(this.kmText);
2517
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() {
4568
bbd82bd8e541 flys-client: Cosmetics and warnings.
Christian Lins <christian.lins@intevation.de>
parents: 4148
diff changeset
189 @Override
9072
02739b8c010d bundu progress (Klon FixationAnalysis +Vollmer funktioniert; Verzweigung neue Berechnungsart Bezugswst)
gernotbelger
parents: 8856
diff changeset
190 public void onClick(final ClickEvent ce) {
02739b8c010d bundu progress (Klon FixationAnalysis +Vollmer funktioniert; Verzweigung neue Berechnungsart Bezugswst)
gernotbelger
parents: 8856
diff changeset
191 final FixFilter filter = updateChartTabLow();
02739b8c010d bundu progress (Klon FixationAnalysis +Vollmer funktioniert; Verzweigung neue Berechnungsart Bezugswst)
gernotbelger
parents: 8856
diff changeset
192 final NumberFormat nf = NumberFormat.getDecimalFormat();
3362
bea50e45f0d3 FixA: Input fields for chart navigation now use the correct i18n number formats.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2963
diff changeset
193 try {
9072
02739b8c010d bundu progress (Klon FixationAnalysis +Vollmer funktioniert; Verzweigung neue Berechnungsart Bezugswst)
gernotbelger
parents: 8856
diff changeset
194 final double d = Double.valueOf(filter.getCurrentKm());
02739b8c010d bundu progress (Klon FixationAnalysis +Vollmer funktioniert; Verzweigung neue Berechnungsart Bezugswst)
gernotbelger
parents: 8856
diff changeset
195 FixationPanel.this.kmText.setValue(nf.format(d));
02739b8c010d bundu progress (Klon FixationAnalysis +Vollmer funktioniert; Verzweigung neue Berechnungsart Bezugswst)
gernotbelger
parents: 8856
diff changeset
196 }
02739b8c010d bundu progress (Klon FixationAnalysis +Vollmer funktioniert; Verzweigung neue Berechnungsart Bezugswst)
gernotbelger
parents: 8856
diff changeset
197 catch (final NumberFormatException e) {
02739b8c010d bundu progress (Klon FixationAnalysis +Vollmer funktioniert; Verzweigung neue Berechnungsart Bezugswst)
gernotbelger
parents: 8856
diff changeset
198 FixationPanel.this.kmText.setValue(filter.getCurrentKm());
3362
bea50e45f0d3 FixA: Input fields for chart navigation now use the correct i18n number formats.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2963
diff changeset
199 }
2517
8f528f5ae137 Added filter object class and scrollable chart to helper panel.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2505
diff changeset
200 }
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 upper.addClickHandler(new ClickHandler() {
4568
bbd82bd8e541 flys-client: Cosmetics and warnings.
Christian Lins <christian.lins@intevation.de>
parents: 4148
diff changeset
204 @Override
9072
02739b8c010d bundu progress (Klon FixationAnalysis +Vollmer funktioniert; Verzweigung neue Berechnungsart Bezugswst)
gernotbelger
parents: 8856
diff changeset
205 public void onClick(final ClickEvent ce) {
02739b8c010d bundu progress (Klon FixationAnalysis +Vollmer funktioniert; Verzweigung neue Berechnungsart Bezugswst)
gernotbelger
parents: 8856
diff changeset
206 final FixFilter filter = updateChartTabUp();
02739b8c010d bundu progress (Klon FixationAnalysis +Vollmer funktioniert; Verzweigung neue Berechnungsart Bezugswst)
gernotbelger
parents: 8856
diff changeset
207 final NumberFormat nf = NumberFormat.getDecimalFormat();
3362
bea50e45f0d3 FixA: Input fields for chart navigation now use the correct i18n number formats.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2963
diff changeset
208 try {
9072
02739b8c010d bundu progress (Klon FixationAnalysis +Vollmer funktioniert; Verzweigung neue Berechnungsart Bezugswst)
gernotbelger
parents: 8856
diff changeset
209 final double d = Double.valueOf(filter.getCurrentKm());
02739b8c010d bundu progress (Klon FixationAnalysis +Vollmer funktioniert; Verzweigung neue Berechnungsart Bezugswst)
gernotbelger
parents: 8856
diff changeset
210 FixationPanel.this.kmText.setValue(nf.format(d));
02739b8c010d bundu progress (Klon FixationAnalysis +Vollmer funktioniert; Verzweigung neue Berechnungsart Bezugswst)
gernotbelger
parents: 8856
diff changeset
211 }
02739b8c010d bundu progress (Klon FixationAnalysis +Vollmer funktioniert; Verzweigung neue Berechnungsart Bezugswst)
gernotbelger
parents: 8856
diff changeset
212 catch (final NumberFormatException e) {
02739b8c010d bundu progress (Klon FixationAnalysis +Vollmer funktioniert; Verzweigung neue Berechnungsart Bezugswst)
gernotbelger
parents: 8856
diff changeset
213 FixationPanel.this.kmText.setValue(filter.getCurrentKm());
3362
bea50e45f0d3 FixA: Input fields for chart navigation now use the correct i18n number formats.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2963
diff changeset
214 }
2517
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
9072
02739b8c010d bundu progress (Klon FixationAnalysis +Vollmer funktioniert; Verzweigung neue Berechnungsart Bezugswst)
gernotbelger
parents: 8856
diff changeset
218 this.kmText.addChangedHandler(new ChangedHandler() {
4568
bbd82bd8e541 flys-client: Cosmetics and warnings.
Christian Lins <christian.lins@intevation.de>
parents: 4148
diff changeset
219 @Override
9072
02739b8c010d bundu progress (Klon FixationAnalysis +Vollmer funktioniert; Verzweigung neue Berechnungsart Bezugswst)
gernotbelger
parents: 8856
diff changeset
220 public void onChanged(final ChangedEvent ce) {
02739b8c010d bundu progress (Klon FixationAnalysis +Vollmer funktioniert; Verzweigung neue Berechnungsart Bezugswst)
gernotbelger
parents: 8856
diff changeset
221 // TODO: get current value.
02739b8c010d bundu progress (Klon FixationAnalysis +Vollmer funktioniert; Verzweigung neue Berechnungsart Bezugswst)
gernotbelger
parents: 8856
diff changeset
222 if (ce.getItem().getValue() != null) {
02739b8c010d bundu progress (Klon FixationAnalysis +Vollmer funktioniert; Verzweigung neue Berechnungsart Bezugswst)
gernotbelger
parents: 8856
diff changeset
223 final NumberFormat nf = NumberFormat.getDecimalFormat();
2517
8f528f5ae137 Added filter object class and scrollable chart to helper panel.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2505
diff changeset
224 try {
9072
02739b8c010d bundu progress (Klon FixationAnalysis +Vollmer funktioniert; Verzweigung neue Berechnungsart Bezugswst)
gernotbelger
parents: 8856
diff changeset
225 final double d = nf.parse(ce.getItem().getValue().toString());
2923
43e0f6d96206 FixA: Make the km chart helper panel more useful.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2922
diff changeset
226 updateChartTab(d);
2517
8f528f5ae137 Added filter object class and scrollable chart to helper panel.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2505
diff changeset
227 }
9072
02739b8c010d bundu progress (Klon FixationAnalysis +Vollmer funktioniert; Verzweigung neue Berechnungsart Bezugswst)
gernotbelger
parents: 8856
diff changeset
228 catch (final NumberFormatException nfe) {
2517
8f528f5ae137 Added filter object class and scrollable chart to helper panel.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2505
diff changeset
229 // Do nothing.
8f528f5ae137 Added filter object class and scrollable chart to helper panel.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2505
diff changeset
230 }
8f528f5ae137 Added filter object class and scrollable chart to helper panel.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2505
diff changeset
231 }
8f528f5ae137 Added filter object class and scrollable chart to helper panel.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2505
diff changeset
232 }
8f528f5ae137 Added filter object class and scrollable chart to helper panel.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2505
diff changeset
233 });
8f528f5ae137 Added filter object class and scrollable chart to helper panel.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2505
diff changeset
234
9072
02739b8c010d bundu progress (Klon FixationAnalysis +Vollmer funktioniert; Verzweigung neue Berechnungsart Bezugswst)
gernotbelger
parents: 8856
diff changeset
235 final HLayout layout = new HLayout();
2517
8f528f5ae137 Added filter object class and scrollable chart to helper panel.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2505
diff changeset
236 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
237
8f528f5ae137 Added filter object class and scrollable chart to helper panel.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2505
diff changeset
238 layout.addMember(lower);
8f528f5ae137 Added filter object class and scrollable chart to helper panel.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2505
diff changeset
239 layout.addMember(form);
8f528f5ae137 Added filter object class and scrollable chart to helper panel.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2505
diff changeset
240 layout.addMember(upper);
8f528f5ae137 Added filter object class and scrollable chart to helper panel.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2505
diff changeset
241 return layout;
8f528f5ae137 Added filter object class and scrollable chart to helper panel.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2505
diff changeset
242 }
8f528f5ae137 Added filter object class and scrollable chart to helper panel.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2505
diff changeset
243
9256
6c24c857ccf9 fixation refactoring and inputItem behaviour to interfaces
gernotbelger
parents: 9255
diff changeset
244 private void updateChartTab(double km) {
9072
02739b8c010d bundu progress (Klon FixationAnalysis +Vollmer funktioniert; Verzweigung neue Berechnungsart Bezugswst)
gernotbelger
parents: 8856
diff changeset
245 final Config config = Config.getInstance();
02739b8c010d bundu progress (Klon FixationAnalysis +Vollmer funktioniert; Verzweigung neue Berechnungsart Bezugswst)
gernotbelger
parents: 8856
diff changeset
246 final String locale = config.getLocale();
2517
8f528f5ae137 Added filter object class and scrollable chart to helper panel.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2505
diff changeset
247
9072
02739b8c010d bundu progress (Klon FixationAnalysis +Vollmer funktioniert; Verzweigung neue Berechnungsart Bezugswst)
gernotbelger
parents: 8856
diff changeset
248 final AbstractFixBunduArtifact art = (AbstractFixBunduArtifact) this.artifact;
2923
43e0f6d96206 FixA: Make the km chart helper panel more useful.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2922
diff changeset
249
9099
850ce16034e9 2.3.4.1.10 Berechnung mit Start-km > End-km
gernotbelger
parents: 9072
diff changeset
250 // was soll das all
9072
02739b8c010d bundu progress (Klon FixationAnalysis +Vollmer funktioniert; Verzweigung neue Berechnungsart Bezugswst)
gernotbelger
parents: 8856
diff changeset
251 if (this.fixInfo != null) {
9099
850ce16034e9 2.3.4.1.10 Berechnung mit Start-km > End-km
gernotbelger
parents: 9072
diff changeset
252 if (km < this.fixInfo.getLowerKm())
850ce16034e9 2.3.4.1.10 Berechnung mit Start-km > End-km
gernotbelger
parents: 9072
diff changeset
253 km = this.fixInfo.getLowerKm();
850ce16034e9 2.3.4.1.10 Berechnung mit Start-km > End-km
gernotbelger
parents: 9072
diff changeset
254 // if (km > this.fixInfo.getTo())
850ce16034e9 2.3.4.1.10 Berechnung mit Start-km > End-km
gernotbelger
parents: 9072
diff changeset
255 // km = this.fixInfo.getTo();
2884
88bca9f735c0 Implemented filter for fix analysis helper widgets.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2539
diff changeset
256 }
2923
43e0f6d96206 FixA: Make the km chart helper panel more useful.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2922
diff changeset
257
9072
02739b8c010d bundu progress (Klon FixationAnalysis +Vollmer funktioniert; Verzweigung neue Berechnungsart Bezugswst)
gernotbelger
parents: 8856
diff changeset
258 final FixFilter filter = art.getFilter();
2923
43e0f6d96206 FixA: Make the km chart helper panel more useful.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2922
diff changeset
259
9099
850ce16034e9 2.3.4.1.10 Berechnung mit Start-km > End-km
gernotbelger
parents: 9072
diff changeset
260 if (km < filter.getLowerKm())
850ce16034e9 2.3.4.1.10 Berechnung mit Start-km > End-km
gernotbelger
parents: 9072
diff changeset
261 km = filter.getLowerKm();
850ce16034e9 2.3.4.1.10 Berechnung mit Start-km > End-km
gernotbelger
parents: 9072
diff changeset
262 if (km > filter.getUpperKm())
850ce16034e9 2.3.4.1.10 Berechnung mit Start-km > End-km
gernotbelger
parents: 9072
diff changeset
263 km = filter.getUpperKm();
2923
43e0f6d96206 FixA: Make the km chart helper panel more useful.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2922
diff changeset
264
43e0f6d96206 FixA: Make the km chart helper panel more useful.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2922
diff changeset
265 filter.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
266
9072
02739b8c010d bundu progress (Klon FixationAnalysis +Vollmer funktioniert; Verzweigung neue Berechnungsart Bezugswst)
gernotbelger
parents: 8856
diff changeset
267 int hWidth = this.helperContainer.getWidth() - 12;
02739b8c010d bundu progress (Klon FixationAnalysis +Vollmer funktioniert; Verzweigung neue Berechnungsart Bezugswst)
gernotbelger
parents: 8856
diff changeset
268 int hHeight = this.helperContainer.getHeight() - 62;
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
269
9072
02739b8c010d bundu progress (Klon FixationAnalysis +Vollmer funktioniert; Verzweigung neue Berechnungsart Bezugswst)
gernotbelger
parents: 8856
diff changeset
270 if ((int) (hHeight * 4f / 3) < hWidth) {
02739b8c010d bundu progress (Klon FixationAnalysis +Vollmer funktioniert; Verzweigung neue Berechnungsart Bezugswst)
gernotbelger
parents: 8856
diff changeset
271 hWidth = (int) (hHeight * 4f / 3);
02739b8c010d bundu progress (Klon FixationAnalysis +Vollmer funktioniert; Verzweigung neue Berechnungsart Bezugswst)
gernotbelger
parents: 8856
diff changeset
272 } else {
02739b8c010d bundu progress (Klon FixationAnalysis +Vollmer funktioniert; Verzweigung neue Berechnungsart Bezugswst)
gernotbelger
parents: 8856
diff changeset
273 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
274 }
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
275
9255
9be51f776798 Merge from 3.2.1
gernotbelger
parents: 9099 8864
diff changeset
276 final String imgUrl = URL.encode(GWT.getModuleBaseURL()
9be51f776798 Merge from 3.2.1
gernotbelger
parents: 9099 8864
diff changeset
277 + "fixings-km-chart"
9be51f776798 Merge from 3.2.1
gernotbelger
parents: 9099 8864
diff changeset
278 + "?locale=" + locale
9be51f776798 Merge from 3.2.1
gernotbelger
parents: 9099 8864
diff changeset
279 + "&filter=" + getChartFilter(filter, hWidth, hHeight));
2517
8f528f5ae137 Added filter object class and scrollable chart to helper panel.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2505
diff changeset
280
9072
02739b8c010d bundu progress (Klon FixationAnalysis +Vollmer funktioniert; Verzweigung neue Berechnungsart Bezugswst)
gernotbelger
parents: 8856
diff changeset
281 if (this.chartContainer.hasMember(this.chartImg)) {
02739b8c010d bundu progress (Klon FixationAnalysis +Vollmer funktioniert; Verzweigung neue Berechnungsart Bezugswst)
gernotbelger
parents: 8856
diff changeset
282 this.chartImg.setWidth(hWidth);
02739b8c010d bundu progress (Klon FixationAnalysis +Vollmer funktioniert; Verzweigung neue Berechnungsart Bezugswst)
gernotbelger
parents: 8856
diff changeset
283 this.chartImg.setHeight(hHeight);
02739b8c010d bundu progress (Klon FixationAnalysis +Vollmer funktioniert; Verzweigung neue Berechnungsart Bezugswst)
gernotbelger
parents: 8856
diff changeset
284 this.chartImg.setSrc(imgUrl);
02739b8c010d bundu progress (Klon FixationAnalysis +Vollmer funktioniert; Verzweigung neue Berechnungsart Bezugswst)
gernotbelger
parents: 8856
diff changeset
285 } else {
02739b8c010d bundu progress (Klon FixationAnalysis +Vollmer funktioniert; Verzweigung neue Berechnungsart Bezugswst)
gernotbelger
parents: 8856
diff changeset
286 this.chartImg = new Img(imgUrl, hWidth, hHeight);
02739b8c010d bundu progress (Klon FixationAnalysis +Vollmer funktioniert; Verzweigung neue Berechnungsart Bezugswst)
gernotbelger
parents: 8856
diff changeset
287 this.chartContainer.addMember(this.chartImg);
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
288 }
2517
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
9256
6c24c857ccf9 fixation refactoring and inputItem behaviour to interfaces
gernotbelger
parents: 9255
diff changeset
291 private FixFilter updateChartTabLow() {
9072
02739b8c010d bundu progress (Klon FixationAnalysis +Vollmer funktioniert; Verzweigung neue Berechnungsart Bezugswst)
gernotbelger
parents: 8856
diff changeset
292 final AbstractFixBunduArtifact art = (AbstractFixBunduArtifact) this.artifact;
2884
88bca9f735c0 Implemented filter for fix analysis helper widgets.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2539
diff changeset
293
9072
02739b8c010d bundu progress (Klon FixationAnalysis +Vollmer funktioniert; Verzweigung neue Berechnungsart Bezugswst)
gernotbelger
parents: 8856
diff changeset
294 final FixFilter filter = art.getFilter();
2923
43e0f6d96206 FixA: Make the km chart helper panel more useful.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2922
diff changeset
295
9072
02739b8c010d bundu progress (Klon FixationAnalysis +Vollmer funktioniert; Verzweigung neue Berechnungsart Bezugswst)
gernotbelger
parents: 8856
diff changeset
296 final double curr = filter.getCurrentKm();
9099
850ce16034e9 2.3.4.1.10 Berechnung mit Start-km > End-km
gernotbelger
parents: 9072
diff changeset
297 if (curr > filter.getLowerKm()) {
9072
02739b8c010d bundu progress (Klon FixationAnalysis +Vollmer funktioniert; Verzweigung neue Berechnungsart Bezugswst)
gernotbelger
parents: 8856
diff changeset
298 final double newVal = (curr - 0.1) * 10;
02739b8c010d bundu progress (Klon FixationAnalysis +Vollmer funktioniert; Verzweigung neue Berechnungsart Bezugswst)
gernotbelger
parents: 8856
diff changeset
299 final long round = Math.round(newVal);
02739b8c010d bundu progress (Klon FixationAnalysis +Vollmer funktioniert; Verzweigung neue Berechnungsart Bezugswst)
gernotbelger
parents: 8856
diff changeset
300 updateChartTab(((double) round) / 10);
2517
8f528f5ae137 Added filter object class and scrollable chart to helper panel.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2505
diff changeset
301 }
2923
43e0f6d96206 FixA: Make the km chart helper panel more useful.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2922
diff changeset
302 return filter;
2517
8f528f5ae137 Added filter object class and scrollable chart to helper panel.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2505
diff changeset
303 }
8f528f5ae137 Added filter object class and scrollable chart to helper panel.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2505
diff changeset
304
9256
6c24c857ccf9 fixation refactoring and inputItem behaviour to interfaces
gernotbelger
parents: 9255
diff changeset
305 private FixFilter updateChartTabUp() {
9072
02739b8c010d bundu progress (Klon FixationAnalysis +Vollmer funktioniert; Verzweigung neue Berechnungsart Bezugswst)
gernotbelger
parents: 8856
diff changeset
306 final AbstractFixBunduArtifact art = (AbstractFixBunduArtifact) this.artifact;
2884
88bca9f735c0 Implemented filter for fix analysis helper widgets.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2539
diff changeset
307
9072
02739b8c010d bundu progress (Klon FixationAnalysis +Vollmer funktioniert; Verzweigung neue Berechnungsart Bezugswst)
gernotbelger
parents: 8856
diff changeset
308 final FixFilter filter = art.getFilter();
2923
43e0f6d96206 FixA: Make the km chart helper panel more useful.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2922
diff changeset
309
9072
02739b8c010d bundu progress (Klon FixationAnalysis +Vollmer funktioniert; Verzweigung neue Berechnungsart Bezugswst)
gernotbelger
parents: 8856
diff changeset
310 final double curr = filter.getCurrentKm();
9099
850ce16034e9 2.3.4.1.10 Berechnung mit Start-km > End-km
gernotbelger
parents: 9072
diff changeset
311 if (curr < filter.getUpperKm()) {
9072
02739b8c010d bundu progress (Klon FixationAnalysis +Vollmer funktioniert; Verzweigung neue Berechnungsart Bezugswst)
gernotbelger
parents: 8856
diff changeset
312 final double newVal = (curr + 0.1) * 10;
02739b8c010d bundu progress (Klon FixationAnalysis +Vollmer funktioniert; Verzweigung neue Berechnungsart Bezugswst)
gernotbelger
parents: 8856
diff changeset
313 final long round = Math.round(newVal);
02739b8c010d bundu progress (Klon FixationAnalysis +Vollmer funktioniert; Verzweigung neue Berechnungsart Bezugswst)
gernotbelger
parents: 8856
diff changeset
314 updateChartTab(((double) round) / 10);
2517
8f528f5ae137 Added filter object class and scrollable chart to helper panel.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2505
diff changeset
315 }
2923
43e0f6d96206 FixA: Make the km chart helper panel more useful.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2922
diff changeset
316 return filter;
2517
8f528f5ae137 Added filter object class and scrollable chart to helper panel.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2505
diff changeset
317 }
8f528f5ae137 Added filter object class and scrollable chart to helper panel.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2505
diff changeset
318
4568
bbd82bd8e541 flys-client: Cosmetics and warnings.
Christian Lins <christian.lins@intevation.de>
parents: 4148
diff changeset
319 @Override
9256
6c24c857ccf9 fixation refactoring and inputItem behaviour to interfaces
gernotbelger
parents: 9255
diff changeset
320 public final void onResized(final ResizedEvent re) {
9072
02739b8c010d bundu progress (Klon FixationAnalysis +Vollmer funktioniert; Verzweigung neue Berechnungsart Bezugswst)
gernotbelger
parents: 8856
diff changeset
321 final AbstractFixBunduArtifact art = (AbstractFixBunduArtifact) this.artifact;
2884
88bca9f735c0 Implemented filter for fix analysis helper widgets.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2539
diff changeset
322
88bca9f735c0 Implemented filter for fix analysis helper widgets.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2539
diff changeset
323 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
324 }
8f528f5ae137 Added filter object class and scrollable chart to helper panel.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2505
diff changeset
325
2505
87ac5c532523 First part of the UI for fixing analysis parameter.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
326 private native void createCallback() /*-{
5835
821a02bbfb4e Fixed internal java dependencies
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5834
diff changeset
327 $wnd.fixationCallback = @org.dive4elements.river.client.client.ui.fixation.FixationPanel::helperCallback(ZLjava/lang/String;);
2505
87ac5c532523 First part of the UI for fixing analysis parameter.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
328 }-*/;
87ac5c532523 First part of the UI for fixing analysis parameter.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
329
9072
02739b8c010d bundu progress (Klon FixationAnalysis +Vollmer funktioniert; Verzweigung neue Berechnungsart Bezugswst)
gernotbelger
parents: 8856
diff changeset
330 private static void helperCallback(final boolean checked, final String name) {
02739b8c010d bundu progress (Klon FixationAnalysis +Vollmer funktioniert; Verzweigung neue Berechnungsart Bezugswst)
gernotbelger
parents: 8856
diff changeset
331 final String[] parts = name.split(":");
02739b8c010d bundu progress (Klon FixationAnalysis +Vollmer funktioniert; Verzweigung neue Berechnungsart Bezugswst)
gernotbelger
parents: 8856
diff changeset
332 final String uuid = parts[0];
02739b8c010d bundu progress (Klon FixationAnalysis +Vollmer funktioniert; Verzweigung neue Berechnungsart Bezugswst)
gernotbelger
parents: 8856
diff changeset
333 final String cid = parts[1];
2962
f14d4c668ec5 Bugfix: #698 Fix-Analysis is working in Tomcat again.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2923
diff changeset
334
9072
02739b8c010d bundu progress (Klon FixationAnalysis +Vollmer funktioniert; Verzweigung neue Berechnungsart Bezugswst)
gernotbelger
parents: 8856
diff changeset
335 final FixationPanel p = FixationPanel.getInstance(uuid);
2505
87ac5c532523 First part of the UI for fixing analysis parameter.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
336 if (p != null) {
87ac5c532523 First part of the UI for fixing analysis parameter.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
337 p.setValues(cid, checked);
87ac5c532523 First part of the UI for fixing analysis parameter.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
338 }
87ac5c532523 First part of the UI for fixing analysis parameter.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
339 }
87ac5c532523 First part of the UI for fixing analysis parameter.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
340
9072
02739b8c010d bundu progress (Klon FixationAnalysis +Vollmer funktioniert; Verzweigung neue Berechnungsart Bezugswst)
gernotbelger
parents: 8856
diff changeset
341 private static FixationPanel getInstance(final String uuid) {
2923
43e0f6d96206 FixA: Make the km chart helper panel more useful.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2922
diff changeset
342 return instances.get(uuid);
2505
87ac5c532523 First part of the UI for fixing analysis parameter.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
343 }
87ac5c532523 First part of the UI for fixing analysis parameter.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
344
9256
6c24c857ccf9 fixation refactoring and inputItem behaviour to interfaces
gernotbelger
parents: 9255
diff changeset
345 protected abstract Canvas createWidget(DataList data);
9072
02739b8c010d bundu progress (Klon FixationAnalysis +Vollmer funktioniert; Verzweigung neue Berechnungsart Bezugswst)
gernotbelger
parents: 8856
diff changeset
346
9256
6c24c857ccf9 fixation refactoring and inputItem behaviour to interfaces
gernotbelger
parents: 9255
diff changeset
347 protected abstract void setValues(String cid, boolean checked);
9072
02739b8c010d bundu progress (Klon FixationAnalysis +Vollmer funktioniert; Verzweigung neue Berechnungsart Bezugswst)
gernotbelger
parents: 8856
diff changeset
348
9256
6c24c857ccf9 fixation refactoring and inputItem behaviour to interfaces
gernotbelger
parents: 9255
diff changeset
349 protected abstract boolean renderCheckboxes();
9072
02739b8c010d bundu progress (Klon FixationAnalysis +Vollmer funktioniert; Verzweigung neue Berechnungsart Bezugswst)
gernotbelger
parents: 8856
diff changeset
350
9256
6c24c857ccf9 fixation refactoring and inputItem behaviour to interfaces
gernotbelger
parents: 9255
diff changeset
351 protected abstract void success(FixingsOverviewInfo fixInfo);
2517
8f528f5ae137 Added filter object class and scrollable chart to helper panel.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2505
diff changeset
352
5334
b296d435fc69 Doc and whitespace fixes.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 4568
diff changeset
353 /** Creates JSON string from filter. */
9256
6c24c857ccf9 fixation refactoring and inputItem behaviour to interfaces
gernotbelger
parents: 9255
diff changeset
354 private static String getOverviewFilter(final FixFilter filter) {
9072
02739b8c010d bundu progress (Klon FixationAnalysis +Vollmer funktioniert; Verzweigung neue Berechnungsart Bezugswst)
gernotbelger
parents: 8856
diff changeset
355 final String river = filter.getRiver();
2517
8f528f5ae137 Added filter object class and scrollable chart to helper panel.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2505
diff changeset
356
2962
f14d4c668ec5 Bugfix: #698 Fix-Analysis is working in Tomcat again.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2923
diff changeset
357 if (river != null && river.length() > 0) {
9072
02739b8c010d bundu progress (Klon FixationAnalysis +Vollmer funktioniert; Verzweigung neue Berechnungsart Bezugswst)
gernotbelger
parents: 8856
diff changeset
358 final JSONObject jfix = new JSONObject();
02739b8c010d bundu progress (Klon FixationAnalysis +Vollmer funktioniert; Verzweigung neue Berechnungsart Bezugswst)
gernotbelger
parents: 8856
diff changeset
359 final JSONObject jfilter = new JSONObject();
02739b8c010d bundu progress (Klon FixationAnalysis +Vollmer funktioniert; Verzweigung neue Berechnungsart Bezugswst)
gernotbelger
parents: 8856
diff changeset
360 final JSONObject jrName = new JSONObject();
02739b8c010d bundu progress (Klon FixationAnalysis +Vollmer funktioniert; Verzweigung neue Berechnungsart Bezugswst)
gernotbelger
parents: 8856
diff changeset
361 final JSONString jrValue = new JSONString(river);
2962
f14d4c668ec5 Bugfix: #698 Fix-Analysis is working in Tomcat again.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2923
diff changeset
362 jrName.put("name", jrValue);
f14d4c668ec5 Bugfix: #698 Fix-Analysis is working in Tomcat again.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2923
diff changeset
363 jfilter.put("river", jrName);
f14d4c668ec5 Bugfix: #698 Fix-Analysis is working in Tomcat again.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2923
diff changeset
364 jfix.put("fixings", createFilter(filter, jfilter));
f14d4c668ec5 Bugfix: #698 Fix-Analysis is working in Tomcat again.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2923
diff changeset
365 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
366 }
2962
f14d4c668ec5 Bugfix: #698 Fix-Analysis is working in Tomcat again.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2923
diff changeset
367 return "";
f14d4c668ec5 Bugfix: #698 Fix-Analysis is working in Tomcat again.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2923
diff changeset
368 }
2517
8f528f5ae137 Added filter object class and scrollable chart to helper panel.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2505
diff changeset
369
9256
6c24c857ccf9 fixation refactoring and inputItem behaviour to interfaces
gernotbelger
parents: 9255
diff changeset
370 private String getChartFilter(final FixFilter filter, final int width, final int height) {
9072
02739b8c010d bundu progress (Klon FixationAnalysis +Vollmer funktioniert; Verzweigung neue Berechnungsart Bezugswst)
gernotbelger
parents: 8856
diff changeset
371 final String river = filter.getRiver();
02739b8c010d bundu progress (Klon FixationAnalysis +Vollmer funktioniert; Verzweigung neue Berechnungsart Bezugswst)
gernotbelger
parents: 8856
diff changeset
372 final double currentKm = filter.getCurrentKm();
9099
850ce16034e9 2.3.4.1.10 Berechnung mit Start-km > End-km
gernotbelger
parents: 9072
diff changeset
373 final double fromKm = filter.getLowerKm();
850ce16034e9 2.3.4.1.10 Berechnung mit Start-km > End-km
gernotbelger
parents: 9072
diff changeset
374 final double toKm = filter.getUpperKm();
2517
8f528f5ae137 Added filter object class and scrollable chart to helper panel.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2505
diff changeset
375
9072
02739b8c010d bundu progress (Klon FixationAnalysis +Vollmer funktioniert; Verzweigung neue Berechnungsart Bezugswst)
gernotbelger
parents: 8856
diff changeset
376 if (river != null && river.length() > 0 && currentKm >= fromKm && currentKm <= toKm) {
02739b8c010d bundu progress (Klon FixationAnalysis +Vollmer funktioniert; Verzweigung neue Berechnungsart Bezugswst)
gernotbelger
parents: 8856
diff changeset
377 final JSONObject jfix = new JSONObject();
02739b8c010d bundu progress (Klon FixationAnalysis +Vollmer funktioniert; Verzweigung neue Berechnungsart Bezugswst)
gernotbelger
parents: 8856
diff changeset
378 final JSONObject jfilter = new JSONObject();
02739b8c010d bundu progress (Klon FixationAnalysis +Vollmer funktioniert; Verzweigung neue Berechnungsart Bezugswst)
gernotbelger
parents: 8856
diff changeset
379 final JSONObject jrName = new JSONObject();
02739b8c010d bundu progress (Klon FixationAnalysis +Vollmer funktioniert; Verzweigung neue Berechnungsart Bezugswst)
gernotbelger
parents: 8856
diff changeset
380 final JSONString jrValue = new JSONString(river);
02739b8c010d bundu progress (Klon FixationAnalysis +Vollmer funktioniert; Verzweigung neue Berechnungsart Bezugswst)
gernotbelger
parents: 8856
diff changeset
381 final JSONObject jkm = new JSONObject();
02739b8c010d bundu progress (Klon FixationAnalysis +Vollmer funktioniert; Verzweigung neue Berechnungsart Bezugswst)
gernotbelger
parents: 8856
diff changeset
382 final JSONNumber jkmValue = new JSONNumber(currentKm);
02739b8c010d bundu progress (Klon FixationAnalysis +Vollmer funktioniert; Verzweigung neue Berechnungsart Bezugswst)
gernotbelger
parents: 8856
diff changeset
383 final JSONObject jextent = new JSONObject();
02739b8c010d bundu progress (Klon FixationAnalysis +Vollmer funktioniert; Verzweigung neue Berechnungsart Bezugswst)
gernotbelger
parents: 8856
diff changeset
384 final JSONNumber jwidth = new JSONNumber(width);
02739b8c010d bundu progress (Klon FixationAnalysis +Vollmer funktioniert; Verzweigung neue Berechnungsart Bezugswst)
gernotbelger
parents: 8856
diff changeset
385 final JSONNumber jheight = new JSONNumber(height);
2962
f14d4c668ec5 Bugfix: #698 Fix-Analysis is working in Tomcat again.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2923
diff changeset
386
f14d4c668ec5 Bugfix: #698 Fix-Analysis is working in Tomcat again.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2923
diff changeset
387 jkm.put("value", jkmValue);
f14d4c668ec5 Bugfix: #698 Fix-Analysis is working in Tomcat again.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2923
diff changeset
388 jrName.put("name", jrValue);
f14d4c668ec5 Bugfix: #698 Fix-Analysis is working in Tomcat again.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2923
diff changeset
389 jfilter.put("river", jrName);
f14d4c668ec5 Bugfix: #698 Fix-Analysis is working in Tomcat again.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2923
diff changeset
390 jfilter.put("km", jkm);
f14d4c668ec5 Bugfix: #698 Fix-Analysis is working in Tomcat again.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2923
diff changeset
391 jextent.put("width", jwidth);
f14d4c668ec5 Bugfix: #698 Fix-Analysis is working in Tomcat again.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2923
diff changeset
392 jextent.put("height", jheight);
f14d4c668ec5 Bugfix: #698 Fix-Analysis is working in Tomcat again.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2923
diff changeset
393 jfilter.put("extent", jextent);
f14d4c668ec5 Bugfix: #698 Fix-Analysis is working in Tomcat again.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2923
diff changeset
394 jfix.put("fixings", createFilter(filter, jfilter));
f14d4c668ec5 Bugfix: #698 Fix-Analysis is working in Tomcat again.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2923
diff changeset
395 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
396 }
2962
f14d4c668ec5 Bugfix: #698 Fix-Analysis is working in Tomcat again.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2923
diff changeset
397 return "";
f14d4c668ec5 Bugfix: #698 Fix-Analysis is working in Tomcat again.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2923
diff changeset
398 }
2517
8f528f5ae137 Added filter object class and scrollable chart to helper panel.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2505
diff changeset
399
9256
6c24c857ccf9 fixation refactoring and inputItem behaviour to interfaces
gernotbelger
parents: 9255
diff changeset
400 private static JSONObject createFilter(final FixFilter filter, final JSONObject root) {
9099
850ce16034e9 2.3.4.1.10 Berechnung mit Start-km > End-km
gernotbelger
parents: 9072
diff changeset
401 final double fromKm = filter.getLowerKm();
850ce16034e9 2.3.4.1.10 Berechnung mit Start-km > End-km
gernotbelger
parents: 9072
diff changeset
402 final double toKm = filter.getUpperKm();
9072
02739b8c010d bundu progress (Klon FixationAnalysis +Vollmer funktioniert; Verzweigung neue Berechnungsart Bezugswst)
gernotbelger
parents: 8856
diff changeset
403 final boolean hasDate = filter.hasDate();
2517
8f528f5ae137 Added filter object class and scrollable chart to helper panel.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2505
diff changeset
404
2962
f14d4c668ec5 Bugfix: #698 Fix-Analysis is working in Tomcat again.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2923
diff changeset
405 if (fromKm >= 0 && toKm >= 0 && fromKm <= toKm) {
9072
02739b8c010d bundu progress (Klon FixationAnalysis +Vollmer funktioniert; Verzweigung neue Berechnungsart Bezugswst)
gernotbelger
parents: 8856
diff changeset
406 final JSONObject range = new JSONObject();
02739b8c010d bundu progress (Klon FixationAnalysis +Vollmer funktioniert; Verzweigung neue Berechnungsart Bezugswst)
gernotbelger
parents: 8856
diff changeset
407 final JSONObject fromtokm = new JSONObject();
02739b8c010d bundu progress (Klon FixationAnalysis +Vollmer funktioniert; Verzweigung neue Berechnungsart Bezugswst)
gernotbelger
parents: 8856
diff changeset
408 final JSONNumber f = new JSONNumber(fromKm);
02739b8c010d bundu progress (Klon FixationAnalysis +Vollmer funktioniert; Verzweigung neue Berechnungsart Bezugswst)
gernotbelger
parents: 8856
diff changeset
409 final JSONNumber t = new JSONNumber(toKm);
2962
f14d4c668ec5 Bugfix: #698 Fix-Analysis is working in Tomcat again.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2923
diff changeset
410 fromtokm.put("from", f);
f14d4c668ec5 Bugfix: #698 Fix-Analysis is working in Tomcat again.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2923
diff changeset
411 fromtokm.put("to", t);
f14d4c668ec5 Bugfix: #698 Fix-Analysis is working in Tomcat again.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2923
diff changeset
412 root.put("range", fromtokm);
2517
8f528f5ae137 Added filter object class and scrollable chart to helper panel.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2505
diff changeset
413 }
8f528f5ae137 Added filter object class and scrollable chart to helper panel.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2505
diff changeset
414
9072
02739b8c010d bundu progress (Klon FixationAnalysis +Vollmer funktioniert; Verzweigung neue Berechnungsart Bezugswst)
gernotbelger
parents: 8856
diff changeset
415 final JSONObject and = new JSONObject();
2962
f14d4c668ec5 Bugfix: #698 Fix-Analysis is working in Tomcat again.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2923
diff changeset
416 if (hasDate) {
9072
02739b8c010d bundu progress (Klon FixationAnalysis +Vollmer funktioniert; Verzweigung neue Berechnungsart Bezugswst)
gernotbelger
parents: 8856
diff changeset
417 final long fromDate = filter.getFromDate();
02739b8c010d bundu progress (Klon FixationAnalysis +Vollmer funktioniert; Verzweigung neue Berechnungsart Bezugswst)
gernotbelger
parents: 8856
diff changeset
418 final long toDate = filter.getToDate();
2517
8f528f5ae137 Added filter object class and scrollable chart to helper panel.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2505
diff changeset
419
9072
02739b8c010d bundu progress (Klon FixationAnalysis +Vollmer funktioniert; Verzweigung neue Berechnungsart Bezugswst)
gernotbelger
parents: 8856
diff changeset
420 final Date df = new Date(fromDate);
02739b8c010d bundu progress (Klon FixationAnalysis +Vollmer funktioniert; Verzweigung neue Berechnungsart Bezugswst)
gernotbelger
parents: 8856
diff changeset
421 final Date dt = new Date(toDate);
2884
88bca9f735c0 Implemented filter for fix analysis helper widgets.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2539
diff changeset
422
9072
02739b8c010d bundu progress (Klon FixationAnalysis +Vollmer funktioniert; Verzweigung neue Berechnungsart Bezugswst)
gernotbelger
parents: 8856
diff changeset
423 final JSONObject daterange = new JSONObject();
02739b8c010d bundu progress (Klon FixationAnalysis +Vollmer funktioniert; Verzweigung neue Berechnungsart Bezugswst)
gernotbelger
parents: 8856
diff changeset
424 final JSONString f = new JSONString(DTF.format(df));
02739b8c010d bundu progress (Klon FixationAnalysis +Vollmer funktioniert; Verzweigung neue Berechnungsart Bezugswst)
gernotbelger
parents: 8856
diff changeset
425 final JSONString t = new JSONString(DTF.format(dt));
2962
f14d4c668ec5 Bugfix: #698 Fix-Analysis is working in Tomcat again.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2923
diff changeset
426
f14d4c668ec5 Bugfix: #698 Fix-Analysis is working in Tomcat again.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2923
diff changeset
427 daterange.put("from", f);
f14d4c668ec5 Bugfix: #698 Fix-Analysis is working in Tomcat again.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2923
diff changeset
428 daterange.put("to", t);
f14d4c668ec5 Bugfix: #698 Fix-Analysis is working in Tomcat again.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2923
diff changeset
429 and.put("date-range", daterange);
2517
8f528f5ae137 Added filter object class and scrollable chart to helper panel.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2505
diff changeset
430 }
8f528f5ae137 Added filter object class and scrollable chart to helper panel.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2505
diff changeset
431
9072
02739b8c010d bundu progress (Klon FixationAnalysis +Vollmer funktioniert; Verzweigung neue Berechnungsart Bezugswst)
gernotbelger
parents: 8856
diff changeset
432 final int fromClass = filter.getFromClass();
02739b8c010d bundu progress (Klon FixationAnalysis +Vollmer funktioniert; Verzweigung neue Berechnungsart Bezugswst)
gernotbelger
parents: 8856
diff changeset
433 final int toClass = filter.getToClass();
2962
f14d4c668ec5 Bugfix: #698 Fix-Analysis is working in Tomcat again.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2923
diff changeset
434
f14d4c668ec5 Bugfix: #698 Fix-Analysis is working in Tomcat again.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2923
diff changeset
435 if (fromClass >= 0 && toClass >= 0 && fromClass <= toClass) {
9072
02739b8c010d bundu progress (Klon FixationAnalysis +Vollmer funktioniert; Verzweigung neue Berechnungsart Bezugswst)
gernotbelger
parents: 8856
diff changeset
436 final JSONObject classrange = new JSONObject();
02739b8c010d bundu progress (Klon FixationAnalysis +Vollmer funktioniert; Verzweigung neue Berechnungsart Bezugswst)
gernotbelger
parents: 8856
diff changeset
437 final JSONNumber f = new JSONNumber(fromClass);
02739b8c010d bundu progress (Klon FixationAnalysis +Vollmer funktioniert; Verzweigung neue Berechnungsart Bezugswst)
gernotbelger
parents: 8856
diff changeset
438 final JSONNumber t = new JSONNumber(toClass);
2962
f14d4c668ec5 Bugfix: #698 Fix-Analysis is working in Tomcat again.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2923
diff changeset
439
f14d4c668ec5 Bugfix: #698 Fix-Analysis is working in Tomcat again.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2923
diff changeset
440 classrange.put("from", f);
f14d4c668ec5 Bugfix: #698 Fix-Analysis is working in Tomcat again.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2923
diff changeset
441 classrange.put("to", t);
f14d4c668ec5 Bugfix: #698 Fix-Analysis is working in Tomcat again.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2923
diff changeset
442 and.put("sector-range", classrange);
f14d4c668ec5 Bugfix: #698 Fix-Analysis is working in Tomcat again.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2923
diff changeset
443 }
f14d4c668ec5 Bugfix: #698 Fix-Analysis is working in Tomcat again.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2923
diff changeset
444
9072
02739b8c010d bundu progress (Klon FixationAnalysis +Vollmer funktioniert; Verzweigung neue Berechnungsart Bezugswst)
gernotbelger
parents: 8856
diff changeset
445 final int[] events = filter.getEvents();
2962
f14d4c668ec5 Bugfix: #698 Fix-Analysis is working in Tomcat again.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2923
diff changeset
446
f14d4c668ec5 Bugfix: #698 Fix-Analysis is working in Tomcat again.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2923
diff changeset
447 if (events.length > 0) {
9072
02739b8c010d bundu progress (Klon FixationAnalysis +Vollmer funktioniert; Verzweigung neue Berechnungsart Bezugswst)
gernotbelger
parents: 8856
diff changeset
448 final StringBuilder cids = new StringBuilder();
2962
f14d4c668ec5 Bugfix: #698 Fix-Analysis is working in Tomcat again.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2923
diff changeset
449
f14d4c668ec5 Bugfix: #698 Fix-Analysis is working in Tomcat again.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2923
diff changeset
450 for (int i = 0; i < events.length; i++) {
9072
02739b8c010d bundu progress (Klon FixationAnalysis +Vollmer funktioniert; Verzweigung neue Berechnungsart Bezugswst)
gernotbelger
parents: 8856
diff changeset
451 if (i > 0)
02739b8c010d bundu progress (Klon FixationAnalysis +Vollmer funktioniert; Verzweigung neue Berechnungsart Bezugswst)
gernotbelger
parents: 8856
diff changeset
452 cids.append(' ');
2962
f14d4c668ec5 Bugfix: #698 Fix-Analysis is working in Tomcat again.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2923
diff changeset
453 cids.append(events[i]);
2884
88bca9f735c0 Implemented filter for fix analysis helper widgets.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2539
diff changeset
454 }
9072
02739b8c010d bundu progress (Klon FixationAnalysis +Vollmer funktioniert; Verzweigung neue Berechnungsart Bezugswst)
gernotbelger
parents: 8856
diff changeset
455 final JSONObject columns = new JSONObject();
2962
f14d4c668ec5 Bugfix: #698 Fix-Analysis is working in Tomcat again.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2923
diff changeset
456 columns.put("cids", new JSONString(cids.toString()));
f14d4c668ec5 Bugfix: #698 Fix-Analysis is working in Tomcat again.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2923
diff changeset
457 and.put("columns", columns);
2517
8f528f5ae137 Added filter object class and scrollable chart to helper panel.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2505
diff changeset
458 }
2962
f14d4c668ec5 Bugfix: #698 Fix-Analysis is working in Tomcat again.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2923
diff changeset
459 if (and.size() > 0) {
9072
02739b8c010d bundu progress (Klon FixationAnalysis +Vollmer funktioniert; Verzweigung neue Berechnungsart Bezugswst)
gernotbelger
parents: 8856
diff changeset
460 final JSONObject jFilter = new JSONObject();
2962
f14d4c668ec5 Bugfix: #698 Fix-Analysis is working in Tomcat again.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2923
diff changeset
461 jFilter.put("and", and);
f14d4c668ec5 Bugfix: #698 Fix-Analysis is working in Tomcat again.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2923
diff changeset
462 root.put("filter", jFilter);
f14d4c668ec5 Bugfix: #698 Fix-Analysis is working in Tomcat again.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2923
diff changeset
463 }
f14d4c668ec5 Bugfix: #698 Fix-Analysis is working in Tomcat again.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2923
diff changeset
464 return root;
2517
8f528f5ae137 Added filter object class and scrollable chart to helper panel.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2505
diff changeset
465 }
9256
6c24c857ccf9 fixation refactoring and inputItem behaviour to interfaces
gernotbelger
parents: 9255
diff changeset
466 }

http://dive4elements.wald.intevation.org