# HG changeset patch # User Ingo Weinzierl # Date 1266921362 0 # Node ID f2ba58011a2da625652e36f4fad6e9e09c1d1c10 # Parent cbd397712ecf09f63fb48b21a9df3d011170d268 Added histogram option panel. Show chart/histogram options panel after the user selected chart or histogram. Moved options panel beneath action panel. gnv/trunk@699 c6561f87-3c4e-4783-a992-168aeb5c3f6f diff -r cbd397712ecf -r f2ba58011a2d gnv/ChangeLog --- a/gnv/ChangeLog Mon Feb 22 18:04:55 2010 +0000 +++ b/gnv/ChangeLog Tue Feb 23 10:36:02 2010 +0000 @@ -1,3 +1,34 @@ +2010-02-23 Ingo Weinzierl + + * src/main/java/de/intevation/gnv/action/CreateChartAction.java: Class to + trigger chart rendering. + + * src/main/java/de/intevation/gnv/action/ChangeOptionsAction.java: Changed + request parameter from 'diagram' (deprecated) to 'chart'. + + * src/main/resources/applicationMessages.properties, + src/main/resources/applicationMessages_en.properties: Added title and + labels for histogram options. + + * src/main/webapp/images/chart_curve.png: Chart icon (source: famfamfam) + + * src/main/webapp/WEB-INF/config/struts-config.xml: Added new action to + trigger chart rendering analog to histogram action. + + * src/main/webapp/WEB-INF/jsp/index.jsp: Render chart option panel only if + the user already selected charts. + + * src/main/webapp/WEB-INF/jsp/includes/display_histogram_options_inc.jsp, + src/main/webapp/WEB-INF/jsp/includes/display_histogram_inc.jsp, + src/main/webapp/WEB-INF/jsp/includes/display_diagramm_inc.jsp: Show + diagram/chart options panel only if the user chose one of them. Placed + these option panels beneath the action panel. + + * src/main/webapp/WEB-INF/jsp/includes/display_export_inc.jsp: Added new + icon for chart rendering. + + * src/main/webapp/WEB-INF/jsp/mainlayout.jsp: Removed js debug output. + 2010-02-22 Ingo Weinzierl * src/main/webapp/WEB-INF/config/struts-config.xml: New action 'WMSAction'. diff -r cbd397712ecf -r f2ba58011a2d gnv/src/main/java/de/intevation/gnv/action/ChangeOptionsAction.java --- a/gnv/src/main/java/de/intevation/gnv/action/ChangeOptionsAction.java Mon Feb 22 18:04:55 2010 +0000 +++ b/gnv/src/main/java/de/intevation/gnv/action/ChangeOptionsAction.java Tue Feb 23 10:36:02 2010 +0000 @@ -79,7 +79,7 @@ request.setAttribute("furthertargets", true); } else { - request.setAttribute("diagramm", true); + request.setAttribute("chart", true); } return super.execute(mapping, form, request, response); diff -r cbd397712ecf -r f2ba58011a2d gnv/src/main/java/de/intevation/gnv/action/CreateChartAction.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/gnv/src/main/java/de/intevation/gnv/action/CreateChartAction.java Tue Feb 23 10:36:02 2010 +0000 @@ -0,0 +1,40 @@ +package de.intevation.gnv.action; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +import org.apache.log4j.Logger; + +import org.apache.struts.action.ActionForm; +import org.apache.struts.action.ActionForward; +import org.apache.struts.action.ActionMapping; + + +/** + * @author Ingo Weinzierl (ingo.weinzierl@intevation.de) + */ +public class CreateChartAction extends DescribeUIAction { + + private static Logger logger = Logger.getLogger(CreateChartAction.class); + + + public CreateChartAction() { + super(); + } + + + @Override + public ActionForward execute( + ActionMapping mapping, + ActionForm form, + HttpServletRequest request, + HttpServletResponse response) + throws Exception { + logger.debug("Create chart."); + + request.setAttribute("chart", true); + + return super.execute(mapping, form, request, response); + } +} +// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf-8 : diff -r cbd397712ecf -r f2ba58011a2d gnv/src/main/resources/applicationMessages.properties --- a/gnv/src/main/resources/applicationMessages.properties Mon Feb 22 18:04:55 2010 +0000 +++ b/gnv/src/main/resources/applicationMessages.properties Tue Feb 23 10:36:02 2010 +0000 @@ -58,6 +58,9 @@ # Histogramm gnviewer.histogram.button=Histogramm +gnviewer.histogram.options.header.title=Histogrammoptionen +bincount=Anzahl der Klassen +binwidth=Breite einer Klasse # diagram options dialog gnviewer.diagram.options.header.title=Diagrammoptionen diff -r cbd397712ecf -r f2ba58011a2d gnv/src/main/resources/applicationMessages_en.properties --- a/gnv/src/main/resources/applicationMessages_en.properties Mon Feb 22 18:04:55 2010 +0000 +++ b/gnv/src/main/resources/applicationMessages_en.properties Tue Feb 23 10:36:02 2010 +0000 @@ -58,6 +58,9 @@ # Histogramm gnviewer.histogram.button=Histogram +gnviewer.histogram.options.header.title=Histogram Options +bincount=Number of classes +binwidth=Class width # diagram options dialog gnviewer.diagram.options.header.title=Diagram options diff -r cbd397712ecf -r f2ba58011a2d gnv/src/main/webapp/WEB-INF/config/struts-config.xml --- a/gnv/src/main/webapp/WEB-INF/config/struts-config.xml Mon Feb 22 18:04:55 2010 +0000 +++ b/gnv/src/main/webapp/WEB-INF/config/struts-config.xml Tue Feb 23 10:36:02 2010 +0000 @@ -140,6 +140,20 @@ name="selectfis" path="/gnv/selectFis.do"/> + + + + + <% // fetch diagramm parameter from request if the user clicked 'draw' - Object diagramm = request.getAttribute("diagramm"); SessionModel sm = SessionModelFactory.getInstance().getSessionModel(request); String target = "chart"; @@ -32,15 +31,9 @@ } %> -<%-- show chart options if output mode 'chart' is supported --%> -<% if (supportChart) { %> - -<%}%> - <%-- diagramm is not null if the user clicked the 'draw' button --%> -<%if (diagramm != null) { %> -
- <bean:message key="gnviewer.output.options.diagramm.alt"/> -
-
-<%}%> + +
+ <bean:message key="gnviewer.output.options.diagramm.alt"/> +
+
diff -r cbd397712ecf -r f2ba58011a2d gnv/src/main/webapp/WEB-INF/jsp/includes/display_export_inc.jsp --- a/gnv/src/main/webapp/WEB-INF/jsp/includes/display_export_inc.jsp Mon Feb 22 18:04:55 2010 +0000 +++ b/gnv/src/main/webapp/WEB-INF/jsp/includes/display_export_inc.jsp Tue Feb 23 10:36:02 2010 +0000 @@ -86,6 +86,9 @@
<%if (supportChart) { %> + "> + + "> diff -r cbd397712ecf -r f2ba58011a2d 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 Mon Feb 22 18:04:55 2010 +0000 +++ b/gnv/src/main/webapp/WEB-INF/jsp/includes/display_histogram_inc.jsp Tue Feb 23 10:36:02 2010 +0000 @@ -9,6 +9,7 @@ String mimeType = sm.getOutputMode(target).getMimeType(); %> +
<bean:message key="gnviewer.output.options.histogram.alt"/>
diff -r cbd397712ecf -r f2ba58011a2d gnv/src/main/webapp/WEB-INF/jsp/includes/display_histogram_options_inc.jsp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/gnv/src/main/webapp/WEB-INF/jsp/includes/display_histogram_options_inc.jsp Tue Feb 23 10:36:02 2010 +0000 @@ -0,0 +1,51 @@ +<%@ taglib uri="http://jakarta.apache.org/struts/tags-bean" prefix="bean" %> +<%@ taglib uri="http://jakarta.apache.org/struts/tags-bean-el" prefix="bean-el" %> +<%@page import="de.intevation.gnv.action.sessionmodel.DiagrammOptions"%> +<%@page import="de.intevation.gnv.action.sessionmodel.SessionModelFactory"%> +<%@page import="de.intevation.gnv.artifactdatabase.objects.OutputMode"%> +<%@page import="de.intevation.gnv.action.sessionmodel.SessionModel"%> +<%@page import="java.util.Collection"%> +<%@page import="de.intevation.gnv.artifactdatabase.objects.OutputParameter"%> +<%@page import="java.util.Iterator"%> +<% + SessionModel sm = SessionModelFactory.getInstance().getSessionModel(request); + DiagrammOptions diagrammOptions = sm.getDiagrammOptions(); + boolean useDiagrammOptions = diagrammOptions != null; + String target = "histogram"; + OutputMode outputMode = sm.getOutputMode(target); +%> +
+
+ + + +
+ + <%if (outputMode != null && outputMode.getOutputParameters() != null && !outputMode.getOutputParameters().isEmpty()){ + Iterator it = outputMode.getOutputParameters().iterator(); + while (it.hasNext()){ + OutputParameter om = it.next(); %> + + + + + <%}%> +
+ + + <%if (om.getType().equalsIgnoreCase("boolean")){ + boolean checked = useDiagrammOptions ? "true".equalsIgnoreCase(diagrammOptions.getValue(om.getName())) : om.getValue().equalsIgnoreCase("true"); + %> + /> + <%}else{%> + + <%}%> +
+ + "/> + <%}%> +
+
+
diff -r cbd397712ecf -r f2ba58011a2d gnv/src/main/webapp/WEB-INF/jsp/index.jsp --- a/gnv/src/main/webapp/WEB-INF/jsp/index.jsp Mon Feb 22 18:04:55 2010 +0000 +++ b/gnv/src/main/webapp/WEB-INF/jsp/index.jsp Tue Feb 23 10:36:02 2010 +0000 @@ -6,6 +6,7 @@ <%@page import="java.util.Iterator"%> <% Object ui = request.getAttribute("ui"); Object staticui = request.getAttribute("staticui"); + Object chart = request.getAttribute("chart"); Object statistic = request.getAttribute("statistic"); Object histogram = request.getAttribute("histogram"); Object wms = request.getAttribute("wms"); @@ -46,11 +47,13 @@
+ <%-- render export options if existing for this state --%> + + + <%if (chart != null) {%> <%-- render chart options if existing for this state --%> - - <%-- render export options if existing for this state --%> - + <%}%> <%-- render statistic --%> <%if (statistic != null) {%> diff -r cbd397712ecf -r f2ba58011a2d gnv/src/main/webapp/WEB-INF/jsp/mainlayout.jsp --- a/gnv/src/main/webapp/WEB-INF/jsp/mainlayout.jsp Mon Feb 22 18:04:55 2010 +0000 +++ b/gnv/src/main/webapp/WEB-INF/jsp/mainlayout.jsp Tue Feb 23 10:36:02 2010 +0000 @@ -52,7 +52,6 @@ function init() { if (getURLParam("target") == "wms") { - console.log("LAYER NAME: " + getURLParam("layer")); map = new OpenLayers.Map('map'); layer = new OpenLayers.Layer.WMS( "MyWMS", diff -r cbd397712ecf -r f2ba58011a2d gnv/src/main/webapp/images/chart_curve.png Binary file gnv/src/main/webapp/images/chart_curve.png has changed