[Dive4elements-commits] [PATCH 3 of 4] NaviChartOutputTab: Slight refactoring to work not only with FixAnalysisArtifacts
Wald Commits
scm-commit at wald.intevation.org
Tue Oct 30 10:40:38 CET 2012
# HG changeset patch
# User Felix Wolfsteller <felix.wolfsteller at intevation.de>
# Date 1351590294 -3600
# Node ID c3ac330d9be4891484a566f78128440479664665
# Parent 8d3523bbb088f13e1100f395fa855b52623b8c12
NaviChartOutputTab: Slight refactoring to work not only with FixAnalysisArtifacts.
diff -r 8d3523bbb088 -r c3ac330d9be4 flys-client/src/main/java/de/intevation/flys/client/client/ui/chart/NaviChartOutputTab.java
--- a/flys-client/src/main/java/de/intevation/flys/client/client/ui/chart/NaviChartOutputTab.java Tue Oct 30 10:35:37 2012 +0100
+++ b/flys-client/src/main/java/de/intevation/flys/client/client/ui/chart/NaviChartOutputTab.java Tue Oct 30 10:44:54 2012 +0100
@@ -34,13 +34,14 @@
import de.intevation.flys.client.shared.model.Artifact;
import de.intevation.flys.client.shared.model.Collection;
import de.intevation.flys.client.shared.model.FixAnalysisArtifact;
+import de.intevation.flys.client.shared.model.FixFilter;
import de.intevation.flys.client.shared.model.OutputMode;
import java.util.Date;
/**
- * Tab representing and showing one Chart-output.
+ * Tab representing and showing one Chart-output with a "navi" thing.
*
* @author <a href="mailto:ingo.weinzierl at intevation.de">Ingo Weinzierl</a>
*/
@@ -83,35 +84,52 @@
form.setFields(currentkm);
form.setWidth(60);
- FixAnalysisArtifact fix = (FixAnalysisArtifact) art;
- String s = fix.getArtifactDescription().getDataValueAsString("step");
- try {
- double ds = Double.parseDouble(s);
- collectionView.setSteps(ds);
+ double fromKm;
+ double toKm;
+
+ if (art instanceof FixAnalysisArtifact) {
+ FixAnalysisArtifact fix = (FixAnalysisArtifact) art;
+ FixFilter fixFilter = fix.getFilter();
+ String s = fix.getArtifactDescription().getDataValueAsString("step");
+ try {
+ double ds = Double.parseDouble(s);
+ collectionView.setSteps(ds);
+ }
+ catch(NumberFormatException nfe) {
+ collectionView.setSteps(100d);
+ }
+ fromKm = fixFilter.getFromKm();
+ toKm = fixFilter.getToKm();
}
- catch(NumberFormatException nfe) {
+ else {
+ // Probably WINFOArtifact kind of artifact.
+ // TODO Proper implementation
+ // collectionView set real steps.
collectionView.setSteps(100d);
+ fromKm = 0d;
+ toKm = 93d;
}
- collectionView.setMinKm(fix.getFilter().getFromKm());
- collectionView.setMaxKm(fix.getFilter().getToKm());
+
+ collectionView.setMinKm(fromKm);
+ collectionView.setMaxKm(toKm);
final NumberFormat nf = NumberFormat.getDecimalFormat();
if (collectionView.getCurrentKm() == -1d) {
try {
- double d = Double.valueOf(fix.getFilter().getFromKm());
+ double d = Double.valueOf(fromKm);
currentkm.setValue(nf.format(d));
} catch (NumberFormatException e) {
- currentkm.setValue(fix.getFilter().getFromKm());
+ currentkm.setValue(fromKm);
}
- collectionView.setCurrentKm(fix.getFilter().getFromKm());
+ collectionView.setCurrentKm(fromKm);
}
else {
try {
- double d = Double.valueOf(fix.getFilter().getFromKm());
+ double d = Double.valueOf(fromKm);
currentkm.setValue(nf.format(d));
} catch (NumberFormatException e) {
- currentkm.setValue(fix.getFilter().getFromKm());
+ currentkm.setValue(fromKm);
}
currentkm.setValue(collectionView.getCurrentKm());
}
More information about the Dive4elements-commits
mailing list