comparison flys-artifacts/src/main/java/de/intevation/flys/artifacts/MainValuesArtifact.java @ 1112:aeae4d20f32f

Fix translations of Main Values Facets. flys-artifacts/trunk@2619 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Felix Wolfsteller <felix.wolfsteller@intevation.de>
date Wed, 31 Aug 2011 10:34:45 +0000
parents 82798c992975
children 5b38cdf65307
comparison
equal deleted inserted replaced
1111:b96ce07ba56c 1112:aeae4d20f32f
27 import de.intevation.flys.artifacts.model.NamedDouble; 27 import de.intevation.flys.artifacts.model.NamedDouble;
28 import de.intevation.flys.artifacts.model.WstValueTable; 28 import de.intevation.flys.artifacts.model.WstValueTable;
29 import de.intevation.flys.artifacts.model.WstValueTableFactory; 29 import de.intevation.flys.artifacts.model.WstValueTableFactory;
30 30
31 import de.intevation.flys.artifacts.states.StaticState; 31 import de.intevation.flys.artifacts.states.StaticState;
32 import de.intevation.flys.artifacts.resources.Resources;
32 33
33 import de.intevation.flys.utils.FLYSUtils; 34 import de.intevation.flys.utils.FLYSUtils;
34 35
35 36
36 /** 37 /**
69 Object context, 70 Object context,
70 CallMeta callMeta, 71 CallMeta callMeta,
71 Document data) 72 Document data)
72 { 73 {
73 logger.debug("MainValuesArtifact.setup"); 74 logger.debug("MainValuesArtifact.setup");
75 state = new StaticState("state.mainvalue.static", "state.mainvalue.static");
76 List<Facet> fs = new ArrayList<Facet>();
77 Facet qfacet = new MainValuesQFacet(Resources.getMsg(callMeta,
78 "facet.discharge_curves.mainvalues.q",
79 "facet.discharge_curves.mainvalues.q"));
80 Facet wfacet = new MainValuesWFacet(Resources.getMsg(callMeta,
81 "facet.discharge_curves.mainvalues.w",
82 "facet.discharge_curves.mainvalues.w"));
83 fs.add(qfacet);
84 fs.add(wfacet);
85 facets.put(state.getID(), fs);
86 spawnState();
74 super.setup(identifier, factory, context, callMeta, data); 87 super.setup(identifier, factory, context, callMeta, data);
88 }
89
90 protected State spawnState() {
91 state = new StaticState("state.mainvalue.static", "state.mainvalue.static");
92 List<Facet> fs = (List<Facet>) facets.get("state.mainvalue.static");
93 DefaultOutput mainValuesOutput2 = new DefaultOutput(
94 "computed_discharge_curve",
95 "output.computed_discharge_curve", "image/png",
96 fs,
97 "chart");
98
99 state.getOutputs().add(mainValuesOutput2);
100 return state;
75 } 101 }
76 102
77 103
78 @Override 104 @Override
79 protected void initialize(Artifact artifact, Object context, CallMeta meta) { 105 protected void initialize(Artifact artifact, Object context, CallMeta meta) {
92 * @return list with one and only state. 118 * @return list with one and only state.
93 */ 119 */
94 @Override 120 @Override
95 protected List<State> getStates(Object context) { 121 protected List<State> getStates(Object context) {
96 ArrayList<State> states = new ArrayList<State>(); 122 ArrayList<State> states = new ArrayList<State>();
97 states.add(getState(null,null)); 123 states.add(getState());
98 return states; 124 return states;
99 } 125 }
100 126
101 127
102 /** 128 /**
125 * @param stateID ignored. 151 * @param stateID ignored.
126 * @return the state. 152 * @return the state.
127 */ 153 */
128 @Override 154 @Override
129 protected State getState(Object context, String stateID) { 155 protected State getState(Object context, String stateID) {
130 if (state != null) { 156 if (state != null)
131 157 return state;
132 } 158 else
133 else { 159 return spawnState();
134 state = new StaticState();
135 List<Facet> fs = new ArrayList<Facet>();
136 Facet qfacet = new MainValuesQFacet();
137 Facet wfacet = new MainValuesWFacet();
138 fs.add(qfacet);
139 fs.add(wfacet);
140 // TODO check if facets and outputs already exist.
141 // TODO also check, this is usually done in initialize, too.
142 facets.put(state.getID(), fs);
143 DefaultOutput mainValuesOutput1 = new DefaultOutput(
144 "discharge_curve", "output.discharge_curve", "image/png",
145 fs,
146 "chart");
147 DefaultOutput mainValuesOutput2 = new DefaultOutput(
148 "computed_discharge_curve",
149 "output.computed_discharge_curve", "image/png",
150 fs,
151 "chart");
152
153 state.getOutputs().add(mainValuesOutput1);
154 state.getOutputs().add(mainValuesOutput2);
155 }
156 return state;
157 } 160 }
158 161
159 162
160 /** 163 /**
161 * Access the Gauge that the mainvalues are taken from. 164 * Access the Gauge that the mainvalues are taken from.

http://dive4elements.wald.intevation.org