Mercurial > dive4elements > river
view artifacts/src/main/java/org/dive4elements/river/artifacts/uinfo/inundationduration/LoadScenarioSelect.java @ 9170:9b2e46090099
tkh cast exception fix
gigantic refactoring 2
author | gernotbelger |
---|---|
date | Thu, 21 Jun 2018 14:32:11 +0200 |
parents | fc02833dbcc1 |
children | 5a0e8d76582e |
line wrap: on
line source
/* Copyright (C) 2011, 2012, 2013 by Bundesanstalt für Gewässerkunde * Software engineering by Intevation GmbH * * 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.uinfo.inundationduration; import java.util.HashMap; import java.util.Map; import org.apache.log4j.Logger; import org.dive4elements.artifacts.Artifact; import org.dive4elements.artifacts.CallContext; import org.dive4elements.artifacts.common.utils.XMLUtils.ElementCreator; import org.dive4elements.river.artifacts.states.AddTableDataHelper; import org.dive4elements.river.artifacts.states.DefaultState; import org.w3c.dom.Element; /** State in which to fetch years for sedminent load calculation. */ public class LoadScenarioSelect extends DefaultState { private static final long serialVersionUID = 1L; /** The log used in this class. */ private static Logger log = Logger.getLogger(LoadScenarioSelect.class); /** * The default constructor that initializes an empty State object. */ public LoadScenarioSelect() { } /** Year Select Widget. */ @Override protected String getUIProvider() { return "uinfo.sedimentheight_select"; } @Override protected void appendItems(final Artifact artifact, final ElementCreator creator, final String name, final CallContext context, final Element select) { final String datakey = "sedimentheight"; try { if (datakey.equals(name)) { final AddTableDataHelper helper = new AddTableDataHelper(creator, select, "cm", context.getMeta()); helper.addColumn(0, "pinfrom", "40", "common.client.ui.from", "ICON", "CENTER", "from"); // helper.addColumn(1, "pinto", "40", "common.client.ui.to", "ICON", "CENTER", "to"); helper.addColumn(1, "cm", "60", "Delta [cm]", "INTEGER", "RIGHT", null); for (int i = -200; i < 210; i = i + 10) { final Map<String, String> row = new HashMap<>(); row.put("cm", Integer.toString(i)); helper.addRow(row); } helper.submitMapToXml(); } } catch (final IllegalArgumentException iae) { iae.printStackTrace(); } } @Override public boolean validate(final Artifact artifact) throws IllegalArgumentException { return true; // final CollisionLoadYearEpochAccess access = new CollisionLoadYearEpochAccess((D4EArtifact) artifact); // // // Second year should be later than first. // if (access.getYears() == null || access.getYears().length == 0) // return true; // TODO: richtig in CollisionLoadYear... implementieren // // throw new IllegalArgumentException("error_years_wrong"); // // return true; } } // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf-8 :