Mercurial > dive4elements > river
annotate flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/fixation/EventSelect.java @ 5380:75371c9ef472
I1174: Changed label for some themes in fix analysis.
author | Raimund Renkert <rrenkert@intevation.de> |
---|---|
date | Fri, 22 Mar 2013 11:55:14 +0100 |
parents | 58bdf95df5e4 |
children |
rev | line source |
---|---|
2668
53f42adf4505
Modified states and added new state for fixing analysis.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
1 package de.intevation.flys.artifacts.states.fixation; |
53f42adf4505
Modified states and added new state for fixing analysis.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
2 |
2719
d1d35892bbdd
Adjusted fixings transitions and implemented event select state.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2668
diff
changeset
|
3 import java.util.List; |
d1d35892bbdd
Adjusted fixings transitions and implemented event select state.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2668
diff
changeset
|
4 |
2668
53f42adf4505
Modified states and added new state for fixing analysis.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
5 import org.apache.log4j.Logger; |
53f42adf4505
Modified states and added new state for fixing analysis.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
6 |
2719
d1d35892bbdd
Adjusted fixings transitions and implemented event select state.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2668
diff
changeset
|
7 import org.w3c.dom.Element; |
d1d35892bbdd
Adjusted fixings transitions and implemented event select state.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2668
diff
changeset
|
8 |
d1d35892bbdd
Adjusted fixings transitions and implemented event select state.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2668
diff
changeset
|
9 import de.intevation.artifacts.common.utils.XMLUtils.ElementCreator; |
d1d35892bbdd
Adjusted fixings transitions and implemented event select state.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2668
diff
changeset
|
10 |
d1d35892bbdd
Adjusted fixings transitions and implemented event select state.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2668
diff
changeset
|
11 import de.intevation.artifacts.CallContext; |
d1d35892bbdd
Adjusted fixings transitions and implemented event select state.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2668
diff
changeset
|
12 |
2668
53f42adf4505
Modified states and added new state for fixing analysis.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
13 import de.intevation.flys.artifacts.states.DefaultState; |
2719
d1d35892bbdd
Adjusted fixings transitions and implemented event select state.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2668
diff
changeset
|
14 import de.intevation.flys.artifacts.FLYSArtifact; |
d1d35892bbdd
Adjusted fixings transitions and implemented event select state.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2668
diff
changeset
|
15 import de.intevation.flys.utils.FLYSUtils; |
d1d35892bbdd
Adjusted fixings transitions and implemented event select state.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2668
diff
changeset
|
16 |
d1d35892bbdd
Adjusted fixings transitions and implemented event select state.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2668
diff
changeset
|
17 import de.intevation.flys.artifacts.model.FixingsOverview; |
d1d35892bbdd
Adjusted fixings transitions and implemented event select state.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2668
diff
changeset
|
18 import de.intevation.flys.artifacts.model.FixingsOverviewFactory; |
d1d35892bbdd
Adjusted fixings transitions and implemented event select state.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2668
diff
changeset
|
19 import de.intevation.flys.artifacts.model.FixingsOverview.IdFilter; |
d1d35892bbdd
Adjusted fixings transitions and implemented event select state.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2668
diff
changeset
|
20 import de.intevation.flys.artifacts.model.FixingsOverview.Fixing; |
d1d35892bbdd
Adjusted fixings transitions and implemented event select state.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2668
diff
changeset
|
21 |
2668
53f42adf4505
Modified states and added new state for fixing analysis.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
22 |
53f42adf4505
Modified states and added new state for fixing analysis.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
23 /** |
53f42adf4505
Modified states and added new state for fixing analysis.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
24 * @author <a href="mailto:raimund.renkert@intevation.de">Raimund Renkert</a> |
53f42adf4505
Modified states and added new state for fixing analysis.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
25 */ |
53f42adf4505
Modified states and added new state for fixing analysis.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
26 public class EventSelect extends DefaultState { |
53f42adf4505
Modified states and added new state for fixing analysis.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
27 |
53f42adf4505
Modified states and added new state for fixing analysis.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
28 /** The logger used in this class. */ |
53f42adf4505
Modified states and added new state for fixing analysis.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
29 private static Logger logger = Logger.getLogger(EventSelect.class); |
53f42adf4505
Modified states and added new state for fixing analysis.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
30 |
53f42adf4505
Modified states and added new state for fixing analysis.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
31 |
53f42adf4505
Modified states and added new state for fixing analysis.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
32 /** |
53f42adf4505
Modified states and added new state for fixing analysis.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
33 * The default constructor that initializes an empty State object. |
53f42adf4505
Modified states and added new state for fixing analysis.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
34 */ |
53f42adf4505
Modified states and added new state for fixing analysis.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
35 public EventSelect() { |
53f42adf4505
Modified states and added new state for fixing analysis.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
36 } |
53f42adf4505
Modified states and added new state for fixing analysis.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
37 |
53f42adf4505
Modified states and added new state for fixing analysis.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
38 @Override |
53f42adf4505
Modified states and added new state for fixing analysis.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
39 protected String getUIProvider() { |
53f42adf4505
Modified states and added new state for fixing analysis.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
40 return "fix.event_panel"; |
53f42adf4505
Modified states and added new state for fixing analysis.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
41 } |
2719
d1d35892bbdd
Adjusted fixings transitions and implemented event select state.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2668
diff
changeset
|
42 |
d1d35892bbdd
Adjusted fixings transitions and implemented event select state.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2668
diff
changeset
|
43 @Override |
d1d35892bbdd
Adjusted fixings transitions and implemented event select state.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2668
diff
changeset
|
44 protected Element createStaticData( |
d1d35892bbdd
Adjusted fixings transitions and implemented event select state.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2668
diff
changeset
|
45 FLYSArtifact flys, |
d1d35892bbdd
Adjusted fixings transitions and implemented event select state.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2668
diff
changeset
|
46 ElementCreator creator, |
d1d35892bbdd
Adjusted fixings transitions and implemented event select state.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2668
diff
changeset
|
47 CallContext cc, |
d1d35892bbdd
Adjusted fixings transitions and implemented event select state.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2668
diff
changeset
|
48 String name, |
d1d35892bbdd
Adjusted fixings transitions and implemented event select state.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2668
diff
changeset
|
49 String value, |
d1d35892bbdd
Adjusted fixings transitions and implemented event select state.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2668
diff
changeset
|
50 String type |
d1d35892bbdd
Adjusted fixings transitions and implemented event select state.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2668
diff
changeset
|
51 ) { |
d1d35892bbdd
Adjusted fixings transitions and implemented event select state.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2668
diff
changeset
|
52 int[] array = FLYSUtils.intArrayFromString(value); |
d1d35892bbdd
Adjusted fixings transitions and implemented event select state.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2668
diff
changeset
|
53 |
d1d35892bbdd
Adjusted fixings transitions and implemented event select state.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2668
diff
changeset
|
54 Element dataElement = creator.create("data"); |
d1d35892bbdd
Adjusted fixings transitions and implemented event select state.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2668
diff
changeset
|
55 creator.addAttr(dataElement, "name", name, true); |
d1d35892bbdd
Adjusted fixings transitions and implemented event select state.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2668
diff
changeset
|
56 creator.addAttr(dataElement, "type", type, true); |
d1d35892bbdd
Adjusted fixings transitions and implemented event select state.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2668
diff
changeset
|
57 |
d1d35892bbdd
Adjusted fixings transitions and implemented event select state.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2668
diff
changeset
|
58 String river = FLYSUtils.getRiver(flys).getName(); |
d1d35892bbdd
Adjusted fixings transitions and implemented event select state.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2668
diff
changeset
|
59 |
d1d35892bbdd
Adjusted fixings transitions and implemented event select state.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2668
diff
changeset
|
60 FixingsOverview overview = FixingsOverviewFactory.getOverview(river); |
d1d35892bbdd
Adjusted fixings transitions and implemented event select state.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2668
diff
changeset
|
61 |
d1d35892bbdd
Adjusted fixings transitions and implemented event select state.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2668
diff
changeset
|
62 for (int i = 0; i < array.length; i++) { |
d1d35892bbdd
Adjusted fixings transitions and implemented event select state.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2668
diff
changeset
|
63 Element itemElement = creator.create("item"); |
d1d35892bbdd
Adjusted fixings transitions and implemented event select state.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2668
diff
changeset
|
64 creator.addAttr( |
d1d35892bbdd
Adjusted fixings transitions and implemented event select state.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2668
diff
changeset
|
65 itemElement, |
d1d35892bbdd
Adjusted fixings transitions and implemented event select state.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2668
diff
changeset
|
66 "value", |
d1d35892bbdd
Adjusted fixings transitions and implemented event select state.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2668
diff
changeset
|
67 String.valueOf(array[i]), |
d1d35892bbdd
Adjusted fixings transitions and implemented event select state.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2668
diff
changeset
|
68 true); |
d1d35892bbdd
Adjusted fixings transitions and implemented event select state.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2668
diff
changeset
|
69 |
d1d35892bbdd
Adjusted fixings transitions and implemented event select state.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2668
diff
changeset
|
70 creator.addAttr( |
d1d35892bbdd
Adjusted fixings transitions and implemented event select state.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2668
diff
changeset
|
71 itemElement, |
d1d35892bbdd
Adjusted fixings transitions and implemented event select state.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2668
diff
changeset
|
72 "label", |
d1d35892bbdd
Adjusted fixings transitions and implemented event select state.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2668
diff
changeset
|
73 getLabel(cc, array[i], overview), |
d1d35892bbdd
Adjusted fixings transitions and implemented event select state.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2668
diff
changeset
|
74 true); |
d1d35892bbdd
Adjusted fixings transitions and implemented event select state.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2668
diff
changeset
|
75 dataElement.appendChild(itemElement); |
d1d35892bbdd
Adjusted fixings transitions and implemented event select state.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2668
diff
changeset
|
76 } |
d1d35892bbdd
Adjusted fixings transitions and implemented event select state.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2668
diff
changeset
|
77 return dataElement; |
d1d35892bbdd
Adjusted fixings transitions and implemented event select state.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2668
diff
changeset
|
78 } |
d1d35892bbdd
Adjusted fixings transitions and implemented event select state.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2668
diff
changeset
|
79 |
d1d35892bbdd
Adjusted fixings transitions and implemented event select state.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2668
diff
changeset
|
80 |
d1d35892bbdd
Adjusted fixings transitions and implemented event select state.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2668
diff
changeset
|
81 public static String getLabel( |
d1d35892bbdd
Adjusted fixings transitions and implemented event select state.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2668
diff
changeset
|
82 CallContext cc, |
d1d35892bbdd
Adjusted fixings transitions and implemented event select state.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2668
diff
changeset
|
83 int value, |
d1d35892bbdd
Adjusted fixings transitions and implemented event select state.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2668
diff
changeset
|
84 FixingsOverview overview |
d1d35892bbdd
Adjusted fixings transitions and implemented event select state.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2668
diff
changeset
|
85 ) { |
d1d35892bbdd
Adjusted fixings transitions and implemented event select state.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2668
diff
changeset
|
86 logger.debug("Create label for value: " + value); |
d1d35892bbdd
Adjusted fixings transitions and implemented event select state.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2668
diff
changeset
|
87 |
d1d35892bbdd
Adjusted fixings transitions and implemented event select state.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2668
diff
changeset
|
88 IdFilter filter = new IdFilter(value); |
d1d35892bbdd
Adjusted fixings transitions and implemented event select state.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2668
diff
changeset
|
89 List<Fixing.Column> columns = overview.filter(null, filter); |
4051
58bdf95df5e4
More dead code removal. Minor code clean ups.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
2719
diff
changeset
|
90 return columns.isEmpty() |
58bdf95df5e4
More dead code removal. Minor code clean ups.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
2719
diff
changeset
|
91 ? "" |
58bdf95df5e4
More dead code removal. Minor code clean ups.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
2719
diff
changeset
|
92 : columns.get(0).getDescription(); |
2719
d1d35892bbdd
Adjusted fixings transitions and implemented event select state.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2668
diff
changeset
|
93 } |
2668
53f42adf4505
Modified states and added new state for fixing analysis.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
94 } |
53f42adf4505
Modified states and added new state for fixing analysis.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
95 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf-8 : |