# HG changeset patch # User Ingo Weinzierl # Date 1264168710 0 # Node ID 9602f4bffc07f95473a0b80de44d42597c2c7232 # Parent df78178e1180a2e47166eb71e722ffcf6192c283 Added statistic to the actions if available. gnv/trunk@604 c6561f87-3c4e-4783-a992-168aeb5c3f6f diff -r df78178e1180 -r 9602f4bffc07 gnv/ChangeLog --- a/gnv/ChangeLog Fri Jan 22 11:28:25 2010 +0000 +++ b/gnv/ChangeLog Fri Jan 22 13:58:30 2010 +0000 @@ -1,3 +1,26 @@ +2010-01-22 Ingo Weinzierl + + * src/main/java/de/intevation/gnv/action/ShowStatisticAction.java: This + action 'calculates' the statistic and shows the result in the gui. + + * src/main/webapp/WEB-INF/config/struts-config.xml: Added controller and + forwards. + + * src/main/webapp/images/statistics.png: Statistic icon. + + * src/main/webapp/WEB-INF/jsp/index.jsp, + src/main/webapp/WEB-INF/jsp/includes/display_diagramm_statistics_inc.jsp, + src/main/webapp/WEB-INF/jsp/includes/display_diagramm_inc.jsp, + src/main/webapp/WEB-INF/jsp/includes/display_export_inc.jsp: Added symbol + in action box to show the statistic. + + * src/main/webapp/styles/default.css: Adjusted some parameter for a proper + placement of the statistic box. + + * src/main/resources/applicationMessages.properties, + src/main/resources/applicationMessages_en.properties: Added label for + statistic icon. + 2010-01-22 Ingo Weinzierl * src/main/java/de/intevation/gnv/action/DescribeUIAction.java: New action. diff -r df78178e1180 -r 9602f4bffc07 gnv/src/main/java/de/intevation/gnv/action/ShowStatisticAction.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/gnv/src/main/java/de/intevation/gnv/action/ShowStatisticAction.java Fri Jan 22 13:58:30 2010 +0000 @@ -0,0 +1,62 @@ +package de.intevation.gnv.action; + +import java.util.Collection; + +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; + +import de.intevation.gnv.action.sessionmodel.SessionModel; +import de.intevation.gnv.action.sessionmodel.SessionModelFactory; +import de.intevation.gnv.artifactdatabase.client.ArtifactDatabaseClient; +import de.intevation.gnv.artifactdatabase.client.ArtifactDatabaseClientFactory; +import de.intevation.gnv.artifactdatabase.objects.ArtifactStatisticsSet; + +/** + * @author Ingo Weinzierl (ingo.weinzierl@intevation.de) + */ +public class ShowStatisticAction extends DescribeUIAction { + + private static Logger logger = Logger.getLogger(ShowStatisticAction.class); + + + public ShowStatisticAction() { + super(); + } + + + @Override + public ActionForward execute( + ActionMapping mapping, + ActionForm form, + HttpServletRequest request, + HttpServletResponse response + ) throws Exception + { + logger.info("show statistic"); + SessionModel sm = SessionModelFactory.getInstance().getSessionModel( + request); + + ArtifactDatabaseClient adc = ArtifactDatabaseClientFactory.getInstance() + .getArtifactDatabaseClient(getLocale(request)); + + try{ + Collection statistics = + adc.calculateStatistics(sm.getSelectedArtifactFactory(), + sm.getCurrentArtifact()); + + sm.setStatistics(statistics); + + request.setAttribute("statistic", true); + } + catch (Exception e) { + logger.error(e, e); + } + + return super.execute(mapping, form, request, response); + } +} diff -r df78178e1180 -r 9602f4bffc07 gnv/src/main/resources/applicationMessages.properties --- a/gnv/src/main/resources/applicationMessages.properties Fri Jan 22 11:28:25 2010 +0000 +++ b/gnv/src/main/resources/applicationMessages.properties Fri Jan 22 13:58:30 2010 +0000 @@ -52,6 +52,7 @@ gnviewer.statistics.descriptive.variance=Varianz gnviewer.statistics.descriptive.intercept=Intercept gnviewer.statistics.descriptive.slope=Steigung +gnviewer.statistic.button = Statistik # diagram options dialog gnviewer.diagram.options.header.title=Diagrammoptionen diff -r df78178e1180 -r 9602f4bffc07 gnv/src/main/resources/applicationMessages_en.properties --- a/gnv/src/main/resources/applicationMessages_en.properties Fri Jan 22 11:28:25 2010 +0000 +++ b/gnv/src/main/resources/applicationMessages_en.properties Fri Jan 22 13:58:30 2010 +0000 @@ -52,6 +52,7 @@ gnviewer.statistics.descriptive.variance=Variance gnviewer.statistics.descriptive.intercept=Intercept gnviewer.statistics.descriptive.slope=Increase +gnviewer.statistic.button = Statistic # diagram options dialog gnviewer.diagram.options.header.title=Diagram options diff -r df78178e1180 -r 9602f4bffc07 gnv/src/main/webapp/WEB-INF/config/struts-config.xml --- a/gnv/src/main/webapp/WEB-INF/config/struts-config.xml Fri Jan 22 11:28:25 2010 +0000 +++ b/gnv/src/main/webapp/WEB-INF/config/struts-config.xml Fri Jan 22 13:58:30 2010 +0000 @@ -90,6 +90,20 @@ name="selectfis" path="/gnv/selectFis.do"/> + + + + + diff -r df78178e1180 -r 9602f4bffc07 gnv/src/main/webapp/WEB-INF/jsp/includes/display_diagramm_inc.jsp --- a/gnv/src/main/webapp/WEB-INF/jsp/includes/display_diagramm_inc.jsp Fri Jan 22 11:28:25 2010 +0000 +++ b/gnv/src/main/webapp/WEB-INF/jsp/includes/display_diagramm_inc.jsp Fri Jan 22 13:58:30 2010 +0000 @@ -26,7 +26,7 @@ Iterator it = op.iterator(); while (it.hasNext()){ OutputParameter parameter = it.next(); - parameterString = parameterString +"&"+parameter.getName()+"="+(diagrammOptions != null ? diagrammOptions.getValue(parameter.getName()): parameter.getValue()); + parameterString = parameterString +"&"+parameter.getName()+"="+(diagrammOptions != null ? diagrammOptions.getValue(parameter.getName()): parameter.getValue()); } } } diff -r df78178e1180 -r 9602f4bffc07 gnv/src/main/webapp/WEB-INF/jsp/includes/display_diagramm_statistics_inc.jsp --- a/gnv/src/main/webapp/WEB-INF/jsp/includes/display_diagramm_statistics_inc.jsp Fri Jan 22 11:28:25 2010 +0000 +++ b/gnv/src/main/webapp/WEB-INF/jsp/includes/display_diagramm_statistics_inc.jsp Fri Jan 22 13:58:30 2010 +0000 @@ -5,7 +5,8 @@ <%@page import="java.util.Collection"%> <%@page import="de.intevation.gnv.artifactdatabase.objects.ArtifactStatisticValue"%> <%@page import="java.util.Iterator"%> -<%@page import="de.intevation.gnv.artifactdatabase.objects.ArtifactStatisticsSet"%>
+<%@page import="de.intevation.gnv.artifactdatabase.objects.ArtifactStatisticsSet"%> +
<% SessionModel sm = SessionModelFactory.getInstance().getSessionModel(request); Collection statistics = sm.getStatistics(); @@ -19,25 +20,24 @@ while (it.hasNext()){ ArtifactStatisticsSet set = it.next(); %> -
-

<%=set.getName()%>

- +

<%=set.getName()%>

+
- <% Iterator sit = set.getStatisticValues().iterator(); - while (sit.hasNext()){ - ArtifactStatisticValue asv = sit.next(); + <% + Iterator sit = set.getStatisticValues().iterator(); + while (sit.hasNext()){ + ArtifactStatisticValue asv = sit.next(); %> - - - - - <%}%> + + + + + <%}%>
<%=asv.getValue()%>
<%=asv.getValue()%>
- <%} %> -
+ <%} %> <%}%> -
\ No newline at end of file +
diff -r df78178e1180 -r 9602f4bffc07 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 Fri Jan 22 11:28:25 2010 +0000 +++ b/gnv/src/main/webapp/WEB-INF/jsp/includes/display_export_inc.jsp Fri Jan 22 13:58:30 2010 +0000 @@ -18,6 +18,7 @@ String targetSVG = "svg"; String targetZIP = "zip"; String targetWMS = "wms"; + String targetSta = "statistics"; boolean supportChart = sm.getOutputMode(target) != null; boolean supportCSV = sm.getOutputMode(targetCSV) != null; @@ -26,6 +27,7 @@ boolean supportSVG = sm.getOutputMode(targetSVG) != null; boolean supportZIP = sm.getOutputMode(targetZIP) != null; boolean supportWMS = sm.getOutputMode(targetWMS) != null; + boolean supportSta = sm.getOutputMode(targetSta) != null; if (supportChart){ mimeType = sm.getOutputMode(target).getMimeType(); @@ -111,6 +113,12 @@ <%}%> + + <%if (supportSta) { %> + " title=""> + + + <%}%> <%}%> diff -r df78178e1180 -r 9602f4bffc07 gnv/src/main/webapp/WEB-INF/jsp/index.jsp --- a/gnv/src/main/webapp/WEB-INF/jsp/index.jsp Fri Jan 22 11:28:25 2010 +0000 +++ b/gnv/src/main/webapp/WEB-INF/jsp/index.jsp Fri Jan 22 13:58:30 2010 +0000 @@ -6,6 +6,7 @@ <%@page import="java.util.Iterator"%> <% Object ui = request.getAttribute("ui"); Object staticui = request.getAttribute("staticui"); + Object statistic = request.getAttribute("statistic"); boolean furthertargets = true; Object furthertargetsObject = request.getAttribute("furthertargets"); @@ -41,3 +42,8 @@ <%-- render export options if existing for this state --%> + + <%-- render statistic --%> + <%if (statistic != null) {%> + + <%}%> diff -r df78178e1180 -r 9602f4bffc07 gnv/src/main/webapp/images/statistics.png Binary file gnv/src/main/webapp/images/statistics.png has changed diff -r df78178e1180 -r 9602f4bffc07 gnv/src/main/webapp/styles/default.css --- a/gnv/src/main/webapp/styles/default.css Fri Jan 22 11:28:25 2010 +0000 +++ b/gnv/src/main/webapp/styles/default.css Fri Jan 22 13:58:30 2010 +0000 @@ -255,10 +255,8 @@ } div#diagram { -/*POSITION DEFINIEREN*/ -/* border: 1px solid crimson;*/ position: absolute; - top: 65px; + top: 33px; left: 350px; } @@ -274,7 +272,6 @@ } div#diagramoptions { -/*POSITION DEFINIEREN*/ position: relative; width: 325px; } @@ -283,11 +280,11 @@ width : 325px; } -div#statistics { -/*POSITION DEFINIEREN*/ -/*border: 1px solid Red;*/ - position: relative; - width: 600px; +div.statistics { + position: absolute; + top : 33px; + left : 350px; + width : 325px; } div#statisticValues {