changeset 2189:19518116a49a

Refactored some code in DefaultState to better override the base class. flys-artifacts/trunk@3799 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Ingo Weinzierl <ingo.weinzierl@intevation.de>
date Fri, 27 Jan 2012 13:18:37 +0000
parents fd9aece97aa3
children 2792d2617be9
files flys-artifacts/ChangeLog flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/DefaultState.java
diffstat 2 files changed, 34 insertions(+), 11 deletions(-) [+]
line wrap: on
line diff
--- a/flys-artifacts/ChangeLog	Fri Jan 27 13:12:31 2012 +0000
+++ b/flys-artifacts/ChangeLog	Fri Jan 27 13:18:37 2012 +0000
@@ -1,3 +1,8 @@
+2012-01-27  Ingo Weinzierl <ingo@intevation.de>
+
+	* src/main/java/de/intevation/flys/artifacts/states/DefaultState.java: Moved
+	  code to add items to a data node for dynamich UI into an own method.
+
 2012-01-27  Ingo Weinzierl <ingo@intevation.de>
 
 	* src/main/java/de/intevation/flys/artifacts/model/WQKmsFacet.java: Removed
--- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/DefaultState.java	Fri Jan 27 13:12:31 2012 +0000
+++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/DefaultState.java	Fri Jan 27 13:18:37 2012 +0000
@@ -228,18 +228,8 @@
                 }
             }
 
-            Element choices = ProtocolUtils.createArtNode(
-            creator, "choices", null, null);
-
-            select.appendChild(choices);
+            appendItems(artifact, creator, name, context, select);
             ui.appendChild(select);
-
-            Element[] items = createItems(creator, artifact, name, context);
-            if (items != null) {
-                for (Element item: items) {
-                    choices.appendChild(item);
-                }
-            }
         }
 
         return ui;
@@ -247,6 +237,34 @@
 
 
     /**
+     * @param artifact
+     * @param creator
+     * @param name
+     * @param context
+     * @param select
+     */
+    protected void appendItems(
+        Artifact       artifact,
+        ElementCreator creator,
+        String         name,
+        CallContext    context,
+        Element        select
+    ) {
+        Element choices = ProtocolUtils.createArtNode(
+            creator, "choices", null, null);
+
+        select.appendChild(choices);
+
+        Element[] items = createItems(creator, artifact, name, context);
+        if (items != null) {
+            for (Element item: items) {
+                choices.appendChild(item);
+            }
+        }
+    }
+
+
+    /**
      * This method creates the root node that contains the list of selectable
      * items.
      *

http://dive4elements.wald.intevation.org