9058
|
1 /* Copyright (C) 2011, 2012, 2013 by Bundesanstalt für Gewässerkunde |
|
2 * Software engineering by Intevation GmbH |
|
3 * |
|
4 * This file is Free Software under the GNU AGPL (>=v3) |
|
5 * and comes with ABSOLUTELY NO WARRANTY! Check out the |
|
6 * documentation coming with Dive4Elements River for details. |
|
7 */ |
|
8 |
|
9 package org.dive4elements.river.artifacts.sinfo.collision; |
|
10 |
|
11 import org.apache.log4j.Logger; |
|
12 import org.dive4elements.artifacts.Artifact; |
|
13 import org.dive4elements.river.artifacts.D4EArtifact; |
|
14 import org.dive4elements.river.artifacts.states.DefaultState; |
|
15 |
|
16 /** State in which to fetch years for sedminent load calculation. */ |
|
17 public class LoadYearSelect extends DefaultState { |
|
18 private static final long serialVersionUID = 1L; |
|
19 /** The log used in this class. */ |
|
20 private static Logger log = Logger.getLogger(LoadYearSelect.class); |
|
21 |
|
22 /** |
|
23 * The default constructor that initializes an empty State object. |
|
24 */ |
|
25 public LoadYearSelect() { |
|
26 } |
|
27 |
|
28 /** Year Select Widget. */ |
|
29 @Override |
|
30 protected String getUIProvider() { |
9066
|
31 return "uinfo.inundationduration.load_year_select"; |
9058
|
32 } |
|
33 |
|
34 @Override |
|
35 public boolean validate(final Artifact artifact) throws IllegalArgumentException { |
|
36 final CollisionLoadYearEpochAccess access = new CollisionLoadYearEpochAccess((D4EArtifact) artifact); |
|
37 |
|
38 // Second year should be later than first. |
|
39 if (access.getYears() == null || access.getYears().length == 0) |
|
40 return true; // TODO: richtig in CollisionLoadYear... implementieren |
|
41 // throw new IllegalArgumentException("error_years_wrong"); |
|
42 |
|
43 return true; |
|
44 } |
|
45 } |
|
46 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf-8 : |