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; |
9067
|
13 import org.dive4elements.river.artifacts.sinfo.SINFOArtifact; |
9058
|
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() { |
9067
|
31 return "minfo.sedimentload_year_select"; // TODO: eigenes Panel oder allgemeineren Code |
9058
|
32 } |
|
33 |
|
34 @Override |
|
35 public boolean validate(final Artifact artifact) throws IllegalArgumentException { |
9067
|
36 // TODO: check verstehen |
|
37 |
|
38 final CollisionAccess access = new CollisionAccess((SINFOArtifact) artifact); |
9058
|
39 |
|
40 // Second year should be later than first. |
9067
|
41 |
9058
|
42 if (access.getYears() == null || access.getYears().length == 0) |
9067
|
43 return true; |
9058
|
44 // throw new IllegalArgumentException("error_years_wrong"); |
|
45 |
|
46 return true; |
|
47 } |
|
48 } |
|
49 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf-8 : |