changeset 289:890d7a41ab93

Added Support for Boolean-Output-Parameters in Diagramm-Options gnv/trunk@422 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Tim Englich <tim.englich@intevation.de>
date Mon, 14 Dec 2009 16:14:33 +0000 (2009-12-14)
parents 9f0efb10ee24
children ca10f0ea153a
files gnv/ChangeLog gnv/src/main/java/de/intevation/gnv/action/ChangeOptionsAction.java gnv/src/main/webapp/WEB-INF/jsp/includes/display_diagramm_options_inc.jsp
diffstat 3 files changed, 24 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/gnv/ChangeLog	Mon Dec 14 14:59:34 2009 +0000
+++ b/gnv/ChangeLog	Mon Dec 14 16:14:33 2009 +0000
@@ -1,3 +1,11 @@
+2009-12-14  Tim Englich  <tim.englich@intevation.de>
+
+    * src/main/webapp/WEB-INF/jsp/includes/display_diagramm_options_inc.jsp: 
+      Added switch between boolean and other Values to determin wether a checkbox 
+      is required or an text-field should be used.
+    * src/main/java/de/intevation/gnv/action/ChangeOptionsAction.java (execute): 
+      Added parsing of boolean-Option-Values to provide this Feature.
+      
 2009-12-14  Hans Plum <hans@intevation.de>
 
 	Issue109: Tomcat: Konfiguration des Kontexts enth�lt Redundanz
--- a/gnv/src/main/java/de/intevation/gnv/action/ChangeOptionsAction.java	Mon Dec 14 14:59:34 2009 +0000
+++ b/gnv/src/main/java/de/intevation/gnv/action/ChangeOptionsAction.java	Mon Dec 14 16:14:33 2009 +0000
@@ -63,8 +63,13 @@
                     DiagrammOptions diagrammOptions = new DiagrammOptions();
                     while (it.hasNext()) {
                         OutputParameter parameter = it.next();
-                        diagrammOptions.setValue(parameter.getName(), request
-                                .getParameter(parameter.getName()));
+                        String value = request.getParameter(parameter.getName());
+                        if (parameter.getType().equalsIgnoreCase("boolean")){
+                            if (value == null){
+                                value = "false";
+                            }
+                        }
+                        diagrammOptions.setValue(parameter.getName(),value);
 
                     }
                     sm.setDiagrammOptions(diagrammOptions);
--- a/gnv/src/main/webapp/WEB-INF/jsp/includes/display_diagramm_options_inc.jsp	Mon Dec 14 14:59:34 2009 +0000
+++ b/gnv/src/main/webapp/WEB-INF/jsp/includes/display_diagramm_options_inc.jsp	Mon Dec 14 16:14:33 2009 +0000
@@ -30,7 +30,15 @@
                       <bean-el:message key="<%=om.getName()%>"/>
                   </td>
                   <td>
-                      <input type="text" name="<%=om.getName() %>" value="<%=useDiagrammOptions ? diagrammOptions.getValue(om.getName()): om.getValue()%>"/>
+                      <%if (om.getType().equalsIgnoreCase("boolean")){
+                          boolean checked = useDiagrammOptions ? "true".equalsIgnoreCase(diagrammOptions.getValue(om.getName())) : om.getValue().equalsIgnoreCase("true");
+                      %>
+                            <input type="checkbox" 
+                                   name="<%=om.getName() %>" 
+                                   <%=checked ? " value=\"true\" checked=\"checked\"": "" %>/>
+                      <%}else{%>
+                            <input type="text" name="<%=om.getName() %>" value="<%=useDiagrammOptions ? diagrammOptions.getValue(om.getName()): om.getValue()%>"/>
+                      <%}%>
                   </td>
               </tr>
            <%}%>

http://dive4elements.wald.intevation.org