view artifacts/src/main/java/org/dive4elements/river/artifacts/uinfo/salix/LoadSingleYearSelectState.java @ 9321:a978b601a034

Salix: Fixed ArrrayoutOfBoundsException; minor cleanup
author gernotbelger
date Fri, 27 Jul 2018 10:25:09 +0200
parents f5cff8708531
children
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.salix;

import java.util.List;

import org.dive4elements.artifacts.Artifact;
import org.dive4elements.artifacts.CallContext;
import org.dive4elements.artifacts.common.utils.XMLUtils.ElementCreator;
import org.dive4elements.river.artifacts.states.DefaultState;
import org.dive4elements.river.artifacts.uinfo.UINFOArtifact;
import org.dive4elements.river.model.BedHeight;
import org.w3c.dom.Element;

/** State in which to fetch years for sedminent load calculation. */
public class LoadSingleYearSelectState extends DefaultState {

    private static final long serialVersionUID = 1L;

    /**
     * The default constructor that initializes an empty State object.
     */
    public LoadSingleYearSelectState() {
    }

    /** Year Select Widget. */
    @Override
    protected String getUIProvider() {
        return "common.state.load_single_year_select";
    }

    @Override
    protected void appendItems(final Artifact artifact, final ElementCreator creator, final String name, final CallContext context, final Element select) {

        final String dataKeyofState = "singleyear";// siehe .xml
        try {
            if (dataKeyofState.equals(name)) {
                final SalixLineAccess access = new SalixLineAccess((UINFOArtifact) artifact);
                final List<BedHeight> bhs = BedHeight.getBedHeightYear(access.getRiver(), access.getLowerKm(), access.getUpperKm());
                LoadSingleEpochSelectState.makeDataSourceYearEpoch(creator, select, context, bhs);
            }
        }
        catch (

                final IllegalArgumentException iae) {
            iae.printStackTrace();
        }
    }
}

http://dive4elements.wald.intevation.org