# HG changeset patch # User Ingo Weinzierl # Date 1266234149 0 # Node ID 9a5e50e7afaa4a66131150992e0e572c4a81ac5d # Parent f21ad239c748ed7902aa5084653e7537d116f55e Added action and jsp for rendering histograms. gnv/trunk@687 c6561f87-3c4e-4783-a992-168aeb5c3f6f diff -r f21ad239c748 -r 9a5e50e7afaa gnv/ChangeLog --- a/gnv/ChangeLog Fri Feb 12 11:16:33 2010 +0000 +++ b/gnv/ChangeLog Mon Feb 15 11:42:29 2010 +0000 @@ -1,3 +1,35 @@ +2010-02-15 Ingo Weinzierl + + * src/main/webapp/WEB-INF/config/struts-config.xml: Added an action + 'histogram' to render histograms. + + * src/main/java/de/intevation/gnv/action/CreateHistogramAction.java: Added a + new action for rendering histograms. + + * src/main/webapp/WEB-INF/jsp/includes/display_export_inc.jsp: Display an + icon for histograms if this output mode is present for this artifact. + + * src/main/webapp/images/chart_bar.png: Icon for histograms from famfamfam + iconset. + + * src/main/webapp/WEB-INF/jsp/includes/display_histogram_inc.jsp: JSP for + rendering histograms. + + * src/main/webapp/styles/default.css: Added a style class for adapting + histogram div. + + * src/main/webapp/WEB-INF/jsp/index.jsp: Include display_histogram_inc if + histogram action have been chosen by user. + + * src/main/resources/applicationMessages_en.properties, + src/main/resources/applicationMessages.properties: Button label and + alternative image text for histograms. + + * src/main/java/de/intevation/gnv/action/ChangeOptionsAction.java: Removed + comment lines at the beginning of the file. These empty comment lines + would cause trouble later, when inserting GPL text automatically with a + script. + 2010-02-12 Ingo Weinzierl * src/main/webapp/WEB-INF/config/templates/describe-ui-static.xsl: Render an diff -r f21ad239c748 -r 9a5e50e7afaa gnv/src/main/java/de/intevation/gnv/action/ChangeOptionsAction.java --- a/gnv/src/main/java/de/intevation/gnv/action/ChangeOptionsAction.java Fri Feb 12 11:16:33 2010 +0000 +++ b/gnv/src/main/java/de/intevation/gnv/action/ChangeOptionsAction.java Mon Feb 15 11:42:29 2010 +0000 @@ -1,6 +1,3 @@ -/** - * - */ package de.intevation.gnv.action; import java.util.Collection; diff -r f21ad239c748 -r 9a5e50e7afaa gnv/src/main/java/de/intevation/gnv/action/CreateHistogramAction.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/gnv/src/main/java/de/intevation/gnv/action/CreateHistogramAction.java Mon Feb 15 11:42:29 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 CreateHistogramAction extends DescribeUIAction { + + private static Logger logger = Logger.getLogger(CreateHistogramAction.class); + + + public CreateHistogramAction() { + super(); + } + + + @Override + public ActionForward execute( + ActionMapping mapping, + ActionForm form, + HttpServletRequest request, + HttpServletResponse response) + throws Exception { + logger.debug("Create histogram."); + + request.setAttribute("histogram", true); + + return super.execute(mapping, form, request, response); + } +} +// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf-8 : diff -r f21ad239c748 -r 9a5e50e7afaa gnv/src/main/resources/applicationMessages.properties --- a/gnv/src/main/resources/applicationMessages.properties Fri Feb 12 11:16:33 2010 +0000 +++ b/gnv/src/main/resources/applicationMessages.properties Mon Feb 15 11:42:29 2010 +0000 @@ -56,12 +56,16 @@ gnviewer.statistics.descriptive.slope=Steigung gnviewer.statistic.button = Statistik +# Histogramm +gnviewer.histogram.button=Histogramm + # diagram options dialog gnviewer.diagram.options.header.title=Diagrammoptionen # attachedOutputOptions gnviewer.output.options.diagramm.alt=Diagramm +gnviewer.output.options.histogram.alt=Histogramm gnviewer.output.options.save.title=Diagramm speichern gnviewer.output.options.export.csv.title=Daten als CSV exportieren gnviewer.output.options.export.odv.title=Daten als ODV exportieren diff -r f21ad239c748 -r 9a5e50e7afaa gnv/src/main/resources/applicationMessages_en.properties --- a/gnv/src/main/resources/applicationMessages_en.properties Fri Feb 12 11:16:33 2010 +0000 +++ b/gnv/src/main/resources/applicationMessages_en.properties Mon Feb 15 11:42:29 2010 +0000 @@ -56,12 +56,16 @@ gnviewer.statistics.descriptive.slope=Increase gnviewer.statistic.button = Statistic +# Histogramm +gnviewer.histogram.button=Histogram + # diagram options dialog gnviewer.diagram.options.header.title=Diagram options # attachedOutputOptions gnviewer.output.options.diagramm.alt=Diagram +gnviewer.output.options.histogram.alt=Histogram gnviewer.output.options.save.title=Save Diagram gnviewer.output.options.export.csv.title=Export Data as CSV gnviewer.output.options.export.odv.title=Export Data as ODV diff -r f21ad239c748 -r 9a5e50e7afaa gnv/src/main/webapp/WEB-INF/config/struts-config.xml --- a/gnv/src/main/webapp/WEB-INF/config/struts-config.xml Fri Feb 12 11:16:33 2010 +0000 +++ b/gnv/src/main/webapp/WEB-INF/config/struts-config.xml Mon Feb 15 11:42:29 2010 +0000 @@ -112,6 +112,20 @@ name="selectfis" path="/gnv/selectFis.do"/> + + + + + <%}%> + + <%if (supportHis) { %> + " title=""> + + + <%}%> <%}%> diff -r f21ad239c748 -r 9a5e50e7afaa gnv/src/main/webapp/WEB-INF/jsp/includes/display_histogram_inc.jsp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/gnv/src/main/webapp/WEB-INF/jsp/includes/display_histogram_inc.jsp Mon Feb 15 11:42:29 2010 +0000 @@ -0,0 +1,14 @@ +<%@ 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.SessionModel"%> +<%@page import="de.intevation.gnv.action.sessionmodel.SessionModelFactory"%> +<% + SessionModel sm = SessionModelFactory.getInstance().getSessionModel(request); + + String target = "histogram"; + String mimeType = sm.getOutputMode(target).getMimeType(); +%> + +
+ <bean:message key="gnviewer.output.options.histogram.alt"/> +
diff -r f21ad239c748 -r 9a5e50e7afaa gnv/src/main/webapp/WEB-INF/jsp/index.jsp --- a/gnv/src/main/webapp/WEB-INF/jsp/index.jsp Fri Feb 12 11:16:33 2010 +0000 +++ b/gnv/src/main/webapp/WEB-INF/jsp/index.jsp Mon Feb 15 11:42:29 2010 +0000 @@ -7,6 +7,7 @@ <% Object ui = request.getAttribute("ui"); Object staticui = request.getAttribute("staticui"); Object statistic = request.getAttribute("statistic"); + Object histogram = request.getAttribute("histogram"); boolean furthertargets = true; Object furthertargetsObject = request.getAttribute("furthertargets"); @@ -52,3 +53,8 @@ <%if (statistic != null) {%> <%}%> + + <%-- render histogram --%> + <%if (histogram != null) {%> + + <%}%> diff -r f21ad239c748 -r 9a5e50e7afaa gnv/src/main/webapp/images/chart_bar.png Binary file gnv/src/main/webapp/images/chart_bar.png has changed diff -r f21ad239c748 -r 9a5e50e7afaa gnv/src/main/webapp/styles/default.css --- a/gnv/src/main/webapp/styles/default.css Fri Feb 12 11:16:33 2010 +0000 +++ b/gnv/src/main/webapp/styles/default.css Mon Feb 15 11:42:29 2010 +0000 @@ -261,6 +261,12 @@ left: 350px; } +div.histogram { + position: absolute; + top: 33px; + left: 350px; +} + div#export { width: 325px; }