Mercurial > dive4elements > river
comparison artifacts/src/main/java/org/dive4elements/river/artifacts/uinfo/vegetationzones/VegetationZonesTableEditState.java @ 9118:431f1c269be5
Veg-Zone Table improved, State change data recovery;
author | gernotbelger |
---|---|
date | Mon, 04 Jun 2018 19:38:59 +0200 |
parents | 1ffd38826175 |
children | e511eb935ccd |
comparison
equal
deleted
inserted
replaced
9117:623b51bf03d7 | 9118:431f1c269be5 |
---|---|
7 * and comes with ABSOLUTELY NO WARRANTY! Check out the | 7 * and comes with ABSOLUTELY NO WARRANTY! Check out the |
8 * documentation coming with Dive4Elements River for details. | 8 * documentation coming with Dive4Elements River for details. |
9 */ | 9 */ |
10 package org.dive4elements.river.artifacts.uinfo.vegetationzones; | 10 package org.dive4elements.river.artifacts.uinfo.vegetationzones; |
11 | 11 |
12 import org.dive4elements.artifactdatabase.ProtocolUtils; | |
12 import org.dive4elements.artifacts.Artifact; | 13 import org.dive4elements.artifacts.Artifact; |
14 import org.dive4elements.artifacts.CallContext; | |
15 import org.dive4elements.artifacts.common.utils.XMLUtils.ElementCreator; | |
16 import org.dive4elements.river.artifacts.D4EArtifact; | |
13 import org.dive4elements.river.artifacts.states.DefaultState; | 17 import org.dive4elements.river.artifacts.states.DefaultState; |
18 import org.w3c.dom.Element; | |
14 | 19 |
15 /** | 20 /** |
16 * @author Domenico Nardi Tironi | 21 * @author Domenico Nardi Tironi |
17 */ | 22 */ |
18 public class VegetationZonesTableEditState extends DefaultState { | 23 public class VegetationZonesTableEditState extends DefaultState { |
20 private static final long serialVersionUID = 1L; | 25 private static final long serialVersionUID = 1L; |
21 | 26 |
22 @Override | 27 @Override |
23 protected String getUIProvider() { | 28 protected String getUIProvider() { |
24 return "uinfo.vegetationzones.table.edit"; | 29 return "uinfo.vegetationzones.table.edit"; |
30 } | |
31 | |
32 @Override | |
33 protected Element[] createItems(final ElementCreator cr, final Artifact artifact, final String name, final CallContext context) { | |
34 final String datakey = "vegzones"; | |
35 if (name.equals(datakey)) { | |
36 final Element item = ProtocolUtils.createArtNode(cr, "item", null, null); | |
37 final Element label = ProtocolUtils.createArtNode(cr, "label", null, null); | |
38 final Element value = ProtocolUtils.createArtNode(cr, "value", null, null); | |
39 final D4EArtifact flys = (D4EArtifact) artifact; | |
40 final String s = flys.getDataAsString(datakey) == null ? VegetationZone.parseListToDataString(VegetationZone.getStandardList()) | |
41 : flys.getDataAsString(datakey); | |
42 | |
43 value.setTextContent(s); | |
44 item.appendChild(label); | |
45 item.appendChild(value); | |
46 return new Element[] { item }; | |
47 } | |
48 return new Element[] {}; | |
25 } | 49 } |
26 | 50 |
27 @Override | 51 @Override |
28 public boolean validate(final Artifact artifact) throws IllegalArgumentException { | 52 public boolean validate(final Artifact artifact) throws IllegalArgumentException { |
29 // TODO: check verstehen | 53 // TODO: check verstehen |
36 return true; | 60 return true; |
37 // throw new IllegalArgumentException("error_years_wrong"); | 61 // throw new IllegalArgumentException("error_years_wrong"); |
38 | 62 |
39 // return true; | 63 // return true; |
40 } | 64 } |
65 | |
66 /** | |
67 * Creats the data element used for the static part of DESCRIBE document. | |
68 */ | |
69 // @Override | |
70 // protected Element createStaticData(final D4EArtifact flys, final ElementCreator creator, final CallContext cc, final | |
71 // String name, final String value, | |
72 // final String type) { | |
73 // final Element dataElement = creator.create("data"); | |
74 // creator.addAttr(dataElement, "name", name, true); | |
75 // creator.addAttr(dataElement, "type", type, true); | |
76 // | |
77 // final Element itemElement = creator.create("item"); | |
78 // creator.addAttr(itemElement, "value", value, true); | |
79 // | |
80 // final String[] labels = getLabels(cc, value); | |
81 // final Object[] obj = new Object[] { labels[0] }; | |
82 // | |
83 // // TODO own i18n | |
84 // final String attrValue = Resources.getMsg(cc.getMeta(), "wsp.selected.string", "wsp.selected.string", obj); | |
85 // // I18N_STATIC_KEY, I18N_STATIC_KEY, obj); | |
86 // | |
87 // creator.addAttr(itemElement, "label", attrValue, true); | |
88 // dataElement.appendChild(itemElement); | |
89 // | |
90 // return dataElement; | |
91 // } | |
92 | |
41 } | 93 } |