comparison flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/DefaultState.java @ 1136:8da5f5a9ed3c

Cosmetics, docs. flys-artifacts/trunk@2657 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Felix Wolfsteller <felix.wolfsteller@intevation.de>
date Wed, 07 Sep 2011 07:28:52 +0000
parents eccf966fb677
children fb5a7ff9feb8
comparison
equal deleted inserted replaced
1135:c8c753931514 1136:8da5f5a9ed3c
46 protected StateData getData(FLYSArtifact artifact, String name) { 46 protected StateData getData(FLYSArtifact artifact, String name) {
47 return artifact.getData(name); 47 return artifact.getData(name);
48 } 48 }
49 49
50 50
51 /**
52 * Append to a node and return xml description relevant for gui.
53 */
51 public Element describeStatic( 54 public Element describeStatic(
52 Artifact artifact, 55 Artifact artifact,
53 Document document, 56 Document document,
54 Node root, 57 Node root,
55 CallContext context, 58 CallContext context,
78 81
79 while (iter.hasNext()) { 82 while (iter.hasNext()) {
80 String name = iter.next(); 83 String name = iter.next();
81 StateData data = getData(flys, name); 84 StateData data = getData(flys, name);
82 85
83 String value = data != null ? (String) data.getValue() : null; 86 String value = (data != null) ? (String) data.getValue() : null;
84 87
85 if (value == null) { 88 if (value == null) {
86 continue; 89 continue;
87 } 90 }
88 91
96 creator.addAttr(itemElement, "value", value, true); 99 creator.addAttr(itemElement, "value", value, true);
97 100
98 String attrValue = ""; 101 String attrValue = "";
99 try { 102 try {
100 // XXX A better way to format the output would be to use the 103 // XXX A better way to format the output would be to use the
101 // 'type' value if the data objects. 104 // 'type' value of the data objects.
102 double doubleVal = Double.valueOf(value); 105 double doubleVal = Double.valueOf(value);
103 Locale l = Resources.getLocale(meta); 106 Locale l = Resources.getLocale(meta);
104 NumberFormat nf = NumberFormat.getInstance(l); 107 NumberFormat nf = NumberFormat.getInstance(l);
105 108
106 attrValue = nf.format(doubleVal); 109 attrValue = nf.format(doubleVal);
132 ArtifactNamespaceContext.NAMESPACE_PREFIX); 135 ArtifactNamespaceContext.NAMESPACE_PREFIX);
133 136
134 Element ui = null; 137 Element ui = null;
135 String uiprovider = getUIProvider(); 138 String uiprovider = getUIProvider();
136 if (uiprovider != null) { 139 if (uiprovider != null) {
137 ui = ProtocolUtils.createArtNode( 140 ui = ProtocolUtils.createArtNode(
138 creator, "dynamic", 141 creator, "dynamic",
139 new String[] { "uiprovider" }, 142 new String[] { "uiprovider" },
140 new String[] { uiprovider }); 143 new String[] { uiprovider });
141 } 144 }
142 else { 145 else {
143 ui = ProtocolUtils.createArtNode(creator, "dynamic", null, null); 146 ui = ProtocolUtils.createArtNode(creator, "dynamic", null, null);
144 } 147 }
145 148
146 Map<String, StateData> theData = getData(); 149 Map<String, StateData> theData = getData();
147 if (theData == null) { 150 if (theData == null) {
148 return ui; 151 return ui;
261 264
262 protected String getUIProvider() { 265 protected String getUIProvider() {
263 return null; 266 return null;
264 } 267 }
265 268
269
266 public Object computeAdvance( 270 public Object computeAdvance(
267 FLYSArtifact artifact, 271 FLYSArtifact artifact,
268 String hash, 272 String hash,
269 CallContext context, 273 CallContext context,
270 List<Facet> facets, 274 List<Facet> facets,
271 Object old 275 Object old
272 ) { 276 ) {
273 return null; 277 return null;
274 } 278 }
275 279
280
276 public Object computeFeed( 281 public Object computeFeed(
277 FLYSArtifact artifact, 282 FLYSArtifact artifact,
278 String hash, 283 String hash,
279 CallContext context, 284 CallContext context,
280 List<Facet> facets, 285 List<Facet> facets,
281 Object old 286 Object old
282 ) { 287 ) {
283 return null; 288 return null;
284 } 289 }
285 290
291
286 public Object computeInit( 292 public Object computeInit(
287 FLYSArtifact artifact, 293 FLYSArtifact artifact,
288 String hash, 294 String hash,
289 Object context, 295 Object context,
290 CallMeta meta, 296 CallMeta meta,

http://dive4elements.wald.intevation.org