Mercurial > dive4elements > river
annotate artifacts/src/main/java/org/dive4elements/river/artifacts/states/minfo/SedimentLoadYearSelect.java @ 8856:5e38e2924c07 3.2.x
Fix code style.
author | Tom Gottfried <tom@intevation.de> |
---|---|
date | Thu, 18 Jan 2018 20:12:01 +0100 |
parents | 9fa5c66073e7 |
children | 0a5239a1e46e |
rev | line source |
---|---|
5863
4897a58c8746
River artifacts: Added new copyright headers.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5838
diff
changeset
|
1 /* Copyright (C) 2011, 2012, 2013 by Bundesanstalt für Gewässerkunde |
4897a58c8746
River artifacts: Added new copyright headers.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5838
diff
changeset
|
2 * Software engineering by Intevation GmbH |
4897a58c8746
River artifacts: Added new copyright headers.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5838
diff
changeset
|
3 * |
5994
af13ceeba52a
Removed trailing whitespace.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5867
diff
changeset
|
4 * This file is Free Software under the GNU AGPL (>=v3) |
5863
4897a58c8746
River artifacts: Added new copyright headers.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5838
diff
changeset
|
5 * and comes with ABSOLUTELY NO WARRANTY! Check out the |
5994
af13ceeba52a
Removed trailing whitespace.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5867
diff
changeset
|
6 * documentation coming with Dive4Elements River for details. |
5863
4897a58c8746
River artifacts: Added new copyright headers.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5838
diff
changeset
|
7 */ |
4897a58c8746
River artifacts: Added new copyright headers.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5838
diff
changeset
|
8 |
5831
bd047b71ab37
Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5701
diff
changeset
|
9 package org.dive4elements.river.artifacts.states.minfo; |
4220
a30647abf009
Added config and states for sediment load calculation in MINFO module.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
10 |
a30647abf009
Added config and states for sediment load calculation in MINFO module.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
11 import org.apache.log4j.Logger; |
a30647abf009
Added config and states for sediment load calculation in MINFO module.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
12 |
5831
bd047b71ab37
Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5701
diff
changeset
|
13 import org.dive4elements.artifacts.Artifact; |
5694
8508ee487893
SedimentLoadYearSelect: Add validation to have second year later than first.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
4220
diff
changeset
|
14 |
5867
59ff03ff48f1
River artifacts: Renamed FLYSArtifact(Collection) to D4EArtifact(Collection).
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5863
diff
changeset
|
15 import org.dive4elements.river.artifacts.D4EArtifact; |
5694
8508ee487893
SedimentLoadYearSelect: Add validation to have second year later than first.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
4220
diff
changeset
|
16 |
5831
bd047b71ab37
Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5701
diff
changeset
|
17 import org.dive4elements.river.artifacts.access.SedimentLoadAccess; |
bd047b71ab37
Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5701
diff
changeset
|
18 import org.dive4elements.river.artifacts.states.DefaultState; |
4220
a30647abf009
Added config and states for sediment load calculation in MINFO module.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
19 |
a30647abf009
Added config and states for sediment load calculation in MINFO module.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
20 |
5695
fd020ac6f6cd
Doc and vimline.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
5694
diff
changeset
|
21 /** State in which to fetch years for sedminent load calculation. */ |
4220
a30647abf009
Added config and states for sediment load calculation in MINFO module.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
22 public class SedimentLoadYearSelect |
a30647abf009
Added config and states for sediment load calculation in MINFO module.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
23 extends DefaultState |
a30647abf009
Added config and states for sediment load calculation in MINFO module.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
24 { |
8202
e4606eae8ea5
sed src/**/*.java 's/logger/log/g'
Sascha L. Teichmann <teichmann@intevation.de>
parents:
6101
diff
changeset
|
25 /** The log used in this class. */ |
e4606eae8ea5
sed src/**/*.java 's/logger/log/g'
Sascha L. Teichmann <teichmann@intevation.de>
parents:
6101
diff
changeset
|
26 private static Logger log = Logger.getLogger(SedimentLoadYearSelect.class); |
4220
a30647abf009
Added config and states for sediment load calculation in MINFO module.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
27 |
a30647abf009
Added config and states for sediment load calculation in MINFO module.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
28 |
a30647abf009
Added config and states for sediment load calculation in MINFO module.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
29 /** |
a30647abf009
Added config and states for sediment load calculation in MINFO module.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
30 * The default constructor that initializes an empty State object. |
a30647abf009
Added config and states for sediment load calculation in MINFO module.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
31 */ |
a30647abf009
Added config and states for sediment load calculation in MINFO module.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
32 public SedimentLoadYearSelect() { |
a30647abf009
Added config and states for sediment load calculation in MINFO module.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
33 } |
a30647abf009
Added config and states for sediment load calculation in MINFO module.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
34 |
5695
fd020ac6f6cd
Doc and vimline.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
5694
diff
changeset
|
35 |
fd020ac6f6cd
Doc and vimline.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
5694
diff
changeset
|
36 /** Year Select Widget. */ |
4220
a30647abf009
Added config and states for sediment load calculation in MINFO module.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
37 @Override |
a30647abf009
Added config and states for sediment load calculation in MINFO module.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
38 protected String getUIProvider() { |
a30647abf009
Added config and states for sediment load calculation in MINFO module.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
39 return "minfo.sedimentload_year_select"; |
a30647abf009
Added config and states for sediment load calculation in MINFO module.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
40 } |
a30647abf009
Added config and states for sediment load calculation in MINFO module.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
41 |
5694
8508ee487893
SedimentLoadYearSelect: Add validation to have second year later than first.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
4220
diff
changeset
|
42 |
8508ee487893
SedimentLoadYearSelect: Add validation to have second year later than first.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
4220
diff
changeset
|
43 @Override |
8508ee487893
SedimentLoadYearSelect: Add validation to have second year later than first.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
4220
diff
changeset
|
44 public boolean validate(Artifact artifact) |
8508ee487893
SedimentLoadYearSelect: Add validation to have second year later than first.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
4220
diff
changeset
|
45 throws IllegalArgumentException |
8508ee487893
SedimentLoadYearSelect: Add validation to have second year later than first.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
4220
diff
changeset
|
46 { |
8856 | 47 SedimentLoadAccess access = |
48 new SedimentLoadAccess((D4EArtifact)artifact); | |
5694
8508ee487893
SedimentLoadYearSelect: Add validation to have second year later than first.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
4220
diff
changeset
|
49 |
8508ee487893
SedimentLoadYearSelect: Add validation to have second year later than first.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
4220
diff
changeset
|
50 // Second year should be later than first. |
8591
9fa5c66073e7
Don't die if only one year is selected for SedimentLoad calculation
Andre Heinecke <andre.heinecke@intevation.de>
parents:
8532
diff
changeset
|
51 if (access.getYears() == null || access.getYears().length == 0) |
5694
8508ee487893
SedimentLoadYearSelect: Add validation to have second year later than first.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
4220
diff
changeset
|
52 throw new IllegalArgumentException("error_years_wrong"); |
8508ee487893
SedimentLoadYearSelect: Add validation to have second year later than first.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
4220
diff
changeset
|
53 |
8508ee487893
SedimentLoadYearSelect: Add validation to have second year later than first.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
4220
diff
changeset
|
54 return true; |
8508ee487893
SedimentLoadYearSelect: Add validation to have second year later than first.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
4220
diff
changeset
|
55 } |
4220
a30647abf009
Added config and states for sediment load calculation in MINFO module.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
56 } |
5695
fd020ac6f6cd
Doc and vimline.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
5694
diff
changeset
|
57 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf-8 : |