9292
|
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.client.client.ui.bundu; |
|
10 |
|
11 import org.dive4elements.river.client.client.ui.RadioPanel; |
|
12 import org.dive4elements.river.client.shared.model.Data; |
|
13 import org.dive4elements.river.client.shared.model.DataItem; |
|
14 import org.dive4elements.river.client.shared.model.DefaultData; |
|
15 import org.dive4elements.river.client.shared.model.DefaultDataItem; |
|
16 |
|
17 public class BunduWstCalcSelectRadioPanel extends RadioPanel { |
|
18 |
9369
|
19 public BunduWstCalcSelectRadioPanel(final String datakey) { |
|
20 super(datakey); |
|
21 } |
|
22 |
9292
|
23 private static final long serialVersionUID = 3357071563224461043L; |
|
24 |
|
25 @Override |
|
26 protected Data[] getData() { |
|
27 // if auto selected, additional custom data (function) has to be set. the rest is standard radioPanel behaviour |
|
28 final String value = this.form.getValueAsString("selection"); |
|
29 |
|
30 final DataItem item = new DefaultDataItem("label_irrelevant", "description_irrelevant", value); |
9369
|
31 final DefaultData selection = new DefaultData(getDatakey(), "label_no_effect", "description_no_effect", new DataItem[] { item }); |
9292
|
32 if (value.equals("state.bundu.calc.auto")) { |
|
33 final Data[] data = new Data[2]; |
|
34 data[0] = selection; |
|
35 data[1] = new DefaultData("function", "label_no_effect", "description_no_effect", |
|
36 new DataItem[] { new DefaultDataItem("", "", org.dive4elements.river.client.client.ui.fixation.FixFunctionSelect.funcDesc.get("log")) }); |
|
37 return data; |
|
38 } else { |
|
39 return new Data[] { selection }; |
|
40 } |
|
41 } |
|
42 |
|
43 } |