annotate artifacts/src/main/java/org/dive4elements/river/artifacts/states/minfo/SedimentLoadYearSelect.java @ 5838:5aa05a7a34b7

Rename modules to more fitting names.
author Sascha L. Teichmann <teichmann@intevation.de>
date Thu, 25 Apr 2013 15:23:37 +0200
parents flys-artifacts/src/main/java/org/dive4elements/river/artifacts/states/minfo/SedimentLoadYearSelect.java@bd047b71ab37
children 4897a58c8746
rev   line source
5831
bd047b71ab37 Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5701
diff changeset
1 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
2
a30647abf009 Added config and states for sediment load calculation in MINFO module.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
3 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
4
5831
bd047b71ab37 Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5701
diff changeset
5 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
6
5831
bd047b71ab37 Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5701
diff changeset
7 import org.dive4elements.river.artifacts.FLYSArtifact;
5694
8508ee487893 SedimentLoadYearSelect: Add validation to have second year later than first.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 4220
diff changeset
8
5831
bd047b71ab37 Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5701
diff changeset
9 import org.dive4elements.river.artifacts.access.SedimentLoadAccess;
bd047b71ab37 Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5701
diff changeset
10 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
11
a30647abf009 Added config and states for sediment load calculation in MINFO module.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
12
5695
fd020ac6f6cd Doc and vimline.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 5694
diff changeset
13 /** 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
14 public class SedimentLoadYearSelect
a30647abf009 Added config and states for sediment load calculation in MINFO module.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
15 extends DefaultState
a30647abf009 Added config and states for sediment load calculation in MINFO module.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
16 {
a30647abf009 Added config and states for sediment load calculation in MINFO module.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
17 /** The logger used in this class. */
a30647abf009 Added config and states for sediment load calculation in MINFO module.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
18 private static Logger logger = Logger.getLogger(SedimentLoadYearSelect.class);
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
a30647abf009 Added config and states for sediment load calculation in MINFO module.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
21 /**
a30647abf009 Added config and states for sediment load calculation in MINFO module.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
22 * 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
23 */
a30647abf009 Added config and states for sediment load calculation in MINFO module.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
24 public SedimentLoadYearSelect() {
a30647abf009 Added config and states for sediment load calculation in MINFO module.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
25 }
a30647abf009 Added config and states for sediment load calculation in MINFO module.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
26
5695
fd020ac6f6cd Doc and vimline.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 5694
diff changeset
27
fd020ac6f6cd Doc and vimline.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 5694
diff changeset
28 /** Year Select Widget. */
4220
a30647abf009 Added config and states for sediment load calculation in MINFO module.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
29 @Override
a30647abf009 Added config and states for sediment load calculation in MINFO module.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
30 protected String getUIProvider() {
a30647abf009 Added config and states for sediment load calculation in MINFO module.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
31 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
32 }
a30647abf009 Added config and states for sediment load calculation in MINFO module.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
33
5694
8508ee487893 SedimentLoadYearSelect: Add validation to have second year later than first.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 4220
diff changeset
34
8508ee487893 SedimentLoadYearSelect: Add validation to have second year later than first.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 4220
diff changeset
35 @Override
8508ee487893 SedimentLoadYearSelect: Add validation to have second year later than first.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 4220
diff changeset
36 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
37 throws IllegalArgumentException
8508ee487893 SedimentLoadYearSelect: Add validation to have second year later than first.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 4220
diff changeset
38 {
8508ee487893 SedimentLoadYearSelect: Add validation to have second year later than first.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 4220
diff changeset
39 SedimentLoadAccess access = new SedimentLoadAccess((FLYSArtifact) artifact, null);
8508ee487893 SedimentLoadYearSelect: Add validation to have second year later than first.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 4220
diff changeset
40
8508ee487893 SedimentLoadYearSelect: Add validation to have second year later than first.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 4220
diff changeset
41 // Second year should be later than first.
5701
56897ceb5589 Avoid NPE.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 5695
diff changeset
42 if (access.getPeriod() != null && access.getPeriod()[1] < access.getPeriod()[0])
5694
8508ee487893 SedimentLoadYearSelect: Add validation to have second year later than first.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 4220
diff changeset
43 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
44
8508ee487893 SedimentLoadYearSelect: Add validation to have second year later than first.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 4220
diff changeset
45 return true;
8508ee487893 SedimentLoadYearSelect: Add validation to have second year later than first.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 4220
diff changeset
46 }
4220
a30647abf009 Added config and states for sediment load calculation in MINFO module.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
47 }
5695
fd020ac6f6cd Doc and vimline.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 5694
diff changeset
48 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf-8 :

http://dive4elements.wald.intevation.org