comparison artifacts/src/main/java/org/dive4elements/river/artifacts/uinfo/salix/LoadSingleEpochSelectState.java @ 9321:a978b601a034

Salix: Fixed ArrrayoutOfBoundsException; minor cleanup
author gernotbelger
date Fri, 27 Jul 2018 10:25:09 +0200
parents 9e6b70cce337
children 6dd539efebb1
comparison
equal deleted inserted replaced
9320:61e6d158a20f 9321:a978b601a034
12 import java.util.Iterator; 12 import java.util.Iterator;
13 import java.util.List; 13 import java.util.List;
14 import java.util.Map; 14 import java.util.Map;
15 import java.util.TreeMap; 15 import java.util.TreeMap;
16 16
17 import org.apache.log4j.Logger;
18 import org.dive4elements.artifacts.Artifact; 17 import org.dive4elements.artifacts.Artifact;
19 import org.dive4elements.artifacts.CallContext; 18 import org.dive4elements.artifacts.CallContext;
20 import org.dive4elements.artifacts.common.utils.XMLUtils.ElementCreator; 19 import org.dive4elements.artifacts.common.utils.XMLUtils.ElementCreator;
21 import org.dive4elements.river.artifacts.states.AddTableDataHelper; 20 import org.dive4elements.river.artifacts.states.AddTableDataHelper;
22 import org.dive4elements.river.artifacts.states.DefaultState; 21 import org.dive4elements.river.artifacts.states.DefaultState;
23 import org.dive4elements.river.artifacts.uinfo.UINFOArtifact; 22 import org.dive4elements.river.artifacts.uinfo.UINFOArtifact;
24 import org.dive4elements.river.model.BedHeight; 23 import org.dive4elements.river.model.BedHeight;
25 import org.w3c.dom.Element; 24 import org.w3c.dom.Element;
26 25
27 public class LoadSingleEpochSelectState extends DefaultState { 26 public class LoadSingleEpochSelectState extends DefaultState {
27
28 private static final long serialVersionUID = 1L; 28 private static final long serialVersionUID = 1L;
29 /** The log used in this class. */
30 private static Logger log = Logger.getLogger(LoadSingleEpochSelectState.class);
31 29
32 /** 30 /**
33 * The default constructor that initializes an empty State object. 31 * The default constructor that initializes an empty State object.
34 */ 32 */
35 public LoadSingleEpochSelectState() { 33 public LoadSingleEpochSelectState() {
46 44
47 try { 45 try {
48 if (datakey.equals(name)) { 46 if (datakey.equals(name)) {
49 final SalixLineAccess access = new SalixLineAccess((UINFOArtifact) artifact); 47 final SalixLineAccess access = new SalixLineAccess((UINFOArtifact) artifact);
50 final List<BedHeight> bhs = BedHeight.getBedHeightEpochs(access.getRiver(), access.getLowerKm(), access.getUpperKm()); 48 final List<BedHeight> bhs = BedHeight.getBedHeightEpochs(access.getRiver(), access.getLowerKm(), access.getUpperKm());
51 makeDataSourceYearEpoch(artifact, creator, select, context, bhs); 49 makeDataSourceYearEpoch(creator, select, context, bhs);
52 } 50 }
53 } 51 }
54 catch ( 52 catch (
55 53
56 final IllegalArgumentException iae) { 54 final IllegalArgumentException iae) {
57 iae.printStackTrace(); 55 iae.printStackTrace();
58 } 56 }
59 } 57 }
60 58
61 public static final void makeDataSourceYearEpoch(final Artifact artifact, final ElementCreator creator, final Element select, final CallContext context, 59 public static final void makeDataSourceYearEpoch(final ElementCreator creator, final Element select, final CallContext context,
62 final List<BedHeight> bedheights) { // TODO: maybe move to appropriate helper... 60 final List<BedHeight> bedheights) { // TODO: maybe move to appropriate helper...
63 61
64 final AddTableDataHelper helper = new AddTableDataHelper(creator, select, "year", context.getMeta()); 62 final AddTableDataHelper helper = new AddTableDataHelper(creator, select, "year", context.getMeta());
65 63
66 helper.addColumn(0, "pinfrom", "40", "common.client.ui.from", "ICON", "CENTER", "from"); 64 helper.addColumn(0, "pinfrom", "40", "common.client.ui.from", "ICON", "CENTER", "from");
84 helper.addRow(row); 82 helper.addRow(row);
85 } 83 }
86 84
87 helper.submitMapToXml(); 85 helper.submitMapToXml();
88 } 86 }
89
90 } 87 }

http://dive4elements.wald.intevation.org