Mercurial > dive4elements > gnv-client
changeset 575:a634d5ee961d
Added checkboxes for selecting the field which is used to adjust the number of bins in histogram charts.
gnv/trunk@707 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Ingo Weinzierl <ingo.weinzierl@intevation.de> |
---|---|
date | Wed, 24 Feb 2010 14:38:36 +0000 |
parents | 800874dc0b29 |
children | b21fc7502750 |
files | gnv/ChangeLog gnv/src/main/java/de/intevation/gnv/action/ChangeOptionsAction.java gnv/src/main/java/de/intevation/gnv/action/DoOutputAction.java gnv/src/main/webapp/WEB-INF/jsp/includes/display_histogram_inc.jsp gnv/src/main/webapp/WEB-INF/jsp/includes/display_histogram_options_inc.jsp gnv/src/main/webapp/WEB-INF/jsp/mainlayout.jsp |
diffstat | 6 files changed, 73 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/gnv/ChangeLog Wed Feb 24 08:35:26 2010 +0000 +++ b/gnv/ChangeLog Wed Feb 24 14:38:36 2010 +0000 @@ -1,3 +1,23 @@ +2010-02-24 Ingo Weinzierl <ingo.weinzierl@intevation.de> + + * src/main/java/de/intevation/gnv/action/ChangeOptionsAction.java: Added + user selected type of bin setting (number of bins, bin width) to diagram + options and request object which are used to create links for chart + images. + + * src/main/java/de/intevation/gnv/action/DoOutputAction.java: Added user + selected type of bin setting to InputParameters which are used to create + xml documents for 'out' target. + + * src/main/webapp/WEB-INF/jsp/includes/display_histogram_options_inc.jsp, + src/main/webapp/WEB-INF/jsp/includes/display_histogram_inc.jsp: Added + checkboxes to select the field to adjust bins in histogram charts (bin + width or number of bins). When selecting a checkbox, the other box becomes + disabled. + + * src/main/webapp/WEB-INF/jsp/mainlayout.jsp: JavaScript function to toggle + checkboxes. + 2010-02-24 Ingo Weinzierl <ingo.weinzierl@intevation.de> * src/main/webapp/WEB-INF/jsp/includes/display_histogram_inc.jsp: Append
--- a/gnv/src/main/java/de/intevation/gnv/action/ChangeOptionsAction.java Wed Feb 24 08:35:26 2010 +0000 +++ b/gnv/src/main/java/de/intevation/gnv/action/ChangeOptionsAction.java Wed Feb 24 14:38:36 2010 +0000 @@ -71,6 +71,15 @@ } sm.setDiagrammOptions(diagrammOptions); + + // XXX Little workarround. We should implement a 'choice' type, + // if we need further choice elements! (iw) + String bintype = request.getParameter("bintype"); + if (bintype != null) { + diagrammOptions.setValue("bintype", bintype); + sm.setDiagrammOptions(diagrammOptions); + request.setAttribute("bintype", bintype); + } } }
--- a/gnv/src/main/java/de/intevation/gnv/action/DoOutputAction.java Wed Feb 24 08:35:26 2010 +0000 +++ b/gnv/src/main/java/de/intevation/gnv/action/DoOutputAction.java Wed Feb 24 14:38:36 2010 +0000 @@ -75,7 +75,7 @@ .getOutputParameters(); Collection<InputParameter> ips = null; if (inputParameter != null) { - ips = new ArrayList<InputParameter>(inputParameter.size()); + ips = new ArrayList<InputParameter>(inputParameter.size()+1); Iterator<OutputParameter> it = inputParameter.iterator(); while (it.hasNext()) { String name = it.next().getName(); @@ -84,6 +84,12 @@ values); ips.add(ip); } + + if (request.getParameter("bintype") != null) { + InputParameter ip = new DefaultInputParameter( + "bintype", request.getParameterValues("bintype")); + ips.add(ip); + } } ArtifactDatabaseClient adc = ArtifactDatabaseClientFactory
--- a/gnv/src/main/webapp/WEB-INF/jsp/includes/display_histogram_inc.jsp Wed Feb 24 08:35:26 2010 +0000 +++ b/gnv/src/main/webapp/WEB-INF/jsp/includes/display_histogram_inc.jsp Wed Feb 24 14:38:36 2010 +0000 @@ -22,6 +22,8 @@ OutputParameter parameter = it.next(); parameterString = parameterString +"&"+parameter.getName()+"="+(diagrammOptions != null ? diagrammOptions.getValue(parameter.getName()): parameter.getValue()); } + + parameterString += "&bintype="+request.getAttribute("bintype"); } %>
--- a/gnv/src/main/webapp/WEB-INF/jsp/includes/display_histogram_options_inc.jsp Wed Feb 24 08:35:26 2010 +0000 +++ b/gnv/src/main/webapp/WEB-INF/jsp/includes/display_histogram_options_inc.jsp Wed Feb 24 14:38:36 2010 +0000 @@ -59,9 +59,35 @@ <%if (outputMode != null && outputMode.getOutputParameters() != null && !outputMode.getOutputParameters().isEmpty()){ Iterator<OutputParameter> it = outputMode.getOutputParameters().iterator(); while (it.hasNext()){ - OutputParameter om = it.next(); %> + OutputParameter om = it.next(); + String diaOpts = null; + if (diagrammOptions != null) { + diaOpts = request.getParameter("bintype"); + }%> <tr> <td> + <%if (om.getName().equals("bincount")) { + String check = ""; + if (diaOpts != null && diaOpts.equalsIgnoreCase("binwidth")) { + check = ""; + } + else { + check = "checked=\"checked\""; + }%> + <input type="checkbox" <%= check %> name="bintype" value="bincount" id="checkCount" onClick="toggleBinType('checkWidth')"> </input> + <%}%> + <%if (om.getName().equals("binwidth")) { + String check = ""; + if (diaOpts != null && diaOpts.equalsIgnoreCase("binwidth")) { + check = "checked=\"checked\""; + } + else if (diaOpts == null) { + check = ""; + }%> + <input type="checkbox" <%= check %> name="bintype" value="binwidth" id="checkWidth" onClick="toggleBinType('checkCount')"> </input> + <%}%> + </td> + <td> <bean-el:message key="<%=om.getName()%>"/> </td> <td>
--- a/gnv/src/main/webapp/WEB-INF/jsp/mainlayout.jsp Wed Feb 24 08:35:26 2010 +0000 +++ b/gnv/src/main/webapp/WEB-INF/jsp/mainlayout.jsp Wed Feb 24 14:38:36 2010 +0000 @@ -42,6 +42,14 @@ " 0.0219 58.5768, " + "-1.5763 58.3616))"; } + + function toggleBinType(toDeactivate) { + var ele = document.getElementById(toDeactivate); + + if (ele != null) { + ele.checked = false; + } + } </script> </head>