# HG changeset patch
# User gernotbelger
# Date 1526485427 -7200
# Node ID 02739b8c010da87bc054d47a94ef6606d6ec463a
# Parent a561b882436d4cb8054ca36ec113c54f4229c2f3
bundu progress (Klon FixationAnalysis +Vollmer funktioniert; Verzweigung neue Berechnungsart Bezugswst)
diff -r a561b882436d -r 02739b8c010d artifacts/doc/conf/artifacts/bundu.xml
--- a/artifacts/doc/conf/artifacts/bundu.xml Wed May 16 11:08:56 2018 +0200
+++ b/artifacts/doc/conf/artifacts/bundu.xml Wed May 16 17:43:47 2018 +0200
@@ -1,337 +1,331 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff -r a561b882436d -r 02739b8c010d artifacts/doc/conf/artifacts/uinfo.xml
--- a/artifacts/doc/conf/artifacts/uinfo.xml Wed May 16 11:08:56 2018 +0200
+++ b/artifacts/doc/conf/artifacts/uinfo.xml Wed May 16 17:43:47 2018 +0200
@@ -75,7 +75,7 @@
-
+
diff -r a561b882436d -r 02739b8c010d artifacts/src/main/java/org/dive4elements/river/artifacts/bundu/BUNDUArtifact.java
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/bundu/BUNDUArtifact.java Wed May 16 11:08:56 2018 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/bundu/BUNDUArtifact.java Wed May 16 17:43:47 2018 +0200
@@ -10,7 +10,9 @@
package org.dive4elements.river.artifacts.bundu;
import org.apache.commons.lang.StringUtils;
+import org.dive4elements.artifactdatabase.state.Facet;
import org.dive4elements.artifactdatabase.state.FacetActivity;
+import org.dive4elements.artifacts.Artifact;
import org.dive4elements.river.artifacts.D4EArtifact;
/**
@@ -41,7 +43,12 @@
// Active/deactivate facets.
// BEWARE: we can only define one activity for "sinfo", so we use the artifact
// as place for this
- FacetActivity.Registry.getInstance().register(ARTIFACT_NAME, (artifact, facet, output) -> null);
+ FacetActivity.Registry.getInstance().register(ARTIFACT_NAME, new FacetActivity() {
+ @Override
+ public Boolean isInitialActive(final Artifact artifact, final Facet facet, final String output) {
+ return null;
+ }
+ });
}
/**
diff -r a561b882436d -r 02739b8c010d artifacts/src/main/java/org/dive4elements/river/artifacts/bundu/BunduCalcMode.java
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/bundu/BunduCalcMode.java Wed May 16 11:08:56 2018 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/bundu/BunduCalcMode.java Wed May 16 17:43:47 2018 +0200
@@ -11,5 +11,6 @@
package org.dive4elements.river.artifacts.bundu;
public enum BunduCalcMode {
- bundu_bezugswst
+
+ bundu_analysis, bundu_vollmer, bundu_bezugswst
}
\ No newline at end of file
diff -r a561b882436d -r 02739b8c010d artifacts/src/main/java/org/dive4elements/river/artifacts/bundu/CalculationSelectBundu.java
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/bundu/CalculationSelectBundu.java Wed May 16 17:43:47 2018 +0200
@@ -0,0 +1,61 @@
+/* Copyright (C) 2017 by Bundesanstalt für Gewässerkunde
+ * Software engineering by
+ * Björnsen Beratende Ingenieure GmbH
+ * Dr. Schumacher Ingenieurbüro für Wasser und Umwelt
+ *
+ * This file is Free Software under the GNU AGPL (>=v3)
+ * and comes with ABSOLUTELY NO WARRANTY! Check out the
+ * documentation coming with Dive4Elements River for details.
+ */
+package org.dive4elements.river.artifacts.bundu;
+
+import java.util.ArrayList;
+import java.util.Collection;
+
+import org.apache.log4j.Logger;
+import org.dive4elements.artifacts.Artifact;
+import org.dive4elements.artifacts.CallContext;
+import org.dive4elements.artifacts.CallMeta;
+import org.dive4elements.artifacts.common.utils.XMLUtils;
+import org.dive4elements.river.artifacts.resources.Resources;
+import org.dive4elements.river.artifacts.states.DefaultState;
+import org.w3c.dom.Element;
+
+/**
+ * @author Gernot Belger
+ */
+public class CalculationSelectBundu extends DefaultState {
+
+ private static final long serialVersionUID = 1L;
+
+ /** The log that is used in this class. */
+ private static Logger log = Logger.getLogger(CalculationSelectBundu.class);
+
+ @Override
+ protected Element[] createItems(final XMLUtils.ElementCreator cr, final Artifact artifact, final String name, final CallContext context) {
+ final CallMeta meta = context.getMeta();
+
+ final Collection calcs = new ArrayList<>(BunduCalcMode.values().length);
+
+ for (final BunduCalcMode calcMode : BunduCalcMode.values()) {
+ final String calc = calcMode.name();
+
+ final String label = Resources.getMsg(meta, calc, calc);
+
+ final Element element = createItem(cr, new String[] { label, calc });
+ calcs.add(element);
+ }
+
+ return calcs.toArray(new Element[calcs.size()]);
+ }
+
+ @Override
+ public boolean validate(final Artifact artifact) throws IllegalArgumentException {
+ log.debug("CalculationSelect.validate");
+
+ final BUNDUArtifact m_artifact = (BUNDUArtifact) artifact;
+ /* throws an exception if calculation mode is invalid */
+ m_artifact.getCalculationMode();
+ return true;
+ }
+}
\ No newline at end of file
diff -r a561b882436d -r 02739b8c010d artifacts/src/main/java/org/dive4elements/river/artifacts/bundu/bezugswst/BezugswstState.java
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/bundu/bezugswst/BezugswstState.java Wed May 16 17:43:47 2018 +0200
@@ -0,0 +1,32 @@
+/** Copyright (C) 2017 by Bundesanstalt für Gewässerkunde
+ * Software engineering by
+ * Björnsen Beratende Ingenieure GmbH
+ * Dr. Schumacher Ingenieurbüro für Wasser und Umwelt
+ *
+ * This file is Free Software under the GNU AGPL (>=v3)
+ * and comes with ABSOLUTELY NO WARRANTY! Check out the
+ * documentation coming with Dive4Elements River for details.
+ */
+package org.dive4elements.river.artifacts.bundu.bezugswst;
+
+import org.dive4elements.river.artifacts.states.DefaultState;
+
+/**
+ * @author Domenico Nardi Tironi
+ */
+public class BezugswstState extends DefaultState {
+
+ /// ** The log that is used in this state. */
+ // private static Logger log = Logger.getLogger(FlowDepthState.class);
+
+ private static final long serialVersionUID = 1L;
+
+ /**
+ * From this state can only be continued trivially.
+ */
+ @Override
+ protected String getUIProvider() {
+ return "continue";
+ }
+
+}
\ No newline at end of file
diff -r a561b882436d -r 02739b8c010d artifacts/src/main/resources/messages.properties
--- a/artifacts/src/main/resources/messages.properties Wed May 16 11:08:56 2018 +0200
+++ b/artifacts/src/main/resources/messages.properties Wed May 16 17:43:47 2018 +0200
@@ -1081,4 +1081,38 @@
predefineddepthevol.total.title = Gesamt: {0}
predefineddepthevol.peryear.title = J\u00e4hrlich: {0}
-bundu_bezugswst = Bezugswasserst\u00e4nde
\ No newline at end of file
+bundu_bezugswst = Bezugswasserst\u00e4nde
+bundu_analysis = Fixinganalysis
+bundu_vollmer = relocated Waterlevel Calculation
+
+state.bundu.river = River
+state.bundu.calculation.mode = Calculation Mode
+state.bundu.location = Distance
+state.bundu.period = Period
+state.bundu.gaugerange = Gaugerange
+state.bundu.eventselect = Event selection
+state.bundu.analysis.referenceperiod = Reference period
+state.bundu.analysis.analysisperiods = Analysis period
+state.bundu.analysis.function = Function
+state.bundu.analysis.preprocessing = Outliers
+state.bundu.preprocess=use outlier test
+state.bundu.vollmer.function=Function
+state.bundu.vollmer.preprocessing = Outliers
+state.bundu.vollmer.qs = Input for W/Q data
+state.bundu.yearselect = Bezugsjahr
+
+help.state.bundu.river=${help.url}/OnlineHilfe/bunduierungsanalyse#help.state.bundu.river
+help.state.bundu.calculation.mode=${help.url}/OnlineHilfe/bunduierungsanalyse#help.state.bundu.calculation.mode
+help.state.bundu.location=${help.url}/OnlineHilfe/bunduierungsanalyse#help.state.bundu.location
+help.state.bundu.period=${help.url}/OnlineHilfe/bunduierungsanalyse#help.state.bundu.period
+help.state.bundu.gaugerange=${help.url}/OnlineHilfe/bunduierungsanalyse#help.state.bundu.gaugerange
+help.state.bundu.eventselect=${help.url}/OnlineHilfe/bunduierungsanalyse#help.state.bundu.eventselect
+help.state.bundu.analysis.referenceperiod=${help.url}/OnlineHilfe/bunduierungsanalyse#help.state.bundu.analysis.referenceperiod
+help.state.bundu.analysis.analysisperiods=${help.url}/OnlineHilfe/bunduierungsanalyse#help.state.bundu.analysis.analysisperiods
+help.state.bundu.analysis.function=${help.url}/OnlineHilfe/bunduierungsanalyse#help.state.bundu.analysis.function
+help.state.bundu.analysis.preprocessing=${help.url}/OnlineHilfe/bunduierungsanalyse#help.state.bundu.analysis.preprocessing
+help.state.bundu.analysis.compute=${help.url}/OnlineHilfe/bunduierungsanalyse#help.state.bundu.analysis.compute
+help.state.bundu.vollmer.function=${help.url}/OnlineHilfe/bunduierungsanalyse#help.state.bundu.vollmer.function
+help.state.bundu.vollmer.preprocessing=${help.url}/OnlineHilfe/bunduierungsanalyse#help.state.bundu.vollmer.preprocessing
+help.state.bundu.vollmer.qs=${help.url}/OnlineHilfe/bunduierungsanalyse#help.state.bundu.vollmer.qs
+help.state.bundu.vollmer.compute=${help.url}/OnlineHilfe/bunduierungsanalyse#help.state.bundu.vollmer.compute
\ No newline at end of file
diff -r a561b882436d -r 02739b8c010d artifacts/src/main/resources/messages_de.properties
--- a/artifacts/src/main/resources/messages_de.properties Wed May 16 11:08:56 2018 +0200
+++ b/artifacts/src/main/resources/messages_de.properties Wed May 16 17:43:47 2018 +0200
@@ -1080,5 +1080,39 @@
predefineddepthevol.total.title = Gesamt: {0}
predefineddepthevol.peryear.title = J\u00e4hrlich: {0}
+
+bundu_bezugswst = Bezugswasserst\u00e4nde
+bundu_analysis = Fixierungsanalyse
+bundu_vollmer = ausgelagerte Wasserspiegellage
-bundu_bezugswst = Bezugswasserst\u00e4nde
\ No newline at end of file
+state.bundu.river = Gew\u00e4sser
+state.bundu.calculation.mode = Berechnungsart
+state.bundu.location = Strecke
+state.bundu.period = Zeitraum
+state.bundu.gaugerange = Abflussklassen
+state.bundu.eventselect = Ereignisauswahl
+state.bundu.analysis.referenceperiod = Bezugszeitraum
+state.bundu.analysis.analysisperiods = Analysezeitr\u00e4ume
+state.bundu.analysis.function = Ausgleichsfunktion
+state.bundu.analysis.preprocessing = Ausrei\u00dfer
+state.bundu.preprocess=Ausrei\u00dfertest durchf\u00fchren
+state.bundu.vollmer.function= Ausgleichsfunktion
+state.bundu.vollmer.preprocessing = Ausrei\u00dfer
+state.bundu.vollmer.qs = Eingabe f\u00fcr W/Q Daten
+state.bundu.yearselect = Bezugsjahr
+
+help.state.bundu.river=${help.url}/OnlineHilfe/bunduierungsanalyse#help.state.bundu.river
+help.state.bundu.calculation.mode=${help.url}/OnlineHilfe/bunduierungsanalyse#help.state.bundu.calculation.mode
+help.state.bundu.location=${help.url}/OnlineHilfe/bunduierungsanalyse#help.state.bundu.location
+help.state.bundu.period=${help.url}/OnlineHilfe/bunduierungsanalyse#help.state.bundu.period
+help.state.bundu.gaugerange=${help.url}/OnlineHilfe/bunduierungsanalyse#help.state.bundu.gaugerange
+help.state.bundu.eventselect=${help.url}/OnlineHilfe/bunduierungsanalyse#help.state.bundu.eventselect
+help.state.bundu.analysis.referenceperiod=${help.url}/OnlineHilfe/bunduierungsanalyse#help.state.bundu.analysis.referenceperiod
+help.state.bundu.analysis.analysisperiods=${help.url}/OnlineHilfe/bunduierungsanalyse#help.state.bundu.analysis.analysisperiods
+help.state.bundu.analysis.function=${help.url}/OnlineHilfe/bunduierungsanalyse#help.state.bundu.analysis.function
+help.state.bundu.analysis.preprocessing=${help.url}/OnlineHilfe/bunduierungsanalyse#help.state.bundu.analysis.preprocessing
+help.state.bundu.analysis.compute=${help.url}/OnlineHilfe/bunduierungsanalyse#help.state.bundu.analysis.compute
+help.state.bundu.vollmer.function=${help.url}/OnlineHilfe/bunduierungsanalyse#help.state.bundu.vollmer.function
+help.state.bundu.vollmer.preprocessing=${help.url}/OnlineHilfe/bunduierungsanalyse#help.state.bundu.vollmer.preprocessing
+help.state.bundu.vollmer.qs=${help.url}/OnlineHilfe/bunduierungsanalyse#help.state.bundu.vollmer.qs
+help.state.bundu.vollmer.compute=${help.url}/OnlineHilfe/bunduierungsanalyse#help.state.bundu.vollmer.compute
\ No newline at end of file
diff -r a561b882436d -r 02739b8c010d gwt-client/src/main/java/org/dive4elements/river/client/client/ui/ParameterList.java
--- a/gwt-client/src/main/java/org/dive4elements/river/client/client/ui/ParameterList.java Wed May 16 11:08:56 2018 +0200
+++ b/gwt-client/src/main/java/org/dive4elements/river/client/client/ui/ParameterList.java Wed May 16 17:43:47 2018 +0200
@@ -42,9 +42,9 @@
import org.dive4elements.river.client.client.ui.stationinfo.GaugePanel;
import org.dive4elements.river.client.client.ui.stationinfo.InfoPanel;
import org.dive4elements.river.client.client.ui.stationinfo.MeasurementStationPanel;
+import org.dive4elements.river.client.shared.model.AbstractFixBunduArtifact;
import org.dive4elements.river.client.shared.model.Artifact;
import org.dive4elements.river.client.shared.model.ArtifactDescription;
-import org.dive4elements.river.client.shared.model.BUNDUArtifact;
import org.dive4elements.river.client.shared.model.Collection;
import org.dive4elements.river.client.shared.model.Data;
import org.dive4elements.river.client.shared.model.DataItem;
@@ -52,7 +52,6 @@
import org.dive4elements.river.client.shared.model.DefaultData;
import org.dive4elements.river.client.shared.model.DefaultDataItem;
import org.dive4elements.river.client.shared.model.ExportMode;
-import org.dive4elements.river.client.shared.model.FixAnalysisArtifact;
import org.dive4elements.river.client.shared.model.MINFOArtifact;
import org.dive4elements.river.client.shared.model.OutputMode;
import org.dive4elements.river.client.shared.model.ReportMode;
@@ -707,8 +706,7 @@
// FIXME: we got a whole artifact framework to separate ui and backend stuff, but in the end.... we have switches over
// specific datatypes here...
- if (art instanceof WINFOArtifact || art instanceof SINFOArtifact || art instanceof UINFOArtifact || art instanceof FixAnalysisArtifact
- || art instanceof BUNDUArtifact) {
+ if (art instanceof WINFOArtifact || art instanceof SINFOArtifact || art instanceof UINFOArtifact || art instanceof AbstractFixBunduArtifact) {
createGaugePanel();
renderInfo(desc.getRiver(), desc.getOldData());
} else if (art instanceof MINFOArtifact) {
diff -r a561b882436d -r 02739b8c010d gwt-client/src/main/java/org/dive4elements/river/client/client/ui/chart/NaviChartOutputTab.java
--- a/gwt-client/src/main/java/org/dive4elements/river/client/client/ui/chart/NaviChartOutputTab.java Wed May 16 11:08:56 2018 +0200
+++ b/gwt-client/src/main/java/org/dive4elements/river/client/client/ui/chart/NaviChartOutputTab.java Wed May 16 17:43:47 2018 +0200
@@ -8,203 +8,183 @@
package org.dive4elements.river.client.client.ui.chart;
+import java.util.Date;
+import java.util.HashMap;
import java.util.Map;
-import java.util.HashMap;
+
+import org.dive4elements.river.client.client.Config;
+import org.dive4elements.river.client.client.ui.CollectionView;
+import org.dive4elements.river.client.shared.model.AbstractFixBunduArtifact;
+import org.dive4elements.river.client.shared.model.Artifact;
+import org.dive4elements.river.client.shared.model.Collection;
+import org.dive4elements.river.client.shared.model.FixFilter;
+import org.dive4elements.river.client.shared.model.OutputMode;
import com.google.gwt.core.client.GWT;
import com.google.gwt.i18n.client.NumberFormat;
-
import com.smartgwt.client.types.Alignment;
-
import com.smartgwt.client.widgets.Button;
import com.smartgwt.client.widgets.Canvas;
-
import com.smartgwt.client.widgets.events.ClickEvent;
import com.smartgwt.client.widgets.events.ClickHandler;
-
import com.smartgwt.client.widgets.form.DynamicForm;
-
import com.smartgwt.client.widgets.form.fields.TextItem;
-
import com.smartgwt.client.widgets.form.fields.events.KeyPressEvent;
import com.smartgwt.client.widgets.form.fields.events.KeyPressHandler;
-
import com.smartgwt.client.widgets.layout.HLayout;
import com.smartgwt.client.widgets.layout.VLayout;
-
import com.smartgwt.client.widgets.tab.events.TabSelectedEvent;
import com.smartgwt.client.widgets.tab.events.TabSelectedHandler;
-import org.dive4elements.river.client.client.Config;
-
-import org.dive4elements.river.client.client.ui.CollectionView;
-
-import org.dive4elements.river.client.shared.model.Artifact;
-import org.dive4elements.river.client.shared.model.Collection;
-import org.dive4elements.river.client.shared.model.FixAnalysisArtifact;
-import org.dive4elements.river.client.shared.model.FixFilter;
-import org.dive4elements.river.client.shared.model.OutputMode;
-
-import java.util.Date;
-
-
/**
* Tab representing and showing one Chart-output with a "navi" thing.
*
* @author Ingo Weinzierl
*/
-public class NaviChartOutputTab
-extends ChartOutputTab
-implements TabSelectedHandler
-{
+public class NaviChartOutputTab extends ChartOutputTab implements TabSelectedHandler {
protected TextItem currentkm;
- public NaviChartOutputTab(
- String title,
- Collection collection,
- OutputMode mode,
- CollectionView collectionView
- ){
+ public NaviChartOutputTab(final String title, final Collection collection, final OutputMode mode, final CollectionView collectionView) {
super(title, collection, mode, collectionView);
- right.removeChild(chart);
- right.addChild(createNaviChart());
+ this.right.removeChild(this.chart);
+ this.right.addChild(createNaviChart());
collectionView.registerTabHandler(this);
}
-
protected Canvas createNaviChart() {
- final Artifact art = collectionView.getArtifact();
- VLayout root = new VLayout();
+ final Artifact art = this.collectionView.getArtifact();
+ final VLayout root = new VLayout();
root.setWidth100();
root.setHeight100();
- HLayout layout = new HLayout();
+ final HLayout layout = new HLayout();
layout.setAlign(Alignment.CENTER);
- DynamicForm form = new DynamicForm();
- Button lower = new Button("<<");
+ final DynamicForm form = new DynamicForm();
+ final Button lower = new Button("<<");
lower.setWidth(30);
- Button upper = new Button(">>");
+ final Button upper = new Button(">>");
upper.setWidth(30);
- currentkm = new TextItem();
- currentkm.setWidth(60);
- currentkm.setShowTitle(false);
+ this.currentkm = new TextItem();
+ this.currentkm.setWidth(60);
+ this.currentkm.setShowTitle(false);
- form.setFields(currentkm);
+ form.setFields(this.currentkm);
form.setWidth(60);
double fromKm;
double toKm;
- if (art instanceof FixAnalysisArtifact) {
- FixAnalysisArtifact fix = (FixAnalysisArtifact) art;
- FixFilter fixFilter = fix.getFilter();
- String s = fix.getArtifactDescription().getDataValueAsString(
- "ld_step");
+ if (art instanceof AbstractFixBunduArtifact) {
+ final AbstractFixBunduArtifact fix = (AbstractFixBunduArtifact) art;
+ final FixFilter fixFilter = fix.getFilter();
+ final String s = fix.getArtifactDescription().getDataValueAsString("ld_step");
try {
- double ds = Double.parseDouble(s);
- collectionView.setSteps(ds);
+ final double ds = Double.parseDouble(s);
+ this.collectionView.setSteps(ds);
}
- catch(NumberFormatException nfe) {
- collectionView.setSteps(100d);
+ catch (final NumberFormatException nfe) {
+ this.collectionView.setSteps(100d);
}
fromKm = fixFilter.getFromKm();
- toKm = fixFilter.getToKm();
- }
- else {
+ toKm = fixFilter.getToKm();
+ } else {
// Probably WINFOArtifact kind of artifact.
- String ld_step =
- art.getArtifactDescription().getDataValueAsString(
- "ld_step");
+ final String ld_step = art.getArtifactDescription().getDataValueAsString("ld_step");
try {
- collectionView.setSteps(Double.valueOf(ld_step));
+ this.collectionView.setSteps(Double.valueOf(ld_step));
}
- catch (Exception e) {
+ catch (final Exception e) {
GWT.log("No ld_steps data or not parsable.");
return root;
}
- double[] kmRange = art.getArtifactDescription().getKMRange();
+ final double[] kmRange = art.getArtifactDescription().getKMRange();
if (kmRange == null || kmRange.length == 2) {
fromKm = kmRange[0];
- toKm = kmRange[1];
- }
- else {
+ toKm = kmRange[1];
+ } else {
GWT.log("No KM range in description found.");
return root;
}
}
- collectionView.setMinKm(fromKm);
- collectionView.setMaxKm(toKm);
+ this.collectionView.setMinKm(fromKm);
+ this.collectionView.setMaxKm(toKm);
final NumberFormat nf = NumberFormat.getDecimalFormat();
// Always jump to the from km when initialized.
try {
- double d = Double.valueOf(fromKm);
- currentkm.setValue(nf.format(d));
- } catch (NumberFormatException e) {
- currentkm.setValue(fromKm);
+ final double d = Double.valueOf(fromKm);
+ this.currentkm.setValue(nf.format(d));
}
- collectionView.setCurrentKm(fromKm);
+ catch (final NumberFormatException e) {
+ this.currentkm.setValue(fromKm);
+ }
+ this.collectionView.setCurrentKm(fromKm);
lower.addClickHandler(new ClickHandler() {
- public void onClick(ClickEvent ce) {
- tbarPanel.deselectControls();
+ @Override
+ public void onClick(final ClickEvent ce) {
+ NaviChartOutputTab.this.tbarPanel.deselectControls();
updateChartDown();
try {
- double d = Double.valueOf(collectionView.getCurrentKm());
- currentkm.setValue(nf.format(d));
- tbarPanel.onZoom(null);
- } catch (NumberFormatException e) {
- currentkm.setValue(collectionView.getCurrentKm());
+ final double d = Double.valueOf(NaviChartOutputTab.this.collectionView.getCurrentKm());
+ NaviChartOutputTab.this.currentkm.setValue(nf.format(d));
+ NaviChartOutputTab.this.tbarPanel.onZoom(null);
+ }
+ catch (final NumberFormatException e) {
+ NaviChartOutputTab.this.currentkm.setValue(NaviChartOutputTab.this.collectionView.getCurrentKm());
}
}
});
upper.addClickHandler(new ClickHandler() {
- public void onClick(ClickEvent ce) {
- tbarPanel.deselectControls();
+ @Override
+ public void onClick(final ClickEvent ce) {
+ NaviChartOutputTab.this.tbarPanel.deselectControls();
updateChartUp();
try {
- double d = Double.valueOf(collectionView.getCurrentKm());
- currentkm.setValue(nf.format(d));
- tbarPanel.onZoom(null);
- } catch (NumberFormatException e) {
- currentkm.setValue(collectionView.getCurrentKm());
+ final double d = Double.valueOf(NaviChartOutputTab.this.collectionView.getCurrentKm());
+ NaviChartOutputTab.this.currentkm.setValue(nf.format(d));
+ NaviChartOutputTab.this.tbarPanel.onZoom(null);
+ }
+ catch (final NumberFormatException e) {
+ NaviChartOutputTab.this.currentkm.setValue(NaviChartOutputTab.this.collectionView.getCurrentKm());
}
}
});
- currentkm.addKeyPressHandler(new KeyPressHandler() {
- public void onKeyPress(KeyPressEvent kpe) {
+ this.currentkm.addKeyPressHandler(new KeyPressHandler() {
+ @Override
+ public void onKeyPress(final KeyPressEvent kpe) {
if (!kpe.getKeyName().equals("Enter")) {
return;
}
- if(kpe.getItem().getValue() != null) {
- tbarPanel.deselectControls();
+ if (kpe.getItem().getValue() != null) {
+ NaviChartOutputTab.this.tbarPanel.deselectControls();
try {
- String s = kpe.getItem().getValue().toString();
+ final String s = kpe.getItem().getValue().toString();
double d;
try {
d = nf.parse(s);
- currentkm.setValue(nf.format(d));
- } catch (NumberFormatException e) {
+ NaviChartOutputTab.this.currentkm.setValue(nf.format(d));
+ }
+ catch (final NumberFormatException e) {
d = -1d;
}
- if (d <= collectionView.getMaxKm() &&
- d >= collectionView.getMinKm()) {
- collectionView.setCurrentKm(d);
- tbarPanel.updateLinks();
- tbarPanel.onZoom(null);
- if (right != null) {
+ if (d <= NaviChartOutputTab.this.collectionView.getMaxKm() && d >= NaviChartOutputTab.this.collectionView.getMinKm()) {
+ NaviChartOutputTab.this.collectionView.setCurrentKm(d);
+ NaviChartOutputTab.this.tbarPanel.updateLinks();
+ NaviChartOutputTab.this.tbarPanel.onZoom(null);
+ if (NaviChartOutputTab.this.right != null) {
updateChartPanel();
updateChartInfo();
}
}
}
- catch(NumberFormatException nfe) {
+ catch (final NumberFormatException nfe) {
// Do nothing.
}
}
@@ -214,24 +194,23 @@
layout.addMember(form);
layout.addMember(upper);
- root.addMember(chart);
+ root.addMember(this.chart);
root.addMember(layout);
return root;
}
-
/**
* Callback when km-up-button is clicked.
* Increases collectionViews KM and refreshes view.
*/
protected void updateChartUp() {
- double currentKm = collectionView.getCurrentKm();
- if (currentKm < collectionView.getMaxKm()) {
+ final double currentKm = this.collectionView.getCurrentKm();
+ if (currentKm < this.collectionView.getMaxKm()) {
// Why this math?
double newVal = currentKm * 100;
- newVal += (collectionView.getSteps() / 10);
- collectionView.setCurrentKm((double)Math.round(newVal) / 100);
- tbarPanel.updateLinks();
+ newVal += (this.collectionView.getSteps() / 10);
+ this.collectionView.setCurrentKm((double) Math.round(newVal) / 100);
+ this.tbarPanel.updateLinks();
updateChartPanel();
updateChartInfo();
}
@@ -242,53 +221,57 @@
* Decreases collectionViews KM and refreshes view.
*/
protected void updateChartDown() {
- double currentKm = collectionView.getCurrentKm();
- if (currentKm > collectionView.getMinKm()) {
+ final double currentKm = this.collectionView.getCurrentKm();
+ if (currentKm > this.collectionView.getMinKm()) {
// Why this math?
double newVal = currentKm * 100;
- newVal -= (collectionView.getSteps() / 10);
- collectionView.setCurrentKm((double)Math.round(newVal) / 100);
- tbarPanel.updateLinks();
+ newVal -= (this.collectionView.getSteps() / 10);
+ this.collectionView.setCurrentKm((double) Math.round(newVal) / 100);
+ this.tbarPanel.updateLinks();
updateChartPanel();
updateChartInfo();
}
}
- /**
+ /**
* Returns the existing chart panel.
*
* @return the existing chart panel.
*/
@Override
public Canvas getChartPanel() {
- return chart;
+ return this.chart;
}
/**
* Builds the URL that points to the chart image.
*
- * @param width The width of the requested chart.
- * @param height The height of the requested chart.
- * @param xr Optional x range (used for zooming).
- * @param yr Optional y range (used for zooming).
+ * @param width
+ * The width of the requested chart.
+ * @param height
+ * The height of the requested chart.
+ * @param xr
+ * Optional x range (used for zooming).
+ * @param yr
+ * Optional y range (used for zooming).
*
* @return the URL to the chart image.
*/
@Override
- protected String getImgUrl(int width, int height) {
- Config config = Config.getInstance();
+ protected String getImgUrl(final int width, final int height) {
+ final Config config = Config.getInstance();
String imgUrl = GWT.getModuleBaseURL();
imgUrl += "chart";
- imgUrl += "?uuid=" + collection.identifier();
- imgUrl += "&type=" + mode.getName();
+ imgUrl += "?uuid=" + this.collection.identifier();
+ imgUrl += "&type=" + this.mode.getName();
imgUrl += "&locale=" + config.getLocale();
imgUrl += "×tamp=" + new Date().getTime();
imgUrl += "&width=" + Integer.toString(width);
imgUrl += "&height=" + Integer.toString(height - 40);
- Number[] zoom = getZoomValues();
+ final Number[] zoom = getZoomValues();
if (zoom != null) {
if (zoom[0].intValue() != 0 || zoom[1].intValue() != 1) {
@@ -306,30 +289,27 @@
}
}
- if (collectionView.getArtifact() instanceof FixAnalysisArtifact) {
- if (collectionView.getCurrentKm() == -1) {
- FixAnalysisArtifact fix =
- (FixAnalysisArtifact) collectionView.getArtifact();
- collectionView.setCurrentKm(fix.getFilter().getFromKm());
+ if (this.collectionView.getArtifact() instanceof AbstractFixBunduArtifact) {
+ if (this.collectionView.getCurrentKm() == -1) {
+ final AbstractFixBunduArtifact fix = (AbstractFixBunduArtifact) this.collectionView.getArtifact();
+ this.collectionView.setCurrentKm(fix.getFilter().getFromKm());
}
+ } else if (this.collectionView.getCurrentKm() == -1) {
+ this.collectionView.setCurrentKm(this.collectionView.getArtifact().getArtifactDescription().getKMRange()[0]);
}
- else if (collectionView.getCurrentKm() == -1) {
- collectionView.setCurrentKm(
- collectionView.getArtifact().getArtifactDescription()
- .getKMRange()[0]);
- }
- if (collectionView.getCurrentKm() != -1) {
- imgUrl += "¤tKm=" + collectionView.getCurrentKm();
+ if (this.collectionView.getCurrentKm() != -1) {
+ imgUrl += "¤tKm=" + this.collectionView.getCurrentKm();
}
return imgUrl;
}
- public void onTabSelected(TabSelectedEvent tse) {
+ @Override
+ public void onTabSelected(final TabSelectedEvent tse) {
if (this.equals(tse.getTab())) {
updateChartPanel();
updateChartInfo();
- currentkm.setValue(collectionView.getCurrentKm());
+ this.currentkm.setValue(this.collectionView.getCurrentKm());
}
}
@@ -338,18 +318,20 @@
Map attr = new HashMap();
attr = super.getChartAttributes();
- attr.put("km", String.valueOf(collectionView.getCurrentKm()));
+ attr.put("km", String.valueOf(this.collectionView.getCurrentKm()));
return attr;
}
- /** In contrast to supers implementation, include the currently selected
- * km in the url. */
+ /**
+ * In contrast to supers implementation, include the currently selected
+ * km in the url.
+ */
@Override
- public String getExportUrl(int width, int height, String format) {
+ public String getExportUrl(final int width, final int height, final String format) {
String url = super.getExportUrl(width, height, format);
- if (collectionView.getCurrentKm() != -1) {
- url += "¤tKm=" + collectionView.getCurrentKm();
+ if (this.collectionView.getCurrentKm() != -1) {
+ url += "¤tKm=" + this.collectionView.getCurrentKm();
}
return url;
}
diff -r a561b882436d -r 02739b8c010d gwt-client/src/main/java/org/dive4elements/river/client/client/ui/fixation/FixationPanel.java
--- a/gwt-client/src/main/java/org/dive4elements/river/client/client/ui/fixation/FixationPanel.java Wed May 16 11:08:56 2018 +0200
+++ b/gwt-client/src/main/java/org/dive4elements/river/client/client/ui/fixation/FixationPanel.java Wed May 16 17:43:47 2018 +0200
@@ -8,6 +8,21 @@
package org.dive4elements.river.client.client.ui.fixation;
+import java.util.Date;
+import java.util.HashMap;
+
+import org.dive4elements.river.client.client.Config;
+import org.dive4elements.river.client.client.FLYSConstants;
+import org.dive4elements.river.client.client.services.FixingsOverviewService;
+import org.dive4elements.river.client.client.services.FixingsOverviewServiceAsync;
+import org.dive4elements.river.client.client.ui.AbstractUIProvider;
+import org.dive4elements.river.client.shared.MapUtils;
+import org.dive4elements.river.client.shared.model.AbstractFixBunduArtifact;
+import org.dive4elements.river.client.shared.model.Data;
+import org.dive4elements.river.client.shared.model.DataList;
+import org.dive4elements.river.client.shared.model.FixFilter;
+import org.dive4elements.river.client.shared.model.FixingsOverviewInfo;
+
import com.google.gwt.core.client.GWT;
import com.google.gwt.i18n.client.DateTimeFormat;
import com.google.gwt.i18n.client.NumberFormat;
@@ -15,7 +30,6 @@
import com.google.gwt.json.client.JSONObject;
import com.google.gwt.json.client.JSONString;
import com.google.gwt.user.client.rpc.AsyncCallback;
-
import com.smartgwt.client.types.Alignment;
import com.smartgwt.client.util.SC;
import com.smartgwt.client.widgets.Button;
@@ -35,42 +49,21 @@
import com.smartgwt.client.widgets.tab.Tab;
import com.smartgwt.client.widgets.tab.TabSet;
-import org.dive4elements.river.client.client.Config;
-import org.dive4elements.river.client.client.FLYSConstants;
-import org.dive4elements.river.client.client.services.FixingsOverviewService;
-import org.dive4elements.river.client.client.services.FixingsOverviewServiceAsync;
-import org.dive4elements.river.client.client.ui.AbstractUIProvider;
-import org.dive4elements.river.client.shared.MapUtils;
-import org.dive4elements.river.client.shared.model.Data;
-import org.dive4elements.river.client.shared.model.DataList;
-import org.dive4elements.river.client.shared.model.FixAnalysisArtifact;
-import org.dive4elements.river.client.shared.model.FixFilter;
-import org.dive4elements.river.client.shared.model.FixingsOverviewInfo;
-
-import java.util.Date;
-import java.util.HashMap;
-
-
/**
* This UIProvider creates helper panel for fixation analysis without input
* elements.
*
* @author Raimund Renkert
*/
-public abstract class FixationPanel
-extends AbstractUIProvider
-implements ResizedHandler
-{
+public abstract class FixationPanel extends AbstractUIProvider implements ResizedHandler {
private static final long serialVersionUID = -3667553404493415619L;
- protected static HashMap instances =
- new HashMap();
+ protected static HashMap instances = new HashMap();
/** The message class that provides i18n strings. */
protected FLYSConstants MESSAGES = GWT.create(FLYSConstants.class);
- protected FixingsOverviewServiceAsync overviewService =
- GWT.create(FixingsOverviewService.class);
+ protected FixingsOverviewServiceAsync overviewService = GWT.create(FixingsOverviewService.class);
protected String htmlOverview;
protected FixingsOverviewInfo fixInfo;
@@ -81,16 +74,13 @@
protected Img chartImg;
protected TextItem kmText;
- public static final DateTimeFormat DTF = DateTimeFormat.getFormat(
- "dd.MM.yyyy");
-
+ public static final DateTimeFormat DTF = DateTimeFormat.getFormat("dd.MM.yyyy");
public FixationPanel() {
- chartImg = new Img();
- htmlOverview = "";
+ this.chartImg = new Img();
+ this.htmlOverview = "";
}
-
/** Get the (master) artifact UUID. */
protected String getArtifactUuid() {
return this.artifact.getUuid();
@@ -105,14 +95,14 @@
}
@Override
- public Canvas create(DataList list) {
- VLayout layout = new VLayout();
+ public Canvas create(final DataList list) {
+ final VLayout layout = new VLayout();
- Canvas helper = createHelper();
+ final Canvas helper = createHelper();
this.helperContainer.addMember(helper);
- Canvas submit = getNextButton();
- Canvas widget = createWidget(list);
+ final Canvas submit = getNextButton();
+ final Canvas widget = createWidget(list);
layout.addMember(widget);
layout.addMember(submit);
@@ -120,147 +110,143 @@
}
@Override
- public Canvas createOld(DataList list) {
+ public Canvas createOld(final DataList list) {
return new DynamicForm();
}
protected Canvas createHelper() {
- Config config = Config.getInstance();
- String locale = config.getLocale ();
+ final Config config = Config.getInstance();
+ final String locale = config.getLocale();
- tabs = new TabSet();
- events = new Tab(MESSAGES.events());
- chart = new Tab(MESSAGES.kmchart());
+ this.tabs = new TabSet();
+ this.events = new Tab(this.MESSAGES.events());
+ this.chart = new Tab(this.MESSAGES.kmchart());
- chartContainer = new VLayout();
- Canvas scroll = createChartHelper();
+ this.chartContainer = new VLayout();
+ final Canvas scroll = createChartHelper();
- VLayout layout = new VLayout();
+ final VLayout layout = new VLayout();
layout.addResizedHandler(this);
- layout.addMember(chartContainer);
+ layout.addMember(this.chartContainer);
layout.addMember(scroll);
layout.setAlign(Alignment.CENTER);
- chart.setPane(layout);
+ this.chart.setPane(layout);
final HTMLPane eventPane = new HTMLPane();
- String river = artifact.getArtifactDescription().getRiver();
+ final String river = this.artifact.getArtifactDescription().getRiver();
createCallback();
- String callBack = "fixationCallback(this.checked, this.name)";
-
- if (this.artifact instanceof FixAnalysisArtifact == false)
- return chartContainer;
-
- FixAnalysisArtifact art = (FixAnalysisArtifact) this.artifact;
+ final String callBack = "fixationCallback(this.checked, this.name)";
- overviewService.generateOverview(
- locale,
- artifact.getUuid(),
- MapUtils.toJavaEncodedString(getOverviewFilter(art.getFilter())),
- renderCheckboxes(),
- callBack,
- new AsyncCallback() {
- @Override
- public void onFailure(Throwable caught) {
- GWT.log("Could not receive overview.");
- SC.warn(caught.getMessage());
- }
- @Override
- public void onSuccess(FixingsOverviewInfo info) {
- GWT.log("Successfully loaded overview.");
- fixInfo = info;
- htmlOverview = info.getHTML();
- FixAnalysisArtifact art = (FixAnalysisArtifact)artifact;
- FixFilter filter = art.getFilter();
- filter.setRiver(info.getRiver());
- if (filter.getCurrentKm() == -Double.MAX_VALUE ||
- filter.getCurrentKm() == -1d) {
- filter.setCurrentKm(info.getFrom());
- filter.setToKm(info.getTo());
+ if (this.artifact instanceof AbstractFixBunduArtifact == false)
+ return this.chartContainer;
+
+ final AbstractFixBunduArtifact art = (AbstractFixBunduArtifact) this.artifact;
+
+ this.overviewService.generateOverview(locale, this.artifact.getUuid(), MapUtils.toJavaEncodedString(getOverviewFilter(art.getFilter())),
+ renderCheckboxes(), callBack, new AsyncCallback() {
+ @Override
+ public void onFailure(final Throwable caught) {
+ GWT.log("Could not receive overview.");
+ SC.warn(caught.getMessage());
}
- if (kmText != null) {
- NumberFormat nf = NumberFormat.getDecimalFormat();
- try {
- double d = Double.valueOf(filter.getCurrentKm());
- kmText.setValue(nf.format(d));
- } catch (NumberFormatException e) {
- kmText.setValue(filter.getCurrentKm());
+
+ @Override
+ public void onSuccess(final FixingsOverviewInfo info) {
+ GWT.log("Successfully loaded overview.");
+ FixationPanel.this.fixInfo = info;
+ FixationPanel.this.htmlOverview = info.getHTML();
+ final AbstractFixBunduArtifact art = (AbstractFixBunduArtifact) FixationPanel.this.artifact;
+ final FixFilter filter = art.getFilter();
+ filter.setRiver(info.getRiver());
+ if (filter.getCurrentKm() == -Double.MAX_VALUE || filter.getCurrentKm() == -1d) {
+ filter.setCurrentKm(info.getFrom());
+ filter.setToKm(info.getTo());
}
+ if (FixationPanel.this.kmText != null) {
+ final NumberFormat nf = NumberFormat.getDecimalFormat();
+ try {
+ final double d = Double.valueOf(filter.getCurrentKm());
+ FixationPanel.this.kmText.setValue(nf.format(d));
+ }
+ catch (final NumberFormatException e) {
+ FixationPanel.this.kmText.setValue(filter.getCurrentKm());
+ }
+ }
+ eventPane.setContents(FixationPanel.this.htmlOverview);
+ updateChartTab(FixationPanel.this.fixInfo.getFrom());
+ FixationPanel.this.events.setPane(eventPane);
+ success();
}
- eventPane.setContents(htmlOverview);
- updateChartTab(fixInfo.getFrom());
- events.setPane(eventPane);
- success();
- }
- });
+ });
- tabs.addTab(events);
- tabs.addTab(chart);
+ this.tabs.addTab(this.events);
+ this.tabs.addTab(this.chart);
- return tabs;
+ return this.tabs;
}
-
protected Canvas createChartHelper() {
- DynamicForm form = new DynamicForm();
- Button lower = new Button("<<");
+ final DynamicForm form = new DynamicForm();
+ final Button lower = new Button("<<");
lower.setWidth(30);
- Button upper = new Button(">>");
+ final Button upper = new Button(">>");
upper.setWidth(30);
- kmText = new TextItem();
- kmText.setWidth(60);
- kmText.setShowTitle(false);
+ this.kmText = new TextItem();
+ this.kmText.setWidth(60);
+ this.kmText.setShowTitle(false);
-
- form.setFields(kmText);
+ form.setFields(this.kmText);
form.setWidth(60);
lower.addClickHandler(new ClickHandler() {
@Override
- public void onClick(ClickEvent ce) {
- FixFilter filter = updateChartTabLow();
- NumberFormat nf = NumberFormat.getDecimalFormat();
+ public void onClick(final ClickEvent ce) {
+ final FixFilter filter = updateChartTabLow();
+ final NumberFormat nf = NumberFormat.getDecimalFormat();
try {
- double d = Double.valueOf(filter.getCurrentKm());
- kmText.setValue(nf.format(d));
- } catch (NumberFormatException e) {
- kmText.setValue(filter.getCurrentKm());
+ final double d = Double.valueOf(filter.getCurrentKm());
+ FixationPanel.this.kmText.setValue(nf.format(d));
+ }
+ catch (final NumberFormatException e) {
+ FixationPanel.this.kmText.setValue(filter.getCurrentKm());
}
}
});
upper.addClickHandler(new ClickHandler() {
@Override
- public void onClick(ClickEvent ce) {
- FixFilter filter = updateChartTabUp();
- NumberFormat nf = NumberFormat.getDecimalFormat();
+ public void onClick(final ClickEvent ce) {
+ final FixFilter filter = updateChartTabUp();
+ final NumberFormat nf = NumberFormat.getDecimalFormat();
try {
- double d = Double.valueOf(filter.getCurrentKm());
- kmText.setValue(nf.format(d));
- } catch (NumberFormatException e) {
- kmText.setValue(filter.getCurrentKm());
+ final double d = Double.valueOf(filter.getCurrentKm());
+ FixationPanel.this.kmText.setValue(nf.format(d));
+ }
+ catch (final NumberFormatException e) {
+ FixationPanel.this.kmText.setValue(filter.getCurrentKm());
}
}
});
- kmText.addChangedHandler(new ChangedHandler() {
+ this.kmText.addChangedHandler(new ChangedHandler() {
@Override
- public void onChanged(ChangedEvent ce) {
- //TODO: get current value.
- if(ce.getItem().getValue() != null) {
- NumberFormat nf = NumberFormat.getDecimalFormat();
+ public void onChanged(final ChangedEvent ce) {
+ // TODO: get current value.
+ if (ce.getItem().getValue() != null) {
+ final NumberFormat nf = NumberFormat.getDecimalFormat();
try {
- double d = nf.parse(ce.getItem().getValue().toString());
+ final double d = nf.parse(ce.getItem().getValue().toString());
updateChartTab(d);
}
- catch(NumberFormatException nfe) {
+ catch (final NumberFormatException nfe) {
// Do nothing.
}
}
}
});
- HLayout layout = new HLayout();
+ final HLayout layout = new HLayout();
layout.setAlign(Alignment.CENTER);
layout.addMember(lower);
@@ -270,31 +256,34 @@
}
protected void updateChartTab(double km) {
- Config config = Config.getInstance();
- String locale = config.getLocale ();
+ final Config config = Config.getInstance();
+ final String locale = config.getLocale();
- FixAnalysisArtifact art = (FixAnalysisArtifact) this.artifact;
+ final AbstractFixBunduArtifact art = (AbstractFixBunduArtifact) this.artifact;
- if (fixInfo != null) {
- if (km < fixInfo.getFrom()) km = fixInfo.getFrom();
- if (km > fixInfo.getTo()) km = fixInfo.getTo();
+ if (this.fixInfo != null) {
+ if (km < this.fixInfo.getFrom())
+ km = this.fixInfo.getFrom();
+ if (km > this.fixInfo.getTo())
+ km = this.fixInfo.getTo();
}
- FixFilter filter = art.getFilter();
+ final FixFilter filter = art.getFilter();
- if (km < filter.getFromKm()) km = filter.getFromKm();
- if (km > filter.getToKm()) km = filter.getToKm();
+ if (km < filter.getFromKm())
+ km = filter.getFromKm();
+ if (km > filter.getToKm())
+ km = filter.getToKm();
filter.setCurrentKm(km);
- int hWidth = helperContainer.getWidth() - 12;
- int hHeight = helperContainer.getHeight() - 62;
+ int hWidth = this.helperContainer.getWidth() - 12;
+ int hHeight = this.helperContainer.getHeight() - 62;
- if ((int)(hHeight *4f/3) < hWidth) {
- hWidth = (int)(hHeight * 4f/3);
- }
- else {
- hHeight = (int)(hWidth *3f/4);
+ if ((int) (hHeight * 4f / 3) < hWidth) {
+ hWidth = (int) (hHeight * 4f / 3);
+ } else {
+ hHeight = (int) (hWidth * 3f / 4);
}
String imgUrl = GWT.getModuleBaseURL();
@@ -302,90 +291,87 @@
imgUrl += "?locale=" + locale;
imgUrl += "&filter=" + getChartFilter(filter, hWidth, hHeight);
- if (chartContainer.hasMember(chartImg)) {
- chartImg.setWidth(hWidth);
- chartImg.setHeight(hHeight);
- chartImg.setSrc(imgUrl);
- }
- else {
- chartImg = new Img(imgUrl, hWidth, hHeight);
- chartContainer.addMember(chartImg);
+ if (this.chartContainer.hasMember(this.chartImg)) {
+ this.chartImg.setWidth(hWidth);
+ this.chartImg.setHeight(hHeight);
+ this.chartImg.setSrc(imgUrl);
+ } else {
+ this.chartImg = new Img(imgUrl, hWidth, hHeight);
+ this.chartContainer.addMember(this.chartImg);
}
}
-
protected FixFilter updateChartTabLow() {
- FixAnalysisArtifact art = (FixAnalysisArtifact) this.artifact;
+ final AbstractFixBunduArtifact art = (AbstractFixBunduArtifact) this.artifact;
- FixFilter filter = art.getFilter();
+ final FixFilter filter = art.getFilter();
- double curr = filter.getCurrentKm();
+ final double curr = filter.getCurrentKm();
if (curr > filter.getFromKm()) {
- double newVal = (curr - 0.1) * 10;
- long round = Math.round(newVal);
- updateChartTab(((double)round) / 10);
+ final double newVal = (curr - 0.1) * 10;
+ final long round = Math.round(newVal);
+ updateChartTab(((double) round) / 10);
}
return filter;
}
-
protected FixFilter updateChartTabUp() {
- FixAnalysisArtifact art = (FixAnalysisArtifact) this.artifact;
+ final AbstractFixBunduArtifact art = (AbstractFixBunduArtifact) this.artifact;
- FixFilter filter = art.getFilter();
+ final FixFilter filter = art.getFilter();
- double curr = filter.getCurrentKm();
+ final double curr = filter.getCurrentKm();
if (curr < filter.getToKm()) {
- double newVal = (curr + 0.1) * 10;
- long round = Math.round(newVal);
- updateChartTab(((double)round) / 10);
+ final double newVal = (curr + 0.1) * 10;
+ final long round = Math.round(newVal);
+ updateChartTab(((double) round) / 10);
}
return filter;
}
-
@Override
- public void onResized(ResizedEvent re) {
- FixAnalysisArtifact art = (FixAnalysisArtifact) this.artifact;
+ public void onResized(final ResizedEvent re) {
+ final AbstractFixBunduArtifact art = (AbstractFixBunduArtifact) this.artifact;
updateChartTab(art.getFilter().getCurrentKm());
}
-
private native void createCallback() /*-{
$wnd.fixationCallback = @org.dive4elements.river.client.client.ui.fixation.FixationPanel::helperCallback(ZLjava/lang/String;);
}-*/;
- private static void helperCallback(boolean checked, String name) {
- String[] parts = name.split(":");
- String uuid = parts[0];
- String cid = parts[1];
+ private static void helperCallback(final boolean checked, final String name) {
+ final String[] parts = name.split(":");
+ final String uuid = parts[0];
+ final String cid = parts[1];
- FixationPanel p = FixationPanel.getInstance(uuid);
+ final FixationPanel p = FixationPanel.getInstance(uuid);
if (p != null) {
p.setValues(cid, checked);
}
}
- private static FixationPanel getInstance(String uuid) {
+ private static FixationPanel getInstance(final String uuid) {
return instances.get(uuid);
}
public abstract Canvas createWidget(DataList data);
+
public abstract void setValues(String cid, boolean checked);
+
public abstract boolean renderCheckboxes();
+
public abstract void success();
-
/** Creates JSON string from filter. */
- public static String getOverviewFilter(FixFilter filter) {
- String river = filter.getRiver();
+ public static String getOverviewFilter(final FixFilter filter) {
+ final String river = filter.getRiver();
if (river != null && river.length() > 0) {
- JSONObject jfix = new JSONObject();
- JSONObject jfilter = new JSONObject();
- JSONObject jrName = new JSONObject();
- JSONString jrValue = new JSONString(river);
+ final JSONObject jfix = new JSONObject();
+ final JSONObject jfilter = new JSONObject();
+ final JSONObject jrName = new JSONObject();
+ final JSONString jrValue = new JSONString(river);
jrName.put("name", jrValue);
jfilter.put("river", jrName);
jfix.put("fixings", createFilter(filter, jfilter));
@@ -394,24 +380,22 @@
return "";
}
- public String getChartFilter(FixFilter filter, int width, int height) {
- String river = filter.getRiver();
- double currentKm = filter.getCurrentKm();
- double fromKm = filter.getFromKm();
- double toKm = filter.getToKm();
+ public String getChartFilter(final FixFilter filter, final int width, final int height) {
+ final String river = filter.getRiver();
+ final double currentKm = filter.getCurrentKm();
+ final double fromKm = filter.getFromKm();
+ final double toKm = filter.getToKm();
- if (river != null && river.length() > 0 &&
- currentKm >= fromKm && currentKm <= toKm)
- {
- JSONObject jfix = new JSONObject();
- JSONObject jfilter = new JSONObject();
- JSONObject jrName = new JSONObject();
- JSONString jrValue = new JSONString(river);
- JSONObject jkm = new JSONObject();
- JSONNumber jkmValue = new JSONNumber(currentKm);
- JSONObject jextent = new JSONObject();
- JSONNumber jwidth = new JSONNumber(width);
- JSONNumber jheight = new JSONNumber(height);
+ if (river != null && river.length() > 0 && currentKm >= fromKm && currentKm <= toKm) {
+ final JSONObject jfix = new JSONObject();
+ final JSONObject jfilter = new JSONObject();
+ final JSONObject jrName = new JSONObject();
+ final JSONString jrValue = new JSONString(river);
+ final JSONObject jkm = new JSONObject();
+ final JSONNumber jkmValue = new JSONNumber(currentKm);
+ final JSONObject jextent = new JSONObject();
+ final JSONNumber jwidth = new JSONNumber(width);
+ final JSONNumber jheight = new JSONNumber(height);
jkm.put("value", jkmValue);
jrName.put("name", jrValue);
@@ -426,69 +410,67 @@
return "";
}
- protected static JSONObject createFilter(
- FixFilter filter,
- JSONObject root
- ) {
- double fromKm = filter.getFromKm();
- double toKm = filter.getToKm();
- boolean hasDate = filter.hasDate();
+ protected static JSONObject createFilter(final FixFilter filter, final JSONObject root) {
+ final double fromKm = filter.getFromKm();
+ final double toKm = filter.getToKm();
+ final boolean hasDate = filter.hasDate();
if (fromKm >= 0 && toKm >= 0 && fromKm <= toKm) {
- JSONObject range = new JSONObject();
- JSONObject fromtokm = new JSONObject();
- JSONNumber f = new JSONNumber(fromKm);
- JSONNumber t = new JSONNumber(toKm);
+ final JSONObject range = new JSONObject();
+ final JSONObject fromtokm = new JSONObject();
+ final JSONNumber f = new JSONNumber(fromKm);
+ final JSONNumber t = new JSONNumber(toKm);
fromtokm.put("from", f);
fromtokm.put("to", t);
root.put("range", fromtokm);
}
- JSONObject and = new JSONObject();
+ final JSONObject and = new JSONObject();
if (hasDate) {
- long fromDate = filter.getFromDate();
- long toDate = filter.getToDate();
+ final long fromDate = filter.getFromDate();
+ final long toDate = filter.getToDate();
- Date df = new Date(fromDate);
- Date dt = new Date(toDate);
+ final Date df = new Date(fromDate);
+ final Date dt = new Date(toDate);
- JSONObject daterange = new JSONObject();
- JSONString f = new JSONString(DTF.format(df));
- JSONString t = new JSONString(DTF.format(dt));
+ final JSONObject daterange = new JSONObject();
+ final JSONString f = new JSONString(DTF.format(df));
+ final JSONString t = new JSONString(DTF.format(dt));
daterange.put("from", f);
daterange.put("to", t);
and.put("date-range", daterange);
}
- int fromClass = filter.getFromClass();
- int toClass = filter.getToClass();
+ final int fromClass = filter.getFromClass();
+ final int toClass = filter.getToClass();
if (fromClass >= 0 && toClass >= 0 && fromClass <= toClass) {
- JSONObject classrange = new JSONObject();
- JSONNumber f = new JSONNumber(fromClass);
- JSONNumber t = new JSONNumber(toClass);
+ final JSONObject classrange = new JSONObject();
+ final JSONNumber f = new JSONNumber(fromClass);
+ final JSONNumber t = new JSONNumber(toClass);
classrange.put("from", f);
classrange.put("to", t);
and.put("sector-range", classrange);
}
- int[] events = filter.getEvents();
+ final int[] events = filter.getEvents();
if (events.length > 0) {
- StringBuilder cids = new StringBuilder();
+ final StringBuilder cids = new StringBuilder();
for (int i = 0; i < events.length; i++) {
- if (i > 0) cids.append(' ');
+ if (i > 0)
+ cids.append(' ');
cids.append(events[i]);
}
- JSONObject columns = new JSONObject();
+ final JSONObject columns = new JSONObject();
columns.put("cids", new JSONString(cids.toString()));
and.put("columns", columns);
}
if (and.size() > 0) {
- JSONObject jFilter = new JSONObject();
+ final JSONObject jFilter = new JSONObject();
jFilter.put("and", and);
root.put("filter", jFilter);
}
diff -r a561b882436d -r 02739b8c010d gwt-client/src/main/java/org/dive4elements/river/client/server/FLYSArtifactCreator.java
--- a/gwt-client/src/main/java/org/dive4elements/river/client/server/FLYSArtifactCreator.java Wed May 16 11:08:56 2018 +0200
+++ b/gwt-client/src/main/java/org/dive4elements/river/client/server/FLYSArtifactCreator.java Wed May 16 17:43:47 2018 +0200
@@ -18,6 +18,7 @@
import org.dive4elements.artifacts.common.utils.XMLUtils;
import org.dive4elements.artifacts.httpclient.utils.ArtifactCreator;
import org.dive4elements.river.client.shared.model.Artifact;
+import org.dive4elements.river.client.shared.model.BUNDUArtifact;
import org.dive4elements.river.client.shared.model.CalculationMessage;
import org.dive4elements.river.client.shared.model.ChartArtifact;
import org.dive4elements.river.client.shared.model.DefaultArtifact;
@@ -172,7 +173,7 @@
}
if (name.equals("bundu")) {
log.debug("+++++ NEW BUNDU ARTIFACT.");
- return new UINFOArtifact(uuid, hash, background, msg);
+ return new BUNDUArtifact(uuid, hash, background, msg);
}
return new DefaultArtifact(uuid, hash, background, msg);
}
diff -r a561b882436d -r 02739b8c010d gwt-client/src/main/java/org/dive4elements/river/client/shared/model/AbstractFixBunduArtifact.java
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/gwt-client/src/main/java/org/dive4elements/river/client/shared/model/AbstractFixBunduArtifact.java Wed May 16 17:43:47 2018 +0200
@@ -0,0 +1,143 @@
+/** Copyright (C) 2017 by Bundesanstalt für Gewässerkunde
+ * Software engineering by
+ * Björnsen Beratende Ingenieure GmbH
+ * Dr. Schumacher Ingenieurbüro für Wasser und Umwelt
+ *
+ * This file is Free Software under the GNU AGPL (>=v3)
+ * and comes with ABSOLUTELY NO WARRANTY! Check out the
+ * documentation coming with Dive4Elements River for details.
+ */
+package org.dive4elements.river.client.shared.model;
+
+import java.util.List;
+
+import com.google.gwt.core.client.GWT;
+
+/**
+ * @author Domenico Nardi Tironi
+ *
+ */
+public abstract class AbstractFixBunduArtifact extends DefaultArtifact {
+
+ /** The name of this artifact: 'fixanalysis'. */
+
+ protected FixFilter filter;
+
+ public AbstractFixBunduArtifact() {
+ this.filter = null;
+ }
+
+ public AbstractFixBunduArtifact(final String uuid, final String hash) {
+ super(uuid, hash);
+ this.filter = null;
+ }
+
+ public AbstractFixBunduArtifact(final String uuid, final String hash, final boolean inBackground, final List messages) {
+ super(uuid, hash, inBackground, messages);
+ }
+
+ public FixFilter getFilter() {
+ return createFilter();
+ }
+
+ protected abstract String getEventstateId();
+
+ protected FixFilter createFilter() {
+ if (this.filter == null) {
+ this.filter = new FixFilter();
+ }
+ final DataList[] old = this.artifactDescription.getOldData();
+
+ final String river = this.artifactDescription.getDataValueAsString("river");
+ if (river != null) {
+ this.filter.setRiver(river);
+ }
+
+ final String from = this.artifactDescription.getDataValueAsString("ld_from");
+ if (from != null) {
+ try {
+ final double fkm = Double.parseDouble(from);
+ this.filter.setFromKm(fkm);
+ }
+ catch (final NumberFormatException nfe) {
+ GWT.log("Could not parse from km.");
+ }
+ }
+
+ final String to = this.artifactDescription.getDataValueAsString("ld_to");
+ if (to != null) {
+ try {
+ final double tkm = Double.parseDouble(to);
+ this.filter.setToKm(tkm);
+ }
+ catch (final NumberFormatException nfe) {
+ GWT.log("Could not parse to km");
+ }
+ }
+
+ final String start = this.artifactDescription.getDataValueAsString("start");
+ if (start != null) {
+ try {
+ final long s = Long.parseLong(start);
+ this.filter.setFromDate(s);
+ }
+ catch (final NumberFormatException nfe) {
+ GWT.log("Could not parse start date");
+ }
+ }
+
+ final String end = this.artifactDescription.getDataValueAsString("end");
+ if (end != null) {
+ try {
+ final long e = Long.parseLong(end);
+ this.filter.setToDate(e);
+ }
+ catch (final NumberFormatException nfe) {
+ GWT.log("Could not parse end date");
+ }
+ }
+
+ final String q1 = this.artifactDescription.getDataValueAsString("q1");
+ if (q1 != null) {
+ try {
+ final int q1i = Integer.parseInt(q1);
+ this.filter.setFromClass(q1i);
+ }
+ catch (final NumberFormatException nfe) {
+ GWT.log("Could not parse start class");
+ }
+ }
+
+ final String q2 = this.artifactDescription.getDataValueAsString("q2");
+ if (q2 != null) {
+ try {
+ final int q2i = Integer.parseInt(q2);
+ this.filter.setToClass(q2i);
+ }
+ catch (final NumberFormatException nfe) {
+ GWT.log("could not parse end class");
+ }
+ }
+
+ for (final DataList list : old) {
+ final List items = list.getAll();
+ final String state = list.getState();
+ if (state.equals(getEventstateId())) {
+ final Data de = getData(items, "events");
+ final IntegerArrayData iad = (IntegerArrayData) de;
+ this.filter.setEvents(iad.getValues());
+ }
+ }
+
+ return this.filter;
+ }
+
+ protected Data getData(final List data, final String name) {
+ for (final Data d : data) {
+ if (name.equals(d.getLabel())) {
+ return d;
+ }
+ }
+ return null;
+ }
+}
diff -r a561b882436d -r 02739b8c010d gwt-client/src/main/java/org/dive4elements/river/client/shared/model/BUNDUArtifact.java
--- a/gwt-client/src/main/java/org/dive4elements/river/client/shared/model/BUNDUArtifact.java Wed May 16 11:08:56 2018 +0200
+++ b/gwt-client/src/main/java/org/dive4elements/river/client/shared/model/BUNDUArtifact.java Wed May 16 17:43:47 2018 +0200
@@ -15,22 +15,32 @@
*
* @author Gernot Belger
*/
-public class BUNDUArtifact extends DefaultArtifact {
+public class BUNDUArtifact extends AbstractFixBunduArtifact {
/** The name of this artifact: 'bundu'. */
private static final String NAME = "bundu";
- /** Necessary for serialization */
public BUNDUArtifact() {
+ super();
}
- public BUNDUArtifact(final String uuid, final String hash, final boolean inBackground, final List messages) {
- super(uuid, hash, inBackground, messages);
+ public BUNDUArtifact(final String uuid, final String hash) {
+ super(uuid, hash);
+ }
+
+ public BUNDUArtifact(final String uuid, final String hash, final boolean background, final List msg) {
+ super(uuid, hash, background, msg);
}
@Override
public String getName() {
return NAME;
}
+
+ @Override
+ protected String getEventstateId() {
+
+ return "state.bundu.eventselect"; // mit bundu.xml im server synchron halten :-(
+ }
}
// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
diff -r a561b882436d -r 02739b8c010d gwt-client/src/main/java/org/dive4elements/river/client/shared/model/FixAnalysisArtifact.java
--- a/gwt-client/src/main/java/org/dive4elements/river/client/shared/model/FixAnalysisArtifact.java Wed May 16 11:08:56 2018 +0200
+++ b/gwt-client/src/main/java/org/dive4elements/river/client/shared/model/FixAnalysisArtifact.java Wed May 16 17:43:47 2018 +0200
@@ -10,150 +10,36 @@
import java.util.List;
-import com.google.gwt.core.client.GWT;
-
-
/**
* The Fixanalysis implementation of an Artifact (client side).
*
* @author Raimund Renkert
*/
-public class FixAnalysisArtifact extends DefaultArtifact {
+public class FixAnalysisArtifact extends AbstractFixBunduArtifact {
- /** The name of this artifact: 'fixanalysis'.*/
public static final String NAME = "fixanalysis";
- protected FixFilter filter;
-
-
public FixAnalysisArtifact() {
- this.filter = null;
+ super();
}
-
- public FixAnalysisArtifact(String uuid, String hash) {
+ public FixAnalysisArtifact(final String uuid, final String hash) {
super(uuid, hash);
- this.filter = null;
}
-
- public FixAnalysisArtifact(
- String uuid,
- String hash,
- boolean inBackground,
- List messages
- ) {
- super(uuid, hash, inBackground, messages);
+ public FixAnalysisArtifact(final String uuid, final String hash, final boolean background, final List msg) {
+ super(uuid, hash, background, msg);
}
-
+ @Override
public String getName() {
return NAME;
}
-
- public FixFilter getFilter () {
- return createFilter();
+ @Override
+ protected String getEventstateId() {
+ return "state.fix.eventselect"; // synchron halten mit xml-file im Server
}
-
- protected FixFilter createFilter() {
- if (this.filter == null) {
- this.filter = new FixFilter();
- }
- DataList[] old = artifactDescription.getOldData();
-
- String river = artifactDescription.getDataValueAsString("river");
- if (river != null) {
- this.filter.setRiver(river);
- }
-
- String from = artifactDescription.getDataValueAsString("ld_from");
- if (from != null) {
- try {
- double fkm = Double.parseDouble(from);
- this.filter.setFromKm(fkm);
- }
- catch(NumberFormatException nfe) {
- GWT.log("Could not parse from km.");
- }
- }
-
- String to = artifactDescription.getDataValueAsString("ld_to");
- if (to != null) {
- try {
- double tkm = Double.parseDouble(to);
- this.filter.setToKm(tkm);
- }
- catch(NumberFormatException nfe) {
- GWT.log("Could not parse to km");
- }
- }
-
- String start = artifactDescription.getDataValueAsString("start");
- if (start != null) {
- try {
- long s = Long.parseLong(start);
- this.filter.setFromDate(s);
- }
- catch(NumberFormatException nfe) {
- GWT.log("Could not parse start date");
- }
- }
-
- String end = artifactDescription.getDataValueAsString("end");
- if (end != null) {
- try {
- long e = Long.parseLong(end);
- this.filter.setToDate(e);
- }
- catch(NumberFormatException nfe) {
- GWT.log("Could not parse end date");
- }
- }
-
- String q1 = artifactDescription.getDataValueAsString("q1");
- if (q1 != null) {
- try {
- int q1i = Integer.parseInt(q1);
- this.filter.setFromClass(q1i);
- }
- catch(NumberFormatException nfe) {
- GWT.log("Could not parse start class");
- }
- }
-
- String q2 = artifactDescription.getDataValueAsString("q2");
- if (q2 != null) {
- try {
- int q2i = Integer.parseInt(q2);
- this.filter.setToClass(q2i);
- }
- catch(NumberFormatException nfe) {
- GWT.log("could not parse end class");
- }
- }
-
- for (DataList list: old) {
- List items = list.getAll();
- String state = list.getState();
- if(state.equals("state.fix.eventselect")) {
- Data de = getData(items, "events");
- IntegerArrayData iad = (IntegerArrayData) de;
- this.filter.setEvents(iad.getValues());
- }
- }
-
- return this.filter;
- }
-
- protected Data getData(List data, String name) {
- for (Data d: data) {
- if (name.equals(d.getLabel())) {
- return d;
- }
- }
- return null;
- }
}
// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :