# HG changeset patch # User Ingo Weinzierl # Date 1267022316 0 # Node ID a634d5ee961dcbcf38df6cecb7fa870448fec429 # Parent 800874dc0b29710044a195afaa27afa793cde39b 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 diff -r 800874dc0b29 -r a634d5ee961d gnv/ChangeLog --- 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 + + * 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 * src/main/webapp/WEB-INF/jsp/includes/display_histogram_inc.jsp: Append diff -r 800874dc0b29 -r a634d5ee961d gnv/src/main/java/de/intevation/gnv/action/ChangeOptionsAction.java --- 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); + } } } diff -r 800874dc0b29 -r a634d5ee961d gnv/src/main/java/de/intevation/gnv/action/DoOutputAction.java --- 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 ips = null; if (inputParameter != null) { - ips = new ArrayList(inputParameter.size()); + ips = new ArrayList(inputParameter.size()+1); Iterator 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 diff -r 800874dc0b29 -r a634d5ee961d gnv/src/main/webapp/WEB-INF/jsp/includes/display_histogram_inc.jsp --- 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"); } %> diff -r 800874dc0b29 -r a634d5ee961d gnv/src/main/webapp/WEB-INF/jsp/includes/display_histogram_options_inc.jsp --- 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 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"); + }%> + <%if (om.getName().equals("bincount")) { + String check = ""; + if (diaOpts != null && diaOpts.equalsIgnoreCase("binwidth")) { + check = ""; + } + else { + check = "checked=\"checked\""; + }%> + name="bintype" value="bincount" id="checkCount" onClick="toggleBinType('checkWidth')">  + <%}%> + <%if (om.getName().equals("binwidth")) { + String check = ""; + if (diaOpts != null && diaOpts.equalsIgnoreCase("binwidth")) { + check = "checked=\"checked\""; + } + else if (diaOpts == null) { + check = ""; + }%> + name="bintype" value="binwidth" id="checkWidth" onClick="toggleBinType('checkCount')">  + <%}%> + + diff -r 800874dc0b29 -r a634d5ee961d gnv/src/main/webapp/WEB-INF/jsp/mainlayout.jsp --- 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; + } + }